From owner-dev-commits-src-all@freebsd.org Mon Mar 29 00:02:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0A875B42F5; Mon, 29 Mar 2021 00:02:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F7t7h4dWQz3q7G; Mon, 29 Mar 2021 00:02:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 921A716A1; Mon, 29 Mar 2021 00:02:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T02uJk082328; Mon, 29 Mar 2021 00:02:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T02uP9082327; Mon, 29 Mar 2021 00:02:56 GMT (envelope-from git) Date: Mon, 29 Mar 2021 00:02:56 GMT Message-Id: <202103290002.12T02uP9082327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 2e70fcbb1543 - releng/13.0 - 13.0: update to RC4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 2e70fcbb154359d7eb5cebfa0c895887f3400ae0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 00:02:56 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=2e70fcbb154359d7eb5cebfa0c895887f3400ae0 commit 2e70fcbb154359d7eb5cebfa0c895887f3400ae0 Author: Glen Barber AuthorDate: 2021-03-28 23:51:40 +0000 Commit: Glen Barber CommitDate: 2021-03-28 23:51:40 +0000 13.0: update to RC4 Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 50fcab5609a2..79d64cfbfb2a 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="RC3-p1" +BRANCH="RC4" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-all@freebsd.org Mon Mar 29 08:04:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8887B5C02C9 for ; Mon, 29 Mar 2021 08:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F84q43VtNz4lXr; Mon, 29 Mar 2021 08:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 607327B34; Mon, 29 Mar 2021 08:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T84GxO054110; Mon, 29 Mar 2021 08:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T84GBE054109; Mon, 29 Mar 2021 08:04:16 GMT (envelope-from git) Date: Mon, 29 Mar 2021 08:04:16 GMT Message-Id: <202103290804.12T84GBE054109@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Baptiste Daroussin Subject: git: 31595a7c3a4a - vendor/NetBSD/libedit - libedit: vendor import snapshot 2021-03-28 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/vendor/NetBSD/libedit X-Git-Reftype: branch X-Git-Commit: 31595a7c3a4afa330555de5f58b1a23ad88a8bc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 08:04:16 -0000 The branch vendor/NetBSD/libedit has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=31595a7c3a4afa330555de5f58b1a23ad88a8bc5 commit 31595a7c3a4afa330555de5f58b1a23ad88a8bc5 Author: Baptiste Daroussin AuthorDate: 2021-03-29 08:01:41 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-29 08:02:12 +0000 libedit: vendor import snapshot 2021-03-28 --- filecomplete.c | 47 ++++++++++++++++++++++++++++++++--------------- filecomplete.h | 8 +++++++- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/filecomplete.c b/filecomplete.c index ba887e0e4180..963a73fc8322 100644 --- a/filecomplete.c +++ b/filecomplete.c @@ -1,4 +1,4 @@ -/* $NetBSD: filecomplete.c,v 1.64 2020/01/05 07:12:05 abhinav Exp $ */ +/* $NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: filecomplete.c,v 1.64 2020/01/05 07:12:05 abhinav Exp $"); +__RCSID("$NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -291,7 +291,7 @@ escape_filename(EditLine * el, const char *filename, int single_match, if (single_match && app_func) { escaped_str[offset] = 0; - append_char = app_func(escaped_str); + append_char = app_func(filename); /* we want to append space only if we are not inside quotes */ if (append_char[0] == ' ') { if (!s_quoted && !d_quoted) @@ -652,12 +652,13 @@ find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, * '!' could never be invoked */ int -fn_complete(EditLine *el, - char *(*complet_func)(const char *, int), - char **(*attempted_completion_function)(const char *, int, int), - const wchar_t *word_break, const wchar_t *special_prefixes, - const char *(*app_func)(const char *), size_t query_items, - int *completion_type, int *over, int *point, int *end) +fn_complete2(EditLine *el, + char *(*complete_func)(const char *, int), + char **(*attempted_completion_function)(const char *, int, int), + const wchar_t *word_break, const wchar_t *special_prefixes, + const char *(*app_func)(const char *), size_t query_items, + int *completion_type, int *over, int *point, int *end, + unsigned int flags) { const LineInfoW *li; wchar_t *temp; @@ -666,7 +667,7 @@ fn_complete(EditLine *el, size_t len; int what_to_do = '\t'; int retval = CC_NORM; - int do_unescape = attempted_completion_function == NULL? 1: 0; + int do_unescape = flags & FN_QUOTE_MATCH; if (el->el_state.lastcmd == el->el_state.thiscmd) what_to_do = '?'; @@ -675,8 +676,8 @@ fn_complete(EditLine *el, if (completion_type != NULL) *completion_type = what_to_do; - if (!complet_func) - complet_func = fn_filename_completion_function; + if (!complete_func) + complete_func = fn_filename_completion_function; if (!app_func) app_func = append_char_function; @@ -703,7 +704,7 @@ fn_complete(EditLine *el, if (!attempted_completion_function || (over != NULL && !*over && !matches)) matches = completion_matches( - ct_encode_string(temp, &el->el_scratch), complet_func); + ct_encode_string(temp, &el->el_scratch), complete_func); if (over != NULL) *over = 0; @@ -720,7 +721,7 @@ fn_complete(EditLine *el, if (matches[0][0] != '\0') { el_deletestr(el, (int)len); - if (!attempted_completion_function) + if (flags & FN_QUOTE_MATCH) completion = escape_filename(el, matches[0], single_match, app_func); else @@ -735,7 +736,9 @@ fn_complete(EditLine *el, el_winsertstr(el, ct_decode_string(completion, &el->el_scratch)); - if (single_match && attempted_completion_function) { + if (single_match && attempted_completion_function && + !(flags & FN_QUOTE_MATCH)) + { /* * We found an exact match. Add a space after * it, unless we do filename completion and the @@ -817,6 +820,20 @@ out: return retval; } +int +fn_complete(EditLine *el, + char *(*complete_func)(const char *, int), + char **(*attempted_completion_function)(const char *, int, int), + const wchar_t *word_break, const wchar_t *special_prefixes, + const char *(*app_func)(const char *), size_t query_items, + int *completion_type, int *over, int *point, int *end) +{ + return fn_complete2(el, complete_func, attempted_completion_function, + word_break, special_prefixes, app_func, query_items, + completion_type, over, point, end, + attempted_completion_function ? 0 : FN_QUOTE_MATCH); +} + /* * el-compatible wrapper around rl_complete; needed for key binding */ diff --git a/filecomplete.h b/filecomplete.h index 61d81389a0f7..60ea4894414b 100644 --- a/filecomplete.h +++ b/filecomplete.h @@ -1,4 +1,4 @@ -/* $NetBSD: filecomplete.h,v 1.11 2017/04/21 05:38:03 abhinav Exp $ */ +/* $NetBSD: filecomplete.h,v 1.13 2021/03/28 13:38:10 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -36,6 +36,12 @@ int fn_complete(EditLine *, char **(*)(const char *, int, int), const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t, int *, int *, int *, int *); +int fn_complete2(EditLine *, + char *(*)(const char *, int), + char **(*)(const char *, int, int), + const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t, + int *, int *, int *, int *, unsigned int); +#define FN_QUOTE_MATCH 1 /* Quote the returned match */ void fn_display_match_list(EditLine *, char **, size_t, size_t, const char *(*)(const char *)); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 08:04:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B683B5C007C for ; Mon, 29 Mar 2021 08:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F84q53x8Xz4lN3; Mon, 29 Mar 2021 08:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A4DE7A96; Mon, 29 Mar 2021 08:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T84Hjf054137; Mon, 29 Mar 2021 08:04:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T84Hvf054136; Mon, 29 Mar 2021 08:04:17 GMT (envelope-from git) Date: Mon, 29 Mar 2021 08:04:17 GMT Message-Id: <202103290804.12T84Hvf054136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Baptiste Daroussin Subject: git: b8159c77b323 - Create tag vendor/NetBSD/libedit/2021-03-28 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/tags/vendor/NetBSD/libedit/2021-03-28 X-Git-Reftype: annotated tag X-Git-Commit: b8159c77b3239ed91b03ec8d2d7efdb96ca1f9a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 08:04:17 -0000 The annotated tag vendor/NetBSD/libedit/2021-03-28 has been created by bapt: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/NetBSD/libedit/2021-03-28 tag vendor/NetBSD/libedit/2021-03-28 Tagger: Baptiste Daroussin TaggerDate: 2021-03-29 08:03:32 +0000 libedit: tag import of snapshot 2021-03-28 commit 31595a7c3a4afa330555de5f58b1a23ad88a8bc5 Author: Baptiste Daroussin AuthorDate: 2021-03-29 08:01:41 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-29 08:02:12 +0000 libedit: vendor import snapshot 2021-03-28 From owner-dev-commits-src-all@freebsd.org Mon Mar 29 08:06:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE9D25C0620; Mon, 29 Mar 2021 08:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F84t15TNlz4llj; Mon, 29 Mar 2021 08:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AECCA7C9D; Mon, 29 Mar 2021 08:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T86nSQ054647; Mon, 29 Mar 2021 08:06:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T86nIw054646; Mon, 29 Mar 2021 08:06:49 GMT (envelope-from git) Date: Mon, 29 Mar 2021 08:06:49 GMT Message-Id: <202103290806.12T86nIw054646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 19318a62d7f8 - main - libedit: vendor import libedit 2021-03-28 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19318a62d7f8cfe2f0f5c24178fa33e8844ae5d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 08:06:49 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=19318a62d7f8cfe2f0f5c24178fa33e8844ae5d1 commit 19318a62d7f8cfe2f0f5c24178fa33e8844ae5d1 Merge: cb0dd7e122b8 31595a7c3a4a Author: Baptiste Daroussin AuthorDate: 2021-03-29 08:05:18 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-29 08:05:55 +0000 libedit: vendor import libedit 2021-03-28 It contains changes pushed by pstef@ when working on improving the completion for /bin/sh contrib/libedit/filecomplete.c | 47 ++++++++++++++++++++++++++++-------------- contrib/libedit/filecomplete.h | 8 ++++++- 2 files changed, 39 insertions(+), 16 deletions(-) diff --cc contrib/libedit/filecomplete.c index 61579024926c,000000000000..8279d7ff82b6 mode 100644,000000..100644 --- a/contrib/libedit/filecomplete.c +++ b/contrib/libedit/filecomplete.c @@@ -1,840 -1,0 +1,857 @@@ - /* $NetBSD: filecomplete.c,v 1.64 2020/01/05 07:12:05 abhinav Exp $ */ ++/* $NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $ */ + +/*- + * Copyright (c) 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jaromir Dolecek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#if !defined(lint) && !defined(SCCSID) - __RCSID("$NetBSD: filecomplete.c,v 1.64 2020/01/05 07:12:05 abhinav Exp $"); ++__RCSID("$NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $"); +#endif /* not lint && not SCCSID */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "el.h" +#include "filecomplete.h" + +static const wchar_t break_chars[] = L" \t\n\"\\'`@$><=;|&{("; + +/********************************/ +/* completion functions */ + +/* + * does tilde expansion of strings of type ``~user/foo'' + * if ``user'' isn't valid user name or ``txt'' doesn't start + * w/ '~', returns pointer to strdup()ed copy of ``txt'' + * + * it's the caller's responsibility to free() the returned string + */ +char * +fn_tilde_expand(const char *txt) +{ +#if defined(HAVE_GETPW_R_POSIX) || defined(HAVE_GETPW_R_DRAFT) + struct passwd pwres; + char pwbuf[1024]; +#endif + struct passwd *pass; + char *temp; + size_t len = 0; + + if (txt[0] != '~') + return strdup(txt); + + temp = strchr(txt + 1, '/'); + if (temp == NULL) { + temp = strdup(txt + 1); + if (temp == NULL) + return NULL; + } else { + /* text until string after slash */ + len = (size_t)(temp - txt + 1); + temp = el_calloc(len, sizeof(*temp)); + if (temp == NULL) + return NULL; + (void)strlcpy(temp, txt + 1, len - 1); + } + if (temp[0] == 0) { +#ifdef HAVE_GETPW_R_POSIX + if (getpwuid_r(getuid(), &pwres, pwbuf, sizeof(pwbuf), + &pass) != 0) + pass = NULL; +#elif HAVE_GETPW_R_DRAFT + pass = getpwuid_r(getuid(), &pwres, pwbuf, sizeof(pwbuf)); +#else + pass = getpwuid(getuid()); +#endif + } else { +#ifdef HAVE_GETPW_R_POSIX + if (getpwnam_r(temp, &pwres, pwbuf, sizeof(pwbuf), &pass) != 0) + pass = NULL; +#elif HAVE_GETPW_R_DRAFT + pass = getpwnam_r(temp, &pwres, pwbuf, sizeof(pwbuf)); +#else + pass = getpwnam(temp); +#endif + } + el_free(temp); /* value no more needed */ + if (pass == NULL) + return strdup(txt); + + /* update pointer txt to point at string immedially following */ + /* first slash */ + txt += len; + + len = strlen(pass->pw_dir) + 1 + strlen(txt) + 1; + temp = el_calloc(len, sizeof(*temp)); + if (temp == NULL) + return NULL; + (void)snprintf(temp, len, "%s/%s", pass->pw_dir, txt); + + return temp; +} + +static int +needs_escaping(char c) +{ + switch (c) { + case '\'': + case '"': + case '(': + case ')': + case '\\': + case '<': + case '>': + case '$': + case '#': + case ' ': + case '\n': + case '\t': + case '?': + case ';': + case '`': + case '@': + case '=': + case '|': + case '{': + case '}': + case '&': + case '*': + case '[': + return 1; + default: + return 0; + } +} + +static int +needs_dquote_escaping(char c) +{ + switch (c) { + case '"': + case '\\': + case '`': + case '$': + return 1; + default: + return 0; + } +} + + +static wchar_t * +unescape_string(const wchar_t *string, size_t length) +{ + size_t i; + size_t j = 0; + wchar_t *unescaped = el_calloc(length + 1, sizeof(*string)); + if (unescaped == NULL) + return NULL; + for (i = 0; i < length ; i++) { + if (string[i] == '\\') + continue; + unescaped[j++] = string[i]; + } + unescaped[j] = 0; + return unescaped; +} + +static char * +escape_filename(EditLine * el, const char *filename, int single_match, + const char *(*app_func)(const char *)) +{ + size_t original_len = 0; + size_t escaped_character_count = 0; + size_t offset = 0; + size_t newlen; + const char *s; + char c; + size_t s_quoted = 0; /* does the input contain a single quote */ + size_t d_quoted = 0; /* does the input contain a double quote */ + char *escaped_str; + wchar_t *temp = el->el_line.buffer; + const char *append_char = NULL; + + if (filename == NULL) + return NULL; + + while (temp != el->el_line.cursor) { + /* + * If we see a single quote but have not seen a double quote + * so far set/unset s_quote + */ + if (temp[0] == '\'' && !d_quoted) + s_quoted = !s_quoted; + /* + * vice versa to the above condition + */ + else if (temp[0] == '"' && !s_quoted) + d_quoted = !d_quoted; + temp++; + } + + /* Count number of special characters so that we can calculate + * number of extra bytes needed in the new string + */ + for (s = filename; *s; s++, original_len++) { + c = *s; + /* Inside a single quote only single quotes need escaping */ + if (s_quoted && c == '\'') { + escaped_character_count += 3; + continue; + } + /* Inside double quotes only ", \, ` and $ need escaping */ + if (d_quoted && needs_dquote_escaping(c)) { + escaped_character_count++; + continue; + } + if (!s_quoted && !d_quoted && needs_escaping(c)) + escaped_character_count++; + } + + newlen = original_len + escaped_character_count + 1; + if (s_quoted || d_quoted) + newlen++; + + if (single_match && app_func) + newlen++; + + if ((escaped_str = el_malloc(newlen)) == NULL) + return NULL; + + for (s = filename; *s; s++) { + c = *s; + if (!needs_escaping(c)) { + /* no escaping is required continue as usual */ + escaped_str[offset++] = c; + continue; + } + + /* single quotes inside single quotes require special handling */ + if (c == '\'' && s_quoted) { + escaped_str[offset++] = '\''; + escaped_str[offset++] = '\\'; + escaped_str[offset++] = '\''; + escaped_str[offset++] = '\''; + continue; + } + + /* Otherwise no escaping needed inside single quotes */ + if (s_quoted) { + escaped_str[offset++] = c; + continue; + } + + /* No escaping needed inside a double quoted string either + * unless we see a '$', '\', '`', or '"' (itself) + */ + if (d_quoted && !needs_dquote_escaping(c)) { + escaped_str[offset++] = c; + continue; + } + + /* If we reach here that means escaping is actually needed */ + escaped_str[offset++] = '\\'; + escaped_str[offset++] = c; + } + + if (single_match && app_func) { + escaped_str[offset] = 0; - append_char = app_func(escaped_str); ++ append_char = app_func(filename); + /* we want to append space only if we are not inside quotes */ + if (append_char[0] == ' ') { + if (!s_quoted && !d_quoted) + escaped_str[offset++] = append_char[0]; + } else + escaped_str[offset++] = append_char[0]; + } + + /* close the quotes if single match and the match is not a directory */ + if (single_match && (append_char && append_char[0] == ' ')) { + if (s_quoted) + escaped_str[offset++] = '\''; + else if (d_quoted) + escaped_str[offset++] = '"'; + } + + escaped_str[offset] = 0; + return escaped_str; +} + +/* + * return first found file name starting by the ``text'' or NULL if no + * such file can be found + * value of ``state'' is ignored + * + * it's the caller's responsibility to free the returned string + */ +char * +fn_filename_completion_function(const char *text, int state) +{ + static DIR *dir = NULL; + static char *filename = NULL, *dirname = NULL, *dirpath = NULL; + static size_t filename_len = 0; + struct dirent *entry; + char *temp; + size_t len; + + if (state == 0 || dir == NULL) { + temp = strrchr(text, '/'); + if (temp) { + char *nptr; + temp++; + nptr = el_realloc(filename, (strlen(temp) + 1) * + sizeof(*nptr)); + if (nptr == NULL) { + el_free(filename); + filename = NULL; + return NULL; + } + filename = nptr; + (void)strcpy(filename, temp); + len = (size_t)(temp - text); /* including last slash */ + + nptr = el_realloc(dirname, (len + 1) * + sizeof(*nptr)); + if (nptr == NULL) { + el_free(dirname); + dirname = NULL; + return NULL; + } + dirname = nptr; + (void)strlcpy(dirname, text, len + 1); + } else { + el_free(filename); + if (*text == 0) + filename = NULL; + else { + filename = strdup(text); + if (filename == NULL) + return NULL; + } + el_free(dirname); + dirname = NULL; + } + + if (dir != NULL) { + (void)closedir(dir); + dir = NULL; + } + + /* support for ``~user'' syntax */ + + el_free(dirpath); + dirpath = NULL; + if (dirname == NULL) { + if ((dirname = strdup("")) == NULL) + return NULL; + dirpath = strdup("./"); + } else if (*dirname == '~') + dirpath = fn_tilde_expand(dirname); + else + dirpath = strdup(dirname); + + if (dirpath == NULL) + return NULL; + + dir = opendir(dirpath); + if (!dir) + return NULL; /* cannot open the directory */ + + /* will be used in cycle */ + filename_len = filename ? strlen(filename) : 0; + } + + /* find the match */ + while ((entry = readdir(dir)) != NULL) { + /* skip . and .. */ + if (entry->d_name[0] == '.' && (!entry->d_name[1] + || (entry->d_name[1] == '.' && !entry->d_name[2]))) + continue; + if (filename_len == 0) + break; + /* otherwise, get first entry where first */ + /* filename_len characters are equal */ + if (entry->d_name[0] == filename[0] +#if HAVE_STRUCT_DIRENT_D_NAMLEN + && entry->d_namlen >= filename_len +#else + && strlen(entry->d_name) >= filename_len +#endif + && strncmp(entry->d_name, filename, + filename_len) == 0) + break; + } + + if (entry) { /* match found */ + +#if HAVE_STRUCT_DIRENT_D_NAMLEN + len = entry->d_namlen; +#else + len = strlen(entry->d_name); +#endif + + len = strlen(dirname) + len + 1; + temp = el_calloc(len, sizeof(*temp)); + if (temp == NULL) + return NULL; + (void)snprintf(temp, len, "%s%s", dirname, entry->d_name); + } else { + (void)closedir(dir); + dir = NULL; + temp = NULL; + } + + return temp; +} + + +static const char * +append_char_function(const char *name) +{ + struct stat stbuf; + char *expname = *name == '~' ? fn_tilde_expand(name) : NULL; + const char *rs = " "; + + if (stat(expname ? expname : name, &stbuf) == -1) + goto out; + if (S_ISDIR(stbuf.st_mode)) + rs = "/"; +out: + if (expname) + el_free(expname); + return rs; +} +/* + * returns list of completions for text given + * non-static for readline. + */ +char ** completion_matches(const char *, char *(*)(const char *, int)); +char ** +completion_matches(const char *text, char *(*genfunc)(const char *, int)) +{ + char **match_list = NULL, *retstr, *prevstr; + size_t match_list_len, max_equal, which, i; + size_t matches; + + matches = 0; + match_list_len = 1; + while ((retstr = (*genfunc) (text, (int)matches)) != NULL) { + /* allow for list terminator here */ + if (matches + 3 >= match_list_len) { + char **nmatch_list; + while (matches + 3 >= match_list_len) + match_list_len <<= 1; + nmatch_list = el_realloc(match_list, + match_list_len * sizeof(*nmatch_list)); + if (nmatch_list == NULL) { + el_free(match_list); + return NULL; + } + match_list = nmatch_list; + + } + match_list[++matches] = retstr; + } + + if (!match_list) + return NULL; /* nothing found */ + + /* find least denominator and insert it to match_list[0] */ + which = 2; + prevstr = match_list[1]; + max_equal = strlen(prevstr); + for (; which <= matches; which++) { + for (i = 0; i < max_equal && + prevstr[i] == match_list[which][i]; i++) + continue; + max_equal = i; + } + + retstr = el_calloc(max_equal + 1, sizeof(*retstr)); + if (retstr == NULL) { + el_free(match_list); + return NULL; + } + (void)strlcpy(retstr, match_list[1], max_equal + 1); + match_list[0] = retstr; + + /* add NULL as last pointer to the array */ + match_list[matches + 1] = NULL; + + return match_list; +} + +/* + * Sort function for qsort(). Just wrapper around strcasecmp(). + */ +static int +_fn_qsort_string_compare(const void *i1, const void *i2) +{ + const char *s1 = ((const char * const *)i1)[0]; + const char *s2 = ((const char * const *)i2)[0]; + + return strcasecmp(s1, s2); +} + +/* + * Display list of strings in columnar format on readline's output stream. + * 'matches' is list of strings, 'num' is number of strings in 'matches', + * 'width' is maximum length of string in 'matches'. + * + * matches[0] is not one of the match strings, but it is counted in + * num, so the strings are matches[1] *through* matches[num-1]. + */ +void +fn_display_match_list(EditLine * el, char **matches, size_t num, size_t width, + const char *(*app_func) (const char *)) +{ + size_t line, lines, col, cols, thisguy; + int screenwidth = el->el_terminal.t_size.h; + if (app_func == NULL) + app_func = append_char_function; + + /* Ignore matches[0]. Avoid 1-based array logic below. */ + matches++; + num--; + + /* + * Find out how many entries can be put on one line; count + * with one space between strings the same way it's printed. + */ + cols = (size_t)screenwidth / (width + 2); + if (cols == 0) + cols = 1; + + /* how many lines of output, rounded up */ + lines = (num + cols - 1) / cols; + + /* Sort the items. */ + qsort(matches, num, sizeof(char *), _fn_qsort_string_compare); + + /* + * On the ith line print elements i, i+lines, i+lines*2, etc. + */ + for (line = 0; line < lines; line++) { + for (col = 0; col < cols; col++) { + thisguy = line + col * lines; + if (thisguy >= num) + break; + (void)fprintf(el->el_outfile, "%s%s%s", + col == 0 ? "" : " ", matches[thisguy], + (*app_func)(matches[thisguy])); + (void)fprintf(el->el_outfile, "%-*s", + (int) (width - strlen(matches[thisguy])), ""); + } + (void)fprintf(el->el_outfile, "\n"); + } +} + +static wchar_t * +find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer, + const wchar_t * word_break, const wchar_t * special_prefixes, size_t * length, + int do_unescape) +{ + /* We now look backwards for the start of a filename/variable word */ + const wchar_t *ctemp = cursor; + wchar_t *temp; + size_t len; + + /* if the cursor is placed at a slash or a quote, we need to find the + * word before it + */ + if (ctemp > buffer) { + switch (ctemp[-1]) { + case '\\': + case '\'': + case '"': + ctemp--; + break; + default: + break; + } + } + + for (;;) { + if (ctemp <= buffer) + break; + if (wcschr(word_break, ctemp[-1])) { + if (ctemp - buffer >= 2 && ctemp[-2] == '\\') { + ctemp -= 2; + continue; + } + break; + } + if (special_prefixes && wcschr(special_prefixes, ctemp[-1])) + break; + ctemp--; + } + + len = (size_t) (cursor - ctemp); + if (len == 1 && (ctemp[0] == '\'' || ctemp[0] == '"')) { + len = 0; + ctemp++; + } + *length = len; + if (do_unescape) { + wchar_t *unescaped_word = unescape_string(ctemp, len); + if (unescaped_word == NULL) + return NULL; + return unescaped_word; + } + temp = el_malloc((len + 1) * sizeof(*temp)); + (void) wcsncpy(temp, ctemp, len); + temp[len] = '\0'; + return temp; +} + +/* + * Complete the word at or before point, + * 'what_to_do' says what to do with the completion. + * \t means do standard completion. + * `?' means list the possible completions. + * `*' means insert all of the possible completions. + * `!' means to do standard completion, and list all possible completions if + * there is more than one. + * + * Note: '*' support is not implemented + * '!' could never be invoked + */ +int - fn_complete(EditLine *el, - char *(*complet_func)(const char *, int), - char **(*attempted_completion_function)(const char *, int, int), - const wchar_t *word_break, const wchar_t *special_prefixes, - const char *(*app_func)(const char *), size_t query_items, - int *completion_type, int *over, int *point, int *end) ++fn_complete2(EditLine *el, ++ char *(*complete_func)(const char *, int), ++ char **(*attempted_completion_function)(const char *, int, int), ++ const wchar_t *word_break, const wchar_t *special_prefixes, ++ const char *(*app_func)(const char *), size_t query_items, ++ int *completion_type, int *over, int *point, int *end, ++ unsigned int flags) +{ + const LineInfoW *li; + wchar_t *temp; + char **matches; + char *completion; + size_t len; + int what_to_do = '\t'; + int retval = CC_NORM; - int do_unescape = attempted_completion_function == NULL? 1: 0; ++ int do_unescape = flags & FN_QUOTE_MATCH; + + if (el->el_state.lastcmd == el->el_state.thiscmd) + what_to_do = '?'; + + /* readline's rl_complete() has to be told what we did... */ + if (completion_type != NULL) + *completion_type = what_to_do; + - if (!complet_func) - complet_func = fn_filename_completion_function; ++ if (!complete_func) ++ complete_func = fn_filename_completion_function; + if (!app_func) + app_func = append_char_function; + + li = el_wline(el); + temp = find_word_to_complete(li->cursor, + li->buffer, word_break, special_prefixes, &len, do_unescape); + if (temp == NULL) + goto out; + + /* these can be used by function called in completion_matches() */ + /* or (*attempted_completion_function)() */ + if (point != NULL) + *point = (int)(li->cursor - li->buffer); + if (end != NULL) + *end = (int)(li->lastchar - li->buffer); + + if (attempted_completion_function) { + int cur_off = (int)(li->cursor - li->buffer); + matches = (*attempted_completion_function)( + ct_encode_string(temp, &el->el_scratch), + cur_off - (int)len, cur_off); + } else + matches = NULL; + if (!attempted_completion_function || + (over != NULL && !*over && !matches)) + matches = completion_matches( - ct_encode_string(temp, &el->el_scratch), complet_func); ++ ct_encode_string(temp, &el->el_scratch), complete_func); + + if (over != NULL) + *over = 0; + + if (matches == NULL) { + goto out; + } + int i; + size_t matches_num, maxlen, match_len, match_display=1; + int single_match = matches[2] == NULL && + (matches[1] == NULL || strcmp(matches[0], matches[1]) == 0); + + retval = CC_REFRESH; + + if (matches[0][0] != '\0') { + el_deletestr(el, (int)len); - if (!attempted_completion_function) ++ if (flags & FN_QUOTE_MATCH) + completion = escape_filename(el, matches[0], + single_match, app_func); + else + completion = strdup(matches[0]); + if (completion == NULL) + goto out; + + /* + * Replace the completed string with the common part of + * all possible matches if there is a possible completion. + */ + el_winsertstr(el, + ct_decode_string(completion, &el->el_scratch)); + - if (single_match && attempted_completion_function) { ++ if (single_match && attempted_completion_function && ++ !(flags & FN_QUOTE_MATCH)) ++ { + /* + * We found an exact match. Add a space after + * it, unless we do filename completion and the + * object is a directory. Also do necessary + * escape quoting + */ + el_winsertstr(el, ct_decode_string( + (*app_func)(completion), &el->el_scratch)); + } + free(completion); + } + + + if (!single_match && (what_to_do == '!' || what_to_do == '?')) { + /* + * More than one match and requested to list possible + * matches. + */ + + for(i = 1, maxlen = 0; matches[i]; i++) { + match_len = strlen(matches[i]); + if (match_len > maxlen) + maxlen = match_len; + } + /* matches[1] through matches[i-1] are available */ + matches_num = (size_t)(i - 1); + + /* newline to get on next line from command line */ + (void)fprintf(el->el_outfile, "\n"); + + /* + * If there are too many items, ask user for display + * confirmation. + */ + if (matches_num > query_items) { + (void)fprintf(el->el_outfile, + "Display all %zu possibilities? (y or n) ", + matches_num); + (void)fflush(el->el_outfile); + if (getc(stdin) != 'y') + match_display = 0; + (void)fprintf(el->el_outfile, "\n"); + } + + if (match_display) { + /* + * Interface of this function requires the + * strings be matches[1..num-1] for compat. + * We have matches_num strings not counting + * the prefix in matches[0], so we need to + * add 1 to matches_num for the call. + */ + fn_display_match_list(el, matches, + matches_num+1, maxlen, app_func); + } + retval = CC_REDISPLAY; + } else if (matches[0][0]) { + /* + * There was some common match, but the name was + * not complete enough. Next tab will print possible + * completions. + */ + el_beep(el); + } else { + /* lcd is not a valid object - further specification */ + /* is needed */ + el_beep(el); + retval = CC_NORM; + } + + /* free elements of array and the array itself */ + for (i = 0; matches[i]; i++) + el_free(matches[i]); + el_free(matches); + matches = NULL; + +out: + el_free(temp); + return retval; +} + ++int ++fn_complete(EditLine *el, ++ char *(*complete_func)(const char *, int), ++ char **(*attempted_completion_function)(const char *, int, int), ++ const wchar_t *word_break, const wchar_t *special_prefixes, ++ const char *(*app_func)(const char *), size_t query_items, ++ int *completion_type, int *over, int *point, int *end) ++{ ++ return fn_complete2(el, complete_func, attempted_completion_function, ++ word_break, special_prefixes, app_func, query_items, ++ completion_type, over, point, end, ++ attempted_completion_function ? 0 : FN_QUOTE_MATCH); ++} ++ +/* + * el-compatible wrapper around rl_complete; needed for key binding + */ +/* ARGSUSED */ +unsigned char +_el_fn_complete(EditLine *el, int ch __attribute__((__unused__))) +{ + return (unsigned char)fn_complete(el, NULL, NULL, + break_chars, NULL, NULL, (size_t)100, + NULL, NULL, NULL, NULL); +} + +/* + * el-compatible wrapper around rl_complete; needed for key binding + */ +/* ARGSUSED */ +unsigned char +_el_fn_sh_complete(EditLine *el, int ch) +{ + return _el_fn_complete(el, ch); +} From owner-dev-commits-src-all@freebsd.org Mon Mar 29 08:54:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AC405C1C84; Mon, 29 Mar 2021 08:54:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F85x20k0fz4prs; Mon, 29 Mar 2021 08:54:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BA0D109FF; Mon, 29 Mar 2021 08:54:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T8sTgZ024118; Mon, 29 Mar 2021 08:54:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T8sTrU024117; Mon, 29 Mar 2021 08:54:29 GMT (envelope-from git) Date: Mon, 29 Mar 2021 08:54:29 GMT Message-Id: <202103290854.12T8sTrU024117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 1aadba9cc8af - stable/12 - Hyper-V: hn: Store host hash value in flowid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1aadba9cc8af4c1925eb27215eaf6d68e6fbf4d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 08:54:30 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=1aadba9cc8af4c1925eb27215eaf6d68e6fbf4d8 commit 1aadba9cc8af4c1925eb27215eaf6d68e6fbf4d8 Author: Wei Hu AuthorDate: 2021-02-24 05:07:46 +0000 Commit: Wei Hu CommitDate: 2021-03-29 08:32:39 +0000 Hyper-V: hn: Store host hash value in flowid When rx packet contains hash value sent from host, store it in the mbuf's flowid field so when the same mbuf is on the tx path, the hash value can be used by the host to determine the outgoing network queue. MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit 80f39bd95f22322152709ea5fae3a3c546044c9c) --- sys/dev/hyperv/netvsc/if_hn.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 1945732590cc..b77f3118b777 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -3073,13 +3073,24 @@ hn_encap(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd, if (txr->hn_tx_flags & HN_TX_FLAG_HASHVAL) { /* - * Set the hash value for this packet, so that the host could - * dispatch the TX done event for this packet back to this TX - * ring's channel. + * Set the hash value for this packet. */ pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL); - *pi_data = txr->hn_tx_idx; + + if (M_HASHTYPE_ISHASH(m_head)) + /* + * The flowid field contains the hash value host + * set in the rx queue if it is a ip forwarding pkt. + * Set the same hash value so host can send on the + * cpu it was received. + */ + *pi_data = m_head->m_pkthdr.flowid; + else + /* + * Otherwise just put the tx queue index. + */ + *pi_data = txr->hn_tx_idx; } if (m_head->m_flags & M_VLANTAG) { From owner-dev-commits-src-all@freebsd.org Mon Mar 29 08:57:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB95C5C1A6D; Mon, 29 Mar 2021 08:57:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F860H6KpYz4qQc; Mon, 29 Mar 2021 08:57:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC2AB108A8; Mon, 29 Mar 2021 08:57:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T8vJ7b024687; Mon, 29 Mar 2021 08:57:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T8vJvf024686; Mon, 29 Mar 2021 08:57:19 GMT (envelope-from git) Date: Mon, 29 Mar 2021 08:57:19 GMT Message-Id: <202103290857.12T8vJvf024686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 177772088060 - main - Reduce chance of RCU deadlock in the LinuxKPI by implementing the section feature of the concurrency kit, CK. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 177772088060ab0f41bcdbdd81c4712e7f1c7621 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 08:57:20 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=177772088060ab0f41bcdbdd81c4712e7f1c7621 commit 177772088060ab0f41bcdbdd81c4712e7f1c7621 Author: Hans Petter Selasky AuthorDate: 2021-03-28 07:36:48 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-29 08:55:14 +0000 Reduce chance of RCU deadlock in the LinuxKPI by implementing the section feature of the concurrency kit, CK. Differential Revision: https://reviews.freebsd.org/D29467 Reviewed by: kib@ and markj@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/compat/linuxkpi/common/include/linux/sched.h | 1 + sys/compat/linuxkpi/common/src/linux_rcu.c | 43 ++++++++++++++++++------ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h index da38d89eb639..937e9f27870c 100644 --- a/sys/compat/linuxkpi/common/include/linux/sched.h +++ b/sys/compat/linuxkpi/common/include/linux/sched.h @@ -82,6 +82,7 @@ struct task_struct { int bsd_interrupt_value; struct work_struct *work; /* current work struct, if set */ struct task_struct *group_leader; + unsigned rcu_section[TS_RCU_TYPE_MAX]; }; #define current ({ \ diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c index 86ec193aa4e4..404c5cec4ae4 100644 --- a/sys/compat/linuxkpi/common/src/linux_rcu.c +++ b/sys/compat/linuxkpi/common/src/linux_rcu.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Matthew Macy (mmacy@mattmacy.io) - * Copyright (c) 2017-2020 Hans Petter Selasky (hselasky@freebsd.org) + * Copyright (c) 2017-2021 Hans Petter Selasky (hselasky@freebsd.org) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,6 +85,15 @@ struct linux_epoch_record { */ CTASSERT(sizeof(struct rcu_head) == sizeof(struct callback_head)); +/* + * Verify that "rcu_section[0]" has the same size as + * "ck_epoch_section_t". This has been done to avoid having to add + * special compile flags for including ck_epoch.h to all clients of + * the LinuxKPI. + */ +CTASSERT(sizeof(((struct task_struct *)0)->rcu_section[0] == + sizeof(ck_epoch_section_t))); + /* * Verify that "epoch_record" is at beginning of "struct * linux_epoch_record": @@ -189,6 +198,14 @@ linux_rcu_read_lock(unsigned type) if (RCU_SKIP()) return; + ts = current; + + /* assert valid refcount */ + MPASS(ts->rcu_recurse[type] != INT_MAX); + + if (++(ts->rcu_recurse[type]) != 1) + return; + /* * Pin thread to current CPU so that the unlock code gets the * same per-CPU epoch record: @@ -196,17 +213,15 @@ linux_rcu_read_lock(unsigned type) sched_pin(); record = &DPCPU_GET(linux_epoch_record[type]); - ts = current; /* * Use a critical section to prevent recursion inside * ck_epoch_begin(). Else this function supports recursion. */ critical_enter(); - ck_epoch_begin(&record->epoch_record, NULL); - ts->rcu_recurse[type]++; - if (ts->rcu_recurse[type] == 1) - TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); + ck_epoch_begin(&record->epoch_record, + (ck_epoch_section_t *)&ts->rcu_section[type]); + TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); critical_exit(); } @@ -221,18 +236,24 @@ linux_rcu_read_unlock(unsigned type) if (RCU_SKIP()) return; - record = &DPCPU_GET(linux_epoch_record[type]); ts = current; + /* assert valid refcount */ + MPASS(ts->rcu_recurse[type] > 0); + + if (--(ts->rcu_recurse[type]) != 0) + return; + + record = &DPCPU_GET(linux_epoch_record[type]); + /* * Use a critical section to prevent recursion inside * ck_epoch_end(). Else this function supports recursion. */ critical_enter(); - ck_epoch_end(&record->epoch_record, NULL); - ts->rcu_recurse[type]--; - if (ts->rcu_recurse[type] == 0) - TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); + ck_epoch_end(&record->epoch_record, + (ck_epoch_section_t *)&ts->rcu_section[type]); + TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); critical_exit(); sched_unpin(); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 09:12:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4BB05C2741; Mon, 29 Mar 2021 09:12:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F86KT5vSlz4s4x; Mon, 29 Mar 2021 09:12:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD72110CC9; Mon, 29 Mar 2021 09:12:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T9CDiL052725; Mon, 29 Mar 2021 09:12:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T9CDTY052724; Mon, 29 Mar 2021 09:12:13 GMT (envelope-from git) Date: Mon, 29 Mar 2021 09:12:13 GMT Message-Id: <202103290912.12T9CDTY052724@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 4150446f6467 - stable/12 - Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4150446f6467f585595803db211f58152cd3587a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 09:12:14 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=4150446f6467f585595803db211f58152cd3587a commit 4150446f6467f585595803db211f58152cd3587a Author: Wei Hu AuthorDate: 2021-03-12 04:35:16 +0000 Commit: Wei Hu CommitDate: 2021-03-29 08:55:18 +0000 Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver Receive Segment Coalescing (RSC) in the vSwitch is a feature available in Windows Server 2019 hosts and later. It reduces the per packet processing overhead by coalescing multiple TCP segments when possible. This happens mostly when TCP traffics are among different guests on same host. This patch adds netvsc driver support for this feature. The patch also updates NVS version to 6.1 as needed for RSC enablement. MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D29075 (cherry picked from commit a491581f3f8df07cdff0236bd556895205929af4) --- sys/dev/hyperv/netvsc/hn_nvs.c | 5 + sys/dev/hyperv/netvsc/hn_rndis.c | 25 ++++ sys/dev/hyperv/netvsc/if_hn.c | 258 ++++++++++++++++++++++++++++----------- sys/dev/hyperv/netvsc/if_hnreg.h | 14 +++ sys/dev/hyperv/netvsc/if_hnvar.h | 19 ++- sys/dev/hyperv/netvsc/ndis.h | 31 +++-- sys/net/rndis.h | 7 +- 7 files changed, 269 insertions(+), 90 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hn_nvs.c b/sys/dev/hyperv/netvsc/hn_nvs.c index 73a112c4e5e1..4dbc28996617 100644 --- a/sys/dev/hyperv/netvsc/hn_nvs.c +++ b/sys/dev/hyperv/netvsc/hn_nvs.c @@ -80,6 +80,8 @@ struct hn_nvs_sendctx hn_nvs_sendctx_none = HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL); static const uint32_t hn_nvs_version[] = { + HN_NVS_VERSION_61, + HN_NVS_VERSION_6, HN_NVS_VERSION_5, HN_NVS_VERSION_4, HN_NVS_VERSION_2, @@ -508,6 +510,9 @@ hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) conf.nvs_caps |= HN_NVS_NDIS_CONF_SRIOV; + if (sc->hn_nvs_ver >= HN_NVS_VERSION_61) + conf.nvs_caps |= HN_NVS_NDIS_CONF_RSC; + /* NOTE: No response. */ error = hn_nvs_req_send(sc, &conf, sizeof(conf)); diff --git a/sys/dev/hyperv/netvsc/hn_rndis.c b/sys/dev/hyperv/netvsc/hn_rndis.c index b9bf683fe811..794a82cf3957 100644 --- a/sys/dev/hyperv/netvsc/hn_rndis.c +++ b/sys/dev/hyperv/netvsc/hn_rndis.c @@ -723,6 +723,17 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_RX; } + /* RSC offload */ + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) { + if (hwcaps.ndis_rsc.ndis_ip4 && hwcaps.ndis_rsc.ndis_ip6) { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_ON; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_ON; + } else { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_OFF; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_OFF; + } + } + if (bootverbose) { if_printf(sc->hn_ifp, "offload csum: " "ip4 %u, tcp4 %u, udp4 %u, tcp6 %u, udp6 %u\n", @@ -734,6 +745,10 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) if_printf(sc->hn_ifp, "offload lsov2: ip4 %u, ip6 %u\n", params.ndis_lsov2_ip4, params.ndis_lsov2_ip6); + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) + if_printf(sc->hn_ifp, "offload rsc: ip4 %u, ip6 %u\n", + params.ndis_rsc_ip4, + params.ndis_rsc_ip6); } error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, ¶ms, paramsz); @@ -969,6 +984,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n", caps->ndis_hdr.ndis_size); return (EINVAL); + } else if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3 && + caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE) { + if_printf(sc->hn_ifp, "invalid NDIS rev3 objsize %u\n", + caps->ndis_hdr.ndis_size); + return (EINVAL); } if (bootverbose) { @@ -1001,6 +1021,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) caps->ndis_lsov2.ndis_ip6_minsg, caps->ndis_lsov2.ndis_ip6_encap, caps->ndis_lsov2.ndis_ip6_opts); + if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3) + if_printf(sc->hn_ifp, "hwcaps rsc: " + "ip4 %u ip6 %u\n", + caps->ndis_rsc.ndis_ip4, + caps->ndis_rsc.ndis_ip6); } return (0); } diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index b77f3118b777..1e90e8ef14fb 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -223,11 +223,25 @@ struct hn_txdesc { #define HN_TXD_FLAG_DMAMAP 0x0002 #define HN_TXD_FLAG_ONAGG 0x0004 +#define HN_NDIS_PKTINFO_SUBALLOC 0x01 +#define HN_NDIS_PKTINFO_1ST_FRAG 0x02 +#define HN_NDIS_PKTINFO_LAST_FRAG 0x04 + +struct packet_info_id { + uint8_t ver; + uint8_t flag; + uint16_t pkt_id; +}; + +#define NDIS_PKTINFOID_SZ sizeof(struct packet_info_id) + + struct hn_rxinfo { - uint32_t vlan_info; - uint32_t csum_info; - uint32_t hash_info; - uint32_t hash_value; + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + const struct packet_info_id *pktinfo_id; }; struct hn_rxvf_setarg { @@ -239,15 +253,13 @@ struct hn_rxvf_setarg { #define HN_RXINFO_CSUM 0x0002 #define HN_RXINFO_HASHINF 0x0004 #define HN_RXINFO_HASHVAL 0x0008 +#define HN_RXINFO_PKTINFO_ID 0x0010 #define HN_RXINFO_ALL \ (HN_RXINFO_VLAN | \ HN_RXINFO_CSUM | \ HN_RXINFO_HASHINF | \ - HN_RXINFO_HASHVAL) - -#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff -#define HN_NDIS_RXCSUM_INFO_INVALID 0 -#define HN_NDIS_HASH_INFO_INVALID 0 + HN_RXINFO_HASHVAL | \ + HN_RXINFO_PKTINFO_ID) static int hn_probe(device_t); static int hn_attach(device_t); @@ -396,8 +408,7 @@ static int hn_rxfilter_config(struct hn_softc *); static int hn_rss_reconfig(struct hn_softc *); static void hn_rss_ind_fixup(struct hn_softc *); static void hn_rss_mbuf_hash(struct hn_softc *, uint32_t); -static int hn_rxpkt(struct hn_rx_ring *, const void *, - int, const struct hn_rxinfo *); +static int hn_rxpkt(struct hn_rx_ring *); static uint32_t hn_rss_type_fromndis(uint32_t); static uint32_t hn_rss_type_tondis(uint32_t); @@ -3349,9 +3360,10 @@ again: * allocated with cluster size MJUMPAGESIZE, and filled * accordingly. * - * Return 1 if able to complete the job; otherwise 0. + * Return the last mbuf in the chain or NULL if failed to + * allocate new mbuf. */ -static int +static struct mbuf * hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) { struct mbuf *m, *n; @@ -3379,7 +3391,7 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) */ n = m_getjcl(M_NOWAIT, m->m_type, 0, MJUMPAGESIZE); if (n == NULL) - break; + return NULL; n->m_len = min(MJUMPAGESIZE, remainder); bcopy(cp, mtod(n, caddr_t), n->m_len); cp += n->m_len; @@ -3387,10 +3399,8 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) m->m_next = n; m = n; } - if (m0->m_flags & M_PKTHDR) - m0->m_pkthdr.len += len - remainder; - return (remainder == 0); + return m; } #if defined(INET) || defined(INET6) @@ -3408,14 +3418,14 @@ hn_lro_rx(struct lro_ctrl *lc, struct mbuf *m) #endif static int -hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, - const struct hn_rxinfo *info) +hn_rxpkt(struct hn_rx_ring *rxr) { struct ifnet *ifp, *hn_ifp = rxr->hn_ifp; - struct mbuf *m_new; + struct mbuf *m_new, *n; int size, do_lro = 0, do_csum = 1, is_vf = 0; int hash_type = M_HASHTYPE_NONE; int l3proto = ETHERTYPE_MAX, l4proto = IPPROTO_DONE; + int i; ifp = hn_ifp; if (rxr->hn_rxvf_ifp != NULL) { @@ -3442,20 +3452,20 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - if (__predict_false(dlen < ETHER_HDR_LEN)) { + if (__predict_false(rxr->rsc.pktlen < ETHER_HDR_LEN)) { if_inc_counter(hn_ifp, IFCOUNTER_IERRORS, 1); return (0); } - if (dlen <= MHLEN) { + if (rxr->rsc.cnt == 1 && rxr->rsc.pktlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); return (0); } - memcpy(mtod(m_new, void *), data, dlen); - m_new->m_pkthdr.len = m_new->m_len = dlen; - rxr->hn_small_pkts++; + memcpy(mtod(m_new, void *), rxr->rsc.frag_data[0], + rxr->rsc.frag_len[0]); + m_new->m_pkthdr.len = m_new->m_len = rxr->rsc.frag_len[0]; } else { /* * Get an mbuf with a cluster. For packets 2K or less, @@ -3464,7 +3474,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * if looped around to the Hyper-V TX channel, so avoid them. */ size = MCLBYTES; - if (dlen > MCLBYTES) { + if (rxr->rsc.pktlen > MCLBYTES) { /* 4096 */ size = MJUMPAGESIZE; } @@ -3475,29 +3485,42 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - hv_m_append(m_new, dlen, data); + n = m_new; + for (i = 0; i < rxr->rsc.cnt; i++) { + n = hv_m_append(n, rxr->rsc.frag_len[i], + rxr->rsc.frag_data[i]); + if (n == NULL) { + if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); + return (0); + } else { + m_new->m_pkthdr.len += rxr->rsc.frag_len[i]; + } + } } + if (rxr->rsc.pktlen <= MHLEN) + rxr->hn_small_pkts++; + m_new->m_pkthdr.rcvif = ifp; if (__predict_false((hn_ifp->if_capenable & IFCAP_RXCSUM) == 0)) do_csum = 0; /* receive side checksum offload */ - if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) { + if (rxr->rsc.csum_info != NULL) { /* IP csum offload */ - if ((info->csum_info & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { + if ((*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID); rxr->hn_csum_ip++; } /* TCP/UDP csum offload */ - if ((info->csum_info & (NDIS_RXCSUM_INFO_UDPCS_OK | + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_UDPCS_OK | NDIS_RXCSUM_INFO_TCPCS_OK)) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); m_new->m_pkthdr.csum_data = 0xffff; - if (info->csum_info & NDIS_RXCSUM_INFO_TCPCS_OK) + if (*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_TCPCS_OK) rxr->hn_csum_tcp++; else rxr->hn_csum_udp++; @@ -3510,7 +3533,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * the do_lro setting here is actually _not_ accurate. We * depend on the RSS hash type check to reset do_lro. */ - if ((info->csum_info & + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) == (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) do_lro = 1; @@ -3547,11 +3570,11 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, } } - if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) { + if (rxr->rsc.vlan_info != NULL) { m_new->m_pkthdr.ether_vtag = EVL_MAKETAG( - NDIS_VLAN_INFO_ID(info->vlan_info), - NDIS_VLAN_INFO_PRI(info->vlan_info), - NDIS_VLAN_INFO_CFI(info->vlan_info)); + NDIS_VLAN_INFO_ID(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_PRI(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_CFI(*(rxr->rsc.vlan_info))); m_new->m_flags |= M_VLANTAG; } @@ -3577,14 +3600,14 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * matter here), do _not_ mess with unsupported hash types or * functions. */ - if (info->hash_info != HN_NDIS_HASH_INFO_INVALID) { + if (rxr->rsc.hash_info != NULL) { rxr->hn_rss_pkts++; - m_new->m_pkthdr.flowid = info->hash_value; + m_new->m_pkthdr.flowid = *(rxr->rsc.hash_value); if (!is_vf) hash_type = M_HASHTYPE_OPAQUE_HASH; - if ((info->hash_info & NDIS_HASH_FUNCTION_MASK) == + if ((*(rxr->rsc.hash_info) & NDIS_HASH_FUNCTION_MASK) == NDIS_HASH_FUNCTION_TOEPLITZ) { - uint32_t type = (info->hash_info & NDIS_HASH_TYPE_MASK & + uint32_t type = (*(rxr->rsc.hash_info) & NDIS_HASH_TYPE_MASK & rxr->hn_mbuf_hash); /* @@ -5029,6 +5052,16 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt) OID_AUTO, "rss_pkts", CTLFLAG_RW, &rxr->hn_rss_pkts, "# of packets w/ RSS info received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_pkts", CTLFLAG_RW, + &rxr->hn_rsc_pkts, + "# of RSC packets received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_drop", CTLFLAG_RW, + &rxr->hn_rsc_drop, + "# of RSC fragments dropped"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), OID_AUTO, "pktbuf_len", CTLFLAG_RD, @@ -7053,37 +7086,56 @@ hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_rxinfo *info) dlen = pi->rm_size - pi->rm_pktinfooffset; data = pi->rm_data; - switch (pi->rm_type) { - case NDIS_PKTINFO_TYPE_VLAN: - if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) - return (EINVAL); - info->vlan_info = *((const uint32_t *)data); - mask |= HN_RXINFO_VLAN; - break; + if (pi->rm_internal == 1) { + switch (pi->rm_type) { + case NDIS_PKTINFO_IT_PKTINFO_ID: + if (__predict_false(dlen < NDIS_PKTINFOID_SZ)) + return (EINVAL); + info->pktinfo_id = + (const struct packet_info_id *)data; + mask |= HN_RXINFO_PKTINFO_ID; + break; - case NDIS_PKTINFO_TYPE_CSUM: - if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) - return (EINVAL); - info->csum_info = *((const uint32_t *)data); - mask |= HN_RXINFO_CSUM; - break; + default: + goto next; + } + } else { + switch (pi->rm_type) { + case NDIS_PKTINFO_TYPE_VLAN: + if (__predict_false(dlen + < NDIS_VLAN_INFO_SIZE)) + return (EINVAL); + info->vlan_info = (const uint32_t *)data; + mask |= HN_RXINFO_VLAN; + break; - case HN_NDIS_PKTINFO_TYPE_HASHVAL: - if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) - return (EINVAL); - info->hash_value = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHVAL; - break; + case NDIS_PKTINFO_TYPE_CSUM: + if (__predict_false(dlen + < NDIS_RXCSUM_INFO_SIZE)) + return (EINVAL); + info->csum_info = (const uint32_t *)data; + mask |= HN_RXINFO_CSUM; + break; - case HN_NDIS_PKTINFO_TYPE_HASHINF: - if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) - return (EINVAL); - info->hash_info = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHINF; - break; + case HN_NDIS_PKTINFO_TYPE_HASHVAL: + if (__predict_false(dlen + < HN_NDIS_HASH_VALUE_SIZE)) + return (EINVAL); + info->hash_value = (const uint32_t *)data; + mask |= HN_RXINFO_HASHVAL; + break; - default: - goto next; + case HN_NDIS_PKTINFO_TYPE_HASHINF: + if (__predict_false(dlen + < HN_NDIS_HASH_INFO_SIZE)) + return (EINVAL); + info->hash_info = (const uint32_t *)data; + mask |= HN_RXINFO_HASHINF; + break; + + default: + goto next; + } } if (mask == HN_RXINFO_ALL) { @@ -7100,7 +7152,7 @@ next: * - If there is no hash value, invalidate the hash info. */ if ((mask & HN_RXINFO_HASHVAL) == 0) - info->hash_info = HN_NDIS_HASH_INFO_INVALID; + info->hash_info = NULL; return (0); } @@ -7118,12 +7170,34 @@ hn_rndis_check_overlap(int off, int len, int check_off, int check_len) return (true); } +static __inline void +hn_rsc_add_data(struct hn_rx_ring *rxr, const void *data, + uint32_t len, struct hn_rxinfo *info) +{ + uint32_t cnt = rxr->rsc.cnt; + + if (cnt) { + rxr->rsc.pktlen += len; + } else { + rxr->rsc.vlan_info = info->vlan_info; + rxr->rsc.csum_info = info->csum_info; + rxr->rsc.hash_info = info->hash_info; + rxr->rsc.hash_value = info->hash_value; + rxr->rsc.pktlen = len; + } + + rxr->rsc.frag_data[cnt] = data; + rxr->rsc.frag_len[cnt] = len; + rxr->rsc.cnt++; +} + static void hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) { const struct rndis_packet_msg *pkt; struct hn_rxinfo info; int data_off, pktinfo_off, data_len, pktinfo_len; + bool rsc_more= false; /* * Check length. @@ -7231,9 +7305,11 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) /* * Check per-packet-info coverage and find useful per-packet-info. */ - info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; - info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; - info.hash_info = HN_NDIS_HASH_INFO_INVALID; + info.vlan_info = NULL; + info.csum_info = NULL; + info.hash_info = NULL; + info.pktinfo_id = NULL; + if (__predict_true(pktinfo_len != 0)) { bool overlap; int error; @@ -7277,7 +7353,43 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) pkt->rm_len, data_off, data_len); return; } - hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); + + /* Identify RSC fragments, drop invalid packets */ + if ((info.pktinfo_id != NULL) && + (info.pktinfo_id->flag & HN_NDIS_PKTINFO_SUBALLOC)) { + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_1ST_FRAG) { + rxr->rsc.cnt = 0; + rxr->hn_rsc_pkts++; + } else if (rxr->rsc.cnt == 0) + goto drop; + + rsc_more = true; + + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_LAST_FRAG) + rsc_more = false; + + if (rsc_more && rxr->rsc.is_last) + goto drop; + } else { + rxr->rsc.cnt = 0; + } + + if (__predict_false(rxr->rsc.cnt >= HN_NVS_RSC_MAX)) + goto drop; + + /* Store data in per rx ring structure */ + hn_rsc_add_data(rxr,((const uint8_t *)pkt) + data_off, + data_len, &info); + + if (rsc_more) + return; + + hn_rxpkt(rxr); + rxr->rsc.cnt = 0; + return; +drop: + rxr->hn_rsc_drop++; + return; } static __inline void @@ -7390,6 +7502,8 @@ hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, "ofs %d, len %d\n", i, ofs, len); continue; } + + rxr->rsc.is_last = (i == (count - 1)); hn_rndis_rxpkt(rxr, rxr->hn_rxbuf + ofs, len); } diff --git a/sys/dev/hyperv/netvsc/if_hnreg.h b/sys/dev/hyperv/netvsc/if_hnreg.h index 154d69264679..54db556cc56d 100644 --- a/sys/dev/hyperv/netvsc/if_hnreg.h +++ b/sys/dev/hyperv/netvsc/if_hnreg.h @@ -48,6 +48,8 @@ #define HN_NVS_VERSION_2 0x30002 #define HN_NVS_VERSION_4 0x40000 #define HN_NVS_VERSION_5 0x50000 +#define HN_NVS_VERSION_6 0x60000 +#define HN_NVS_VERSION_61 0x60001 #define HN_NVS_RXBUF_SIG 0xcafe #define HN_NVS_CHIM_SIG 0xface @@ -101,6 +103,7 @@ struct hn_nvs_init { uint32_t nvs_ver_min; uint32_t nvs_ver_max; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_init) >= HN_NVS_REQSIZE_MIN); @@ -118,11 +121,13 @@ struct hn_nvs_ndis_conf { uint32_t nvs_rsvd; uint64_t nvs_caps; /* HN_NVS_NDIS_CONF_ */ uint8_t nvs_rsvd1[12]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_conf) >= HN_NVS_REQSIZE_MIN); #define HN_NVS_NDIS_CONF_SRIOV 0x0004 #define HN_NVS_NDIS_CONF_VLAN 0x0008 +#define HN_NVS_NDIS_CONF_RSC 0x0080 /* No response */ struct hn_nvs_ndis_init { @@ -130,6 +135,7 @@ struct hn_nvs_ndis_init { uint32_t nvs_ndis_major; /* NDIS_VERSION_MAJOR_ */ uint32_t nvs_ndis_minor; /* NDIS_VERSION_MINOR_ */ uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_init) >= HN_NVS_REQSIZE_MIN); @@ -141,6 +147,7 @@ struct hn_nvs_datapath { uint32_t nvs_type; /* HN_NVS_TYPE_SET_DATAPATH */ uint32_t nvs_active_path;/* HN_NVS_DATAPATH_* */ uint32_t nvs_rsvd[6]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_datapath) >= HN_NVS_REQSIZE_MIN); @@ -149,6 +156,7 @@ struct hn_nvs_rxbuf_conn { uint32_t nvs_gpadl; /* RXBUF vmbus GPADL */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_conn) >= HN_NVS_REQSIZE_MIN); @@ -171,6 +179,7 @@ struct hn_nvs_rxbuf_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_RXBUF_DISCONN */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_disconn) >= HN_NVS_REQSIZE_MIN); @@ -179,6 +188,7 @@ struct hn_nvs_chim_conn { uint32_t nvs_gpadl; /* chimney buf vmbus GPADL */ uint16_t nvs_sig; /* NDIS_NVS_CHIM_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_conn) >= HN_NVS_REQSIZE_MIN); @@ -193,6 +203,7 @@ struct hn_nvs_chim_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_CHIM_DISCONN */ uint16_t nvs_sig; /* HN_NVS_CHIM_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_disconn) >= HN_NVS_REQSIZE_MIN); @@ -203,6 +214,7 @@ struct hn_nvs_subch_req { uint32_t nvs_op; /* HN_NVS_SUBCH_OP_ */ uint32_t nvs_nsubch; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_subch_req) >= HN_NVS_REQSIZE_MIN); @@ -226,6 +238,7 @@ struct hn_nvs_rndis { uint32_t nvs_chim_idx; uint32_t nvs_chim_sz; uint8_t nvs_rsvd[16]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis) >= HN_NVS_REQSIZE_MIN); @@ -233,6 +246,7 @@ struct hn_nvs_rndis_ack { uint32_t nvs_type; /* HN_NVS_TYPE_RNDIS_ACK */ uint32_t nvs_status; /* HN_NVS_STATUS_ */ uint8_t nvs_rsvd[24]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis_ack) >= HN_NVS_REQSIZE_MIN); diff --git a/sys/dev/hyperv/netvsc/if_hnvar.h b/sys/dev/hyperv/netvsc/if_hnvar.h index c0e17c9643e0..27d93db5395e 100644 --- a/sys/dev/hyperv/netvsc/if_hnvar.h +++ b/sys/dev/hyperv/netvsc/if_hnvar.h @@ -33,7 +33,7 @@ #define HN_CHIM_SIZE (15 * 1024 * 1024) -#define HN_RXBUF_SIZE (16 * 1024 * 1024) +#define HN_RXBUF_SIZE (31 * 1024 * 1024) #define HN_RXBUF_SIZE_COMPAT (15 * 1024 * 1024) #define HN_MTU_MAX (65535 - ETHER_ADDR_LEN) @@ -56,6 +56,20 @@ struct buf_ring; #endif struct hn_tx_ring; +#define HN_NVS_RSC_MAX 562 /* Max RSC frags in one vmbus packet */ + +struct hn_rx_rsc { + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + uint32_t cnt; /* fragment count */ + uint32_t pktlen; /* full packet length */ + uint8_t is_last; /* last fragment */ + const void *frag_data[HN_NVS_RSC_MAX]; + uint32_t frag_len[HN_NVS_RSC_MAX]; +}; + struct hn_rx_ring { struct ifnet *hn_ifp; struct ifnet *hn_rxvf_ifp; /* SR-IOV VF for RX */ @@ -66,6 +80,7 @@ struct hn_rx_ring { uint32_t hn_mbuf_hash; /* NDIS_HASH_ */ uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ int hn_rx_idx; + struct hn_rx_rsc rsc; /* Trust csum verification on host side */ int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ @@ -80,6 +95,8 @@ struct hn_rx_ring { u_long hn_pkts; u_long hn_rss_pkts; u_long hn_ack_failed; + u_long hn_rsc_pkts; + u_long hn_rsc_drop; /* Rarely used stuffs */ struct sysctl_oid *hn_rx_sysctl_tree; diff --git a/sys/dev/hyperv/netvsc/ndis.h b/sys/dev/hyperv/netvsc/ndis.h index 32b6aa307452..c69da7807a63 100644 --- a/sys/dev/hyperv/netvsc/ndis.h +++ b/sys/dev/hyperv/netvsc/ndis.h @@ -115,8 +115,8 @@ struct ndis_offload_params { /* NDIS >= 6.30 */ uint8_t ndis_rsc_ip4; /* NDIS_OFFLOAD_RSC_ */ uint8_t ndis_rsc_ip6; /* NDIS_OFFLOAD_RSC_ */ - uint32_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ - uint32_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ + uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ + uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ }; #define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) @@ -305,17 +305,17 @@ struct ndis_lsov2_offload { struct ndis_ipsecv2_offload { uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ - uint16_t ndis_ip6; - uint16_t ndis_ip4opt; - uint16_t ndis_ip6ext; - uint16_t ndis_ah; - uint16_t ndis_esp; - uint16_t ndis_ah_esp; - uint16_t ndis_xport; - uint16_t ndis_tun; - uint16_t ndis_xport_tun; - uint16_t ndis_lso; - uint16_t ndis_extseq; + uint8_t ndis_ip6; + uint8_t ndis_ip4opt; + uint8_t ndis_ip6ext; + uint8_t ndis_ah; + uint8_t ndis_esp; + uint8_t ndis_ah_esp; + uint8_t ndis_xport; + uint8_t ndis_tun; + uint8_t ndis_xport_tun; + uint8_t ndis_lso; + uint8_t ndis_extseq; uint32_t ndis_udp_esp; uint32_t ndis_auth; uint32_t ndis_crypto; @@ -323,8 +323,8 @@ struct ndis_ipsecv2_offload { }; struct ndis_rsc_offload { - uint16_t ndis_ip4; - uint16_t ndis_ip6; + uint8_t ndis_ip4; + uint8_t ndis_ip6; }; struct ndis_encap_offload { @@ -419,5 +419,4 @@ struct ndis_offload { #define NDIS_TXCSUM_INFO_MKUDPCS(thoff) \ NDIS_TXCSUM_INFO_MKL4CS((thoff), NDIS_TXCSUM_INFO_UDPCS) - #endif /* !_NET_NDIS_H_ */ diff --git a/sys/net/rndis.h b/sys/net/rndis.h index 5d45469a4b52..56350dbb7824 100644 --- a/sys/net/rndis.h +++ b/sys/net/rndis.h @@ -142,7 +142,8 @@ struct rndis_packet_msg { /* Per-packet-info for RNDIS data message */ struct rndis_pktinfo { uint32_t rm_size; - uint32_t rm_type; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_type:31; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_internal:1; /* Indicate if internal type */ uint32_t rm_pktinfooffset; uint8_t rm_data[]; }; @@ -165,6 +166,10 @@ struct rndis_pktinfo { #define NDIS_PKTINFO_TYPE_CACHE_NBLIST 10 #define NDIS_PKTINFO_TYPE_PKT_PAD 11 +/* Per-packet-info internal type */ +#define NDIS_PKTINFO_IT_PKTINFO_ID 1 +/* Add more internal type here */ + /* * RNDIS control messages */ From owner-dev-commits-src-all@freebsd.org Mon Mar 29 09:16:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C46FA5C2769; Mon, 29 Mar 2021 09:16:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F86Px5D6Xz4sSL; Mon, 29 Mar 2021 09:16:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5E5F106EC; Mon, 29 Mar 2021 09:16:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T9G59K053403; Mon, 29 Mar 2021 09:16:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T9G54c053402; Mon, 29 Mar 2021 09:16:05 GMT (envelope-from git) Date: Mon, 29 Mar 2021 09:16:05 GMT Message-Id: <202103290916.12T9G54c053402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 2a321939b02b - stable/12 - Hyper-V: hn: Initialize the internal field of per packet info on tx path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2a321939b02bbf6123ba029f1967778c10538fe6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 09:16:05 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=2a321939b02bbf6123ba029f1967778c10538fe6 commit 2a321939b02bbf6123ba029f1967778c10538fe6 Author: Wei Hu AuthorDate: 2021-03-15 10:20:52 +0000 Commit: Wei Hu CommitDate: 2021-03-29 09:12:56 +0000 Hyper-V: hn: Initialize the internal field of per packet info on tx path The RSC support feature introduced a bit field "rm_internal" in struct rndis_pktinfo with total size unchanged. The guest does not use this field in the tx path. However we need to initialize it to zero in case older hosts which are not aware of this field. Fixes: a491581f ("Hyper-V: hn: Enable vSwitch RSC support") MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit 805dbff6c36a6cd84491aa53a02315fa025734cc) --- sys/dev/hyperv/netvsc/if_hn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 1e90e8ef14fb..54d2e41c36c8 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -2928,6 +2928,7 @@ hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, pi->rm_size = pi_size; pi->rm_type = pi_type; + pi->rm_internal = 0; pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; return (pi->rm_data); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 09:22:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F5BF5C29E2; Mon, 29 Mar 2021 09:22:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F86YG2n8sz4svC; Mon, 29 Mar 2021 09:22:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5234F10EB8; Mon, 29 Mar 2021 09:22:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T9MQW7066525; Mon, 29 Mar 2021 09:22:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T9MQ7x066524; Mon, 29 Mar 2021 09:22:26 GMT (envelope-from git) Date: Mon, 29 Mar 2021 09:22:26 GMT Message-Id: <202103290922.12T9MQ7x066524@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: b315a7296d2a - main - sh(1): autocomplete commands MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b315a7296d2a69883c483d79dfcb3860a0428f21 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 09:22:26 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=b315a7296d2a69883c483d79dfcb3860a0428f21 commit b315a7296d2a69883c483d79dfcb3860a0428f21 Author: Piotr Pawel Stefaniak AuthorDate: 2021-03-28 09:58:20 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-03-29 09:14:27 +0000 sh(1): autocomplete commands Without this patch, sh can autocomplete file names but not commands from $PATH. Use libedit's facility to execute custom function for autocomplete, but yield to the library's standard autocomplete function when cursor is not at position 0. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29361 --- bin/sh/histedit.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++- bin/sh/myhistedit.h | 2 + lib/libedit/Makefile | 2 +- 3 files changed, 130 insertions(+), 2 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 4c596c82257e..45a821736bc0 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -39,6 +39,8 @@ static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; __FBSDID("$FreeBSD$"); #include +#include +#include #include #include #include @@ -72,6 +74,9 @@ static FILE *el_in, *el_out; static char *fc_replace(const char *, char *, char *); static int not_fcnumber(const char *); static int str_to_event(const char *, int); +static int comparator(const void *, const void *, void *); +static char **sh_matches(const char *, int, int); +static unsigned char sh_complete(EditLine *, int); /* * Set history and editing status. Called whenever the status may @@ -122,7 +127,7 @@ histedit(void) el_set(el, EL_PROMPT, getprompt); el_set(el, EL_ADDFN, "sh-complete", "Filename completion", - _el_fn_complete); + sh_complete); } else { bad: out2fmt_flush("sh: can't initialize editing\n"); @@ -519,3 +524,124 @@ bindcmd(int argc __unused, char **argv __unused) return (0); } #endif + +/* + * Comparator function for qsort(). The use of curpos here is to skip + * characters that we already know to compare equal (common prefix). + */ +static int +comparator(const void *a, const void *b, void *thunk) +{ + size_t curpos = (intptr_t)thunk; + return (strcmp(*(char *const *)a + curpos, + *(char *const *)b + curpos)); +} + +/* + * This function is passed to libedit's fn_complete2(). The library will + * use it instead of its standard function that finds matching files in + * current directory. If we're at the start of the line, we want to look + * for available commands from all paths in $PATH. + */ +static char +**sh_matches(const char *text, int start, int end) +{ + char *free_path = NULL, *path; + const char *dirname; + char **matches = NULL; + size_t i = 0, size = 16, j, k; + size_t curpos = end - start; + + if (start > 0 || memchr("/.~", text[0], 3) != NULL) + return (NULL); + if ((free_path = path = strdup(pathval())) == NULL) + goto out; + if ((matches = malloc(size * sizeof(matches[0]))) == NULL) + goto out; + while ((dirname = strsep(&path, ":")) != NULL) { + struct dirent *entry; + DIR *dir; + int dfd; + + dir = opendir(dirname[0] == '\0' ? "." : dirname); + if (dir == NULL) + continue; + if ((dfd = dirfd(dir)) == -1) { + closedir(dir); + continue; + } + while ((entry = readdir(dir)) != NULL) { + struct stat statb; + char **rmatches; + + if (strncmp(entry->d_name, text, curpos) != 0) + continue; + if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK) { + if (fstatat(dfd, entry->d_name, &statb, 0) == -1) + continue; + if (!S_ISREG(statb.st_mode)) + continue; + } else if (entry->d_type != DT_REG) + continue; + matches[++i] = strdup(entry->d_name); + if (i < size - 1) + continue; + size *= 2; + rmatches = reallocarray(matches, size, sizeof(matches[0])); + if (rmatches == NULL) { + closedir(dir); + goto out; + } + matches = rmatches; + } + closedir(dir); + } +out: + free(free_path); + /* + * matches[0] is special: it's not a real matching file name but a common + * prefix for all matching names. It can't be null, unlike any other + * element of the array. When strings matches[0] and matches[1] compare + * equal and matches[2] is null that means to libedit that there is only + * a single match. It will then replace user input with possibly escaped + * string in matches[0] which is the reason to copy the full name of the + * only match. + */ + if (i == 0) { + free(matches); + return (NULL); + } else if (i == 1) { + matches[0] = strdup(matches[1]); + matches[2] = NULL; + if (matches[0] != NULL) + return (matches); + } else + matches[0] = strdup(text); + if (matches[0] == NULL) { + for (j = 1; j <= i; j++) + free(matches[j]); + free(matches); + return (NULL); + } + qsort_s(matches + 1, i, sizeof(matches[0]), comparator, + (void *)(intptr_t)curpos); + for (j = 1, k = 2; k <= i; k++) + if (strcmp(matches[j] + curpos, matches[k] + curpos) == 0) + free(matches[k]); + else + matches[++j] = matches[k]; + matches[j + 1] = NULL; + return (matches); +} + +/* + * This is passed to el_set(el, EL_ADDFN, ...) so that it's possible to + * bind a key (tab by default) to execute the function. + */ +unsigned char +sh_complete(EditLine *sel, int ch __unused) +{ + return (unsigned char)fn_complete2(sel, NULL, sh_matches, + L" \t\n\"\\'`@$><=;|&{(", NULL, NULL, (size_t)100, + NULL, &((int) {0}), NULL, NULL, FN_QUOTE_MATCH); +} diff --git a/bin/sh/myhistedit.h b/bin/sh/myhistedit.h index a4c0b56fafd7..968d23c9c1f8 100644 --- a/bin/sh/myhistedit.h +++ b/bin/sh/myhistedit.h @@ -38,6 +38,8 @@ extern History *hist; extern EditLine *el; extern int displayhist; +#include + void histedit(void); void sethistsize(const char *); void setterm(const char *); diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index 963063ef90fa..e549ac15c000 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -65,7 +65,7 @@ MLINKS= \ editline.3 tok_wreset.3 \ editline.3 tok_wstr.3 -INCS= histedit.h +INCS= histedit.h filecomplete.h SRCS+= common.h emacs.h fcns.h func.h help.h vi.h CLEANFILES+= common.h emacs.h fcns.h func.h help.h vi.h From owner-dev-commits-src-all@freebsd.org Mon Mar 29 09:59:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E77E85C31CB; Mon, 29 Mar 2021 09:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F87NC6CP9z3BmZ; Mon, 29 Mar 2021 09:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C800F11578; Mon, 29 Mar 2021 09:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12T9xdRL009394; Mon, 29 Mar 2021 09:59:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T9xdWL009393; Mon, 29 Mar 2021 09:59:39 GMT (envelope-from git) Date: Mon, 29 Mar 2021 09:59:39 GMT Message-Id: <202103290959.12T9xdWL009393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 21d0c01226eb - main - netmap: iflib: add nm_config callback MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 21d0c01226eb979556d6d792ec58eb54012fbc24 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 09:59:40 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=21d0c01226eb979556d6d792ec58eb54012fbc24 commit 21d0c01226eb979556d6d792ec58eb54012fbc24 Author: you@x AuthorDate: 2021-03-29 09:26:12 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-29 09:31:18 +0000 netmap: iflib: add nm_config callback This per-driver callback is invoked by netmap when it wants to align the number of TX/RX netmap rings and/or the number of TX/RX netmap slots to the actual state configured in the hardware. The alignment happens when netmap mode is switched on (with no active netmap file descriptors for that netmap port), or when collecting netmap port information. MFC after: 1 week --- sys/net/iflib.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 05e99ba318df..f6cf1233a3b5 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -829,6 +829,26 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) return (status); } +static int +iflib_netmap_config(struct netmap_adapter *na, struct nm_config_info *info) +{ + if_t ifp = na->ifp; + if_ctx_t ctx = ifp->if_softc; + iflib_rxq_t rxq = &ctx->ifc_rxqs[0]; + iflib_fl_t fl = &rxq->ifr_fl[0]; + + info->num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; + info->num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; + info->num_tx_descs = iflib_num_tx_descs(ctx); + info->num_rx_descs = iflib_num_rx_descs(ctx); + info->rx_buf_maxsize = fl->ifl_buf_size; + nm_prinf("txr %u rxr %u txd %u rxd %u rbufsz %u", + info->num_tx_rings, info->num_rx_rings, info->num_tx_descs, + info->num_rx_descs, info->rx_buf_maxsize); + + return 0; +} + static int netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) { @@ -1279,6 +1299,7 @@ iflib_netmap_attach(if_ctx_t ctx) na.nm_rxsync = iflib_netmap_rxsync; na.nm_register = iflib_netmap_register; na.nm_intr = iflib_netmap_intr; + na.nm_config = iflib_netmap_config; na.num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; na.num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; return (netmap_attach(&na)); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 10:19:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C48F65C3F01; Mon, 29 Mar 2021 10:19:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F87pX4P5zz3D5r; Mon, 29 Mar 2021 10:19:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8992011A40; Mon, 29 Mar 2021 10:19:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TAJ0W1037568; Mon, 29 Mar 2021 10:19:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TAJ0SS037567; Mon, 29 Mar 2021 10:19:00 GMT (envelope-from git) Date: Mon, 29 Mar 2021 10:19:00 GMT Message-Id: <202103291019.12TAJ0SS037567@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: a86be0da9a03 - stable/13 - Hyper-V: hn: Store host hash value in flowid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a86be0da9a03840bcf19499428e8868728c0082e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 10:19:00 -0000 The branch stable/13 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=a86be0da9a03840bcf19499428e8868728c0082e commit a86be0da9a03840bcf19499428e8868728c0082e Author: Wei Hu AuthorDate: 2021-02-24 05:07:46 +0000 Commit: Wei Hu CommitDate: 2021-03-29 10:18:20 +0000 Hyper-V: hn: Store host hash value in flowid When rx packet contains hash value sent from host, store it in the mbuf's flowid field so when the same mbuf is on the tx path, the hash value can be used by the host to determine the outgoing network queue. MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit 80f39bd95f22322152709ea5fae3a3c546044c9c) --- sys/dev/hyperv/netvsc/if_hn.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 5a57ea796d0e..9243ff226f5b 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -3077,13 +3077,24 @@ hn_encap(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd, if (txr->hn_tx_flags & HN_TX_FLAG_HASHVAL) { /* - * Set the hash value for this packet, so that the host could - * dispatch the TX done event for this packet back to this TX - * ring's channel. + * Set the hash value for this packet. */ pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL); - *pi_data = txr->hn_tx_idx; + + if (M_HASHTYPE_ISHASH(m_head)) + /* + * The flowid field contains the hash value host + * set in the rx queue if it is a ip forwarding pkt. + * Set the same hash value so host can send on the + * cpu it was received. + */ + *pi_data = m_head->m_pkthdr.flowid; + else + /* + * Otherwise just put the tx queue index. + */ + *pi_data = txr->hn_tx_idx; } if (m_head->m_flags & M_VLANTAG) { From owner-dev-commits-src-all@freebsd.org Mon Mar 29 10:20:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1688E5C3CD2; Mon, 29 Mar 2021 10:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F87rh090kz3D7M; Mon, 29 Mar 2021 10:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC8EC11758; Mon, 29 Mar 2021 10:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TAKpBB046106; Mon, 29 Mar 2021 10:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TAKpGs046105; Mon, 29 Mar 2021 10:20:51 GMT (envelope-from git) Date: Mon, 29 Mar 2021 10:20:51 GMT Message-Id: <202103291020.12TAKpGs046105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: cdc59163ff8e - stable/13 - Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cdc59163ff8e8f2a98ef8ca02773d1d2047e3aae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 10:20:52 -0000 The branch stable/13 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=cdc59163ff8e8f2a98ef8ca02773d1d2047e3aae commit cdc59163ff8e8f2a98ef8ca02773d1d2047e3aae Author: Wei Hu AuthorDate: 2021-03-12 04:35:16 +0000 Commit: Wei Hu CommitDate: 2021-03-29 10:20:03 +0000 Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver Receive Segment Coalescing (RSC) in the vSwitch is a feature available in Windows Server 2019 hosts and later. It reduces the per packet processing overhead by coalescing multiple TCP segments when possible. This happens mostly when TCP traffics are among different guests on same host. This patch adds netvsc driver support for this feature. The patch also updates NVS version to 6.1 as needed for RSC enablement. MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D29075 (cherry picked from commit a491581f3f8df07cdff0236bd556895205929af4) --- sys/dev/hyperv/netvsc/hn_nvs.c | 5 + sys/dev/hyperv/netvsc/hn_rndis.c | 25 ++++ sys/dev/hyperv/netvsc/if_hn.c | 258 ++++++++++++++++++++++++++++----------- sys/dev/hyperv/netvsc/if_hnreg.h | 14 +++ sys/dev/hyperv/netvsc/if_hnvar.h | 19 ++- sys/dev/hyperv/netvsc/ndis.h | 31 +++-- sys/net/rndis.h | 7 +- 7 files changed, 269 insertions(+), 90 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hn_nvs.c b/sys/dev/hyperv/netvsc/hn_nvs.c index 73a112c4e5e1..4dbc28996617 100644 --- a/sys/dev/hyperv/netvsc/hn_nvs.c +++ b/sys/dev/hyperv/netvsc/hn_nvs.c @@ -80,6 +80,8 @@ struct hn_nvs_sendctx hn_nvs_sendctx_none = HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL); static const uint32_t hn_nvs_version[] = { + HN_NVS_VERSION_61, + HN_NVS_VERSION_6, HN_NVS_VERSION_5, HN_NVS_VERSION_4, HN_NVS_VERSION_2, @@ -508,6 +510,9 @@ hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) conf.nvs_caps |= HN_NVS_NDIS_CONF_SRIOV; + if (sc->hn_nvs_ver >= HN_NVS_VERSION_61) + conf.nvs_caps |= HN_NVS_NDIS_CONF_RSC; + /* NOTE: No response. */ error = hn_nvs_req_send(sc, &conf, sizeof(conf)); diff --git a/sys/dev/hyperv/netvsc/hn_rndis.c b/sys/dev/hyperv/netvsc/hn_rndis.c index b9bf683fe811..794a82cf3957 100644 --- a/sys/dev/hyperv/netvsc/hn_rndis.c +++ b/sys/dev/hyperv/netvsc/hn_rndis.c @@ -723,6 +723,17 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_RX; } + /* RSC offload */ + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) { + if (hwcaps.ndis_rsc.ndis_ip4 && hwcaps.ndis_rsc.ndis_ip6) { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_ON; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_ON; + } else { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_OFF; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_OFF; + } + } + if (bootverbose) { if_printf(sc->hn_ifp, "offload csum: " "ip4 %u, tcp4 %u, udp4 %u, tcp6 %u, udp6 %u\n", @@ -734,6 +745,10 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) if_printf(sc->hn_ifp, "offload lsov2: ip4 %u, ip6 %u\n", params.ndis_lsov2_ip4, params.ndis_lsov2_ip6); + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) + if_printf(sc->hn_ifp, "offload rsc: ip4 %u, ip6 %u\n", + params.ndis_rsc_ip4, + params.ndis_rsc_ip6); } error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, ¶ms, paramsz); @@ -969,6 +984,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n", caps->ndis_hdr.ndis_size); return (EINVAL); + } else if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3 && + caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE) { + if_printf(sc->hn_ifp, "invalid NDIS rev3 objsize %u\n", + caps->ndis_hdr.ndis_size); + return (EINVAL); } if (bootverbose) { @@ -1001,6 +1021,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) caps->ndis_lsov2.ndis_ip6_minsg, caps->ndis_lsov2.ndis_ip6_encap, caps->ndis_lsov2.ndis_ip6_opts); + if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3) + if_printf(sc->hn_ifp, "hwcaps rsc: " + "ip4 %u ip6 %u\n", + caps->ndis_rsc.ndis_ip4, + caps->ndis_rsc.ndis_ip6); } return (0); } diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 9243ff226f5b..f4bdbb1ee788 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -223,11 +223,25 @@ struct hn_txdesc { #define HN_TXD_FLAG_DMAMAP 0x0002 #define HN_TXD_FLAG_ONAGG 0x0004 +#define HN_NDIS_PKTINFO_SUBALLOC 0x01 +#define HN_NDIS_PKTINFO_1ST_FRAG 0x02 +#define HN_NDIS_PKTINFO_LAST_FRAG 0x04 + +struct packet_info_id { + uint8_t ver; + uint8_t flag; + uint16_t pkt_id; +}; + +#define NDIS_PKTINFOID_SZ sizeof(struct packet_info_id) + + struct hn_rxinfo { - uint32_t vlan_info; - uint32_t csum_info; - uint32_t hash_info; - uint32_t hash_value; + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + const struct packet_info_id *pktinfo_id; }; struct hn_rxvf_setarg { @@ -239,15 +253,13 @@ struct hn_rxvf_setarg { #define HN_RXINFO_CSUM 0x0002 #define HN_RXINFO_HASHINF 0x0004 #define HN_RXINFO_HASHVAL 0x0008 +#define HN_RXINFO_PKTINFO_ID 0x0010 #define HN_RXINFO_ALL \ (HN_RXINFO_VLAN | \ HN_RXINFO_CSUM | \ HN_RXINFO_HASHINF | \ - HN_RXINFO_HASHVAL) - -#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff -#define HN_NDIS_RXCSUM_INFO_INVALID 0 -#define HN_NDIS_HASH_INFO_INVALID 0 + HN_RXINFO_HASHVAL | \ + HN_RXINFO_PKTINFO_ID) static int hn_probe(device_t); static int hn_attach(device_t); @@ -396,8 +408,7 @@ static int hn_rxfilter_config(struct hn_softc *); static int hn_rss_reconfig(struct hn_softc *); static void hn_rss_ind_fixup(struct hn_softc *); static void hn_rss_mbuf_hash(struct hn_softc *, uint32_t); -static int hn_rxpkt(struct hn_rx_ring *, const void *, - int, const struct hn_rxinfo *); +static int hn_rxpkt(struct hn_rx_ring *); static uint32_t hn_rss_type_fromndis(uint32_t); static uint32_t hn_rss_type_tondis(uint32_t); @@ -3353,9 +3364,10 @@ again: * allocated with cluster size MJUMPAGESIZE, and filled * accordingly. * - * Return 1 if able to complete the job; otherwise 0. + * Return the last mbuf in the chain or NULL if failed to + * allocate new mbuf. */ -static int +static struct mbuf * hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) { struct mbuf *m, *n; @@ -3383,7 +3395,7 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) */ n = m_getjcl(M_NOWAIT, m->m_type, 0, MJUMPAGESIZE); if (n == NULL) - break; + return NULL; n->m_len = min(MJUMPAGESIZE, remainder); bcopy(cp, mtod(n, caddr_t), n->m_len); cp += n->m_len; @@ -3391,10 +3403,8 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) m->m_next = n; m = n; } - if (m0->m_flags & M_PKTHDR) - m0->m_pkthdr.len += len - remainder; - return (remainder == 0); + return m; } #if defined(INET) || defined(INET6) @@ -3412,14 +3422,14 @@ hn_lro_rx(struct lro_ctrl *lc, struct mbuf *m) #endif static int -hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, - const struct hn_rxinfo *info) +hn_rxpkt(struct hn_rx_ring *rxr) { struct ifnet *ifp, *hn_ifp = rxr->hn_ifp; - struct mbuf *m_new; + struct mbuf *m_new, *n; int size, do_lro = 0, do_csum = 1, is_vf = 0; int hash_type = M_HASHTYPE_NONE; int l3proto = ETHERTYPE_MAX, l4proto = IPPROTO_DONE; + int i; ifp = hn_ifp; if (rxr->hn_rxvf_ifp != NULL) { @@ -3446,20 +3456,20 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - if (__predict_false(dlen < ETHER_HDR_LEN)) { + if (__predict_false(rxr->rsc.pktlen < ETHER_HDR_LEN)) { if_inc_counter(hn_ifp, IFCOUNTER_IERRORS, 1); return (0); } - if (dlen <= MHLEN) { + if (rxr->rsc.cnt == 1 && rxr->rsc.pktlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); return (0); } - memcpy(mtod(m_new, void *), data, dlen); - m_new->m_pkthdr.len = m_new->m_len = dlen; - rxr->hn_small_pkts++; + memcpy(mtod(m_new, void *), rxr->rsc.frag_data[0], + rxr->rsc.frag_len[0]); + m_new->m_pkthdr.len = m_new->m_len = rxr->rsc.frag_len[0]; } else { /* * Get an mbuf with a cluster. For packets 2K or less, @@ -3468,7 +3478,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * if looped around to the Hyper-V TX channel, so avoid them. */ size = MCLBYTES; - if (dlen > MCLBYTES) { + if (rxr->rsc.pktlen > MCLBYTES) { /* 4096 */ size = MJUMPAGESIZE; } @@ -3479,29 +3489,42 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - hv_m_append(m_new, dlen, data); + n = m_new; + for (i = 0; i < rxr->rsc.cnt; i++) { + n = hv_m_append(n, rxr->rsc.frag_len[i], + rxr->rsc.frag_data[i]); + if (n == NULL) { + if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); + return (0); + } else { + m_new->m_pkthdr.len += rxr->rsc.frag_len[i]; + } + } } + if (rxr->rsc.pktlen <= MHLEN) + rxr->hn_small_pkts++; + m_new->m_pkthdr.rcvif = ifp; if (__predict_false((hn_ifp->if_capenable & IFCAP_RXCSUM) == 0)) do_csum = 0; /* receive side checksum offload */ - if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) { + if (rxr->rsc.csum_info != NULL) { /* IP csum offload */ - if ((info->csum_info & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { + if ((*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID); rxr->hn_csum_ip++; } /* TCP/UDP csum offload */ - if ((info->csum_info & (NDIS_RXCSUM_INFO_UDPCS_OK | + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_UDPCS_OK | NDIS_RXCSUM_INFO_TCPCS_OK)) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); m_new->m_pkthdr.csum_data = 0xffff; - if (info->csum_info & NDIS_RXCSUM_INFO_TCPCS_OK) + if (*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_TCPCS_OK) rxr->hn_csum_tcp++; else rxr->hn_csum_udp++; @@ -3514,7 +3537,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * the do_lro setting here is actually _not_ accurate. We * depend on the RSS hash type check to reset do_lro. */ - if ((info->csum_info & + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) == (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) do_lro = 1; @@ -3551,11 +3574,11 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, } } - if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) { + if (rxr->rsc.vlan_info != NULL) { m_new->m_pkthdr.ether_vtag = EVL_MAKETAG( - NDIS_VLAN_INFO_ID(info->vlan_info), - NDIS_VLAN_INFO_PRI(info->vlan_info), - NDIS_VLAN_INFO_CFI(info->vlan_info)); + NDIS_VLAN_INFO_ID(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_PRI(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_CFI(*(rxr->rsc.vlan_info))); m_new->m_flags |= M_VLANTAG; } @@ -3581,14 +3604,14 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * matter here), do _not_ mess with unsupported hash types or * functions. */ - if (info->hash_info != HN_NDIS_HASH_INFO_INVALID) { + if (rxr->rsc.hash_info != NULL) { rxr->hn_rss_pkts++; - m_new->m_pkthdr.flowid = info->hash_value; + m_new->m_pkthdr.flowid = *(rxr->rsc.hash_value); if (!is_vf) hash_type = M_HASHTYPE_OPAQUE_HASH; - if ((info->hash_info & NDIS_HASH_FUNCTION_MASK) == + if ((*(rxr->rsc.hash_info) & NDIS_HASH_FUNCTION_MASK) == NDIS_HASH_FUNCTION_TOEPLITZ) { - uint32_t type = (info->hash_info & NDIS_HASH_TYPE_MASK & + uint32_t type = (*(rxr->rsc.hash_info) & NDIS_HASH_TYPE_MASK & rxr->hn_mbuf_hash); /* @@ -5033,6 +5056,16 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt) OID_AUTO, "rss_pkts", CTLFLAG_RW, &rxr->hn_rss_pkts, "# of packets w/ RSS info received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_pkts", CTLFLAG_RW, + &rxr->hn_rsc_pkts, + "# of RSC packets received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_drop", CTLFLAG_RW, + &rxr->hn_rsc_drop, + "# of RSC fragments dropped"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), OID_AUTO, "pktbuf_len", CTLFLAG_RD, @@ -7057,37 +7090,56 @@ hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_rxinfo *info) dlen = pi->rm_size - pi->rm_pktinfooffset; data = pi->rm_data; - switch (pi->rm_type) { - case NDIS_PKTINFO_TYPE_VLAN: - if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) - return (EINVAL); - info->vlan_info = *((const uint32_t *)data); - mask |= HN_RXINFO_VLAN; - break; + if (pi->rm_internal == 1) { + switch (pi->rm_type) { + case NDIS_PKTINFO_IT_PKTINFO_ID: + if (__predict_false(dlen < NDIS_PKTINFOID_SZ)) + return (EINVAL); + info->pktinfo_id = + (const struct packet_info_id *)data; + mask |= HN_RXINFO_PKTINFO_ID; + break; - case NDIS_PKTINFO_TYPE_CSUM: - if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) - return (EINVAL); - info->csum_info = *((const uint32_t *)data); - mask |= HN_RXINFO_CSUM; - break; + default: + goto next; + } + } else { + switch (pi->rm_type) { + case NDIS_PKTINFO_TYPE_VLAN: + if (__predict_false(dlen + < NDIS_VLAN_INFO_SIZE)) + return (EINVAL); + info->vlan_info = (const uint32_t *)data; + mask |= HN_RXINFO_VLAN; + break; - case HN_NDIS_PKTINFO_TYPE_HASHVAL: - if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) - return (EINVAL); - info->hash_value = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHVAL; - break; + case NDIS_PKTINFO_TYPE_CSUM: + if (__predict_false(dlen + < NDIS_RXCSUM_INFO_SIZE)) + return (EINVAL); + info->csum_info = (const uint32_t *)data; + mask |= HN_RXINFO_CSUM; + break; - case HN_NDIS_PKTINFO_TYPE_HASHINF: - if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) - return (EINVAL); - info->hash_info = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHINF; - break; + case HN_NDIS_PKTINFO_TYPE_HASHVAL: + if (__predict_false(dlen + < HN_NDIS_HASH_VALUE_SIZE)) + return (EINVAL); + info->hash_value = (const uint32_t *)data; + mask |= HN_RXINFO_HASHVAL; + break; - default: - goto next; + case HN_NDIS_PKTINFO_TYPE_HASHINF: + if (__predict_false(dlen + < HN_NDIS_HASH_INFO_SIZE)) + return (EINVAL); + info->hash_info = (const uint32_t *)data; + mask |= HN_RXINFO_HASHINF; + break; + + default: + goto next; + } } if (mask == HN_RXINFO_ALL) { @@ -7104,7 +7156,7 @@ next: * - If there is no hash value, invalidate the hash info. */ if ((mask & HN_RXINFO_HASHVAL) == 0) - info->hash_info = HN_NDIS_HASH_INFO_INVALID; + info->hash_info = NULL; return (0); } @@ -7122,12 +7174,34 @@ hn_rndis_check_overlap(int off, int len, int check_off, int check_len) return (true); } +static __inline void +hn_rsc_add_data(struct hn_rx_ring *rxr, const void *data, + uint32_t len, struct hn_rxinfo *info) +{ + uint32_t cnt = rxr->rsc.cnt; + + if (cnt) { + rxr->rsc.pktlen += len; + } else { + rxr->rsc.vlan_info = info->vlan_info; + rxr->rsc.csum_info = info->csum_info; + rxr->rsc.hash_info = info->hash_info; + rxr->rsc.hash_value = info->hash_value; + rxr->rsc.pktlen = len; + } + + rxr->rsc.frag_data[cnt] = data; + rxr->rsc.frag_len[cnt] = len; + rxr->rsc.cnt++; +} + static void hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) { const struct rndis_packet_msg *pkt; struct hn_rxinfo info; int data_off, pktinfo_off, data_len, pktinfo_len; + bool rsc_more= false; /* * Check length. @@ -7235,9 +7309,11 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) /* * Check per-packet-info coverage and find useful per-packet-info. */ - info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; - info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; - info.hash_info = HN_NDIS_HASH_INFO_INVALID; + info.vlan_info = NULL; + info.csum_info = NULL; + info.hash_info = NULL; + info.pktinfo_id = NULL; + if (__predict_true(pktinfo_len != 0)) { bool overlap; int error; @@ -7281,7 +7357,43 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) pkt->rm_len, data_off, data_len); return; } - hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); + + /* Identify RSC fragments, drop invalid packets */ + if ((info.pktinfo_id != NULL) && + (info.pktinfo_id->flag & HN_NDIS_PKTINFO_SUBALLOC)) { + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_1ST_FRAG) { + rxr->rsc.cnt = 0; + rxr->hn_rsc_pkts++; + } else if (rxr->rsc.cnt == 0) + goto drop; + + rsc_more = true; + + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_LAST_FRAG) + rsc_more = false; + + if (rsc_more && rxr->rsc.is_last) + goto drop; + } else { + rxr->rsc.cnt = 0; + } + + if (__predict_false(rxr->rsc.cnt >= HN_NVS_RSC_MAX)) + goto drop; + + /* Store data in per rx ring structure */ + hn_rsc_add_data(rxr,((const uint8_t *)pkt) + data_off, + data_len, &info); + + if (rsc_more) + return; + + hn_rxpkt(rxr); + rxr->rsc.cnt = 0; + return; +drop: + rxr->hn_rsc_drop++; + return; } static __inline void @@ -7394,6 +7506,8 @@ hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, "ofs %d, len %d\n", i, ofs, len); continue; } + + rxr->rsc.is_last = (i == (count - 1)); hn_rndis_rxpkt(rxr, rxr->hn_rxbuf + ofs, len); } diff --git a/sys/dev/hyperv/netvsc/if_hnreg.h b/sys/dev/hyperv/netvsc/if_hnreg.h index 154d69264679..54db556cc56d 100644 --- a/sys/dev/hyperv/netvsc/if_hnreg.h +++ b/sys/dev/hyperv/netvsc/if_hnreg.h @@ -48,6 +48,8 @@ #define HN_NVS_VERSION_2 0x30002 #define HN_NVS_VERSION_4 0x40000 #define HN_NVS_VERSION_5 0x50000 +#define HN_NVS_VERSION_6 0x60000 +#define HN_NVS_VERSION_61 0x60001 #define HN_NVS_RXBUF_SIG 0xcafe #define HN_NVS_CHIM_SIG 0xface @@ -101,6 +103,7 @@ struct hn_nvs_init { uint32_t nvs_ver_min; uint32_t nvs_ver_max; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_init) >= HN_NVS_REQSIZE_MIN); @@ -118,11 +121,13 @@ struct hn_nvs_ndis_conf { uint32_t nvs_rsvd; uint64_t nvs_caps; /* HN_NVS_NDIS_CONF_ */ uint8_t nvs_rsvd1[12]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_conf) >= HN_NVS_REQSIZE_MIN); #define HN_NVS_NDIS_CONF_SRIOV 0x0004 #define HN_NVS_NDIS_CONF_VLAN 0x0008 +#define HN_NVS_NDIS_CONF_RSC 0x0080 /* No response */ struct hn_nvs_ndis_init { @@ -130,6 +135,7 @@ struct hn_nvs_ndis_init { uint32_t nvs_ndis_major; /* NDIS_VERSION_MAJOR_ */ uint32_t nvs_ndis_minor; /* NDIS_VERSION_MINOR_ */ uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_init) >= HN_NVS_REQSIZE_MIN); @@ -141,6 +147,7 @@ struct hn_nvs_datapath { uint32_t nvs_type; /* HN_NVS_TYPE_SET_DATAPATH */ uint32_t nvs_active_path;/* HN_NVS_DATAPATH_* */ uint32_t nvs_rsvd[6]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_datapath) >= HN_NVS_REQSIZE_MIN); @@ -149,6 +156,7 @@ struct hn_nvs_rxbuf_conn { uint32_t nvs_gpadl; /* RXBUF vmbus GPADL */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_conn) >= HN_NVS_REQSIZE_MIN); @@ -171,6 +179,7 @@ struct hn_nvs_rxbuf_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_RXBUF_DISCONN */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_disconn) >= HN_NVS_REQSIZE_MIN); @@ -179,6 +188,7 @@ struct hn_nvs_chim_conn { uint32_t nvs_gpadl; /* chimney buf vmbus GPADL */ uint16_t nvs_sig; /* NDIS_NVS_CHIM_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_conn) >= HN_NVS_REQSIZE_MIN); @@ -193,6 +203,7 @@ struct hn_nvs_chim_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_CHIM_DISCONN */ uint16_t nvs_sig; /* HN_NVS_CHIM_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_disconn) >= HN_NVS_REQSIZE_MIN); @@ -203,6 +214,7 @@ struct hn_nvs_subch_req { uint32_t nvs_op; /* HN_NVS_SUBCH_OP_ */ uint32_t nvs_nsubch; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_subch_req) >= HN_NVS_REQSIZE_MIN); @@ -226,6 +238,7 @@ struct hn_nvs_rndis { uint32_t nvs_chim_idx; uint32_t nvs_chim_sz; uint8_t nvs_rsvd[16]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis) >= HN_NVS_REQSIZE_MIN); @@ -233,6 +246,7 @@ struct hn_nvs_rndis_ack { uint32_t nvs_type; /* HN_NVS_TYPE_RNDIS_ACK */ uint32_t nvs_status; /* HN_NVS_STATUS_ */ uint8_t nvs_rsvd[24]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis_ack) >= HN_NVS_REQSIZE_MIN); diff --git a/sys/dev/hyperv/netvsc/if_hnvar.h b/sys/dev/hyperv/netvsc/if_hnvar.h index c0e17c9643e0..27d93db5395e 100644 --- a/sys/dev/hyperv/netvsc/if_hnvar.h +++ b/sys/dev/hyperv/netvsc/if_hnvar.h @@ -33,7 +33,7 @@ #define HN_CHIM_SIZE (15 * 1024 * 1024) -#define HN_RXBUF_SIZE (16 * 1024 * 1024) +#define HN_RXBUF_SIZE (31 * 1024 * 1024) #define HN_RXBUF_SIZE_COMPAT (15 * 1024 * 1024) #define HN_MTU_MAX (65535 - ETHER_ADDR_LEN) @@ -56,6 +56,20 @@ struct buf_ring; #endif struct hn_tx_ring; +#define HN_NVS_RSC_MAX 562 /* Max RSC frags in one vmbus packet */ + +struct hn_rx_rsc { + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + uint32_t cnt; /* fragment count */ + uint32_t pktlen; /* full packet length */ + uint8_t is_last; /* last fragment */ + const void *frag_data[HN_NVS_RSC_MAX]; + uint32_t frag_len[HN_NVS_RSC_MAX]; +}; + struct hn_rx_ring { struct ifnet *hn_ifp; struct ifnet *hn_rxvf_ifp; /* SR-IOV VF for RX */ @@ -66,6 +80,7 @@ struct hn_rx_ring { uint32_t hn_mbuf_hash; /* NDIS_HASH_ */ uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ int hn_rx_idx; + struct hn_rx_rsc rsc; /* Trust csum verification on host side */ int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ @@ -80,6 +95,8 @@ struct hn_rx_ring { u_long hn_pkts; u_long hn_rss_pkts; u_long hn_ack_failed; + u_long hn_rsc_pkts; + u_long hn_rsc_drop; /* Rarely used stuffs */ struct sysctl_oid *hn_rx_sysctl_tree; diff --git a/sys/dev/hyperv/netvsc/ndis.h b/sys/dev/hyperv/netvsc/ndis.h index 32b6aa307452..c69da7807a63 100644 --- a/sys/dev/hyperv/netvsc/ndis.h +++ b/sys/dev/hyperv/netvsc/ndis.h @@ -115,8 +115,8 @@ struct ndis_offload_params { /* NDIS >= 6.30 */ uint8_t ndis_rsc_ip4; /* NDIS_OFFLOAD_RSC_ */ uint8_t ndis_rsc_ip6; /* NDIS_OFFLOAD_RSC_ */ - uint32_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ - uint32_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ + uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ + uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ }; #define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) @@ -305,17 +305,17 @@ struct ndis_lsov2_offload { struct ndis_ipsecv2_offload { uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ - uint16_t ndis_ip6; - uint16_t ndis_ip4opt; - uint16_t ndis_ip6ext; - uint16_t ndis_ah; - uint16_t ndis_esp; - uint16_t ndis_ah_esp; - uint16_t ndis_xport; - uint16_t ndis_tun; - uint16_t ndis_xport_tun; - uint16_t ndis_lso; - uint16_t ndis_extseq; + uint8_t ndis_ip6; + uint8_t ndis_ip4opt; + uint8_t ndis_ip6ext; + uint8_t ndis_ah; + uint8_t ndis_esp; + uint8_t ndis_ah_esp; + uint8_t ndis_xport; + uint8_t ndis_tun; + uint8_t ndis_xport_tun; + uint8_t ndis_lso; + uint8_t ndis_extseq; uint32_t ndis_udp_esp; uint32_t ndis_auth; uint32_t ndis_crypto; @@ -323,8 +323,8 @@ struct ndis_ipsecv2_offload { }; struct ndis_rsc_offload { - uint16_t ndis_ip4; - uint16_t ndis_ip6; + uint8_t ndis_ip4; + uint8_t ndis_ip6; }; struct ndis_encap_offload { @@ -419,5 +419,4 @@ struct ndis_offload { #define NDIS_TXCSUM_INFO_MKUDPCS(thoff) \ NDIS_TXCSUM_INFO_MKL4CS((thoff), NDIS_TXCSUM_INFO_UDPCS) - #endif /* !_NET_NDIS_H_ */ diff --git a/sys/net/rndis.h b/sys/net/rndis.h index 5d45469a4b52..56350dbb7824 100644 --- a/sys/net/rndis.h +++ b/sys/net/rndis.h @@ -142,7 +142,8 @@ struct rndis_packet_msg { /* Per-packet-info for RNDIS data message */ struct rndis_pktinfo { uint32_t rm_size; - uint32_t rm_type; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_type:31; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_internal:1; /* Indicate if internal type */ uint32_t rm_pktinfooffset; uint8_t rm_data[]; }; @@ -165,6 +166,10 @@ struct rndis_pktinfo { #define NDIS_PKTINFO_TYPE_CACHE_NBLIST 10 #define NDIS_PKTINFO_TYPE_PKT_PAD 11 +/* Per-packet-info internal type */ +#define NDIS_PKTINFO_IT_PKTINFO_ID 1 +/* Add more internal type here */ + /* * RNDIS control messages */ From owner-dev-commits-src-all@freebsd.org Mon Mar 29 10:22:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67E055C4106; Mon, 29 Mar 2021 10:22:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F87tL2T8Hz3DdK; Mon, 29 Mar 2021 10:22:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47C2211BA4; Mon, 29 Mar 2021 10:22:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TAMIaK050253; Mon, 29 Mar 2021 10:22:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TAMIrF050252; Mon, 29 Mar 2021 10:22:18 GMT (envelope-from git) Date: Mon, 29 Mar 2021 10:22:18 GMT Message-Id: <202103291022.12TAMIrF050252@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 2fbdbfaa0c44 - stable/13 - Hyper-V: hn: Initialize the internal field of per packet info on tx path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2fbdbfaa0c4407547060f8a0ca4d0d04bbf09f9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 10:22:18 -0000 The branch stable/13 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=2fbdbfaa0c4407547060f8a0ca4d0d04bbf09f9e commit 2fbdbfaa0c4407547060f8a0ca4d0d04bbf09f9e Author: Wei Hu AuthorDate: 2021-03-15 10:20:52 +0000 Commit: Wei Hu CommitDate: 2021-03-29 10:21:30 +0000 Hyper-V: hn: Initialize the internal field of per packet info on tx path The RSC support feature introduced a bit field "rm_internal" in struct rndis_pktinfo with total size unchanged. The guest does not use this field in the tx path. However we need to initialize it to zero in case older hosts which are not aware of this field. Fixes: a491581f ("Hyper-V: hn: Enable vSwitch RSC support") MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit 805dbff6c36a6cd84491aa53a02315fa025734cc) --- sys/dev/hyperv/netvsc/if_hn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index f4bdbb1ee788..cd0b5a5fa8b9 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -2932,6 +2932,7 @@ hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, pi->rm_size = pi_size; pi->rm_type = pi_type; + pi->rm_internal = 0; pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; return (pi->rm_data); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 14:39:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23956579416; Mon, 29 Mar 2021 14:39:12 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8FZl4Qc3z3jr4; Mon, 29 Mar 2021 14:39:10 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1617028746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K4YVBx+iMljHtlQzZFmlh3BrxTg6NznNegHFcmfO9ZM=; b=CTI+1Fpo6xLeS4Z27N3YRLT5QKoHW9xtwl0fdmfULy3cqLt4cPxxNNHs/IFjyg4ceXilFx r9zQ8h34fnW6+PcehbzNF0WDwg6/fX3t+kcoYuVC8Gvp4q1g68Bo6dEGTJE33bXIA3uyQP i0jZ/fuVfYVdW10IWfWDqUUncEhQY2g= Received: from skull.home.blih.net (lfbn-idf2-1-644-4.w86-247.abo.wanadoo.fr [86.247.100.4]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 7026ca56 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 29 Mar 2021 14:39:06 +0000 (UTC) Date: Mon, 29 Mar 2021 16:39:02 +0200 From: Emmanuel Vadot To: Vincenzo Maffione Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 21d0c01226eb - main - netmap: iflib: add nm_config callback Message-Id: <20210329163902.276b6025663539b2c181af0c@bidouilliste.com> In-Reply-To: <202103290959.12T9xdWL009393@gitrepo.freebsd.org> References: <202103290959.12T9xdWL009393@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4F8FZl4Qc3z3jr4 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 14:39:12 -0000 Hi Vincenzo, On Mon, 29 Mar 2021 09:59:39 GMT Vincenzo Maffione wrote: > The branch main has been updated by vmaffione: > > URL: https://cgit.FreeBSD.org/src/commit/?id=21d0c01226eb979556d6d792ec58eb54012fbc24 > > commit 21d0c01226eb979556d6d792ec58eb54012fbc24 > Author: you@x I don't think that you've setup your env correctly. > AuthorDate: 2021-03-29 09:26:12 +0000 > Commit: Vincenzo Maffione > CommitDate: 2021-03-29 09:31:18 +0000 > > netmap: iflib: add nm_config callback > > This per-driver callback is invoked by netmap when it wants > to align the number of TX/RX netmap rings and/or the number of > TX/RX netmap slots to the actual state configured in the hardware. > The alignment happens when netmap mode is switched on (with no > active netmap file descriptors for that netmap port), or when > collecting netmap port information. > > MFC after: 1 week > --- > sys/net/iflib.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/sys/net/iflib.c b/sys/net/iflib.c > index 05e99ba318df..f6cf1233a3b5 100644 > --- a/sys/net/iflib.c > +++ b/sys/net/iflib.c > @@ -829,6 +829,26 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) > return (status); > } > > +static int > +iflib_netmap_config(struct netmap_adapter *na, struct nm_config_info *info) > +{ > + if_t ifp = na->ifp; > + if_ctx_t ctx = ifp->if_softc; > + iflib_rxq_t rxq = &ctx->ifc_rxqs[0]; > + iflib_fl_t fl = &rxq->ifr_fl[0]; > + > + info->num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; > + info->num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; > + info->num_tx_descs = iflib_num_tx_descs(ctx); > + info->num_rx_descs = iflib_num_rx_descs(ctx); > + info->rx_buf_maxsize = fl->ifl_buf_size; > + nm_prinf("txr %u rxr %u txd %u rxd %u rbufsz %u", > + info->num_tx_rings, info->num_rx_rings, info->num_tx_descs, > + info->num_rx_descs, info->rx_buf_maxsize); > + > + return 0; > +} > + > static int > netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) > { > @@ -1279,6 +1299,7 @@ iflib_netmap_attach(if_ctx_t ctx) > na.nm_rxsync = iflib_netmap_rxsync; > na.nm_register = iflib_netmap_register; > na.nm_intr = iflib_netmap_intr; > + na.nm_config = iflib_netmap_config; > na.num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; > na.num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; > return (netmap_attach(&na)); -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Mon Mar 29 15:02:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 075CB57A189; Mon, 29 Mar 2021 15:02:00 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8G536Zqmz3lh1; Mon, 29 Mar 2021 15:01:59 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f44.google.com with SMTP id k25so13071999iob.6; Mon, 29 Mar 2021 08:01:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Qscp73gjenMvQ9uirpCcGvOVSIkklhxH5GoJ3cqqM/Y=; b=HvpY8z3m9w6B+UdS7s/PDw41sWOkdunabDgSgxAsFYaofauchcUg37VnXhv4kv665A GW2ruP2EssvMGYz7ynXVDajCxhoelrSqsgQsv1d8L+nS7pROTSWL0gCO7JEblI3oxkOc Cn+XFYIFhKNscPNO5KLRPSEChITQoUOmsD7fnI3oSkK/F9rgYPcXStlbXB7cXBl//kp7 nNcb8hURGEc8GbJoIbKWdwUQfVHt3fQdWX91qT+JE3QOETxI7r6EFfsTuNn4P3xOFUtq dwaxss5WTfGdpNoiuPKtix6nQmRoxjGQGt4kbUs6Ie50vdinUS3XpFbu2J/eh26VWkfG f9JQ== X-Gm-Message-State: AOAM532telvHRLcMVPt5tuOR1fF7bSURlJD00e7aTXvJJ4zU8Nhx4AD1 N/cmopzIZ6dFVr/WPaZ0Ln/dNhK4tFtFPZLuXQA= X-Google-Smtp-Source: ABdhPJzolyKDWKIPZwJ0LIP6iG0CyAEgRsOmzQoV7yvXD7tFK+5+DTBNDui3Vdh9tboD/tWizayFT5ZnwGls2+vqfik= X-Received: by 2002:a5d:8d12:: with SMTP id p18mr20984907ioj.31.1617030112285; Mon, 29 Mar 2021 08:01:52 -0700 (PDT) MIME-Version: 1.0 References: <202103290959.12T9xdWL009393@gitrepo.freebsd.org> <20210329163902.276b6025663539b2c181af0c@bidouilliste.com> In-Reply-To: <20210329163902.276b6025663539b2c181af0c@bidouilliste.com> From: Ed Maste Date: Mon, 29 Mar 2021 11:01:36 -0400 Message-ID: Subject: Re: git: 21d0c01226eb - main - netmap: iflib: add nm_config callback To: Emmanuel Vadot Cc: Vincenzo Maffione , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4F8G536Zqmz3lh1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:02:00 -0000 On Mon, 29 Mar 2021 at 10:39, Emmanuel Vadot wrote: > > Hi Vincenzo, > > On Mon, 29 Mar 2021 09:59:39 GMT > Vincenzo Maffione wrote: > > > The branch main has been updated by vmaffione: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=21d0c01226eb979556d6d792ec58eb54012fbc24 > > > > commit 21d0c01226eb979556d6d792ec58eb54012fbc24 > > Author: you@x > > I don't think that you've setup your env correctly. I'd suggest everyone check `git log freebs/main..` before pushing. Check that the expected commit(s) are included, and that commit metadata is correct. We will have a commit hook that will require a confirmation to push commits with other than @FreeBSD.org as the Author, but it's not installed yet on the production repo. From owner-dev-commits-src-all@freebsd.org Mon Mar 29 15:05:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA3E257A0E4; Mon, 29 Mar 2021 15:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8G9b4Rt5z3mJX; Mon, 29 Mar 2021 15:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AEE015744; Mon, 29 Mar 2021 15:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TF5tLj043974; Mon, 29 Mar 2021 15:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TF5tg7043973; Mon, 29 Mar 2021 15:05:55 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:05:55 GMT Message-Id: <202103291505.12TF5tg7043973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 763107f26c3c - main - Introduce kdb-level watchpoint functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 763107f26c3c3f4c8bb314a7cabc0a5548abff03 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:05:55 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=763107f26c3c3f4c8bb314a7cabc0a5548abff03 commit 763107f26c3c3f4c8bb314a7cabc0a5548abff03 Author: Mitchell Horne AuthorDate: 2021-03-08 15:23:40 +0000 Commit: Mitchell Horne CommitDate: 2021-03-29 15:05:43 +0000 Introduce kdb-level watchpoint functions This basically mirrors what already exists in ddb, but provides a slightly improved interface. It allows the caller to specify the watchpoint access type, and returns more specific error codes to differentiate failure cases. This will be used to support hardware watchpoints in gdb(4). Stubs are provided for architectures lacking hardware watchpoint logic (mips, powerpc, riscv), while other architectures are added individually in follow-up commits. Reviewed by: jhb, kib, markj MFC after: 3 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D29155 --- sys/mips/include/kdb.h | 15 +++++++++++++++ sys/powerpc/include/kdb.h | 14 ++++++++++++++ sys/riscv/include/kdb.h | 14 ++++++++++++++ sys/sys/kdb.h | 6 ++++++ 4 files changed, 49 insertions(+) diff --git a/sys/mips/include/kdb.h b/sys/mips/include/kdb.h index 33e54bc5fc05..64e39e154f21 100644 --- a/sys/mips/include/kdb.h +++ b/sys/mips/include/kdb.h @@ -55,4 +55,19 @@ static __inline void kdb_cpu_sync_icache(unsigned char *addr, size_t size) { } + +static __inline int +kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access) +{ + + return (ENXIO); +} + +static __inline int +kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size) +{ + + return (0); +} + #endif /* _MACHINE_KDB_H_ */ diff --git a/sys/powerpc/include/kdb.h b/sys/powerpc/include/kdb.h index 74f3e390b423..78e4966eaaf0 100644 --- a/sys/powerpc/include/kdb.h +++ b/sys/powerpc/include/kdb.h @@ -54,4 +54,18 @@ kdb_cpu_trap(int vector, int _) { } +static __inline int +kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access) +{ + + return (ENXIO); +} + +static __inline int +kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size) +{ + + return (0); +} + #endif /* _MACHINE_KDB_H_ */ diff --git a/sys/riscv/include/kdb.h b/sys/riscv/include/kdb.h index 312cac502824..0fdff26bb432 100644 --- a/sys/riscv/include/kdb.h +++ b/sys/riscv/include/kdb.h @@ -59,4 +59,18 @@ kdb_cpu_trap(int type, int code) { } +static __inline int +kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access) +{ + + return (ENXIO); +} + +static __inline int +kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size) +{ + + return (0); +} + #endif /* _MACHINE_KDB_H_ */ diff --git a/sys/sys/kdb.h b/sys/sys/kdb.h index 72eb51d57aee..746abb0ee4f4 100644 --- a/sys/sys/kdb.h +++ b/sys/sys/kdb.h @@ -127,4 +127,10 @@ extern const char * volatile kdb_why; #define KDB_REQ_PANIC 2 /* User requested a panic */ #define KDB_REQ_REBOOT 3 /* User requested a clean reboot */ +/* Debug breakpoint/watchpoint access types */ +#define KDB_DBG_ACCESS_EXEC 0 +#define KDB_DBG_ACCESS_R 1 +#define KDB_DBG_ACCESS_W 2 +#define KDB_DBG_ACCESS_RW 3 + #endif /* !_SYS_KDB_H_ */ From owner-dev-commits-src-all@freebsd.org Mon Mar 29 15:06:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 970C557A0EC; Mon, 29 Mar 2021 15:06:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8G9s3wdTz3mVc; Mon, 29 Mar 2021 15:06:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77A70154EB; Mon, 29 Mar 2021 15:06:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TF69nW044110; Mon, 29 Mar 2021 15:06:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TF695U044109; Mon, 29 Mar 2021 15:06:09 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:06:09 GMT Message-Id: <202103291506.12TF695U044109@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 15dc1d44528a - main - x86: implement kdb watchpoint functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15dc1d44528a1e2693df41d5452d6ebb42ecafeb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:06:09 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=15dc1d44528a1e2693df41d5452d6ebb42ecafeb commit 15dc1d44528a1e2693df41d5452d6ebb42ecafeb Author: Mitchell Horne AuthorDate: 2021-02-19 22:36:08 +0000 Commit: Mitchell Horne CommitDate: 2021-03-29 15:05:43 +0000 x86: implement kdb watchpoint functions Add wrappers around the dbreg interface that can be consumed by MI kernel debugger code. The dbreg functions themselves are updated to return error codes, not just -1. dbreg_set_watchpoint() is extended to accept access bits as an argument. Reviewed by: jhb, kib, markj MFC after: 3 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D29155 --- sys/amd64/amd64/db_trace.c | 3 ++- sys/amd64/include/kdb.h | 3 +++ sys/i386/include/kdb.h | 3 +++ sys/x86/include/x86_var.h | 2 +- sys/x86/x86/dbreg.c | 41 ++++++++++++++++++++++++++++++++++++++--- 5 files changed, 47 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index 5c1cd41cda15..beeb5cd6e9f3 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -389,7 +389,8 @@ int db_md_set_watchpoint(db_expr_t addr, db_expr_t size) { - return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size)); + return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size, + DBREG_DR7_WRONLY)); } int diff --git a/sys/amd64/include/kdb.h b/sys/amd64/include/kdb.h index 2fb158622eb4..03cb2205066f 100644 --- a/sys/amd64/include/kdb.h +++ b/sys/amd64/include/kdb.h @@ -36,6 +36,9 @@ #define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid] +int kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access); +int kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size); + static __inline void kdb_cpu_clear_singlestep(void) { diff --git a/sys/i386/include/kdb.h b/sys/i386/include/kdb.h index beb2bd0e4132..29a23fde0aad 100644 --- a/sys/i386/include/kdb.h +++ b/sys/i386/include/kdb.h @@ -36,6 +36,9 @@ #define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid] +int kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access); +int kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size); + static __inline void kdb_cpu_clear_singlestep(void) { diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index d60b4b2acbd8..3e5aa847304e 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -120,7 +120,7 @@ vm_paddr_t cpu_getmaxphyaddr(void); bool cpu_mwait_usable(void); void cpu_probe_amdc1e(void); void cpu_setregs(void); -int dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size); +int dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size, int access); int dbreg_clr_watchpoint(vm_offset_t addr, vm_size_t size); void dbreg_list_watchpoints(void); bool disable_wp(void); diff --git a/sys/x86/x86/dbreg.c b/sys/x86/x86/dbreg.c index 0d28ef8dba38..ef30cc2d614e 100644 --- a/sys/x86/x86/dbreg.c +++ b/sys/x86/x86/dbreg.c @@ -27,11 +27,13 @@ #include "opt_ddb.h" #include +#include #include #include #include #include +#include #include #include @@ -127,7 +129,7 @@ dbreg_sync(struct dbreg *dp) } int -dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size) +dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size, int access) { struct dbreg *d; int avail, i, wsize; @@ -140,6 +142,11 @@ dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size) d = &d_temp; #endif + /* Validate the access type */ + if (access != DBREG_DR7_EXEC && access != DBREG_DR7_WRONLY && + access != DBREG_DR7_RDWR) + return (EINVAL); + fill_dbregs(NULL, d); /* @@ -153,7 +160,7 @@ dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size) } if (avail * MAXWATCHSIZE < size) - return (-1); + return (EBUSY); for (i = 0; i < NDBREGS && size > 0; i++) { if (!DBREG_DR7_ENABLED(d->dr[7], i)) { @@ -164,7 +171,7 @@ dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size) wsize = 4; else wsize = size; - dbreg_set_watchreg(i, addr, wsize, DBREG_DR7_WRONLY, d); + dbreg_set_watchreg(i, addr, wsize, access, d); addr += wsize; size -= wsize; avail--; @@ -265,3 +272,31 @@ amd64_db_resume_dbreg(void) } } #endif + +int +kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access) +{ + + /* Convert the KDB access type */ + switch (access) { + case KDB_DBG_ACCESS_W: + access = DBREG_DR7_WRONLY; + break; + case KDB_DBG_ACCESS_RW: + access = DBREG_DR7_RDWR; + break; + case KDB_DBG_ACCESS_R: + /* FALLTHROUGH: read-only not supported */ + default: + return (EINVAL); + } + + return (dbreg_set_watchpoint(addr, size, access)); +} + +int +kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size) +{ + + return (dbreg_clr_watchpoint(addr, size)); +} From owner-dev-commits-src-all@freebsd.org Mon Mar 29 15:06:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A518B57A3A1; Mon, 29 Mar 2021 15:06:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8G9z60zzz3mW4; Mon, 29 Mar 2021 15:06:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A826A154EC; Mon, 29 Mar 2021 15:06:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TF6EC7044226; Mon, 29 Mar 2021 15:06:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TF6EAG044225; Mon, 29 Mar 2021 15:06:14 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:06:14 GMT Message-Id: <202103291506.12TF6EAG044225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 3ef68bc62c1e - main - arm64: implement kdb watchpoint functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ef68bc62c1e3ca9c452177f5cb9fd4de0df590d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:06:17 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=3ef68bc62c1e3ca9c452177f5cb9fd4de0df590d commit 3ef68bc62c1e3ca9c452177f5cb9fd4de0df590d Author: Mitchell Horne AuthorDate: 2021-03-04 21:53:21 +0000 Commit: Mitchell Horne CommitDate: 2021-03-29 15:05:43 +0000 arm64: implement kdb watchpoint functions Add wrappers around the debug_monitor interface, to be consumed by MI kernel debugger code. Update dbg_setup_watchpoint() and dbg_remove_watchpoint() to return specific error codes, not just -1. Reviewed by: jhb, kib, markj MFC after: 3 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D29155 --- sys/arm64/arm64/debug_monitor.c | 41 +++++++++++++++++++++++++++++++++++------ sys/arm64/include/kdb.h | 2 ++ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/sys/arm64/arm64/debug_monitor.c b/sys/arm64/arm64/debug_monitor.c index c6622650f1ad..845784129b4c 100644 --- a/sys/arm64/arm64/debug_monitor.c +++ b/sys/arm64/arm64/debug_monitor.c @@ -226,6 +226,35 @@ kdb_cpu_clear_singlestep(void) } } +int +kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access) +{ + enum dbg_access_t dbg_access; + + switch (access) { + case KDB_DBG_ACCESS_R: + dbg_access = HW_BREAKPOINT_R; + break; + case KDB_DBG_ACCESS_W: + dbg_access = HW_BREAKPOINT_W; + break; + case KDB_DBG_ACCESS_RW: + dbg_access = HW_BREAKPOINT_RW; + break; + default: + return (EINVAL); + } + + return (dbg_setup_watchpoint(NULL, addr, size, dbg_access)); +} + +int +kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size) +{ + + return (dbg_remove_watchpoint(NULL, addr, size)); +} + static const char * dbg_watchtype_str(uint32_t type) { @@ -362,7 +391,7 @@ dbg_setup_watchpoint(struct debug_monitor_state *monitor, vm_offset_t addr, if (i == -1) { printf("Can not find slot for watchpoint, max %d" " watchpoints supported\n", dbg_watchpoint_num); - return (i); + return (EBUSY); } switch(size) { @@ -379,8 +408,8 @@ dbg_setup_watchpoint(struct debug_monitor_state *monitor, vm_offset_t addr, wcr_size = DBG_WATCH_CTRL_LEN_8; break; default: - printf("Unsupported address size for watchpoint\n"); - return (-1); + printf("Unsupported address size for watchpoint: %zu\n", size); + return (EINVAL); } if ((monitor->dbg_flags & DBGMON_KERNEL) == 0) @@ -402,8 +431,8 @@ dbg_setup_watchpoint(struct debug_monitor_state *monitor, vm_offset_t addr, wcr_access = DBG_WATCH_CTRL_LOAD | DBG_WATCH_CTRL_STORE; break; default: - printf("Unsupported exception level for watchpoint\n"); - return (-1); + printf("Unsupported access type for watchpoint: %d\n", access); + return (EINVAL); } monitor->dbg_wvr[i] = addr; @@ -427,7 +456,7 @@ dbg_remove_watchpoint(struct debug_monitor_state *monitor, vm_offset_t addr, i = dbg_find_slot(monitor, DBG_TYPE_WATCHPOINT, addr); if (i == -1) { printf("Can not find watchpoint for address 0%lx\n", addr); - return (i); + return (EINVAL); } monitor->dbg_wvr[i] = 0; diff --git a/sys/arm64/include/kdb.h b/sys/arm64/include/kdb.h index 2f7306ef669b..d5450dd2d67a 100644 --- a/sys/arm64/include/kdb.h +++ b/sys/arm64/include/kdb.h @@ -39,6 +39,8 @@ void kdb_cpu_clear_singlestep(void); void kdb_cpu_set_singlestep(void); +int kdb_cpu_set_watchpoint(vm_offset_t addr, size_t size, int access); +int kdb_cpu_clr_watchpoint(vm_offset_t addr, size_t size); static __inline void kdb_cpu_sync_icache(unsigned char *addr, size_t size) From owner-dev-commits-src-all@freebsd.org Mon Mar 29 15:06:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAD1E57A32A; Mon, 29 Mar 2021 15:06:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8GB52WJBz3mdD; Mon, 29 Mar 2021 15:06:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 707AF154ED; Mon, 29 Mar 2021 15:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TF6JNI044342; Mon, 29 Mar 2021 15:06:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TF6Juv044341; Mon, 29 Mar 2021 15:06:19 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:06:19 GMT Message-Id: <202103291506.12TF6Juv044341@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 5a2933d0bf9f - main - arm: implement kdb watchpoint functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a2933d0bf9fb0018349b67a39fa85cbb3740779 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:06:22 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=5a2933d0bf9fb0018349b67a39fa85cbb3740779 commit 5a2933d0bf9fb0018349b67a39fa85cbb3740779 Author: Mitchell Horne AuthorDate: 2021-03-04 00:14:42 +0000 Commit: Mitchell Horne CommitDate: 2021-03-29 15:05:44 +0000 arm: implement kdb watchpoint functions Implement wrappers around the existing debug_monitor interface, to be consumed by MI kernel debugger code. For now, the various db_printf() calls in this code remain. In the future, they could be converted to printf() or removed altogether, to properly decouple the DDB and GDB options. Reviewed by: jhb, kib, markj MFC after: 3 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D29155 --- sys/arm/arm/debug_monitor.c | 37 ++++++++++++++++++++++++++++++++++--- sys/arm/include/kdb.h | 2 ++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/sys/arm/arm/debug_monitor.c b/sys/arm/arm/debug_monitor.c index ddf3e8e67b25..55b5f70b2397 100644 --- a/sys/arm/arm/debug_monitor.c +++ b/sys/arm/arm/debug_monitor.c @@ -326,6 +326,35 @@ kdb_cpu_clear_singlestep(void) } } +int +kdb_cpu_set_watchpoint(vm_offset_t addr, size_t size, int access) +{ + enum dbg_access_t dbg_access; + + switch (access) { + case KDB_DBG_ACCESS_R: + dbg_access = HW_WATCHPOINT_R; + break; + case KDB_DBG_ACCESS_W: + dbg_access = HW_WATCHPOINT_W; + break; + case KDB_DBG_ACCESS_RW: + dbg_access = HW_WATCHPOINT_RW; + break; + default: + return (EINVAL); + } + + return (dbg_setup_watchpoint(addr, size, (enum dbg_access_t)access)); +} + +int +kdb_cpu_clr_watchpoint(vm_offset_t addr, size_t size) +{ + + return (dbg_remove_watchpoint(addr, size)); +} + int dbg_setup_watchpoint(db_expr_t addr, db_expr_t size, enum dbg_access_t access) { @@ -624,7 +653,7 @@ dbg_setup_xpoint(struct dbg_wb_conf *conf) if (i == ~0U) { db_printf("Can not find slot for %s, max %d slots supported\n", typestr, dbg_watchpoint_num); - return (ENXIO); + return (EBUSY); } } @@ -645,7 +674,8 @@ dbg_setup_xpoint(struct dbg_wb_conf *conf) cr_size = DBG_WB_CTRL_LEN_8; break; default: - db_printf("Unsupported address size for %s\n", typestr); + db_printf("Unsupported address size for %s: %zu\n", typestr, + conf->size); return (EINVAL); } @@ -667,7 +697,8 @@ dbg_setup_xpoint(struct dbg_wb_conf *conf) cr_access = DBG_WB_CTRL_LOAD | DBG_WB_CTRL_STORE; break; default: - db_printf("Unsupported exception level for %s\n", typestr); + db_printf("Unsupported access type for %s: %d\n", + typestr, conf->access); return (EINVAL); } diff --git a/sys/arm/include/kdb.h b/sys/arm/include/kdb.h index 42677499ed78..728bf211dc62 100644 --- a/sys/arm/include/kdb.h +++ b/sys/arm/include/kdb.h @@ -41,6 +41,8 @@ extern void kdb_cpu_clear_singlestep(void); extern void kdb_cpu_set_singlestep(void); boolean_t kdb_cpu_pc_is_singlestep(db_addr_t); +int kdb_cpu_set_watchpoint(vm_offset_t addr, size_t size, int access); +int kdb_cpu_clr_watchpoint(vm_offset_t addr, size_t size); static __inline void kdb_cpu_sync_icache(unsigned char *addr, size_t size) From owner-dev-commits-src-all@freebsd.org Mon Mar 29 15:06:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9703557A433; Mon, 29 Mar 2021 15:06:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8GBB6Vx6z3mWt; Mon, 29 Mar 2021 15:06:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C35D15806; Mon, 29 Mar 2021 15:06:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TF6OmQ044460; Mon, 29 Mar 2021 15:06:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TF6OMt044459; Mon, 29 Mar 2021 15:06:24 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:06:24 GMT Message-Id: <202103291506.12TF6OMt044459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 9d81dd5404b3 - main - ddb: replace watchpoint set/clear functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9d81dd5404b3ad7108059d7065814d56a722a96c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:06:28 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=9d81dd5404b3ad7108059d7065814d56a722a96c commit 9d81dd5404b3ad7108059d7065814d56a722a96c Author: Mitchell Horne AuthorDate: 2021-03-08 15:27:19 +0000 Commit: Mitchell Horne CommitDate: 2021-03-29 15:05:44 +0000 ddb: replace watchpoint set/clear functions Use the new kdb variants. Print more specific error messages. Reviewed by: jhb, markj MFC after: 3 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D29156 --- sys/amd64/amd64/db_trace.c | 15 ---------- sys/arm/arm/db_trace.c | 14 ---------- sys/arm64/arm64/db_trace.c | 14 ---------- sys/ddb/db_watch.c | 59 +++++++++++++++++++++++++++++----------- sys/ddb/ddb.h | 2 -- sys/i386/i386/db_trace.c | 14 ---------- sys/mips/mips/db_trace.c | 14 ---------- sys/powerpc/powerpc/db_hwwatch.c | 14 ---------- sys/riscv/riscv/db_trace.c | 14 ---------- 9 files changed, 43 insertions(+), 117 deletions(-) diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index beeb5cd6e9f3..4c569c456e92 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -385,21 +385,6 @@ db_trace_thread(struct thread *thr, int count) ctx->pcb_rip, ctx->pcb_rsp, count)); } -int -db_md_set_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size, - DBREG_DR7_WRONLY)); -} - -int -db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (dbreg_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size)); -} - void db_md_list_watchpoints(void) { diff --git a/sys/arm/arm/db_trace.c b/sys/arm/arm/db_trace.c index 195ed0f4e3d9..3f308c9f546c 100644 --- a/sys/arm/arm/db_trace.c +++ b/sys/arm/arm/db_trace.c @@ -134,20 +134,6 @@ db_md_list_watchpoints(void) dbg_show_watchpoint(); } -int -db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (dbg_remove_watchpoint(addr, size)); -} - -int -db_md_set_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (dbg_setup_watchpoint(addr, size, HW_WATCHPOINT_RW)); -} - int db_trace_thread(struct thread *thr, int count) { diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c index 268d4ad0d839..5f018f2133b6 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -57,20 +57,6 @@ db_md_list_watchpoints() dbg_show_watchpoint(); } -int -db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (dbg_remove_watchpoint(NULL, addr, size)); -} - -int -db_md_set_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (dbg_setup_watchpoint(NULL, addr, size, HW_BREAKPOINT_RW)); -} - static void db_stack_trace_cmd(struct thread *td, struct unwind_state *frame) { diff --git a/sys/ddb/db_watch.c b/sys/ddb/db_watch.c index f0fbb6768c12..3226b050a4c3 100644 --- a/sys/ddb/db_watch.c +++ b/sys/ddb/db_watch.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -42,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include @@ -278,33 +281,57 @@ db_find_watchpoint(vm_map_t map, db_addr_t addr, db_regs_t regs) #endif /* Delete hardware watchpoint */ -/*ARGSUSED*/ void -db_deletehwatch_cmd(db_expr_t addr, bool have_addr, db_expr_t count, +db_deletehwatch_cmd(db_expr_t addr, bool have_addr, db_expr_t size, char *modif) { int rc; - if (count < 0) - count = 4; - - rc = db_md_clr_watchpoint(addr, count); - if (rc < 0) - db_printf("hardware watchpoint could not be deleted\n"); + if (size < 0) + size = 4; + + rc = kdb_cpu_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size); + switch (rc) { + case ENXIO: + /* Not supported, ignored. */ + break; + case EINVAL: + db_printf("Invalid watchpoint address or size.\n"); + break; + default: + if (rc != 0) + db_printf("Hardware watchpoint could not be deleted, " + "status=%d\n", rc); + break; + } } /* Set hardware watchpoint */ -/*ARGSUSED*/ void -db_hwatchpoint_cmd(db_expr_t addr, bool have_addr, db_expr_t count, +db_hwatchpoint_cmd(db_expr_t addr, bool have_addr, db_expr_t size, char *modif) { int rc; - if (count < 0) - count = 4; - - rc = db_md_set_watchpoint(addr, count); - if (rc < 0) - db_printf("hardware watchpoint could not be set\n"); + if (size < 0) + size = 4; + + rc = kdb_cpu_set_watchpoint((vm_offset_t)addr, (vm_size_t)size, + KDB_DBG_ACCESS_W); + + switch (rc) { + case EINVAL: + db_printf("Invalid watchpoint size or address.\n"); + break; + case EBUSY: + db_printf("No hardware watchpoints available.\n"); + break; + case ENXIO: + db_printf("Hardware watchpoints are not supported on this platform.\n"); + break; + default: + if (rc != 0) + db_printf("Could not set hardware watchpoint, " + "status=%d\n", rc); + } } diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index 5ae48d21fda9..6218177b3dc2 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -205,8 +205,6 @@ struct thread *db_lookup_thread(db_expr_t addr, bool check_pid); struct vm_map *db_map_addr(vm_offset_t); bool db_map_current(struct vm_map *); bool db_map_equal(struct vm_map *, struct vm_map *); -int db_md_set_watchpoint(db_expr_t addr, db_expr_t size); -int db_md_clr_watchpoint(db_expr_t addr, db_expr_t size); void db_md_list_watchpoints(void); void db_print_loc_and_inst(db_addr_t loc); void db_print_thread(void); diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index 50fb1fa6355d..80ef0fe715d8 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -612,20 +612,6 @@ db_trace_thread(struct thread *thr, int count) ctx->pcb_eip, ctx->pcb_esp, count)); } -int -db_md_set_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size)); -} - -int -db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (dbreg_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size)); -} - void db_md_list_watchpoints(void) { diff --git a/sys/mips/mips/db_trace.c b/sys/mips/mips/db_trace.c index 0762fdb8a1da..4903b6d3d432 100644 --- a/sys/mips/mips/db_trace.c +++ b/sys/mips/mips/db_trace.c @@ -395,20 +395,6 @@ done: } } -int -db_md_set_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return(0); -} - -int -db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return(0); -} - void db_md_list_watchpoints() { diff --git a/sys/powerpc/powerpc/db_hwwatch.c b/sys/powerpc/powerpc/db_hwwatch.c index 37b4a9148495..aa9018a58417 100644 --- a/sys/powerpc/powerpc/db_hwwatch.c +++ b/sys/powerpc/powerpc/db_hwwatch.c @@ -36,20 +36,6 @@ #include #include -int -db_md_set_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (0); -} - -int -db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (0); -} - void db_md_list_watchpoints(void) { diff --git a/sys/riscv/riscv/db_trace.c b/sys/riscv/riscv/db_trace.c index b8421fa3aa7a..dbc2ba92bce3 100644 --- a/sys/riscv/riscv/db_trace.c +++ b/sys/riscv/riscv/db_trace.c @@ -58,20 +58,6 @@ db_md_list_watchpoints() } -int -db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (0); -} - -int -db_md_set_watchpoint(db_expr_t addr, db_expr_t size) -{ - - return (0); -} - static void db_stack_trace_cmd(struct thread *td, struct unwind_state *frame) { From owner-dev-commits-src-all@freebsd.org Mon Mar 29 15:12:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 573A757A556; Mon, 29 Mar 2021 15:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8GK924mgz3n8V; Mon, 29 Mar 2021 15:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A2F3157B0; Mon, 29 Mar 2021 15:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TFCTU6058178; Mon, 29 Mar 2021 15:12:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TFCTVI058177; Mon, 29 Mar 2021 15:12:29 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:12:29 GMT Message-Id: <202103291512.12TFCTVI058177@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: b92b2ffd1233 - stable/13 - align nfsdumpstate column output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b92b2ffd1233d9513dfcbb412c2bb578eef70e05 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:12:29 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b92b2ffd1233d9513dfcbb412c2bb578eef70e05 commit b92b2ffd1233d9513dfcbb412c2bb578eef70e05 Author: Caleb St. John AuthorDate: 2021-03-24 20:33:41 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 13:33:14 +0000 align nfsdumpstate column output There are scenarios where an NFS client will mount an NFSv4 export without specifying a callback address. When running nfsdumpstate under this circumstance, the column output is shifted incorrectly which places the "ClientID" value underneath the "Clientaddr" column. This diff is a small cosmetic change that prints a blank in the "Clientaddr" column and ensures the data for the columns are aligned appropriately. Submitted by: Caleb St. John Reviewed by: sef (previous version) MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D18958 (cherry picked from commit efad9c8ba3cec7f6e39b128b90afab70701fd8d9) --- usr.sbin/nfsdumpstate/nfsdumpstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/nfsdumpstate/nfsdumpstate.c b/usr.sbin/nfsdumpstate/nfsdumpstate.c index 4334a3ddf506..c7e086655f79 100644 --- a/usr.sbin/nfsdumpstate/nfsdumpstate.c +++ b/usr.sbin/nfsdumpstate/nfsdumpstate.c @@ -162,6 +162,9 @@ dump_openstate(void) printf("%-45s ", " "); break; #endif + default: + printf("%-45s ", " "); + break; } for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++) printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 15:12:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 727D357A71A; Mon, 29 Mar 2021 15:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8GKB2jzZz3nRB; Mon, 29 Mar 2021 15:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F77C15922; Mon, 29 Mar 2021 15:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TFCURf058201; Mon, 29 Mar 2021 15:12:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TFCUmC058200; Mon, 29 Mar 2021 15:12:30 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:12:30 GMT Message-Id: <202103291512.12TFCUmC058200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: af68f5380642 - stable/13 - rpc.lockd: Unconditionally close fds as daemon MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: af68f5380642b3beb7be25cdacd73848f9c680e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:12:30 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=af68f5380642b3beb7be25cdacd73848f9c680e3 commit af68f5380642b3beb7be25cdacd73848f9c680e3 Author: Caleb St. John AuthorDate: 2021-03-26 18:00:14 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 13:33:35 +0000 rpc.lockd: Unconditionally close fds as daemon When lockd is configured with a debug level of > 0 and foreground == 0, the process is daemonized with a truth noclose argument to daemon(). This doesn't seem to be the desired behavior because that prevents stdout and stderr from being closed, however, stdout and stderr aren't used anywhere else. Furthermore, the man pages state that with a higher debug level it will use the syslog facilities to do so. Submitted by: Caleb St. John Discussed with: rmacklem MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29415 (cherry picked from commit badcfbacf3840a4097bb79192054481c7674e7d2) --- usr.sbin/rpc.lockd/lockd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index 9aac9273b3fd..e25cef9993bb 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -426,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if ((foreground == 0) && daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, 0)) { err(1, "cannot fork"); /* NOTREACHED */ } From owner-dev-commits-src-all@freebsd.org Mon Mar 29 15:12:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26D2957A567; Mon, 29 Mar 2021 15:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8GKC3ggvz3nRG; Mon, 29 Mar 2021 15:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E15715645; Mon, 29 Mar 2021 15:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TFCVmE058219; Mon, 29 Mar 2021 15:12:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TFCVqU058218; Mon, 29 Mar 2021 15:12:31 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:12:31 GMT Message-Id: <202103291512.12TFCVqU058218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 16443ffd4108 - stable/13 - bsdinstall: Drop vestigial bsdinstall-esps cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 16443ffd4108bed3c290fee90d7337ba6877bb3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:12:33 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=16443ffd4108bed3c290fee90d7337ba6877bb3e commit 16443ffd4108bed3c290fee90d7337ba6877bb3e Author: Ryan Moeller AuthorDate: 2021-03-26 18:12:18 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 13:34:12 +0000 bsdinstall: Drop vestigial bsdinstall-esps cleanup This is not needed after 0b7472b3d8d2f1e90fade5236b44fd98d8e396c2. MFC after: 3 days Sponsored by: iXsystems, Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D29325 (cherry picked from commit b07b7aec6534052d60cffe010c0426a7ab986d85) --- usr.sbin/bsdinstall/partedit/partedit.c | 14 +------------- usr.sbin/bsdinstall/partedit/partedit.h | 2 -- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/usr.sbin/bsdinstall/partedit/partedit.c b/usr.sbin/bsdinstall/partedit/partedit.c index 6d045428dd32..84f7ef032ba9 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.c +++ b/usr.sbin/bsdinstall/partedit/partedit.c @@ -45,7 +45,6 @@ #include "partedit.h" struct pmetadata_head part_metadata; -int tmpdfd; static int sade_mode = 0; static int apply_changes(struct gmesh *mesh); @@ -69,8 +68,6 @@ sigint_handler(int sig) end_dialog(); - close(tmpdfd); - exit(1); } @@ -78,7 +75,7 @@ int main(int argc, const char **argv) { struct partition_metadata *md; - const char *progname, *prompt, *tmpdir; + const char *progname, *prompt; struct partedit_item *items = NULL; struct gmesh mesh; int i, op, nitems, nscroll; @@ -90,14 +87,6 @@ main(int argc, const char **argv) TAILQ_INIT(&part_metadata); - tmpdir = getenv("TMPDIR"); - if (tmpdir == NULL) - tmpdir = "/tmp"; - tmpdfd = open(tmpdir, O_DIRECTORY); - if (tmpdfd < 0) - err(EX_OSERR, "%s", tmpdir); - unlinkat(tmpdfd, "bsdinstall-esps", 0); - init_fstab_metadata(); init_dialog(stdin, stdout); @@ -233,7 +222,6 @@ main(int argc, const char **argv) geom_deletetree(&mesh); free(items); end_dialog(); - close(tmpdfd); return (error); } diff --git a/usr.sbin/bsdinstall/partedit/partedit.h b/usr.sbin/bsdinstall/partedit/partedit.h index e989decc2359..1dccc653aea1 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.h +++ b/usr.sbin/bsdinstall/partedit/partedit.h @@ -39,8 +39,6 @@ struct gprovider; struct gmesh; struct ggeom; -extern int tmpdfd; - TAILQ_HEAD(pmetadata_head, partition_metadata); extern struct pmetadata_head part_metadata; From owner-dev-commits-src-all@freebsd.org Mon Mar 29 16:13:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 521A457BBFD; Mon, 29 Mar 2021 16:13:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8Hgn1r3lz3rqy; Mon, 29 Mar 2021 16:13:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31E701653F; Mon, 29 Mar 2021 16:13:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TGDfhQ042291; Mon, 29 Mar 2021 16:13:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TGDfYx042290; Mon, 29 Mar 2021 16:13:41 GMT (envelope-from git) Date: Mon, 29 Mar 2021 16:13:41 GMT Message-Id: <202103291613.12TGDfYx042290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 57593b2bca76 - stable/12 - align nfsdumpstate column output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 57593b2bca76db683ec6c589c1b051132181d55b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 16:13:41 -0000 The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=57593b2bca76db683ec6c589c1b051132181d55b commit 57593b2bca76db683ec6c589c1b051132181d55b Author: Caleb St. John AuthorDate: 2021-03-24 20:33:41 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 15:13:06 +0000 align nfsdumpstate column output There are scenarios where an NFS client will mount an NFSv4 export without specifying a callback address. When running nfsdumpstate under this circumstance, the column output is shifted incorrectly which places the "ClientID" value underneath the "Clientaddr" column. This diff is a small cosmetic change that prints a blank in the "Clientaddr" column and ensures the data for the columns are aligned appropriately. Submitted by: Caleb St. John Reviewed by: sef (previous version) MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D18958 (cherry picked from commit efad9c8ba3cec7f6e39b128b90afab70701fd8d9) --- usr.sbin/nfsdumpstate/nfsdumpstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/nfsdumpstate/nfsdumpstate.c b/usr.sbin/nfsdumpstate/nfsdumpstate.c index 4334a3ddf506..c7e086655f79 100644 --- a/usr.sbin/nfsdumpstate/nfsdumpstate.c +++ b/usr.sbin/nfsdumpstate/nfsdumpstate.c @@ -162,6 +162,9 @@ dump_openstate(void) printf("%-45s ", " "); break; #endif + default: + printf("%-45s ", " "); + break; } for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++) printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 16:13:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C16557BE79; Mon, 29 Mar 2021 16:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8Hgp35yPz3rlF; Mon, 29 Mar 2021 16:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D92316621; Mon, 29 Mar 2021 16:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TGDg4O042313; Mon, 29 Mar 2021 16:13:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TGDgjE042312; Mon, 29 Mar 2021 16:13:42 GMT (envelope-from git) Date: Mon, 29 Mar 2021 16:13:42 GMT Message-Id: <202103291613.12TGDgjE042312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 4fd5354e85e4 - stable/12 - rpc.lockd: Unconditionally close fds as daemon MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4fd5354e85e4e72b91e7690595173b3bbde21490 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 16:13:42 -0000 The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=4fd5354e85e4e72b91e7690595173b3bbde21490 commit 4fd5354e85e4e72b91e7690595173b3bbde21490 Author: Caleb St. John AuthorDate: 2021-03-26 18:00:14 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 15:13:16 +0000 rpc.lockd: Unconditionally close fds as daemon When lockd is configured with a debug level of > 0 and foreground == 0, the process is daemonized with a truth noclose argument to daemon(). This doesn't seem to be the desired behavior because that prevents stdout and stderr from being closed, however, stdout and stderr aren't used anywhere else. Furthermore, the man pages state that with a higher debug level it will use the syslog facilities to do so. Submitted by: Caleb St. John Discussed with: rmacklem MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29415 (cherry picked from commit badcfbacf3840a4097bb79192054481c7674e7d2) --- usr.sbin/rpc.lockd/lockd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index 9aac9273b3fd..e25cef9993bb 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -426,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if ((foreground == 0) && daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, 0)) { err(1, "cannot fork"); /* NOTREACHED */ } From owner-dev-commits-src-all@freebsd.org Mon Mar 29 16:29:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D25D57C86B; Mon, 29 Mar 2021 16:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8J2G29SVz3tJ3; Mon, 29 Mar 2021 16:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D356165E6; Mon, 29 Mar 2021 16:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TGTgfT057293; Mon, 29 Mar 2021 16:29:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TGTguR057292; Mon, 29 Mar 2021 16:29:42 GMT (envelope-from git) Date: Mon, 29 Mar 2021 16:29:42 GMT Message-Id: <202103291629.12TGTguR057292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: a6d768d845c1 - main - netmap: add kernel support for the "offsets" feature MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a6d768d845c173823785c71bb18b40074e7a8998 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 16:29:42 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=a6d768d845c173823785c71bb18b40074e7a8998 commit a6d768d845c173823785c71bb18b40074e7a8998 Author: Vincenzo Maffione AuthorDate: 2021-03-29 16:22:48 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-29 16:29:01 +0000 netmap: add kernel support for the "offsets" feature This feature enables applications to ask netmap to transmit or receive packets starting at a user-specified offset from the beginning of the netmap buffer. This is meant to ease those packet manipulation operations such as pushing or popping packet headers, that may be useful to implement software switches, routers and other packet processors. To use the feature, drivers (e.g., iflib, vtnet, etc.) must have explicit support. This change does not add support for any driver, but introduces the necessary kernel changes. However, offsets support is already included for VALE ports and pipes. --- sys/dev/netmap/netmap.c | 258 ++++++++++++++++++++++++++++++--- sys/dev/netmap/netmap_bdg.c | 248 ++++++++++++++++++++++++++++---- sys/dev/netmap/netmap_bdg.h | 2 + sys/dev/netmap/netmap_freebsd.c | 2 +- sys/dev/netmap/netmap_generic.c | 2 +- sys/dev/netmap/netmap_kern.h | 119 +++++++++++++++- sys/dev/netmap/netmap_mem2.c | 305 +++++++++++++++++++++++++++------------- sys/dev/netmap/netmap_mem2.h | 2 +- sys/dev/netmap/netmap_null.c | 1 + sys/dev/netmap/netmap_pipe.c | 46 +++--- sys/dev/netmap/netmap_vale.c | 193 +++++-------------------- sys/net/netmap.h | 55 ++++++++ sys/net/netmap_legacy.h | 2 + sys/net/netmap_user.h | 24 +++- sys/net/netmap_virt.h | 4 +- 15 files changed, 935 insertions(+), 328 deletions(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index f9698096b47a..18de5ef205eb 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -805,6 +805,14 @@ netmap_update_config(struct netmap_adapter *na) static int netmap_txsync_to_host(struct netmap_kring *kring, int flags); static int netmap_rxsync_from_host(struct netmap_kring *kring, int flags); +static int +netmap_default_bufcfg(struct netmap_kring *kring, uint64_t target) +{ + kring->hwbuf_len = target; + kring->buf_align = 0; /* no alignment */ + return 0; +} + /* create the krings array and initialize the fields common to all adapters. * The array layout is this: * @@ -885,12 +893,16 @@ netmap_krings_create(struct netmap_adapter *na, u_int tailroom) kring->nr_pending_mode = NKR_NETMAP_OFF; if (i < nma_get_nrings(na, t)) { kring->nm_sync = (t == NR_TX ? na->nm_txsync : na->nm_rxsync); + kring->nm_bufcfg = na->nm_bufcfg; + if (kring->nm_bufcfg == NULL) + kring->nm_bufcfg = netmap_default_bufcfg; } else { if (!(na->na_flags & NAF_HOST_RINGS)) kring->nr_kflags |= NKR_FAKERING; kring->nm_sync = (t == NR_TX ? netmap_txsync_to_host: netmap_rxsync_from_host); + kring->nm_bufcfg = netmap_default_bufcfg; } kring->nm_notify = na->nm_notify; kring->rhead = kring->rcur = kring->nr_hwcur = 0; @@ -969,17 +981,24 @@ netmap_hw_krings_delete(struct netmap_adapter *na) netmap_krings_delete(na); } +void +netmap_mem_restore(struct netmap_adapter *na) +{ + if (na->nm_mem_prev) { + netmap_mem_put(na->nm_mem); + na->nm_mem = na->nm_mem_prev; + na->nm_mem_prev = NULL; + } +} + static void netmap_mem_drop(struct netmap_adapter *na) { - int last = netmap_mem_deref(na->nm_mem, na); /* if the native allocator had been overrided on regif, * restore it now and drop the temporary one */ - if (last && na->nm_mem_prev) { - netmap_mem_put(na->nm_mem); - na->nm_mem = na->nm_mem_prev; - na->nm_mem_prev = NULL; + if (netmap_mem_deref(na->nm_mem, na)) { + netmap_mem_restore(na); } } @@ -1571,7 +1590,7 @@ netmap_get_na(struct nmreq_header *hdr, if (error || *na != NULL) goto out; - /* try to see if this is a bridge port */ + /* try to see if this is a vale port */ error = netmap_get_vale_na(hdr, na, nmd, create); if (error) goto out; @@ -2232,6 +2251,198 @@ netmap_buf_size_validate(const struct netmap_adapter *na, unsigned mtu) { return 0; } +/* Handle the offset option, if present in the hdr. + * Returns 0 on success, or an error. + */ +static int +netmap_offsets_init(struct netmap_priv_d *priv, struct nmreq_header *hdr) +{ + struct nmreq_opt_offsets *opt; + struct netmap_adapter *na = priv->np_na; + struct netmap_kring *kring; + uint64_t mask = 0, bits = 0, maxbits = sizeof(uint64_t) * 8, + max_offset = 0, initial_offset = 0, min_gap = 0; + u_int i; + enum txrx t; + int error = 0; + + opt = (struct nmreq_opt_offsets *) + nmreq_getoption(hdr, NETMAP_REQ_OPT_OFFSETS); + if (opt == NULL) + return 0; + + if (!(na->na_flags & NAF_OFFSETS)) { + if (netmap_verbose) + nm_prerr("%s does not support offsets", + na->name); + error = EOPNOTSUPP; + goto out; + } + + /* check sanity of the opt values */ + max_offset = opt->nro_max_offset; + min_gap = opt->nro_min_gap; + initial_offset = opt->nro_initial_offset; + bits = opt->nro_offset_bits; + + if (bits > maxbits) { + if (netmap_verbose) + nm_prerr("bits: %llu too large (max %llu)", + (unsigned long long)bits, + (unsigned long long)maxbits); + error = EINVAL; + goto out; + } + /* we take bits == 0 as a request to use the entire field */ + if (bits == 0 || bits == maxbits) { + /* shifting a type by sizeof(type) is undefined */ + bits = maxbits; + mask = 0xffffffffffffffff; + } else { + mask = (1ULL << bits) - 1; + } + if (max_offset > NETMAP_BUF_SIZE(na)) { + if (netmap_verbose) + nm_prerr("max offset %llu > buf size %u", + (unsigned long long)max_offset, NETMAP_BUF_SIZE(na)); + error = EINVAL; + goto out; + } + if ((max_offset & mask) != max_offset) { + if (netmap_verbose) + nm_prerr("max offset %llu to large for %llu bits", + (unsigned long long)max_offset, + (unsigned long long)bits); + error = EINVAL; + goto out; + } + if (initial_offset > max_offset) { + if (netmap_verbose) + nm_prerr("initial offset %llu > max offset %llu", + (unsigned long long)initial_offset, + (unsigned long long)max_offset); + error = EINVAL; + goto out; + } + + /* initialize the kring and ring fields. */ + foreach_selected_ring(priv, t, i, kring) { + struct netmap_kring *kring = NMR(na, t)[i]; + struct netmap_ring *ring = kring->ring; + u_int j; + + /* it the ring is already in use we check that the + * new request is compatible with the existing one + */ + if (kring->offset_mask) { + if ((kring->offset_mask & mask) != mask || + kring->offset_max < max_offset) { + if (netmap_verbose) + nm_prinf("%s: cannot increase" + "offset mask and/or max" + "(current: mask=%llx,max=%llu", + kring->name, + (unsigned long long)kring->offset_mask, + (unsigned long long)kring->offset_max); + error = EBUSY; + goto out; + } + mask = kring->offset_mask; + max_offset = kring->offset_max; + } else { + kring->offset_mask = mask; + *(uint64_t *)(uintptr_t)&ring->offset_mask = mask; + kring->offset_max = max_offset; + kring->offset_gap = min_gap; + } + + /* if there is an initial offset, put it into + * all the slots + * + * Note: we cannot change the offsets if the + * ring is already in use. + */ + if (!initial_offset || kring->users > 1) + continue; + + for (j = 0; j < kring->nkr_num_slots; j++) { + struct netmap_slot *slot = ring->slot + j; + + nm_write_offset(kring, slot, initial_offset); + } + } + +out: + opt->nro_opt.nro_status = error; + if (!error) { + opt->nro_max_offset = max_offset; + } + return error; + +} + +static int +netmap_compute_buf_len(struct netmap_priv_d *priv) +{ + enum txrx t; + u_int i; + struct netmap_kring *kring; + int error = 0; + unsigned mtu = 0; + struct netmap_adapter *na = priv->np_na; + uint64_t target, maxframe; + + if (na->ifp != NULL) + mtu = nm_os_ifnet_mtu(na->ifp); + + foreach_selected_ring(priv, t, i, kring) { + + if (kring->users > 1) + continue; + + target = NETMAP_BUF_SIZE(kring->na) - + kring->offset_max; + if (!kring->offset_gap) + kring->offset_gap = + NETMAP_BUF_SIZE(kring->na); + if (kring->offset_gap < target) + target = kring->offset_gap; + + if (mtu) { + maxframe = mtu + ETH_HLEN + + ETH_FCS_LEN + VLAN_HLEN; + if (maxframe < target) { + target = kring->offset_gap; + } + } + + error = kring->nm_bufcfg(kring, target); + if (error) + goto out; + + *(uint64_t *)(uintptr_t)&kring->ring->buf_align = kring->buf_align; + + if (mtu && t == NR_RX && kring->hwbuf_len < mtu) { + if (!(na->na_flags & NAF_MOREFRAG)) { + nm_prerr("error: large MTU (%d) needed " + "but %s does not support " + "NS_MOREFRAG", mtu, + na->name); + error = EINVAL; + goto out; + } else { + nm_prinf("info: netmap application on " + "%s needs to support " + "NS_MOREFRAG " + "(MTU=%u,buf_size=%llu)", + kring->name, mtu, + (unsigned long long)kring->hwbuf_len); + } + } + } +out: + return error; +} /* * possibly move the interface to netmap-mode. @@ -2381,6 +2592,16 @@ netmap_do_regif(struct netmap_priv_d *priv, struct netmap_adapter *na, if (error) goto err_rel_excl; + /* initialize offsets if requested */ + error = netmap_offsets_init(priv, hdr); + if (error) + goto err_rel_excl; + + /* compute and validate the buf lenghts */ + error = netmap_compute_buf_len(priv); + if (error) + goto err_rel_excl; + /* in all cases, create a new netmap if */ nifp = netmap_mem_if_new(na, priv); if (nifp == NULL) { @@ -2713,17 +2934,12 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, } #ifdef WITH_VALE case NETMAP_REQ_VALE_ATTACH: { - error = netmap_vale_attach(hdr, NULL /* userspace request */); + error = netmap_bdg_attach(hdr, NULL /* userspace request */); break; } case NETMAP_REQ_VALE_DETACH: { - error = netmap_vale_detach(hdr, NULL /* userspace request */); - break; - } - - case NETMAP_REQ_VALE_LIST: { - error = netmap_vale_list(hdr); + error = netmap_bdg_detach(hdr, NULL /* userspace request */); break; } @@ -2795,6 +3011,11 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, break; } + case NETMAP_REQ_VALE_LIST: { + error = netmap_vale_list(hdr); + break; + } + case NETMAP_REQ_VALE_NEWIF: { error = nm_vi_create(hdr); break; @@ -2804,13 +3025,13 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, error = nm_vi_destroy(hdr->nr_name); break; } +#endif /* WITH_VALE */ case NETMAP_REQ_VALE_POLLING_ENABLE: case NETMAP_REQ_VALE_POLLING_DISABLE: { error = nm_bdg_polling(hdr); break; } -#endif /* WITH_VALE */ case NETMAP_REQ_POOLS_INFO_GET: { /* Get information from the memory allocator used for * hdr->nr_name. */ @@ -3029,6 +3250,9 @@ nmreq_opt_size_by_type(uint32_t nro_reqtype, uint64_t nro_size) case NETMAP_REQ_OPT_SYNC_KLOOP_MODE: rv = sizeof(struct nmreq_opt_sync_kloop_mode); break; + case NETMAP_REQ_OPT_OFFSETS: + rv = sizeof(struct nmreq_opt_offsets); + break; } /* subtract the common header */ return rv - sizeof(struct nmreq_option); @@ -3733,16 +3957,14 @@ netmap_attach_common(struct netmap_adapter *na) na->active_fds = 0; if (na->nm_mem == NULL) { - /* use the global allocator */ - na->nm_mem = netmap_mem_get(&nm_mem); + /* use iommu or global allocator */ + na->nm_mem = netmap_mem_get_iommu(na); } -#ifdef WITH_VALE if (na->nm_bdg_attach == NULL) /* no special nm_bdg_attach callback. On VALE * attach, we need to interpose a bwrap */ na->nm_bdg_attach = netmap_default_bdg_attach; -#endif return 0; } diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c index 4d18859e2091..57659f3a7a6e 100644 --- a/sys/dev/netmap/netmap_bdg.c +++ b/sys/dev/netmap/netmap_bdg.c @@ -540,6 +540,85 @@ out: return error; } +/* Process NETMAP_REQ_VALE_ATTACH. + */ +int +netmap_bdg_attach(struct nmreq_header *hdr, void *auth_token) +{ + struct nmreq_vale_attach *req = + (struct nmreq_vale_attach *)(uintptr_t)hdr->nr_body; + struct netmap_vp_adapter * vpna; + struct netmap_adapter *na = NULL; + struct netmap_mem_d *nmd = NULL; + struct nm_bridge *b = NULL; + int error; + + NMG_LOCK(); + /* permission check for modified bridges */ + b = nm_find_bridge(hdr->nr_name, 0 /* don't create */, NULL); + if (b && !nm_bdg_valid_auth_token(b, auth_token)) { + error = EACCES; + goto unlock_exit; + } + + if (req->reg.nr_mem_id) { + nmd = netmap_mem_find(req->reg.nr_mem_id); + if (nmd == NULL) { + error = EINVAL; + goto unlock_exit; + } + } + + /* check for existing one */ + error = netmap_get_vale_na(hdr, &na, nmd, 0); + if (na) { + error = EBUSY; + goto unref_exit; + } + error = netmap_get_vale_na(hdr, &na, + nmd, 1 /* create if not exists */); + if (error) { /* no device */ + goto unlock_exit; + } + + if (na == NULL) { /* VALE prefix missing */ + error = EINVAL; + goto unlock_exit; + } + + if (NETMAP_OWNED_BY_ANY(na)) { + error = EBUSY; + goto unref_exit; + } + + if (na->nm_bdg_ctl) { + /* nop for VALE ports. The bwrap needs to put the hwna + * in netmap mode (see netmap_bwrap_bdg_ctl) + */ + error = na->nm_bdg_ctl(hdr, na); + if (error) + goto unref_exit; + nm_prdis("registered %s to netmap-mode", na->name); + } + vpna = (struct netmap_vp_adapter *)na; + req->port_index = vpna->bdg_port; + + if (nmd) + netmap_mem_put(nmd); + + NMG_UNLOCK(); + return 0; + +unref_exit: + netmap_adapter_put(na); +unlock_exit: + if (nmd) + netmap_mem_put(nmd); + + NMG_UNLOCK(); + return error; +} + int nm_is_bwrap(struct netmap_adapter *na) @@ -547,6 +626,74 @@ nm_is_bwrap(struct netmap_adapter *na) return na->nm_register == netmap_bwrap_reg; } +/* Process NETMAP_REQ_VALE_DETACH. + */ +int +netmap_bdg_detach(struct nmreq_header *hdr, void *auth_token) +{ + int error; + + NMG_LOCK(); + error = netmap_bdg_detach_locked(hdr, auth_token); + NMG_UNLOCK(); + return error; +} + +int +netmap_bdg_detach_locked(struct nmreq_header *hdr, void *auth_token) +{ + struct nmreq_vale_detach *nmreq_det = (void *)(uintptr_t)hdr->nr_body; + struct netmap_vp_adapter *vpna; + struct netmap_adapter *na; + struct nm_bridge *b = NULL; + int error; + + /* permission check for modified bridges */ + b = nm_find_bridge(hdr->nr_name, 0 /* don't create */, NULL); + if (b && !nm_bdg_valid_auth_token(b, auth_token)) { + error = EACCES; + goto error_exit; + } + + error = netmap_get_vale_na(hdr, &na, NULL, 0 /* don't create */); + if (error) { /* no device, or another bridge or user owns the device */ + goto error_exit; + } + + if (na == NULL) { /* VALE prefix missing */ + error = EINVAL; + goto error_exit; + } else if (nm_is_bwrap(na) && + ((struct netmap_bwrap_adapter *)na)->na_polling_state) { + /* Don't detach a NIC with polling */ + error = EBUSY; + goto unref_exit; + } + + vpna = (struct netmap_vp_adapter *)na; + if (na->na_vp != vpna) { + /* trying to detach first attach of VALE persistent port attached + * to 2 bridges + */ + error = EBUSY; + goto unref_exit; + } + nmreq_det->port_index = vpna->bdg_port; + + if (na->nm_bdg_ctl) { + /* remove the port from bridge. The bwrap + * also needs to put the hwna in normal mode + */ + error = na->nm_bdg_ctl(hdr, na); + } + +unref_exit: + netmap_adapter_put(na); +error_exit: + return error; + +} + struct nm_bdg_polling_state; struct @@ -1092,7 +1239,7 @@ netmap_bwrap_dtor(struct netmap_adapter *na) * hwna rx ring. * The bridge wrapper then sends the packets through the bridge. */ -static int +int netmap_bwrap_intr_notify(struct netmap_kring *kring, int flags) { struct netmap_adapter *na = kring->na; @@ -1217,7 +1364,7 @@ netmap_bwrap_reg(struct netmap_adapter *na, int onoff) /* intercept the hwna nm_nofify callback on the hw rings */ for (i = 0; i < hwna->num_rx_rings; i++) { hwna->rx_rings[i]->save_notify = hwna->rx_rings[i]->nm_notify; - hwna->rx_rings[i]->nm_notify = netmap_bwrap_intr_notify; + hwna->rx_rings[i]->nm_notify = bna->nm_intr_notify; } i = hwna->num_rx_rings; /* for safety */ /* save the host ring notify unconditionally */ @@ -1250,12 +1397,6 @@ netmap_bwrap_reg(struct netmap_adapter *na, int onoff) hwna->na_lut.objtotal = 0; hwna->na_lut.objsize = 0; - /* pass ownership of the netmap rings to the hwna */ - for_rx_tx(t) { - for (i = 0; i < netmap_all_rings(na, t); i++) { - NMR(na, t)[i]->ring = NULL; - } - } /* reset the number of host rings to default */ for_rx_tx(t) { nma_set_host_nrings(hwna, t, 1); @@ -1275,6 +1416,11 @@ netmap_bwrap_config(struct netmap_adapter *na, struct nm_config_info *info) struct netmap_adapter *hwna = bna->hwna; int error; + /* cache the lut in the embedded host adapter */ + error = netmap_mem_get_lut(hwna->nm_mem, &bna->host.up.na_lut); + if (error) + return error; + /* Forward the request to the hwna. It may happen that nobody * registered hwna yet, so netmap_mem_get_lut() may have not * been called yet. */ @@ -1289,9 +1435,69 @@ netmap_bwrap_config(struct netmap_adapter *na, struct nm_config_info *info) info->num_rx_descs = hwna->num_tx_desc; info->rx_buf_maxsize = hwna->rx_buf_maxsize; + if (na->na_flags & NAF_HOST_RINGS) { + struct netmap_adapter *hostna = &bna->host.up; + enum txrx t; + + /* limit the number of host rings to that of hw */ + if (na->na_flags & NAF_HOST_ALL) { + hostna->num_tx_rings = nma_get_nrings(hwna, NR_RX); + hostna->num_rx_rings = nma_get_nrings(hwna, NR_TX); + } else { + nm_bound_var(&hostna->num_tx_rings, 1, 1, + nma_get_nrings(hwna, NR_TX), NULL); + nm_bound_var(&hostna->num_rx_rings, 1, 1, + nma_get_nrings(hwna, NR_RX), NULL); + } + for_rx_tx(t) { + enum txrx r = nm_txrx_swap(t); + u_int nr = nma_get_nrings(hostna, t); + + nma_set_host_nrings(na, t, nr); + if (nma_get_host_nrings(hwna, t) < nr) { + nma_set_host_nrings(hwna, t, nr); + } + nma_set_ndesc(hostna, t, nma_get_ndesc(hwna, r)); + } + } + return 0; } +/* nm_bufcfg callback for bwrap */ +static int +netmap_bwrap_bufcfg(struct netmap_kring *kring, uint64_t target) +{ + struct netmap_adapter *na = kring->na; + struct netmap_bwrap_adapter *bna = + (struct netmap_bwrap_adapter *)na; + struct netmap_adapter *hwna = bna->hwna; + struct netmap_kring *hwkring; + enum txrx r; + int error; + + /* we need the hw kring that corresponds to the bwrap one: + * remember that rx and tx are swapped + */ + r = nm_txrx_swap(kring->tx); + hwkring = NMR(hwna, r)[kring->ring_id]; + + /* copy down the offset information, forward the request + * and copy up the results + */ + hwkring->offset_mask = kring->offset_mask; + hwkring->offset_max = kring->offset_max; + hwkring->offset_gap = kring->offset_gap; + + error = hwkring->nm_bufcfg(hwkring, target); + if (error) + return error; + + kring->hwbuf_len = hwkring->hwbuf_len; + kring->buf_align = hwkring->buf_align; + + return 0; +} /* nm_krings_create callback for bwrap */ int @@ -1314,6 +1520,9 @@ netmap_bwrap_krings_create_common(struct netmap_adapter *na) for_rx_tx(t) { for (i = 0; i < netmap_all_rings(hwna, t); i++) { NMR(hwna, t)[i]->users++; + /* this to prevent deletion of the rings through + * our krings, instead of through the hwna ones */ + NMR(na, t)[i]->nr_kflags |= NKR_NEEDRING; } } @@ -1355,6 +1564,7 @@ err_dec_users: for_rx_tx(t) { for (i = 0; i < netmap_all_rings(hwna, t); i++) { NMR(hwna, t)[i]->users--; + NMR(na, t)[i]->users--; } } hwna->nm_krings_delete(hwna); @@ -1377,6 +1587,7 @@ netmap_bwrap_krings_delete_common(struct netmap_adapter *na) for_rx_tx(t) { for (i = 0; i < netmap_all_rings(hwna, t); i++) { NMR(hwna, t)[i]->users--; + NMR(na, t)[i]->users--; } } @@ -1480,6 +1691,7 @@ netmap_bwrap_bdg_ctl(struct nmreq_header *hdr, struct netmap_adapter *na) error = netmap_do_regif(npriv, na, hdr); if (error) { netmap_priv_delete(npriv); + netmap_mem_restore(bna->hwna); return error; } bna->na_kpriv = npriv; @@ -1490,6 +1702,7 @@ netmap_bwrap_bdg_ctl(struct nmreq_header *hdr, struct netmap_adapter *na) netmap_priv_delete(bna->na_kpriv); bna->na_kpriv = NULL; na->na_flags &= ~NAF_BUSY; + netmap_mem_restore(bna->hwna); } return error; @@ -1527,6 +1740,7 @@ netmap_bwrap_attach_common(struct netmap_adapter *na, } na->nm_dtor = netmap_bwrap_dtor; na->nm_config = netmap_bwrap_config; + na->nm_bufcfg = netmap_bwrap_bufcfg; na->nm_bdg_ctl = netmap_bwrap_bdg_ctl; na->pdev = hwna->pdev; na->nm_mem = netmap_mem_get(hwna->nm_mem); @@ -1546,25 +1760,8 @@ netmap_bwrap_attach_common(struct netmap_adapter *na, na->na_flags |= NAF_HOST_RINGS; hostna = &bna->host.up; - /* limit the number of host rings to that of hw */ - nm_bound_var(&hostna->num_tx_rings, 1, 1, - nma_get_nrings(hwna, NR_TX), NULL); - nm_bound_var(&hostna->num_rx_rings, 1, 1, - nma_get_nrings(hwna, NR_RX), NULL); - snprintf(hostna->name, sizeof(hostna->name), "%s^", na->name); hostna->ifp = hwna->ifp; - for_rx_tx(t) { - enum txrx r = nm_txrx_swap(t); - u_int nr = nma_get_nrings(hostna, t); - - nma_set_nrings(hostna, t, nr); - nma_set_host_nrings(na, t, nr); - if (nma_get_host_nrings(hwna, t) < nr) { - nma_set_host_nrings(hwna, t, nr); - } - nma_set_ndesc(hostna, t, nma_get_ndesc(hwna, r)); - } // hostna->nm_txsync = netmap_bwrap_host_txsync; // hostna->nm_rxsync = netmap_bwrap_host_rxsync; hostna->nm_mem = netmap_mem_get(na->nm_mem); @@ -1574,6 +1771,7 @@ netmap_bwrap_attach_common(struct netmap_adapter *na, hostna->na_hostvp = &bna->host; hostna->na_flags = NAF_BUSY; /* prevent NIOCREGIF */ hostna->rx_buf_maxsize = hwna->rx_buf_maxsize; + /* bwrap_config() will determine the number of host rings */ } if (hwna->na_flags & NAF_MOREFRAG) na->na_flags |= NAF_MOREFRAG; diff --git a/sys/dev/netmap/netmap_bdg.h b/sys/dev/netmap/netmap_bdg.h index e4683885e66c..a88eaf11b07c 100644 --- a/sys/dev/netmap/netmap_bdg.h +++ b/sys/dev/netmap/netmap_bdg.h @@ -178,8 +178,10 @@ int netmap_bdg_free(struct nm_bridge *b); void netmap_bdg_detach_common(struct nm_bridge *b, int hw, int sw); int netmap_vp_bdg_ctl(struct nmreq_header *hdr, struct netmap_adapter *na); int netmap_bwrap_reg(struct netmap_adapter *, int onoff); +int netmap_bdg_detach_locked(struct nmreq_header *hdr, void *auth_token); int netmap_vp_reg(struct netmap_adapter *na, int onoff); int netmap_vp_rxsync(struct netmap_kring *kring, int flags); +int netmap_bwrap_intr_notify(struct netmap_kring *kring, int flags); int netmap_bwrap_notify(struct netmap_kring *kring, int flags); int netmap_bwrap_attach_common(struct netmap_adapter *na, struct netmap_adapter *hwna); diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index 2cedea4440fe..a47cb508de04 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -1057,7 +1057,7 @@ netmap_dev_pager_fault(vm_object_t object, vm_ooffset_t offset, vm_page_replace(page, object, (*mres)->pindex, *mres); *mres = page; } - vm_page_valid(page); + page->valid = VM_PAGE_BITS_ALL; return (VM_PAGER_OK); } diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c index 09ba550cae92..f999576736fb 100644 --- a/sys/dev/netmap/netmap_generic.c +++ b/sys/dev/netmap/netmap_generic.c @@ -106,7 +106,7 @@ __FBSDID("$FreeBSD$"); static inline struct mbuf * nm_os_get_mbuf(struct ifnet *ifp, int len) { - return alloc_skb(ifp->needed_headroom + len + + return alloc_skb(LL_RESERVED_SPACE(ifp) + len + ifp->needed_tailroom, GFP_ATOMIC); } diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index fd9db5842df3..d9ae6a4f2054 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -459,8 +459,16 @@ struct netmap_kring { * On a NIC reset, the NIC ring indexes may be reset but the * indexes in the netmap rings remain the same. nkr_hwofs * keeps track of the offset between the two. + * + * Moreover, during reset, we can restore only the subset of + * the NIC ring that corresponds to the kernel-owned part of + * the netmap ring. The rest of the slots must be restored + * by the *sync routines when the user releases more slots. + * The nkr_to_refill field keeps track of the number of slots + * that still need to be restored. */ int32_t nkr_hwofs; + int32_t nkr_to_refill; /* last_reclaim is opaque marker to help reduce the frequency * of operations such as reclaiming tx buffers. A possible use @@ -535,6 +543,36 @@ struct netmap_kring { uint32_t pipe_tail; /* hwtail updated by the other end */ #endif /* WITH_PIPES */ + /* mask for the offset-related part of the ptr field in the slots */ + uint64_t offset_mask; + /* maximum user-specified offset, as stipulated at bind time. + * Larger offset requests will be silently capped to offset_max. + */ + uint64_t offset_max; + /* minimum gap between two consecutive offsets into the same + * buffer, as stipulated at bind time. This is used to choose + * the hwbuf_len, but is not otherwise checked for compliance + * at runtime. + */ + uint64_t offset_gap; + + /* size of hardware buffer. This may be less than the size of + * the netmap buffers because of non-zero offsets, or because + * the netmap buffer size exceeds the capability of the hardware. + */ + uint64_t hwbuf_len; + + /* required aligment (in bytes) for the buffers used by this ring. + * Netmap buffers are aligned to cachelines, which should suffice + * for most NICs. If the user is passing offsets, though, we need + * to check that the resulting buf address complies with any + * alignment restriction. + */ + uint64_t buf_align; + + /* harware specific logic for the selection of the hwbuf_len */ + int (*nm_bufcfg)(struct netmap_kring *kring, uint64_t target); + int (*save_notify)(struct netmap_kring *kring, int flags); #ifdef WITH_MONITOR @@ -719,6 +757,8 @@ struct netmap_adapter { #define NAF_FORCE_NATIVE 128 /* the adapter is always NATIVE */ /* free */ #define NAF_MOREFRAG 512 /* the adapter supports NS_MOREFRAG */ +#define NAF_OFFSETS 1024 /* the adapter supports the slot offsets */ +#define NAF_HOST_ALL 2048 /* the adapter wants as many host rings as hw */ #define NAF_ZOMBIE (1U<<30) /* the nic driver has been unloaded */ #define NAF_BUSY (1U<<31) /* the adapter is used internally and * cannot be registered from userspace @@ -782,6 +822,22 @@ struct netmap_adapter { * nm_config() returns configuration information from the OS * Called with NMG_LOCK held. * + * nm_bufcfg() + * the purpose of this callback is to fill the kring->hwbuf_len + * (l) and kring->buf_align fields. The l value is most important + * for RX rings, where we want to disallow writes outside of the + * netmap buffer. The l value must be computed taking into account + * the stipulated max_offset (o), possibily increased if there are + * alignment constraints, the maxframe (m), if known, and the + * current NETMAP_BUF_SIZE (b) of the memory region used by the + * adapter. We want the largest supported l such that o + l <= b. + * If m is known to be <= b - o, the callback may also choose the + * largest l <= b, ignoring the offset. The buf_align field is + * most important for TX rings when there are offsets. The user + * will see this value in the ring->buf_align field. Misaligned + * offsets will cause the corresponding packets to be silently + * dropped. + * * nm_krings_create() create and init the tx_rings and * rx_rings arrays of kring structures. In particular, * set the nm_sync callbacks for each ring. @@ -811,6 +867,7 @@ struct netmap_adapter { int (*nm_txsync)(struct netmap_kring *kring, int flags); int (*nm_rxsync)(struct netmap_kring *kring, int flags); int (*nm_notify)(struct netmap_kring *kring, int flags); + int (*nm_bufcfg)(struct netmap_kring *kring, uint64_t target); #define NAF_FORCE_READ 1 #define NAF_FORCE_RECLAIM 2 #define NAF_CAN_FORWARD_DOWN 4 @@ -1096,12 +1153,13 @@ struct netmap_bwrap_adapter { * here its original value, to be restored at detach */ struct netmap_vp_adapter *saved_na_vp; + int (*nm_intr_notify)(struct netmap_kring *kring, int flags); }; int nm_bdg_polling(struct nmreq_header *hdr); +int netmap_bdg_attach(struct nmreq_header *hdr, void *auth_token); +int netmap_bdg_detach(struct nmreq_header *hdr, void *auth_token); #ifdef WITH_VALE -int netmap_vale_attach(struct nmreq_header *hdr, void *auth_token); -int netmap_vale_detach(struct nmreq_header *hdr, void *auth_token); int netmap_vale_list(struct nmreq_header *hdr); int netmap_vi_create(struct nmreq_header *hdr, int); int nm_vi_create(struct nmreq_header *); @@ -1431,6 +1489,12 @@ uint32_t nm_rxsync_prologue(struct netmap_kring *, struct netmap_ring *); } while (0) #endif +#define NM_CHECK_ADDR_LEN_OFF(na_, l_, o_) do { \ + if ((l_) + (o_) < (l_) || \ + (l_) + (o_) > NETMAP_BUF_SIZE(na_)) { \ + (l_) = NETMAP_BUF_SIZE(na_) - (o_); \ + } } while (0) + /*---------------------------------------------------------------*/ /* @@ -1493,6 +1557,7 @@ int netmap_get_na(struct nmreq_header *hdr, struct netmap_adapter **na, void netmap_unget_na(struct netmap_adapter *na, struct ifnet *ifp); int netmap_get_hw_na(struct ifnet *ifp, struct netmap_mem_d *nmd, struct netmap_adapter **na); +void netmap_mem_restore(struct netmap_adapter *na); #ifdef WITH_VALE uint32_t netmap_vale_learning(struct nm_bdg_fwd *ft, uint8_t *dst_ring, @@ -1680,7 +1745,7 @@ extern int netmap_generic_txqdisc; /* Assigns the device IOMMU domain to an allocator. * Returns -ENOMEM in case the domain is different */ -#define nm_iommu_group_id(dev) (0) +#define nm_iommu_group_id(dev) (-1) /* Callback invoked by the dma machinery after a successful dmamap_load */ static void netmap_dmamap_cb(__unused void *arg, @@ -1890,6 +1955,9 @@ struct plut_entry { struct netmap_obj_pool; +/* alignment for netmap buffers */ +#define NM_BUF_ALIGN 64 + /* * NMB return the virtual address of a buffer (buffer 0 on bad index) * PNMB also fills the physical address @@ -1919,6 +1987,40 @@ PNMB(struct netmap_adapter *na, struct netmap_slot *slot, uint64_t *pp) return ret; } +static inline void +nm_write_offset(struct netmap_kring *kring, + struct netmap_slot *slot, uint64_t offset) +{ + slot->ptr = (slot->ptr & ~kring->offset_mask) | + (offset & kring->offset_mask); +} + +static inline uint64_t +nm_get_offset(struct netmap_kring *kring, struct netmap_slot *slot) +{ + uint64_t offset = (slot->ptr & kring->offset_mask); + if (unlikely(offset > kring->offset_max)) + offset = kring->offset_max; + return offset; +} + +static inline void * +NMB_O(struct netmap_kring *kring, struct netmap_slot *slot) *** 1433 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Mar 29 16:36:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF15857CD22; Mon, 29 Mar 2021 16:36:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8J9Y4WrCz3tQT; Mon, 29 Mar 2021 16:36:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F9D41617C; Mon, 29 Mar 2021 16:36:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TGa1Dk071477; Mon, 29 Mar 2021 16:36:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TGa1UO071476; Mon, 29 Mar 2021 16:36:01 GMT (envelope-from git) Date: Mon, 29 Mar 2021 16:36:01 GMT Message-Id: <202103291636.12TGa1UO071476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 660a47cb991d - main - netmap: monitor: add a flag to distinguish packet direction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 660a47cb991d5a7ca69cd8dd9c09a5288d49e405 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 16:36:01 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=660a47cb991d5a7ca69cd8dd9c09a5288d49e405 commit 660a47cb991d5a7ca69cd8dd9c09a5288d49e405 Author: Vincenzo Maffione AuthorDate: 2021-03-29 16:32:54 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-29 16:32:54 +0000 netmap: monitor: add a flag to distinguish packet direction The netmap monitor intercepts any TX/RX packets on the monitored port. However, before this change there was no way to tell whether an intercepted packet was being transmitted or received on the monitored port. A TXMON flag in the netmap slot has been added for this purpose. --- sys/dev/netmap/netmap_monitor.c | 8 ++++++-- sys/net/netmap.h | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/dev/netmap/netmap_monitor.c b/sys/dev/netmap/netmap_monitor.c index 1f5ff65b3b81..9e5d57f7ff0f 100644 --- a/sys/dev/netmap/netmap_monitor.c +++ b/sys/dev/netmap/netmap_monitor.c @@ -38,6 +38,8 @@ * the traffic transiting on both the tx and rx corresponding rings in the * monitored adapter. During registration, the user can choose if she wants * to intercept tx only, rx only, or both tx and rx traffic. + * The slots containing traffic intercepted in the tx direction will have + * the NS_TXMON flag set. * * If the monitor is not able to cope with the stream of frames, excess traffic * will be dropped. @@ -590,6 +592,7 @@ netmap_zmon_parent_sync(struct netmap_kring *kring, int flags, enum txrx tx) u_int beg, end, i; u_int lim = kring->nkr_num_slots - 1, mlim; // = mkring->nkr_num_slots - 1; + uint16_t txmon = kring->tx == NR_TX ? NS_TXMON : 0; if (mkring == NULL) { nm_prlim(5, "NULL monitor on %s", kring->name); @@ -659,7 +662,7 @@ netmap_zmon_parent_sync(struct netmap_kring *kring, int flags, enum txrx tx) ms->len = s->len; s->len = tmp; - ms->flags = s->flags; + ms->flags = (s->flags & ~NS_TXMON) | txmon; s->flags |= NS_BUF_CHANGED; beg = nm_next(beg, lim); @@ -726,6 +729,7 @@ static void netmap_monitor_parent_sync(struct netmap_kring *kring, u_int first_new, int new_slots) { u_int j; + uint16_t txmon = kring->tx == NR_TX ? NS_TXMON : 0; for (j = 0; j < kring->n_monitors; j++) { struct netmap_kring *mkring = kring->monitors[j]; @@ -777,7 +781,7 @@ netmap_monitor_parent_sync(struct netmap_kring *kring, u_int first_new, int new_ memcpy(dst, src, copy_len); ms->len = copy_len; - ms->flags = s->flags; + ms->flags = (s->flags & ~NS_TXMON) | txmon; sent++; beg = nm_next(beg, lim); diff --git a/sys/net/netmap.h b/sys/net/netmap.h index 7da40d6869f1..57480cba4ebd 100644 --- a/sys/net/netmap.h +++ b/sys/net/netmap.h @@ -219,6 +219,11 @@ struct netmap_slot { * The 'len' field refers to the individual fragment. */ +#define NS_TXMON 0x0040 + /* (monitor ports only) the packet comes from the TX + * ring of the monitored port + */ + #define NS_PORT_SHIFT 8 #define NS_PORT_MASK (0xff << NS_PORT_SHIFT) /* From owner-dev-commits-src-all@freebsd.org Mon Mar 29 16:41:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF05D57CECF; Mon, 29 Mar 2021 16:41:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8JHw4cHdz3v9t; Mon, 29 Mar 2021 16:41:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 915001677E; Mon, 29 Mar 2021 16:41:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TGfWqk081612; Mon, 29 Mar 2021 16:41:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TGfWvb081611; Mon, 29 Mar 2021 16:41:32 GMT (envelope-from git) Date: Mon, 29 Mar 2021 16:41:32 GMT Message-Id: <202103291641.12TGfWvb081611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: f8113f0a65ad - main - libnetmap: add support for the offset features MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8113f0a65ada9367bcbfa6e0d5d8a8451dd8ac2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 16:41:32 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=f8113f0a65ada9367bcbfa6e0d5d8a8451dd8ac2 commit f8113f0a65ada9367bcbfa6e0d5d8a8451dd8ac2 Author: Vincenzo Maffione AuthorDate: 2021-03-29 16:38:37 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-29 16:38:37 +0000 libnetmap: add support for the offset features The companion libnetmap changes for the "offsets" kernel support added in a6d768d845c173823785c. This includes code to parse the "@offset=NNN" option that can be appended to the port name by any nmport_* application. Example: # pkt-gen -i 'netmap:em0@offset=16' --- lib/libnetmap/libnetmap.h | 57 +++++++++++++++++++++++++++++++++ lib/libnetmap/nmctx.c | 1 + lib/libnetmap/nmport.c | 80 +++++++++++++++++++++++++++++++++++++++++++++-- lib/libnetmap/nmreq.c | 21 ++++++------- 4 files changed, 144 insertions(+), 15 deletions(-) diff --git a/lib/libnetmap/libnetmap.h b/lib/libnetmap/libnetmap.h index 0367a1735c4f..ff03babc04b1 100644 --- a/lib/libnetmap/libnetmap.h +++ b/lib/libnetmap/libnetmap.h @@ -151,6 +151,22 @@ struct nmem_d; * causing netmap to take the corresponding values from * the priv_{if,ring,buf}_{num,size} sysctls. * + * offset (multi-key) + * reserve (part of) the ptr fields as an offset field + * and write an initial offset into them. + * + * The keys are: + * + * bits number of bits of ptr to use + * *initial initial offset value + * + * initial must be assigned. If bits is omitted, it + * defaults to the entire ptr field. The max offset is set + * at the same value as the initial offset. Note that the + * actual values may be increased by the kernel. + * + * This option is disabled by default (see + * nmport_enable_option() below) */ @@ -398,6 +414,47 @@ int nmport_extmem_from_file(struct nmport_d *d, const char *fname); struct nmreq_pools_info* nmport_extmem_getinfo(struct nmport_d *d); +/* nmport_offset - use offsets for this port + * @initial the initial offset for all the slots + * @maxoff the maximum offset + * @bits the number of bits of slot->ptr to use for the offsets + * @mingap the minimum gap betwen offsets (in shared buffers) + * + * With this option the lower @bits bits of the ptr field in the netmap_slot + * can be used to specify an offset into the buffer. All offsets will be set + * to the @initial value by netmap. + * + * The offset field can be read and updated using the bitmask found in + * ring->offset_mask after a successful register. netmap_user.h contains + * some helper macros (NETMAP_ROFFSET, NETMAP_WOFFSET and NETMAP_BUF_OFFSET). + * + * For RX rings, the user writes the offset o in an empty slot before passing + * it to netmap; then, netmap will write the incoming packet at an offset o' >= + * o in the buffer. o' may be larger than o because of, e.g., alignment + * constrains. If o' > o netmap will also update the offset field in the slot. + * Note that large offsets may cause the port to split the packet over several + * slots, setting the NS_MOREFRAG flag accordingly. + * + * For TX rings, the user may prepare the packet to send at an offset o into + * the buffer and write o in the offset field. Netmap will send the packets + * starting o bytes in the buffer. Note that the address of the packet must + * comply with any alignment constraints that the port may have, or the result + * will be undefined. The user may read the alignment constraint in the new + * ring->buf_align field. It is also possibile that empty slots already come + * with a non-zero offset o specified in the offset field. In this case, the + * user will have to write the packet at an offset o' >= o. + * + * The user must also declare the @maxoff offset that she is going to use. Any + * offset larger than this will be truncated. + * + * The user may also declare a @mingap (ignored if zero) if she plans to use + * offsets to share the same buffer among several slots. Netmap will guarantee + * that it will never write more than @mingap bytes for each slot, irrespective + * of the buffer length. + */ +int nmport_offset(struct nmport_d *d, uint64_t initial, uint64_t maxoff, + uint64_t bits, uint64_t mingap); + /* enable/disable options * * These functions can be used to disable options that the application cannot diff --git a/lib/libnetmap/nmctx.c b/lib/libnetmap/nmctx.c index 5f2c8c32febd..f5288e58fa9f 100644 --- a/lib/libnetmap/nmctx.c +++ b/lib/libnetmap/nmctx.c @@ -47,6 +47,7 @@ static void nmctx_default_error(struct nmctx *ctx, const char *errmsg) { + (void)ctx; fprintf(stderr, "%s\n", errmsg); } diff --git a/lib/libnetmap/nmport.c b/lib/libnetmap/nmport.c index a3fd7e87100f..58267bd8e9b1 100644 --- a/lib/libnetmap/nmport.c +++ b/lib/libnetmap/nmport.c @@ -178,6 +178,7 @@ struct nmport_extmem_from_file_cleanup_d { void nmport_extmem_from_file_cleanup(struct nmport_cleanup_d *c, struct nmport_d *d) { + (void)d; struct nmport_extmem_from_file_cleanup_d *cc = (struct nmport_extmem_from_file_cleanup_d *)c; @@ -247,6 +248,59 @@ nmport_extmem_getinfo(struct nmport_d *d) return &d->extmem->nro_info; } +struct nmport_offset_cleanup_d { + struct nmport_cleanup_d up; + struct nmreq_opt_offsets *opt; +}; + +static void +nmport_offset_cleanup(struct nmport_cleanup_d *c, + struct nmport_d *d) +{ + struct nmport_offset_cleanup_d *cc = + (struct nmport_offset_cleanup_d *)c; + + nmreq_remove_option(&d->hdr, &cc->opt->nro_opt); + nmctx_free(d->ctx, cc->opt); +} + +int +nmport_offset(struct nmport_d *d, uint64_t initial, + uint64_t maxoff, uint64_t bits, uint64_t mingap) +{ + struct nmctx *ctx = d->ctx; + struct nmreq_opt_offsets *opt; + struct nmport_offset_cleanup_d *clnup = NULL; + + clnup = nmctx_malloc(ctx, sizeof(*clnup)); + if (clnup == NULL) { + nmctx_ferror(ctx, "cannot allocate cleanup descriptor"); + errno = ENOMEM; + return -1; + } + + opt = nmctx_malloc(ctx, sizeof(*opt)); + if (opt == NULL) { + nmctx_ferror(ctx, "%s: cannot allocate offset option", d->hdr.nr_name); + nmctx_free(ctx, clnup); + errno = ENOMEM; + return -1; + } + memset(opt, 0, sizeof(*opt)); + opt->nro_opt.nro_reqtype = NETMAP_REQ_OPT_OFFSETS; + opt->nro_offset_bits = bits; + opt->nro_initial_offset = initial; + opt->nro_max_offset = maxoff; + opt->nro_min_gap = mingap; + nmreq_push_option(&d->hdr, &opt->nro_opt); + + clnup->up.cleanup = nmport_offset_cleanup; + clnup->opt = opt; + nmport_push_cleanup(d, &clnup->up); + + return 0; +} + /* head of the list of options */ static struct nmreq_opt_parser *nmport_opt_parsers; @@ -327,6 +381,9 @@ NPOPT_DECL(conf, 0) NPKEY_DECL(conf, host_rx_rings, 0) NPKEY_DECL(conf, tx_slots, 0) NPKEY_DECL(conf, rx_slots, 0) +NPOPT_DECL(offset, NMREQ_OPTF_DISABLED) + NPKEY_DECL(offset, initial, NMREQ_OPTK_DEFAULT|NMREQ_OPTK_MUSTSET) + NPKEY_DECL(offset, bits, 0) static int @@ -432,6 +489,23 @@ NPOPT_PARSER(conf)(struct nmreq_parse_ctx *p) return 0; } +static int +NPOPT_PARSER(offset)(struct nmreq_parse_ctx *p) +{ + struct nmport_d *d; + uint64_t initial, bits; + + d = p->token; + + initial = atoi(nmport_key(p, offset, initial)); + bits = 0; + if (nmport_key(p, offset, bits) != NULL) + bits = atoi(nmport_key(p, offset, bits)); + + return nmport_offset(d, initial, initial, bits, 0); +} + + void nmport_disable_option(const char *opt) { @@ -586,7 +660,7 @@ nmport_mmap(struct nmport_d *d) struct nmctx *ctx = d->ctx; struct nmem_d *m = NULL; u_int num_tx, num_rx; - int i; + unsigned int i; if (d->mmap_done) { errno = EINVAL; @@ -643,7 +717,7 @@ nmport_mmap(struct nmport_d *d) num_tx = d->reg.nr_tx_rings + d->nifp->ni_host_tx_rings; for (i = 0; i < num_tx && !d->nifp->ring_ofs[i]; i++) ; - d->first_tx_ring = i; + d->cur_tx_ring = d->first_tx_ring = i; for ( ; i < num_tx && d->nifp->ring_ofs[i]; i++) ; d->last_tx_ring = i - 1; @@ -651,7 +725,7 @@ nmport_mmap(struct nmport_d *d) num_rx = d->reg.nr_rx_rings + d->nifp->ni_host_rx_rings; for (i = 0; i < num_rx && !d->nifp->ring_ofs[i + num_tx]; i++) ; - d->first_rx_ring = i; + d->cur_rx_ring = d->first_rx_ring = i; for ( ; i < num_rx && d->nifp->ring_ofs[i + num_tx]; i++) ; d->last_rx_ring = i - 1; diff --git a/lib/libnetmap/nmreq.c b/lib/libnetmap/nmreq.c index 7f4b2703d22d..39ee53c818c5 100644 --- a/lib/libnetmap/nmreq.c +++ b/lib/libnetmap/nmreq.c @@ -603,9 +603,10 @@ nmreq_options_decode(const char *opt, struct nmreq_opt_parser parsers[], struct nmreq_option * nmreq_find_option(struct nmreq_header *h, uint32_t t) { - struct nmreq_option *o = NULL; + struct nmreq_option *o; - nmreq_foreach_option(h, o) { + for (o = (struct nmreq_option *)h->nr_options; o != NULL; + o = (struct nmreq_option *)o->nro_next) { if (o->nro_reqtype == t) break; } @@ -615,10 +616,10 @@ nmreq_find_option(struct nmreq_header *h, uint32_t t) void nmreq_remove_option(struct nmreq_header *h, struct nmreq_option *o) { - struct nmreq_option **nmo; + struct nmreq_option **nmo; for (nmo = (struct nmreq_option **)&h->nr_options; *nmo != NULL; - nmo = (struct nmreq_option **)&(*nmo)->nro_next) { + nmo = (struct nmreq_option **)&(*nmo)->nro_next) { if (*nmo == o) { *((uint64_t *)(*nmo)) = o->nro_next; o->nro_next = (uint64_t)(uintptr_t)NULL; @@ -632,14 +633,8 @@ nmreq_free_options(struct nmreq_header *h) { struct nmreq_option *o, *next; - /* - * Note: can't use nmreq_foreach_option() here; it frees the - * list as it's walking and nmreq_foreach_option() isn't - * modification-safe. - */ - for (o = (struct nmreq_option *)(uintptr_t)h->nr_options; o != NULL; - o = next) { - next = (struct nmreq_option *)(uintptr_t)o->nro_next; + for (o = (struct nmreq_option *)h->nr_options; o != NULL; o = next) { + next = (struct nmreq_option *)o->nro_next; free(o); } } @@ -656,6 +651,8 @@ nmreq_option_name(uint32_t nro_reqtype) return "csb"; case NETMAP_REQ_OPT_SYNC_KLOOP_MODE: return "sync-kloop-mode"; + case NETMAP_REQ_OPT_OFFSETS: + return "offsets"; default: return "unknown"; } From owner-dev-commits-src-all@freebsd.org Mon Mar 29 17:28:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6DD057E2C7; Mon, 29 Mar 2021 17:28:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8KKf6D6mz4S2X; Mon, 29 Mar 2021 17:28:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C86CE16EE3; Mon, 29 Mar 2021 17:28:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12THS6fX042208; Mon, 29 Mar 2021 17:28:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12THS6e6042207; Mon, 29 Mar 2021 17:28:06 GMT (envelope-from git) Date: Mon, 29 Mar 2021 17:28:06 GMT Message-Id: <202103291728.12THS6e6042207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4d5460a720c5 - main - bhyve: Enable virtio-scsi legacy config parsing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d5460a720c59a4404eb1df1b768d2f16b2f341a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 17:28:07 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4d5460a720c59a4404eb1df1b768d2f16b2f341a commit 4d5460a720c59a4404eb1df1b768d2f16b2f341a Author: John Baldwin AuthorDate: 2021-03-29 17:25:45 +0000 Commit: John Baldwin CommitDate: 2021-03-29 17:25:45 +0000 bhyve: Enable virtio-scsi legacy config parsing. The previous commit added the handler to parse the command line options for virtio-scsi devices but forgot to set the correct function pointer to point to the handler. Reported by: vangyzen Reviewed by: vangyzen Fixes: 621b5090487de9fed1b503769702a9a2a27cc7bb Differential Revision: https://reviews.freebsd.org/D29438 --- usr.sbin/bhyve/pci_virtio_scsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index 8edf64a11361..eee9847494dc 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -739,6 +739,7 @@ pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) struct pci_devemu pci_de_vscsi = { .pe_emu = "virtio-scsi", .pe_init = pci_vtscsi_init, + .pe_legacy_config = pci_vtscsi_legacy_config, .pe_barwrite = vi_pci_write, .pe_barread = vi_pci_read }; From owner-dev-commits-src-all@freebsd.org Mon Mar 29 20:10:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 059145A9BAD; Mon, 29 Mar 2021 20:10:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8Nx56nrRz4cJk; Mon, 29 Mar 2021 20:10:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC38919741; Mon, 29 Mar 2021 20:10:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TKAX7C092322; Mon, 29 Mar 2021 20:10:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TKAXsP092321; Mon, 29 Mar 2021 20:10:33 GMT (envelope-from git) Date: Mon, 29 Mar 2021 20:10:33 GMT Message-Id: <202103292010.12TKAXsP092321@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: e61b29ab5d2d - main - nfsv4.1/4.2 client: fix handling of delegations for "oneopenown" mnt option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 20:10:34 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650 commit e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650 Author: Rick Macklem AuthorDate: 2021-03-29 19:09:19 +0000 Commit: Rick Macklem CommitDate: 2021-03-29 19:09:19 +0000 nfsv4.1/4.2 client: fix handling of delegations for "oneopenown" mnt option If a delegation for a file has been acquired, the "oneopenown" option was ignored when the local open was issued. This could result in multiple openowners/opens for a file, that would be transferred to the server when the delegation was recalled. This would not be serious, but could result in more than one openowner. Since the Amazon/EFS does not issue delegations, this probably never occurs in practice. Spotted during code inspection. This small patch fixes the code so that it checks for "oneopenown" when doing client local opens on a delegation. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 4e3abf82c96a..1e4625191bfe 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -267,17 +267,15 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t amode, int usedeleg, } } - if (dp != NULL) { + /* For NFSv4.1/4.2 and this option, use a single open_owner. */ + if (NFSHASONEOPENOWN(VFSTONFS(vp->v_mount))) + nfscl_filllockowner(NULL, own, F_POSIX); + else nfscl_filllockowner(p->td_proc, own, F_POSIX); + if (dp != NULL) ohp = &dp->nfsdl_owner; - } else { - /* For NFSv4.1 and this option, use a single open_owner. */ - if (NFSHASONEOPENOWN(VFSTONFS(vp->v_mount))) - nfscl_filllockowner(NULL, own, F_POSIX); - else - nfscl_filllockowner(p->td_proc, own, F_POSIX); + else ohp = &clp->nfsc_owner; - } /* Now, search for an openowner */ LIST_FOREACH(owp, ohp, nfsow_list) { if (!NFSBCMP(owp->nfsow_owner, own, NFSV4CL_LOCKNAMELEN)) From owner-dev-commits-src-all@freebsd.org Mon Mar 29 20:41:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A17E5AABE8; Mon, 29 Mar 2021 20:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8PcH3Yvcz4fJW; Mon, 29 Mar 2021 20:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D35F19BAD; Mon, 29 Mar 2021 20:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TKf31x035286; Mon, 29 Mar 2021 20:41:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TKf3ro035285; Mon, 29 Mar 2021 20:41:03 GMT (envelope-from git) Date: Mon, 29 Mar 2021 20:41:03 GMT Message-Id: <202103292041.12TKf3ro035285@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: befb0817bd5e - main - powerpc: implement bus_map_resource and bus_unmap_resource DEVMETHODs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: befb0817bd5e47588eb0254744daec02488acd72 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 20:41:03 -0000 The branch main has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=befb0817bd5e47588eb0254744daec02488acd72 commit befb0817bd5e47588eb0254744daec02488acd72 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-03-29 23:28:32 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-03-29 23:28:32 +0000 powerpc: implement bus_map_resource and bus_unmap_resource DEVMETHODs Implements bus_map_resource and bus_unmap_resource DEVMETHODs to be used by powerpc targets. This is identical to the amd64 code. Required by virtio-modern. Reviewed by: bryanv Sponsored by: Eldorado Research Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28012 --- sys/powerpc/powerpc/nexus.c | 95 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c index 34ec3c0fe0ab..b3fe5a3e1527 100644 --- a/sys/powerpc/powerpc/nexus.c +++ b/sys/powerpc/powerpc/nexus.c @@ -69,6 +69,13 @@ static bus_setup_intr_t nexus_setup_intr; static bus_teardown_intr_t nexus_teardown_intr; static bus_activate_resource_t nexus_activate_resource; static bus_deactivate_resource_t nexus_deactivate_resource; +static int nexus_map_resource(device_t bus, device_t child, int type, + struct resource *r, + struct resource_map_request *argsp, + struct resource_map *map); +static int nexus_unmap_resource(device_t bus, device_t child, int type, + struct resource *r, struct resource_map *map); + static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); static int nexus_get_cpus(device_t, device_t, enum cpu_sets, size_t, cpuset_t *); @@ -87,6 +94,8 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_activate_resource, nexus_activate_resource), DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), + DEVMETHOD(bus_map_resource, nexus_map_resource), + DEVMETHOD(bus_unmap_resource, nexus_unmap_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), #ifdef SMP @@ -268,3 +277,89 @@ nexus_deactivate_resource(device_t bus __unused, device_t child __unused, return (rman_deactivate_resource(r)); } + + +static int +nexus_map_resource(device_t bus, device_t child, int type, struct resource *r, + struct resource_map_request *argsp, struct resource_map *map) +{ + + struct resource_map_request args; + rman_res_t end, length, start; + + /* Resources must be active to be mapped. */ + if (!(rman_get_flags(r) & RF_ACTIVE)) + return (ENXIO); + + /* Mappings are only supported on I/O and memory resources. */ + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + break; + default: + return (EINVAL); + } + + resource_init_map_request(&args); + if (argsp != NULL) + bcopy(argsp, &args, imin(argsp->size, args.size)); + + start = rman_get_start(r) + args.offset; + if (args.length == 0) + length = rman_get_size(r); + else + length = args.length; + + end = start + length - 1; + if (start > rman_get_end(r) || start < rman_get_start(r)) + return (EINVAL); + + if (end > rman_get_end(r) || end < start) + return (EINVAL); + + /* + * If this is a memory resource, map it into the kernel. + */ + switch (type) { + case SYS_RES_IOPORT: + panic("%s:%d SYS_RES_IOPORT handling not implemented", __func__, __LINE__); + /* XXX: untested + map->r_bushandle = start; + map->r_bustag = nexus_get_bus_tag(NULL, NULL); + map->r_size = length; + map->r_vaddr = NULL; + */ + break; + case SYS_RES_MEMORY: + map->r_vaddr = pmap_mapdev_attr(start, length, args.memattr); + map->r_bustag = nexus_get_bus_tag(NULL, NULL); + map->r_size = length; + map->r_bushandle = (bus_space_handle_t)map->r_vaddr; + break; + } + + return (0); + +} + +static int +nexus_unmap_resource(device_t bus, device_t child, int type, struct resource *r, + struct resource_map *map) +{ + + /* + * If this is a memory resource, unmap it. + */ + switch (type) { + case SYS_RES_MEMORY: + pmap_unmapdev((vm_offset_t)map->r_vaddr, map->r_size); + /* FALLTHROUGH */ + case SYS_RES_IOPORT: + break; + default: + return (EINVAL); + } + + return (0); + +} From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:11:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B1155AD4AA; Mon, 29 Mar 2021 22:11:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8Rd92fwGz4mB8; Mon, 29 Mar 2021 22:11:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43B851B1F1; Mon, 29 Mar 2021 22:11:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMBvPK062184; Mon, 29 Mar 2021 22:11:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMBvMf062183; Mon, 29 Mar 2021 22:11:57 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:11:57 GMT Message-Id: <202103292211.12TMBvMf062183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 57d7992b50ba - stable/13 - amd64: Only update fsbase/gsbase in pcb for curthread. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57d7992b50ba36290422bd208d45033de8946307 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:11:57 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=57d7992b50ba36290422bd208d45033de8946307 commit 57d7992b50ba36290422bd208d45033de8946307 Author: John Baldwin AuthorDate: 2021-03-12 17:45:18 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:09:26 +0000 amd64: Only update fsbase/gsbase in pcb for curthread. Before the pcb is copied to the new thread during cpu_fork() and cpu_copy_thread(), the kernel re-reads the current register values in case they are stale. This is done by setting PCB_FULL_IRET in pcb_flags. This works fine for user threads, but the creation of kernel processes and kernel threads do not follow the normal synchronization rules for pcb_flags. Specifically, new kernel processes are always forked from thread0, not from curthread, so adjusting pcb_flags via a simple instruction without the LOCK prefix can race with thread0 running on another CPU. Similarly, kthread_add() clones from the first thread in the relevant kernel process, not from curthread. In practice, Netflix encountered a panic where the pcb_flags in the first kthread of the KTLS process were trashed due to update_pcb_bases() in cpu_copy_thread() running from thread0 to create one of the other KTLS threads racing with the first KTLS kthread calling fpu_kern_thread() on another CPU. In the panicking case, the write to update pcb_flags in fpu_kern_thread() was lost triggering an "Unregistered use of FPU in kernel" panic when the first KTLS kthread later tried to use the FPU. Sponsored by: Netflix (cherry picked from commit 92211458689b448cda52a659f9d192fef5a9dd50) --- sys/amd64/amd64/vm_machdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 1d9eacd8a8b8..76f7f400dd9c 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -166,7 +166,8 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Ensure that td1's pcb is up to date. */ fpuexit(td1); - update_pcb_bases(td1->td_pcb); + if (td1 == curthread) + update_pcb_bases(td1->td_pcb); /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); @@ -568,7 +569,8 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Those not loaded individually below get their default * values here. */ - update_pcb_bases(td0->td_pcb); + if (td0 == curthread) + update_pcb_bases(td0->td_pcb); bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | PCB_KERNFPU); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:11:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BA1F5AD176; Mon, 29 Mar 2021 22:11:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8RdB2z3Yz4mGk; Mon, 29 Mar 2021 22:11:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56F221B1F2; Mon, 29 Mar 2021 22:11:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMBwge062230; Mon, 29 Mar 2021 22:11:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMBwFR062224; Mon, 29 Mar 2021 22:11:58 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:11:58 GMT Message-Id: <202103292211.12TMBwFR062224@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 77dfa7cfafb7 - stable/13 - amd64: Cleanups to setting TLS registers for Linux binaries. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 77dfa7cfafb7afb6095f6f4ff30c4c22646b4989 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:11:58 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=77dfa7cfafb7afb6095f6f4ff30c4c22646b4989 commit 77dfa7cfafb7afb6095f6f4ff30c4c22646b4989 Author: John Baldwin AuthorDate: 2021-03-12 17:47:31 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:09:41 +0000 amd64: Cleanups to setting TLS registers for Linux binaries. - Use update_pcb_bases() when updating FS or GS base addresses to permit use of FSBASE and GSBASE in Linux processes. This also sets PCB_FULL_IRET. linux32 was setting PCB_32BIT which should be a no-op (exec sets it). - Remove write-only variables to construct unused segment descriptors for linux32. Sponsored by: Netflix (cherry picked from commit 704547ce1ca56e1123048cd152ed4e468d41d703) --- sys/amd64/linux/linux_machdep.c | 5 +++-- sys/amd64/linux32/linux32_machdep.c | 21 ++------------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index c2aebcf7df19..1a9d79b0c1ba 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -251,7 +251,7 @@ linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) switch (args->code) { case LINUX_ARCH_SET_GS: if (args->addr < VM_MAXUSER_ADDRESS) { - set_pcb_flags(pcb, PCB_FULL_IRET); + update_pcb_bases(pcb); pcb->pcb_gsbase = args->addr; td->td_frame->tf_gs = _ugssel; error = 0; @@ -260,7 +260,7 @@ linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) break; case LINUX_ARCH_SET_FS: if (args->addr < VM_MAXUSER_ADDRESS) { - set_pcb_flags(pcb, PCB_FULL_IRET); + update_pcb_bases(pcb); pcb->pcb_fsbase = args->addr; td->td_frame->tf_fs = _ufssel; error = 0; @@ -290,6 +290,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) return (EPERM); pcb = td->td_pcb; + update_pcb_bases(pcb); pcb->pcb_fsbase = (register_t)desc; td->td_frame->tf_fs = _ufssel; diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 1883b18eeb60..fde180d74d73 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -394,11 +394,9 @@ linux_old_select(struct thread *td, struct linux_old_select_args *args) int linux_set_cloned_tls(struct thread *td, void *desc) { - struct user_segment_descriptor sd; struct l_user_desc info; struct pcb *pcb; int error; - int a[2]; error = copyin(desc, &info, sizeof(struct l_user_desc)); if (error) { @@ -410,14 +408,10 @@ linux_set_cloned_tls(struct thread *td, void *desc) if (error) linux_msg(td, "set_cloned_tls copyout info failed!"); - a[0] = LINUX_LDT_entry_a(&info); - a[1] = LINUX_LDT_entry_b(&info); - - memcpy(&sd, &a, sizeof(a)); pcb = td->td_pcb; + update_pcb_bases(pcb); pcb->pcb_gsbase = (register_t)info.base_addr; td->td_frame->tf_gs = GSEL(GUGS32_SEL, SEL_UPL); - set_pcb_flags(pcb, PCB_32BIT); } return (error); @@ -668,9 +662,7 @@ linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args) { struct l_user_desc info; - struct user_segment_descriptor sd; struct pcb *pcb; - int a[2]; int error; error = copyin(args->desc, &info, sizeof(struct l_user_desc)); @@ -721,18 +713,9 @@ linux_set_thread_area(struct thread *td, if (error) return (error); - if (LINUX_LDT_empty(&info)) { - a[0] = 0; - a[1] = 0; - } else { - a[0] = LINUX_LDT_entry_a(&info); - a[1] = LINUX_LDT_entry_b(&info); - } - - memcpy(&sd, &a, sizeof(a)); pcb = td->td_pcb; + update_pcb_bases(pcb); pcb->pcb_gsbase = (register_t)info.base_addr; - set_pcb_flags(pcb, PCB_32BIT); update_gdt_gsbase(td, info.base_addr); return (0); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:12:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04C615ACFFB; Mon, 29 Mar 2021 22:11:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8RdC3wNjz4mK9; Mon, 29 Mar 2021 22:11:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72B261B218; Mon, 29 Mar 2021 22:11:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMBxiW063677; Mon, 29 Mar 2021 22:11:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMBxst063664; Mon, 29 Mar 2021 22:11:59 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:11:59 GMT Message-Id: <202103292211.12TMBxst063664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 1ebb5d7920fe - stable/13 - x86: Copy the FPU/XSAVE state from the creating thread to new threads. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1ebb5d7920fea1b8bb849d07bf930bd579f0695c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:12:00 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1ebb5d7920fea1b8bb849d07bf930bd579f0695c commit 1ebb5d7920fea1b8bb849d07bf930bd579f0695c Author: John Baldwin AuthorDate: 2021-03-12 17:47:41 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:37 +0000 x86: Copy the FPU/XSAVE state from the creating thread to new threads. POSIX states that new threads created via pthread_create() should inherit the "floating point environment" from the creating thread. Sponsored by: Netflix (cherry picked from commit 755efb8d8fcacc6607bc46469750d78497f89378) --- sys/amd64/amd64/vm_machdep.c | 10 ++++++---- sys/i386/i386/vm_machdep.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 76f7f400dd9c..f10d0339a65a 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -564,16 +564,18 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2 = td->td_pcb; + /* Ensure that td0's pcb is up to date. */ + fpuexit(td0); + if (td0 == curthread) + update_pcb_bases(td0->td_pcb); + /* * Copy the upcall pcb. This loads kernel regs. * Those not loaded individually below get their default * values here. */ - if (td0 == curthread) - update_pcb_bases(td0->td_pcb); bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU); + clear_pcb_flags(pcb2, PCB_KERNFPU); pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, cpu_max_ext_state_size); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index d3182cb224bf..502de6e7f38f 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -428,14 +428,21 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* Point the pcb to the top of the stack. */ pcb2 = td->td_pcb; + /* Ensure that td0's pcb is up to date. */ + if (td0 == curthread) + td0->td_pcb->pcb_gs = rgs(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td0) + npxsave(td0->td_pcb->pcb_save); + critical_exit(); + /* * Copy the upcall pcb. This loads kernel regs. * Those not loaded individually below get their default * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX); + pcb2->pcb_flags &= ~PCB_KERNNPX; pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, cpu_max_ext_state_size); @@ -463,7 +470,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */ pcb2->pcb_ebx = (int)td; /* trampoline arg */ pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - pcb2->pcb_gs = rgs(); /* * If we didn't copy the pcb, we'd need to do the following registers: * pcb2->pcb_cr3: cloned above. From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:12:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C40895AD17E; Mon, 29 Mar 2021 22:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8RdF3vZpz4mKH; Mon, 29 Mar 2021 22:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E30A1B219; Mon, 29 Mar 2021 22:12:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMC0JH064608; Mon, 29 Mar 2021 22:12:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC0Yb064607; Mon, 29 Mar 2021 22:12:00 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:00 GMT Message-Id: <202103292212.12TMC0Yb064607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 1a325aa20403 - stable/13 - Remove unused wrappers around kproc_create() and kproc_exit(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1a325aa2040385c12555b3dbb599b7fa9edc1bf5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:12:02 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1a325aa2040385c12555b3dbb599b7fa9edc1bf5 commit 1a325aa2040385c12555b3dbb599b7fa9edc1bf5 Author: John Baldwin AuthorDate: 2021-03-12 17:47:58 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:43 +0000 Remove unused wrappers around kproc_create() and kproc_exit(). Sponsored by: Netflix (cherry picked from commit 645b15e558dc102ff70a6332b1d0b0aa733fd2bb) --- sys/dev/mpr/mprvar.h | 4 ---- sys/dev/mps/mpsvar.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h index ce755188d706..5abcdd5d4299 100644 --- a/sys/dev/mpr/mprvar.h +++ b/sys/dev/mpr/mprvar.h @@ -913,10 +913,6 @@ int mprsas_send_reset(struct mpr_softc *sc, struct mpr_command *tm, SYSCTL_DECL(_hw_mpr); /* Compatibility shims for different OS versions */ -#define mpr_kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ - kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) -#define mpr_kproc_exit(arg) kproc_exit(arg) - #if defined(CAM_PRIORITY_XPT) #define MPR_PRIORITY_XPT CAM_PRIORITY_XPT #else diff --git a/sys/dev/mps/mpsvar.h b/sys/dev/mps/mpsvar.h index 2029b570c01d..6e6c9fd28c2b 100644 --- a/sys/dev/mps/mpsvar.h +++ b/sys/dev/mps/mpsvar.h @@ -831,10 +831,6 @@ int mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, SYSCTL_DECL(_hw_mps); /* Compatibility shims for different OS versions */ -#define mps_kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ - kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) -#define mps_kproc_exit(arg) kproc_exit(arg) - #if defined(CAM_PRIORITY_XPT) #define MPS_PRIORITY_XPT CAM_PRIORITY_XPT #else From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:12:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D28375AD69F; Mon, 29 Mar 2021 22:12:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8RdM6gflz4lxp; Mon, 29 Mar 2021 22:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D1C91B1F6; Mon, 29 Mar 2021 22:12:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMC5UO064692; Mon, 29 Mar 2021 22:12:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC5kA064691; Mon, 29 Mar 2021 22:12:05 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:05 GMT Message-Id: <202103292212.12TMC5kA064691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: d8debda0d0a3 - stable/13 - x86: Update some stale comments in cpu_fork() and cpu_copy_thread(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d8debda0d0a324c0925f23227514301eb7670b26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:12:12 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d8debda0d0a324c0925f23227514301eb7670b26 commit d8debda0d0a324c0925f23227514301eb7670b26 Author: John Baldwin AuthorDate: 2021-03-12 17:48:49 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:11:03 +0000 x86: Update some stale comments in cpu_fork() and cpu_copy_thread(). Neither of these routines allocate stacks. Sponsored by: Netflix (cherry picked from commit 40d593d17eb6d70ea717d6546a16794858944176) --- sys/amd64/amd64/vm_machdep.c | 6 ++++-- sys/i386/i386/vm_machdep.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 6e60f2b3faff..a17ddd4ba6d8 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -198,7 +198,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); /* - * Create a new fresh stack for the new process. * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. */ @@ -606,7 +605,10 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* - * Create a new fresh stack for the new thread. + * Copy user general-purpose registers. + * + * Some of these registers are rewritten by cpu_set_upcall() + * and linux_set_upcall_kse(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 471128e1713d..5947ae5a6d15 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -205,7 +205,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); /* - * Create a new fresh stack for the new process. * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. * The -VM86_STACK_SPACE (-16) is so we can expand the trapframe @@ -473,7 +472,10 @@ cpu_copy_thread(struct thread *td, struct thread *td0) } /* - * Create a new fresh stack for the new thread. + * Copy user general-purpose registers. + * + * Some of these registers are rewritten by cpu_set_upcall() + * and linux_set_upcall_kse(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:12:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59A915AD70A; Mon, 29 Mar 2021 22:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8RdJ3Qctz4mKW; Mon, 29 Mar 2021 22:12:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC4D91AD51; Mon, 29 Mar 2021 22:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMC2Uh064650; Mon, 29 Mar 2021 22:12:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC2CD064649; Mon, 29 Mar 2021 22:12:02 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:02 GMT Message-Id: <202103292212.12TMC2CD064649@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 053eb17635e1 - stable/13 - Set TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 053eb17635e19c5cfe8140d0d33dd9330bf6bc22 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:12:07 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=053eb17635e19c5cfe8140d0d33dd9330bf6bc22 commit 053eb17635e19c5cfe8140d0d33dd9330bf6bc22 Author: John Baldwin AuthorDate: 2021-03-12 17:48:20 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:54 +0000 Set TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread(). This permits these routines to use special logic for initializing MD kthread state. For the kproc case, this required moving the logic to set these flags from kproc_create() into do_fork(). Sponsored by: Netflix (cherry picked from commit 640d54045bdbf894ae3c75cd9818c29fc2f6e5e7) --- sys/kern/kern_fork.c | 12 ++++++++++-- sys/kern/kern_kthread.c | 17 +++++------------ sys/sys/proc.h | 1 + 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 870ae494de5d..3da8205d8ab0 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -497,9 +497,12 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * } else { sigacts_copy(newsigacts, p1->p_sigacts); p2->p_sigacts = newsigacts; - if ((fr->fr_flags2 & FR2_DROPSIG_CAUGHT) != 0) { + if ((fr->fr_flags2 & (FR2_DROPSIG_CAUGHT | FR2_KPROC)) != 0) { mtx_lock(&p2->p_sigacts->ps_mtx); - sig_drop_caught(p2); + if ((fr->fr_flags2 & FR2_DROPSIG_CAUGHT) != 0) + sig_drop_caught(p2); + if ((fr->fr_flags2 & FR2_KPROC) != 0) + p2->p_sigacts->ps_flag |= PS_NOCLDWAIT; mtx_unlock(&p2->p_sigacts->ps_mtx); } } @@ -511,6 +514,11 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * else p2->p_sigparent = SIGCHLD; + if ((fr->fr_flags2 & FR2_KPROC) != 0) { + p2->p_flag |= P_SYSTEM | P_KPROC; + td2->td_pflags |= TDP_KTHREAD; + } + p2->p_textvp = p1->p_textvp; p2->p_fd = fd; p2->p_fdtol = fdtol; diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index d049a099847c..32832bde2f53 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -95,6 +95,7 @@ kproc_create(void (*func)(void *), void *arg, bzero(&fr, sizeof(fr)); fr.fr_flags = RFMEM | RFFDG | RFPROC | RFSTOPPED | flags; + fr.fr_flags2 = FR2_KPROC; fr.fr_pages = pages; fr.fr_procp = &p2; error = fork1(&thread0, &fr); @@ -105,21 +106,11 @@ kproc_create(void (*func)(void *), void *arg, if (newpp != NULL) *newpp = p2; - /* this is a non-swapped system process */ - PROC_LOCK(p2); - td = FIRST_THREAD_IN_PROC(p2); - p2->p_flag |= P_SYSTEM | P_KPROC; - td->td_pflags |= TDP_KTHREAD; - mtx_lock(&p2->p_sigacts->ps_mtx); - p2->p_sigacts->ps_flag |= PS_NOCLDWAIT; - mtx_unlock(&p2->p_sigacts->ps_mtx); - PROC_UNLOCK(p2); - /* set up arg0 for 'ps', et al */ va_start(ap, fmt); vsnprintf(p2->p_comm, sizeof(p2->p_comm), fmt, ap); va_end(ap); - /* set up arg0 for 'ps', et al */ + td = FIRST_THREAD_IN_PROC(p2); va_start(ap, fmt); vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap); va_end(ap); @@ -295,12 +286,14 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p, TSTHREAD(newtd, newtd->td_name); newtd->td_proc = p; /* needed for cpu_copy_thread */ + newtd->td_pflags |= TDP_KTHREAD; + /* might be further optimized for kthread */ cpu_copy_thread(newtd, oldtd); + /* put the designated function(arg) as the resume context */ cpu_fork_kthread_handler(newtd, func, arg); - newtd->td_pflags |= TDP_KTHREAD; thread_cow_get_proc(newtd, p); /* this code almost the same as create_thread() in kern_thr.c */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 99257878c2e0..783c3896298c 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1043,6 +1043,7 @@ struct fork_req { int fr_flags2; #define FR2_DROPSIG_CAUGHT 0x00000001 /* Drop caught non-DFL signals */ #define FR2_SHARE_PATHS 0x00000002 /* Invert sense of RFFDG for paths */ +#define FR2_KPROC 0x00000004 /* Create a kernel process */ }; /* From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:12:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 742E95AD421; Mon, 29 Mar 2021 22:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8RdJ1PnFz4mKN; Mon, 29 Mar 2021 22:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B88E81AF58; Mon, 29 Mar 2021 22:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMC13U064629; Mon, 29 Mar 2021 22:12:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC1BZ064628; Mon, 29 Mar 2021 22:12:01 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:01 GMT Message-Id: <202103292212.12TMC1BZ064628@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: cc6d86f2ff9c - stable/13 - Don't pass RFPROC to kproc_create(), it is redundant. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cc6d86f2ff9c18f35fd7925d2b0785252af9b892 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:12:07 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cc6d86f2ff9c18f35fd7925d2b0785252af9b892 commit cc6d86f2ff9c18f35fd7925d2b0785252af9b892 Author: John Baldwin AuthorDate: 2021-03-12 17:48:10 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:49 +0000 Don't pass RFPROC to kproc_create(), it is redundant. Sponsored by: Netflix (cherry picked from commit 5a50eb6585ef8d1a40c8086bab8639cc56f00df9) --- sys/netinet/sctp_bsd_addr.c | 2 +- sys/netinet/sctp_pcb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c index aad84f71a678..2a00885d8ddd 100644 --- a/sys/netinet/sctp_bsd_addr.c +++ b/sys/netinet/sctp_bsd_addr.c @@ -108,7 +108,7 @@ sctp_startup_iterator(void) kproc_create(sctp_iterator_thread, (void *)NULL, &sctp_it_ctl.thread_proc, - RFPROC, + 0, SCTP_KTHREAD_PAGES, SCTP_KTRHEAD_NAME); } diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 4d09ad3a7353..f4264ab387f1 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -5678,7 +5678,7 @@ sctp_startup_mcore_threads(void) (void)kproc_create(sctp_mcore_thread, (void *)&sctp_mcore_workers[cpu], &sctp_mcore_workers[cpu].thread_proc, - RFPROC, + 0, SCTP_KTHREAD_PAGES, SCTP_MCORE_NAME); } From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:12:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57BA55AD3E7; Mon, 29 Mar 2021 22:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8RdL01Glz4mHG; Mon, 29 Mar 2021 22:12:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DAB11B21C; Mon, 29 Mar 2021 22:12:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMC3iU064671; Mon, 29 Mar 2021 22:12:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC3oX064670; Mon, 29 Mar 2021 22:12:03 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:03 GMT Message-Id: <202103292212.12TMC3oX064670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 60ae7f745da0 - stable/13 - x86: Always use clean FPU and segment base state for new kthreads. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 60ae7f745da0ec03f9a08b92f4db2fc9101b7123 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:12:10 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=60ae7f745da0ec03f9a08b92f4db2fc9101b7123 commit 60ae7f745da0ec03f9a08b92f4db2fc9101b7123 Author: John Baldwin AuthorDate: 2021-03-12 17:48:36 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:59 +0000 x86: Always use clean FPU and segment base state for new kthreads. Sponsored by: Netflix (cherry picked from commit c7b021352332a2f79907d68f971849f74b73e1c6) --- sys/amd64/amd64/vm_machdep.c | 46 +++++++++++++++++++++++++--------- sys/i386/i386/sys_machdep.c | 6 +++-- sys/i386/i386/vm_machdep.c | 59 +++++++++++++++++++++++++++++++------------- 3 files changed, 81 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index f10d0339a65a..6e60f2b3faff 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -164,10 +164,12 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date. */ - fpuexit(td1); - if (td1 == curthread) + /* Ensure that td1's pcb is up to date for user processes. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + fpuexit(td1); update_pcb_bases(td1->td_pcb); + } /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); @@ -178,8 +180,18 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Properly initialize pcb_save */ pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); + + /* Kernel processes start with clean FPU and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -564,10 +576,12 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2 = td->td_pcb; - /* Ensure that td0's pcb is up to date. */ - fpuexit(td0); - if (td0 == curthread) + /* Ensure that td0's pcb is up to date for user threads. */ + if ((td->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td0 == curthread); + fpuexit(td0); update_pcb_bases(td0->td_pcb); + } /* * Copy the upcall pcb. This loads kernel regs. @@ -575,12 +589,22 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - clear_pcb_flags(pcb2, PCB_KERNFPU); pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); + + /* Kernel threads start with clean FPU and segment bases. */ + if ((td->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, + cpu_max_ext_state_size); + } set_pcb_flags_raw(pcb2, PCB_FULL_IRET); + /* * Create a new fresh stack for the new thread. */ diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index 3f650b65e160..a0a1c273f467 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -108,7 +108,8 @@ set_fsbase(struct thread *td, uint32_t base) fill_based_sd(&sd, base); critical_enter(); td->td_pcb->pcb_fsd = sd; - PCPU_GET(fsgs_gdt)[0] = sd; + if (td == curthread) + PCPU_GET(fsgs_gdt)[0] = sd; critical_exit(); } @@ -120,7 +121,8 @@ set_gsbase(struct thread *td, uint32_t base) fill_based_sd(&sd, base); critical_enter(); td->td_pcb->pcb_gsd = sd; - PCPU_GET(fsgs_gdt)[1] = sd; + if (td == curthread) + PCPU_GET(fsgs_gdt)[1] = sd; critical_exit(); } diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 502de6e7f38f..471128e1713d 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -167,13 +167,15 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date. */ - if (td1 == curthread) + /* Ensure that td1's pcb is up to date for user processes. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); td1->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td1) - npxsave(td1->td_pcb->pcb_save); - critical_exit(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td1) + npxsave(td1->td_pcb->pcb_save); + critical_exit(); + } /* Point the pcb to the top of the stack */ pcb2 = get_pcb_td(td2); @@ -184,8 +186,19 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Properly initialize pcb_save */ pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); + + /* Kernel processes start with clean NPX and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td2, 0); + set_gsbase(td2, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -428,13 +441,15 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* Point the pcb to the top of the stack. */ pcb2 = td->td_pcb; - /* Ensure that td0's pcb is up to date. */ - if (td0 == curthread) + /* Ensure that td0's pcb is up to date for user threads. */ + if ((td->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td0 == curthread); td0->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td0) - npxsave(td0->td_pcb->pcb_save); - critical_exit(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td0) + npxsave(td0->td_pcb->pcb_save); + critical_exit(); + } /* * Copy the upcall pcb. This loads kernel regs. @@ -442,10 +457,20 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_flags &= ~PCB_KERNNPX; pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); + + /* Kernel threads start with clean NPX and segment bases. */ + if ((td->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td, 0); + set_gsbase(td, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, + cpu_max_ext_state_size); + } /* * Create a new fresh stack for the new thread. From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:16:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 333785AD9C8; Mon, 29 Mar 2021 22:16:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8RkD0ysbz4nGD; Mon, 29 Mar 2021 22:16:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13DAB1AEF7; Mon, 29 Mar 2021 22:16:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMGJuA065447; Mon, 29 Mar 2021 22:16:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMGJx3065446; Mon, 29 Mar 2021 22:16:19 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:16:19 GMT Message-Id: <202103292216.12TMGJx3065446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: fdc9b2d50fe9 - main - nfsv4 client: replace while loops with LIST_FOREACH() loops MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fdc9b2d50fe905b54afd773a2fc7fb9947508ddf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:16:20 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fdc9b2d50fe905b54afd773a2fc7fb9947508ddf commit fdc9b2d50fe905b54afd773a2fc7fb9947508ddf Author: Rick Macklem AuthorDate: 2021-03-29 21:14:51 +0000 Commit: Rick Macklem CommitDate: 2021-03-29 21:14:51 +0000 nfsv4 client: replace while loops with LIST_FOREACH() loops This patch replaces a couple of while() loops with LIST_FOREACH() loops. While here, declare a couple of variables "bool". I think LIST_FOREACH() is preferred and makes the code more readable. This also prepares the code for future changes to use a hash table of lists for open searches via file handle. This patch should not result in a semantics change. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 1e4625191bfe..6cb737606525 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -507,7 +507,8 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, struct nfsnode *np; struct nfsmount *nmp; u_int8_t own[NFSV4CL_LOCKNAMELEN]; - int error, done; + int error; + bool done; *lckpp = NULL; /* @@ -596,9 +597,8 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, if (op == NULL) { /* If not found, just look for any OpenOwner that will work. */ top = NULL; - done = 0; - owp = LIST_FIRST(&clp->nfsc_owner); - while (!done && owp != NULL) { + done = false; + LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { if (op->nfso_fhlen == fhlen && !NFSBCMP(op->nfso_fh, nfhp, fhlen)) { @@ -607,13 +607,13 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, (mode & NFSV4OPEN_ACCESSREAD) != 0) top = op; if ((mode & op->nfso_mode) == mode) { - done = 1; + done = true; break; } } } - if (!done) - owp = LIST_NEXT(owp, nfsow_list); + if (done) + break; } if (!done) { NFSCL_DEBUG(2, "openmode top=%p\n", top); @@ -653,7 +653,7 @@ nfscl_getopen(struct nfsclownerhead *ohp, u_int8_t *nfhp, int fhlen, struct nfsclowner *owp; struct nfsclopen *op, *rop, *rop2; struct nfscllockowner *lp; - int keep_looping; + bool keep_looping; if (lpp != NULL) *lpp = NULL; @@ -669,13 +669,11 @@ nfscl_getopen(struct nfsclownerhead *ohp, u_int8_t *nfhp, int fhlen, */ rop = NULL; rop2 = NULL; - keep_looping = 1; + keep_looping = true; /* Search the client list */ - owp = LIST_FIRST(ohp); - while (owp != NULL && keep_looping != 0) { + LIST_FOREACH(owp, ohp, nfsow_list) { /* and look for the correct open */ - op = LIST_FIRST(&owp->nfsow_open); - while (op != NULL && keep_looping != 0) { + LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { if (op->nfso_fhlen == fhlen && !NFSBCMP(op->nfso_fh, nfhp, fhlen) && (op->nfso_mode & mode) == mode) { @@ -688,7 +686,7 @@ nfscl_getopen(struct nfsclownerhead *ohp, u_int8_t *nfhp, int fhlen, NFSV4CL_LOCKNAMELEN)) { *lpp = lp; rop = op; - keep_looping = 0; + keep_looping = false; break; } } @@ -697,14 +695,16 @@ nfscl_getopen(struct nfsclownerhead *ohp, u_int8_t *nfhp, int fhlen, openown, NFSV4CL_LOCKNAMELEN)) { rop = op; if (lpp == NULL) - keep_looping = 0; + keep_looping = false; } if (rop2 == NULL) rop2 = op; } - op = LIST_NEXT(op, nfso_list); + if (!keep_looping) + break; } - owp = LIST_NEXT(owp, nfsow_list); + if (!keep_looping) + break; } if (rop == NULL) rop = rop2; From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:35:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BE285ADE77; Mon, 29 Mar 2021 22:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8S7x3TxPz4pCJ; Mon, 29 Mar 2021 22:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 664D81B644; Mon, 29 Mar 2021 22:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMZ9nE093451; Mon, 29 Mar 2021 22:35:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMZ97h093450; Mon, 29 Mar 2021 22:35:09 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:35:09 GMT Message-Id: <202103292235.12TMZ97h093450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: c6b96921a819 - stable/13 - aarch64: Clear TLS registers during exec(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c6b96921a81968aa768b45e32195854aaec81331 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:35:09 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c6b96921a81968aa768b45e32195854aaec81331 commit c6b96921a81968aa768b45e32195854aaec81331 Author: John Baldwin AuthorDate: 2021-03-17 20:19:04 +0000 Commit: John Baldwin CommitDate: 2021-03-29 22:17:04 +0000 aarch64: Clear TLS registers during exec(). These are not stored in the trapframe so must be cleared explicitly. This is similar to one of the MIPS changes in 822d2d6ac94f. Obtained from: CheriBSD Sponsored by: DARPA (cherry picked from commit 0723b409150ae302eb021cbde86a5f77348a1bb4) --- sys/arm64/arm64/machdep.c | 5 +++++ sys/arm64/linux/linux_sysvec.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index c825c1a18c70..8a1e7520aacb 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -560,6 +560,11 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) tf->tf_lr = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, pcb); #endif diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 67feacfa876b..df16db4040a7 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -365,6 +365,11 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, #endif regs->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, td->td_pcb); #endif From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:45:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08D4C5AEB87; Mon, 29 Mar 2021 22:45:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8SNM4NNbz4qBM; Mon, 29 Mar 2021 22:45:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8913E1BA88; Mon, 29 Mar 2021 22:45:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMjt3g007611; Mon, 29 Mar 2021 22:45:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMjtMR007610; Mon, 29 Mar 2021 22:45:55 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:45:55 GMT Message-Id: <202103292245.12TMjtMR007610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 10438a42f166 - stable/13 - x86: Reduce code duplication in cpu_fork() and cpu_copy_thread(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 10438a42f1665c00f7669e123a0aec49b74d757e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:45:56 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=10438a42f1665c00f7669e123a0aec49b74d757e commit 10438a42f1665c00f7669e123a0aec49b74d757e Author: John Baldwin AuthorDate: 2021-03-18 19:13:17 +0000 Commit: John Baldwin CommitDate: 2021-03-29 22:35:47 +0000 x86: Reduce code duplication in cpu_fork() and cpu_copy_thread(). Add copy_thread() to hold shared code. Sponsored by: Netflix (cherry picked from commit a7883464fcc45b78e6aa01222682ae40f787a378) --- sys/amd64/amd64/vm_machdep.c | 167 +++++++++++++++------------------------ sys/i386/i386/vm_machdep.c | 184 +++++++++++++++++-------------------------- 2 files changed, 137 insertions(+), 214 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index a17ddd4ba6d8..0527ef95cf3b 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -136,6 +136,65 @@ alloc_fpusave(int flags) return (res); } +/* + * Common code shared between cpu_fork() and cpu_copy_thread() for + * initializing a thread. + */ +static void +copy_thread(struct thread *td1, struct thread *td2) +{ + struct pcb *pcb2; + + pcb2 = td2->td_pcb; + + /* Ensure that td1's pcb is up to date for user threads. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + fpuexit(td1); + update_pcb_bases(td1->td_pcb); + } + + /* Copy td1's pcb */ + bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + + /* Properly initialize pcb_save */ + pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + + /* Kernel threads start with clean FPU and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } + + /* + * Set registers for trampoline to user mode. Leave space for the + * return address on stack. These are the kernel mode register values. + */ + pcb2->pcb_r12 = (register_t)fork_return; /* fork_trampoline argument */ + pcb2->pcb_rbp = 0; + pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *); + pcb2->pcb_rbx = (register_t)td2; /* fork_trampoline argument */ + pcb2->pcb_rip = (register_t)fork_trampoline; + /*- + * pcb2->pcb_dr*: cloned above. + * pcb2->pcb_savefpu: cloned above. + * pcb2->pcb_flags: cloned above. + * pcb2->pcb_onfault: cloned above (always NULL here?). + * pcb2->pcb_[fg]sbase: cloned above + */ + + /* Setup to release spin count in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; + pmap_thread_init_invl_gen(td2); +} + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -164,36 +223,13 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date for user processes. */ - if ((td2->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td1 == curthread); - fpuexit(td1); - update_pcb_bases(td1->td_pcb); - } - /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); td2->td_pcb = pcb2 = get_pcb_td(td2); - /* Copy td1's pcb */ - bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - - /* Properly initialize pcb_save */ - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + copy_thread(td1, td2); - /* Kernel processes start with clean FPU and segment bases. */ - if ((td2->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_fsbase = 0; - pcb2->pcb_gsbase = 0; - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU | PCB_KERNFPU_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); - } - - /* Point mdproc and then copy over td1's contents */ + /* Point mdproc and then copy over p1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); @@ -215,29 +251,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) */ td2->td_frame->tf_rflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_r12 = (register_t)fork_return; /* fork_trampoline argument */ - pcb2->pcb_rbp = 0; - pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *); - pcb2->pcb_rbx = (register_t)td2; /* fork_trampoline argument */ - pcb2->pcb_rip = (register_t)fork_trampoline; - /*- - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_[fg]sbase: cloned above - */ - - /* Setup to release spin count in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - pmap_thread_init_invl_gen(td2); - - /* As an i386, do not copy io permission bitmap. */ + /* As on i386, do not copy io permission bitmap. */ pcb2->pcb_tssp = NULL; /* New segment registers. */ @@ -275,7 +289,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) * pcb_rsp is loaded pointing to the cpu_switch() stack frame * containing the return address when exiting cpu_switch. * This will normally be to fork_trampoline(), which will have - * %ebx loaded with the new proc's pointer. fork_trampoline() + * %rbx loaded with the new proc's pointer. fork_trampoline() * will set up a stack to call fork_return(p, frame); to complete * the return to user-mode. */ @@ -571,38 +585,7 @@ cpu_set_syscall_retval(struct thread *td, int error) void cpu_copy_thread(struct thread *td, struct thread *td0) { - struct pcb *pcb2; - - pcb2 = td->td_pcb; - - /* Ensure that td0's pcb is up to date for user threads. */ - if ((td->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td0 == curthread); - fpuexit(td0); - update_pcb_bases(td0->td_pcb); - } - - /* - * Copy the upcall pcb. This loads kernel regs. - * Those not loaded individually below get their default - * values here. - */ - bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel threads start with clean FPU and segment bases. */ - if ((td->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_fsbase = 0; - pcb2->pcb_gsbase = 0; - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU | PCB_KERNFPU_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); - } - set_pcb_flags_raw(pcb2, PCB_FULL_IRET); - + copy_thread(td0, td); /* * Copy user general-purpose registers. @@ -620,27 +603,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) */ td->td_frame->tf_rflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_r12 = (register_t)fork_return; /* trampoline arg */ - pcb2->pcb_rbp = 0; - pcb2->pcb_rsp = (register_t)td->td_frame - sizeof(void *); /* trampoline arg */ - pcb2->pcb_rbx = (register_t)td; /* trampoline arg */ - pcb2->pcb_rip = (register_t)fork_trampoline; - /* - * If we didn't copy the pcb, we'd need to do the following registers: - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_[fg]sbase: cloned above - */ - - /* Setup to release spin count in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - pmap_thread_init_invl_gen(td); + set_pcb_flags_raw(td->td_pcb, PCB_FULL_IRET); } /* diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 5947ae5a6d15..5bbdfdb77b2d 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -133,6 +133,74 @@ alloc_fpusave(int flags) } return (res); } + +/* + * Common code shared between cpu_fork() and cpu_copy_thread() for + * initializing a thread. + */ +static void +copy_thread(struct thread *td1, struct thread *td2) +{ + struct pcb *pcb2; + + pcb2 = td2->td_pcb; + + /* Ensure that td1's pcb is up to date for user threads. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + td1->td_pcb->pcb_gs = rgs(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td1) + npxsave(td1->td_pcb->pcb_save); + critical_exit(); + } + + /* Copy td1's pcb */ + bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + + /* Properly initialize pcb_save */ + pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + + /* Kernel threads start with clean NPX and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td2, 0); + set_gsbase(td2, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } + + /* + * Set registers for trampoline to user mode. Leave space for the + * return address on stack. These are the kernel mode register values. + */ + pcb2->pcb_edi = 0; + pcb2->pcb_esi = (int)fork_return; /* trampoline arg */ + pcb2->pcb_ebp = 0; + pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *); /* trampoline arg */ + pcb2->pcb_ebx = (int)td2; /* trampoline arg */ + pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; + /* + * If we didn't copy the pcb, we'd need to do the following registers: + * pcb2->pcb_cr3: cloned above. + * pcb2->pcb_dr*: cloned above. + * pcb2->pcb_savefpu: cloned above. + * pcb2->pcb_flags: cloned above. + * pcb2->pcb_onfault: cloned above (always NULL here?). + * pcb2->pcb_gs: cloned above. + * pcb2->pcb_ext: cleared below. + */ + pcb2->pcb_ext = NULL; + + /* Setup to release spin count in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; +} + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -167,38 +235,11 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date for user processes. */ - if ((td2->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td1 == curthread); - td1->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td1) - npxsave(td1->td_pcb->pcb_save); - critical_exit(); - } - /* Point the pcb to the top of the stack */ pcb2 = get_pcb_td(td2); td2->td_pcb = pcb2; - /* Copy td1's pcb */ - bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - - /* Properly initialize pcb_save */ - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel processes start with clean NPX and segment bases. */ - if ((td2->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_gs = _udatasel; - set_fsbase(td2, 0); - set_gsbase(td2, 0); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX | PCB_KERNNPX_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); - } + copy_thread(td1, td2); /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -225,30 +266,13 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) */ td2->td_frame->tf_eflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ + /* Set cr3 for the new process. */ pcb2->pcb_cr3 = pmap_get_cr3(vmspace_pmap(p2->p_vmspace)); - pcb2->pcb_edi = 0; - pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */ - pcb2->pcb_ebp = 0; - pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *); - pcb2->pcb_ebx = (int)td2; /* fork_trampoline argument */ - pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - /*- - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_gs: cloned above. - * pcb2->pcb_ext: cleared below. - */ /* * XXX don't copy the i/o pages. this should probably be fixed. */ - pcb2->pcb_ext = 0; + pcb2->pcb_ext = NULL; /* Copy the LDT, if necessary. */ mtx_lock_spin(&dt_lock); @@ -264,10 +288,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) } mtx_unlock_spin(&dt_lock); - /* Setup to release spin count in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - /* * Now, cpu_switch() can schedule the new process. * pcb_esp is loaded pointing to the cpu_switch() stack frame @@ -435,41 +455,7 @@ cpu_set_syscall_retval(struct thread *td, int error) void cpu_copy_thread(struct thread *td, struct thread *td0) { - struct pcb *pcb2; - - /* Point the pcb to the top of the stack. */ - pcb2 = td->td_pcb; - - /* Ensure that td0's pcb is up to date for user threads. */ - if ((td->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td0 == curthread); - td0->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td0) - npxsave(td0->td_pcb->pcb_save); - critical_exit(); - } - - /* - * Copy the upcall pcb. This loads kernel regs. - * Those not loaded individually below get their default - * values here. - */ - bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel threads start with clean NPX and segment bases. */ - if ((td->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_gs = _udatasel; - set_fsbase(td, 0); - set_gsbase(td, 0); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX | PCB_KERNNPX_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); - } + copy_thread(td0, td); /* * Copy user general-purpose registers. @@ -486,32 +472,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * instruction after returning to userland. */ td->td_frame->tf_eflags &= ~PSL_T; - - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_edi = 0; - pcb2->pcb_esi = (int)fork_return; /* trampoline arg */ - pcb2->pcb_ebp = 0; - pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */ - pcb2->pcb_ebx = (int)td; /* trampoline arg */ - pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - /* - * If we didn't copy the pcb, we'd need to do the following registers: - * pcb2->pcb_cr3: cloned above. - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_gs: cloned above. - * pcb2->pcb_ext: cleared below. - */ - pcb2->pcb_ext = NULL; - - /* Setup to release spin count in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; } /* From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:45:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA43A5AEB94; Mon, 29 Mar 2021 22:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8SNN5gyPz4qHH; Mon, 29 Mar 2021 22:45:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB40A1B9AA; Mon, 29 Mar 2021 22:45:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMjurp007637; Mon, 29 Mar 2021 22:45:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMjulF007636; Mon, 29 Mar 2021 22:45:56 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:45:56 GMT Message-Id: <202103292245.12TMjulF007636@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: f9d590884ae3 - stable/13 - Rename linux_set_upcall_kse() to linux_set_upcall(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9d590884ae31a6689c9e472046f7176f3eb57c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:45:57 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f9d590884ae31a6689c9e472046f7176f3eb57c4 commit f9d590884ae31a6689c9e472046f7176f3eb57c4 Author: John Baldwin AuthorDate: 2021-03-18 19:14:34 +0000 Commit: John Baldwin CommitDate: 2021-03-29 22:36:11 +0000 Rename linux_set_upcall_kse() to linux_set_upcall(). This matches the rename of cpu_set_upcall_kse() in 5c2cf818454375536fda522ba83cf67c50929e6b. Sponsored by: DARPA (cherry picked from commit 3b57ddb029daf225a8385dade491019269da82e8) --- sys/amd64/amd64/vm_machdep.c | 2 +- sys/amd64/linux/linux_machdep.c | 2 +- sys/amd64/linux32/linux32_machdep.c | 2 +- sys/arm64/linux/linux_machdep.c | 8 ++++---- sys/compat/linux/linux_fork.c | 4 ++-- sys/compat/linux/linux_misc.h | 2 +- sys/i386/i386/vm_machdep.c | 2 +- sys/i386/linux/linux_machdep.c | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 0527ef95cf3b..f64259decbff 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -591,7 +591,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Copy user general-purpose registers. * * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall_kse(). + * and linux_set_upcall(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index 1a9d79b0c1ba..4736fd3d1682 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -118,7 +118,7 @@ linux_execve(struct thread *td, struct linux_execve_args *args) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index fde180d74d73..8ae82f3df8ca 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -418,7 +418,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c index 512bf1cc3398..711ccb4fd63d 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); /* DTrace probes */ -LIN_SDT_PROBE_DEFINE0(machdep, linux_set_upcall_kse, todo); +LIN_SDT_PROBE_DEFINE0(machdep, linux_set_upcall, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_mmap2, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_rt_sigsuspend, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_sigaltstack, todo); @@ -84,12 +84,12 @@ linux_execve(struct thread *td, struct linux_execve_args *uap) return (error); } -/* LINUXTODO: implement (or deduplicate) arm64 linux_set_upcall_kse */ +/* LINUXTODO: implement (or deduplicate) arm64 linux_set_upcall */ int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { - LIN_SDT_PROBE0(machdep, linux_set_upcall_kse, todo); + LIN_SDT_PROBE0(machdep, linux_set_upcall, todo); return (EDOOFUS); } diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index 3ba40fc2705e..ed4adcf8a175 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -205,7 +205,7 @@ linux_clone_proc(struct thread *td, struct linux_clone_args *args) * stack. This is what normal fork() does, so we just keep tf_rsp arg * intact. */ - linux_set_upcall_kse(td2, PTROUT(args->stack)); + linux_set_upcall(td2, PTROUT(args->stack)); if (args->flags & LINUX_CLONE_SETTLS) linux_set_cloned_tls(td2, args->tls); @@ -304,7 +304,7 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args) cpu_thread_clean(newtd); - linux_set_upcall_kse(newtd, PTROUT(args->stack)); + linux_set_upcall(newtd, PTROUT(args->stack)); PROC_LOCK(p); p->p_flag |= P_HADTHREADS; diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index c7e4fa38682c..da76753e3d24 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -181,7 +181,7 @@ extern int stclohz; int linux_ptrace_status(struct thread *td, int pid, int status); #endif void linux_to_bsd_waitopts(int options, int *bsdopts); -int linux_set_upcall_kse(struct thread *td, register_t stack); +int linux_set_upcall(struct thread *td, register_t stack); int linux_set_cloned_tls(struct thread *td, void *desc); struct thread *linux_tdfind(struct thread *, lwpid_t, pid_t); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 5bbdfdb77b2d..c04fb57db4b1 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -461,7 +461,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Copy user general-purpose registers. * * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall_kse(). + * and linux_set_upcall(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index 624a6ef6ae87..d2d713d4776d 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -314,7 +314,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) From owner-dev-commits-src-all@freebsd.org Mon Mar 29 22:45:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EF955AE993; Mon, 29 Mar 2021 22:45:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8SNQ0F5lz4qF8; Mon, 29 Mar 2021 22:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C00381B6C7; Mon, 29 Mar 2021 22:45:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TMjvBB007660; Mon, 29 Mar 2021 22:45:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMjvNM007659; Mon, 29 Mar 2021 22:45:57 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:45:57 GMT Message-Id: <202103292245.12TMjvNM007659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 325427f71d37 - stable/13 - xnb: Don't pass SIOC{ADD, DEL}MULTI to ifmedia_ioctl(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 325427f71d379bac9a7708d5f87b4063e584ab54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 22:45:59 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=325427f71d379bac9a7708d5f87b4063e584ab54 commit 325427f71d379bac9a7708d5f87b4063e584ab54 Author: John Baldwin AuthorDate: 2021-03-22 16:55:49 +0000 Commit: John Baldwin CommitDate: 2021-03-29 22:36:36 +0000 xnb: Don't pass SIOC{ADD,DEL}MULTI to ifmedia_ioctl(). ifmedia_ioctl() doesn't handle these requests, and this matches what xn does. Sponsored by: DARPA (cherry picked from commit 71ba16a0a02f4a3fd56d03e908615a8b5f701ba4) --- sys/dev/xen/netback/netback.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/xen/netback/netback.c b/sys/dev/xen/netback/netback.c index 44159f60d996..8710120ecef3 100644 --- a/sys/dev/xen/netback/netback.c +++ b/sys/dev/xen/netback/netback.c @@ -2296,6 +2296,7 @@ xnb_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCADDMULTI: case SIOCDELMULTI: + break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &xnb->sc_media, cmd); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 23:07:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B87E75AF2FB; Mon, 29 Mar 2021 23:07:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8SsL4rHMz4rQZ; Mon, 29 Mar 2021 23:07:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 991CF1BD20; Mon, 29 Mar 2021 23:07:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TN7Yt9036664; Mon, 29 Mar 2021 23:07:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TN7Yni036663; Mon, 29 Mar 2021 23:07:34 GMT (envelope-from git) Date: Mon, 29 Mar 2021 23:07:34 GMT Message-Id: <202103292307.12TN7Yni036663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 9095dc7da4cf - main - Fix nexhtop group index array scaling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9095dc7da4cf0c484fb1160b2180b7329b09b107 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 23:07:34 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=9095dc7da4cf0c484fb1160b2180b7329b09b107 commit 9095dc7da4cf0c484fb1160b2180b7329b09b107 Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:00:17 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-29 23:00:17 +0000 Fix nexhtop group index array scaling. The current code has the limit of 127 nexthop groups due to the wrongly-checked bitmask_copy() return value. PR: 254303 Reported by: Aleks MFC after: 1 day --- sys/net/route/nhgrp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/route/nhgrp.c b/sys/net/route/nhgrp.c index c25f4f09865b..f6638b12ebea 100644 --- a/sys/net/route/nhgrp.c +++ b/sys/net/route/nhgrp.c @@ -243,8 +243,8 @@ consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, uint32_t new_id CHT_SLIST_RESIZE(&ctl->gr_head, mpath, nh_ptr, new_nh_buckets); } if (nh_idx_ptr != NULL) { - if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items)) - bitmask_swap(&ctl->nh_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); + if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items) == 0) + bitmask_swap(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); } NHOPS_WUNLOCK(ctl); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 23:07:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 201DA5AF3BA; Mon, 29 Mar 2021 23:07:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8SsM5g99z4rfR; Mon, 29 Mar 2021 23:07:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFC4F1B8ED; Mon, 29 Mar 2021 23:07:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TN7ZFc036690; Mon, 29 Mar 2021 23:07:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TN7Zgt036689; Mon, 29 Mar 2021 23:07:35 GMT (envelope-from git) Date: Mon, 29 Mar 2021 23:07:35 GMT Message-Id: <202103292307.12TN7Zgt036689@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0f30a36dedef - main - Rename variables inside nexhtop group consider_resize() code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f30a36dedef43781f5003bdfcb4254d310f02e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 23:07:36 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0f30a36dedef43781f5003bdfcb4254d310f02e4 commit 0f30a36dedef43781f5003bdfcb4254d310f02e4 Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:06:13 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-29 23:06:13 +0000 Rename variables inside nexhtop group consider_resize() code. No functional changes. MFC after: 3 days --- sys/net/route/nhgrp.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sys/net/route/nhgrp.c b/sys/net/route/nhgrp.c index f6638b12ebea..f763cc25fd5c 100644 --- a/sys/net/route/nhgrp.c +++ b/sys/net/route/nhgrp.c @@ -82,7 +82,7 @@ * */ -static void consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, +static void consider_resize(struct nh_control *ctl, uint32_t new_gr_buckets, uint32_t new_idx_items); static int cmp_nhgrp(const struct nhgrp_priv *a, const struct nhgrp_priv *b); @@ -209,47 +209,47 @@ unlink_nhgrp(struct nh_control *ctl, struct nhgrp_priv *key) * Checks if hash needs resizing and performs this resize if necessary * */ -__noinline static void -consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, uint32_t new_idx_items) +static void +consider_resize(struct nh_control *ctl, uint32_t new_gr_bucket, uint32_t new_idx_items) { - void *nh_ptr, *nh_idx_ptr; + void *gr_ptr, *gr_idx_ptr; void *old_idx_ptr; size_t alloc_size; - nh_ptr = NULL ; - if (new_nh_buckets != 0) { - alloc_size = CHT_SLIST_GET_RESIZE_SIZE(new_nh_buckets); - nh_ptr = malloc(alloc_size, M_NHOP, M_NOWAIT | M_ZERO); + gr_ptr = NULL ; + if (new_gr_bucket != 0) { + alloc_size = CHT_SLIST_GET_RESIZE_SIZE(new_gr_bucket); + gr_ptr = malloc(alloc_size, M_NHOP, M_NOWAIT | M_ZERO); } - nh_idx_ptr = NULL; + gr_idx_ptr = NULL; if (new_idx_items != 0) { alloc_size = bitmask_get_size(new_idx_items); - nh_idx_ptr = malloc(alloc_size, M_NHOP, M_NOWAIT | M_ZERO); + gr_idx_ptr = malloc(alloc_size, M_NHOP, M_NOWAIT | M_ZERO); } - if (nh_ptr == NULL && nh_idx_ptr == NULL) { + if (gr_ptr == NULL && gr_idx_ptr == NULL) { /* Either resize is not required or allocations have failed. */ return; } - DPRINTF("mp: going to resize: nh:[ptr:%p sz:%u] idx:[ptr:%p sz:%u]", - nh_ptr, new_nh_buckets, nh_idx_ptr, new_idx_items); + DPRINTF("mp: going to resize: gr:[ptr:%p sz:%u] idx:[ptr:%p sz:%u]", + gr_ptr, new_gr_bucket, gr_idx_ptr, new_idx_items); old_idx_ptr = NULL; NHOPS_WLOCK(ctl); - if (nh_ptr != NULL) { - CHT_SLIST_RESIZE(&ctl->gr_head, mpath, nh_ptr, new_nh_buckets); + if (gr_ptr != NULL) { + CHT_SLIST_RESIZE(&ctl->gr_head, mpath, gr_ptr, new_gr_bucket); } - if (nh_idx_ptr != NULL) { - if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items) == 0) - bitmask_swap(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); + if (gr_idx_ptr != NULL) { + if (bitmask_copy(&ctl->gr_idx_head, gr_idx_ptr, new_idx_items) == 0) + bitmask_swap(&ctl->gr_idx_head, gr_idx_ptr, new_idx_items, &old_idx_ptr); } NHOPS_WUNLOCK(ctl); - if (nh_ptr != NULL) - free(nh_ptr, M_NHOP); + if (gr_ptr != NULL) + free(gr_ptr, M_NHOP); if (old_idx_ptr != NULL) free(old_idx_ptr, M_NHOP); } From owner-dev-commits-src-all@freebsd.org Mon Mar 29 23:15:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4045A5AFB11; Mon, 29 Mar 2021 23:15:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8T2D1Mn7z4sJb; Mon, 29 Mar 2021 23:15:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DC521BEB3; Mon, 29 Mar 2021 23:15:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TNFFrr050153; Mon, 29 Mar 2021 23:15:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TNFFmZ050152; Mon, 29 Mar 2021 23:15:15 GMT (envelope-from git) Date: Mon, 29 Mar 2021 23:15:15 GMT Message-Id: <202103292315.12TNFFmZ050152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 9fa8d1582b44 - main - Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9fa8d1582b44b4850d40699c9adb104732328b7d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 23:15:16 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=9fa8d1582b44b4850d40699c9adb104732328b7d commit 9fa8d1582b44b4850d40699c9adb104732328b7d Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:12:11 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-29 23:12:11 +0000 Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). Recent rtsock changes widened epoch and covered nhgrp_dump_sysctl(), resulting in `netstat -4On` triggering with KASSERT. MFC after: 1 day --- sys/net/route/nhgrp_ctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index b228c3bcee37..2896730458b5 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -806,7 +806,9 @@ nhgrp_dump_sysctl(struct rib_head *rh, struct sysctl_req *w) sz = sizeof(struct rt_msghdr) + sizeof(struct nhgrp_external); sz += 2 * sizeof(struct nhgrp_container); sz += 2 * sizeof(struct nhgrp_nhop_external) * RIB_MAX_MPATH_WIDTH; - buffer = malloc(sz, M_TEMP, M_WAITOK); + buffer = malloc(sz, M_TEMP, M_MOWAIT); + if (buffer == NULL) + return (ENOMEM); NET_EPOCH_ENTER(et); NHOPS_RLOCK(ctl); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 23:24:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBF255AFECD; Mon, 29 Mar 2021 23:24:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8TDM64xwz4stN; Mon, 29 Mar 2021 23:24:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C39791C0CA; Mon, 29 Mar 2021 23:24:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TNO3e4063650; Mon, 29 Mar 2021 23:24:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TNO3Yf063649; Mon, 29 Mar 2021 23:24:03 GMT (envelope-from git) Date: Mon, 29 Mar 2021 23:24:03 GMT Message-Id: <202103292324.12TNO3Yf063649@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brandon Bergren Subject: git: 5a08df100b58 - main - [PowerPC] Fix 32-bit Book-E panic due to pve leak MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a08df100b58911396e0cc1403f0504bc68461bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 23:24:04 -0000 The branch main has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=5a08df100b58911396e0cc1403f0504bc68461bd commit 5a08df100b58911396e0cc1403f0504bc68461bd Author: Brandon Bergren AuthorDate: 2021-03-29 22:59:19 +0000 Commit: Brandon Bergren CommitDate: 2021-03-29 23:22:16 +0000 [PowerPC] Fix 32-bit Book-E panic due to pve leak On an INVARIANTS kernel on 32-bit Book-E, we were panicing when running the libproc tests. This was caused by extra pv entries being generated accidentally by the pmap icache invalidation code. Use the same VA (i.e. 0) when freeing the temporary mapping, instead of some arbitrary address within the zero page. Failure to do this was causing kernel-side icache syncing to leak PVE entries when invalidating icache for a non page-aligned address, which would later result in pages erroneously showing up as mapped to vm_page. This bug was introduced in r347354 in 2019. Reviewed by: jhibbits (in irc) Sponsored by: Tag1 Consulting, Inc. --- sys/powerpc/booke/pmap_32.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/powerpc/booke/pmap_32.c b/sys/powerpc/booke/pmap_32.c index a9f8af0565f0..924eb223a2b6 100644 --- a/sys/powerpc/booke/pmap_32.c +++ b/sys/powerpc/booke/pmap_32.c @@ -748,14 +748,23 @@ mmu_booke_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) sync_sz = min(sync_sz, sz); if (valid) { if (!active) { - /* Create a mapping in the active pmap. */ + /* + * Create a mapping in the active pmap. + * + * XXX: We use the zero page here, because + * it isn't likely to be in use. + * If we ever decide to support + * security.bsd.map_at_zero on Book-E, change + * this to some other address that isn't + * normally mappable. + */ addr = 0; m = PHYS_TO_VM_PAGE(pa); PMAP_LOCK(pmap); pte_enter(pmap, m, addr, PTE_SR | PTE_VALID, FALSE); - addr += (va & PAGE_MASK); - __syncicache((void *)addr, sync_sz); + __syncicache((void *)(addr + (va & PAGE_MASK)), + sync_sz); pte_remove(pmap, addr, PTBL_UNHOLD); PMAP_UNLOCK(pmap); } else From owner-dev-commits-src-all@freebsd.org Mon Mar 29 23:24:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC91E5AFE4D; Mon, 29 Mar 2021 23:24:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8TDX1N0gz4sfs; Mon, 29 Mar 2021 23:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADB571C0CB; Mon, 29 Mar 2021 23:24:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TNOA55063775; Mon, 29 Mar 2021 23:24:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TNOACF063774; Mon, 29 Mar 2021 23:24:10 GMT (envelope-from git) Date: Mon, 29 Mar 2021 23:24:10 GMT Message-Id: <202103292324.12TNOACF063774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 77ffc9399dad - stable/13 - Stop installing kernel-only crypto headers to /usr/include/crypto. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 77ffc9399dadaf5d512f3f3e4d51c30edfed2c2a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 23:24:14 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=77ffc9399dadaf5d512f3f3e4d51c30edfed2c2a commit 77ffc9399dadaf5d512f3f3e4d51c30edfed2c2a Author: John Baldwin AuthorDate: 2021-03-16 00:00:21 +0000 Commit: John Baldwin CommitDate: 2021-03-29 23:23:36 +0000 Stop installing kernel-only crypto headers to /usr/include/crypto. The only user-facing header from OCF is . Sponsored by: Chelsio Communications (cherry picked from commit afbee98232f41fc05fa8a5b9a8cda4c4c65ff448) (cherry picked from commit 2fc640d5bc0a17024dc1eb996ab00af42a5c6dbd) (cherry picked from commit 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4) (cherry picked from commit 9946b2f4e0b478de69ebd687e2132c318a4d7c21) (cherry picked from commit 7af04dff025d98e2feff979756ecde8ef0ace390) --- ObsoleteFiles.inc | 14 ++++++++++++++ include/Makefile | 22 ++-------------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index d72eebbe7de1..4fd7275fb8fa 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,20 @@ # xargs -n1 | sort | uniq -d; # done +# 20210329: Remove kernel-only crypto headers from /usr/include +OLD_FILES+=usr/include/crypto/_cryptodev.h +OLD_FILES+=usr/include/crypto/cbc_mac.h +OLD_FILES+=usr/include/crypto/deflate.h +OLD_FILES+=usr/include/crypto/gfmult.h +OLD_FILES+=usr/include/crypto/gmac.h +OLD_FILES+=usr/include/crypto/rijndael.h +OLD_FILES+=usr/include/crypto/rmd160.h +OLD_FILES+=usr/include/crypto/xform.h +OLD_FILES+=usr/include/crypto/xform_auth.h +OLD_FILES+=usr/include/crypto/xform_comp.h +OLD_FILES+=usr/include/crypto/xform_enc.h +OLD_FILES+=usr/include/crypto/xform_poly1305.h + # 20210204: bump shared libraries which link against ncurses OLD_LIBS+=lib/libedit.so.7 OLD_LIBS+=usr/lib/libdialog.so.8 diff --git a/include/Makefile b/include/Makefile index b6eb63e5ef15..ffa0b1c01f6a 100644 --- a/include/Makefile +++ b/include/Makefile @@ -84,10 +84,6 @@ FS9660= cd9660_mount.h \ iso_rrip.h FS9660DIR= ${INCLUDEDIR}/isofs/cd9660 -.PATH: ${SRCTOP}/sys/crypto -CRYPTO= rijndael/rijndael.h -CRYPTODIR= ${INCLUDEDIR}/crypto - .PATH: ${SRCTOP}/sys/dev/evdev EVDEV= input.h \ input-event-codes.h \ @@ -105,18 +101,7 @@ HYPERV= hv_snapshot.h \ HYPERVDIR= ${INCLUDEDIR}/dev/hyperv .PATH: ${SRCTOP}/sys/opencrypto -OPENCRYPTO= _cryptodev.h \ - cbc_mac.h \ - cryptodev.h \ - deflate.h \ - gfmult.h \ - gmac.h \ - rmd160.h \ - xform.h \ - xform_auth.h \ - xform_comp.h \ - xform_enc.h \ - xform_poly1305.h +OPENCRYPTO= cryptodev.h OPENCRYPTODIR= ${INCLUDEDIR}/crypto .PATH: ${SRCTOP}/sys/dev/pci @@ -359,10 +344,7 @@ symlinks: .PHONY .META $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; .endif - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/opencrypto/*.h) \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/opencrypto/cryptodev.h \ ${SDESTDIR}${INCLUDEDIR}/crypto; \ cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ From owner-dev-commits-src-all@freebsd.org Mon Mar 29 23:32:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7EBB5B0507; Mon, 29 Mar 2021 23:32:37 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8TQF32wSz4tgD; Mon, 29 Mar 2021 23:32:36 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.66.148.124]) by shaw.ca with ESMTPA id R1N4ltVlm2SWTR1N5lTWyY; Mon, 29 Mar 2021 17:32:35 -0600 X-Authority-Analysis: v=2.4 cv=fdJod2cF c=1 sm=1 tr=0 ts=60626393 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=dESyimp9J3IA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=a2I0WHjqtDzGpkUg5AYA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 8738D14B; Mon, 29 Mar 2021 16:32:33 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 12TNWXSv007193; Mon, 29 Mar 2021 16:32:33 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202103292332.12TNWXSv007193@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: "Alexander V. Chernikov" cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 9fa8d1582b44 - main - Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). In-reply-to: <202103292315.12TNFFmZ050152@gitrepo.freebsd.org> References: <202103292315.12TNFFmZ050152@gitrepo.freebsd.org> Comments: In-reply-to "Alexander V. Chernikov" message dated "Mon, 29 Mar 2021 23:15:15 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 29 Mar 2021 16:32:33 -0700 X-CMAE-Envelope: MS4xfOAI4hRRNgNrmbpW6Rg4wdOuEWZ2RyjXxQcpAevn5gDJNNzm+i9W1xowwxhn8QoaAN9Mf+SouopPRaeOrYLayloxvtIPijUF8tHWh5QPb4rtto/8QRcM /M3mm6Uk/tUt1oRwLLpNWtobQJpeW1FoDGNu+GLFXHTIsAOMW8Ti5bXfCVt6t3Tx7d8NtSi0xUcT6UOC1Zctmc0rnnKG5jPRKVs0XbcfB7sUq+r64PLFgvwy Hnz4U8xQtCXXJre6Wa5eLJsKMJU+kEGsLd8RsLVcSQWocz9lWGYeawfgxMzLsxjDL3fnZxVXblyD5UsfAUdzXTmCNIkqTWm3JxmUfGPtAA8= X-Rspamd-Queue-Id: 4F8TQF32wSz4tgD X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 23:32:37 -0000 In message <202103292315.12TNFFmZ050152@gitrepo.freebsd.org>, "Alexander V. Che rnikov" writes: > The branch main has been updated by melifaro: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9fa8d1582b44b4850d40699c9adb1047 > 32328b7d > > commit 9fa8d1582b44b4850d40699c9adb104732328b7d > Author: Alexander V. Chernikov > AuthorDate: 2021-03-29 23:12:11 +0000 > Commit: Alexander V. Chernikov > CommitDate: 2021-03-29 23:12:11 +0000 > > Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). > > Recent rtsock changes widened epoch and covered nhgrp_dump_sysctl(), > resulting in `netstat -4On` triggering with KASSERT. > > MFC after: 1 day > --- > sys/net/route/nhgrp_ctl.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c > index b228c3bcee37..2896730458b5 100644 > --- a/sys/net/route/nhgrp_ctl.c > +++ b/sys/net/route/nhgrp_ctl.c > @@ -806,7 +806,9 @@ nhgrp_dump_sysctl(struct rib_head *rh, struct sysctl_req > *w) > sz = sizeof(struct rt_msghdr) + sizeof(struct nhgrp_external); > sz += 2 * sizeof(struct nhgrp_container); > sz += 2 * sizeof(struct nhgrp_nhop_external) * RIB_MAX_MPATH_WIDTH; > - buffer = malloc(sz, M_TEMP, M_WAITOK); > + buffer = malloc(sz, M_TEMP, M_MOWAIT); ^ This appears to be a typo. > + if (buffer == NULL) > + return (ENOMEM); > > NET_EPOCH_ENTER(et); > NHOPS_RLOCK(ctl); > -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Mon Mar 29 23:43:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F64D5B0452; Mon, 29 Mar 2021 23:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8TfF3F0sz4tfq; Mon, 29 Mar 2021 23:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 624031C176; Mon, 29 Mar 2021 23:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12TNh105091712; Mon, 29 Mar 2021 23:43:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TNh1fk091711; Mon, 29 Mar 2021 23:43:01 GMT (envelope-from git) Date: Mon, 29 Mar 2021 23:43:01 GMT Message-Id: <202103292343.12TNh1fk091711@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0c2a0e038002 - main - Fix typo in the 9fa8d1582b44b4850d40699c9adb104732328b7d. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c2a0e038002cba423161aeed8f358ffb4fb2836 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 23:43:01 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0c2a0e038002cba423161aeed8f358ffb4fb2836 commit 0c2a0e038002cba423161aeed8f358ffb4fb2836 Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:42:27 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-29 23:42:48 +0000 Fix typo in the 9fa8d1582b44b4850d40699c9adb104732328b7d. Reported by: cy --- sys/net/route/nhgrp_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index 2896730458b5..49866499ac86 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -806,7 +806,7 @@ nhgrp_dump_sysctl(struct rib_head *rh, struct sysctl_req *w) sz = sizeof(struct rt_msghdr) + sizeof(struct nhgrp_external); sz += 2 * sizeof(struct nhgrp_container); sz += 2 * sizeof(struct nhgrp_nhop_external) * RIB_MAX_MPATH_WIDTH; - buffer = malloc(sz, M_TEMP, M_MOWAIT); + buffer = malloc(sz, M_TEMP, M_NOWAIT); if (buffer == NULL) return (ENOMEM); From owner-dev-commits-src-all@freebsd.org Mon Mar 29 23:45:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 716625B046A; Mon, 29 Mar 2021 23:45:06 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8Thc6Lctz4vGv; Mon, 29 Mar 2021 23:45:04 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward103q.mail.yandex.net (forward103q.mail.yandex.net [IPv6:2a02:6b8:c0e:50:0:640:b21c:d009]) by forward105p.mail.yandex.net (Yandex) with ESMTP id ED8AD4D44318; Tue, 30 Mar 2021 02:44:55 +0300 (MSK) Received: from vla1-e8d3e6f22b4d.qloud-c.yandex.net (vla1-e8d3e6f22b4d.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:3603:0:640:e8d3:e6f2]) by forward103q.mail.yandex.net (Yandex) with ESMTP id E97CF61E0002; Tue, 30 Mar 2021 02:44:55 +0300 (MSK) Received: from vla5-8422ddc3185d.qloud-c.yandex.net (vla5-8422ddc3185d.qloud-c.yandex.net [2a02:6b8:c18:3495:0:640:8422:ddc3]) by vla1-e8d3e6f22b4d.qloud-c.yandex.net (mxback/Yandex) with ESMTP id tIeqWUQAHV-itIGe8uc; Tue, 30 Mar 2021 02:44:55 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1617061495; bh=5RbpEIzX1A0O5VJBNaNlnq+3RIZvFeFobeVDipN5Ufc=; h=To:In-Reply-To:Subject:Cc:From:Message-Id:References:Date; b=lCUPOd5ayxGBRUw8+BNdDaVhE+1OWVcsBkZfIwqKr2/hHuePTGHC0t4Pv81cRqsmL OwNrVTW1iVVmHj3ndkZU1lU7Q/z8o6xAolAe2kacKDvoXw67Yt/1X7Vl55RjlWTSNC ffZlvw9ip+GtYaRmEzNU6a+vxazCX6GED25qrSPE= Received: by vla5-8422ddc3185d.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id vWCIIdsTjL-isJGsZCH; Tue, 30 Mar 2021 02:44:54 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 9fa8d1582b44 - main - Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). From: "Alexander V. Chernikov" In-Reply-To: <202103292332.12TNWXSv007193@slippy.cwsent.com> Date: Tue, 30 Mar 2021 00:44:52 +0100 Cc: "Alexander V. Chernikov" , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <8FEA74E1-246F-45E3-9794-330029DCD53E@ipfw.ru> References: <202103292315.12TNFFmZ050152@gitrepo.freebsd.org> <202103292332.12TNWXSv007193@slippy.cwsent.com> To: Cy Schubert X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4F8Thc6Lctz4vGv X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ipfw.ru header.s=mail header.b=lCUPOd5a; dmarc=none; spf=pass (mx1.freebsd.org: domain of melifaro@ipfw.ru designates 77.88.28.108 as permitted sender) smtp.mailfrom=melifaro@ipfw.ru X-Spamd-Result: default: False [-3.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:77.88.0.0/18]; RWL_MAILSPIKE_GOOD(0.00)[77.88.28.108:from]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[ipfw.ru:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[77.88.28.108:from]; ASN(0.00)[asn:13238, ipnet:77.88.0.0/18, country:RU]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[ipfw.ru:s=mail]; FREEFALL_USER(0.00)[melifaro]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[ipfw.ru]; SPAMHAUS_ZRD(0.00)[77.88.28.108:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 23:45:06 -0000 > On 30 Mar 2021, at 00:32, Cy Schubert = wrote: >=20 > In message <202103292315.12TNFFmZ050152@gitrepo.freebsd.org>, = "Alexander V.=20 > Che > rnikov" writes: >> The branch main has been updated by melifaro: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D9fa8d1582b44b4850d40699c9adb1047= >> 32328b7d >>=20 >> commit 9fa8d1582b44b4850d40699c9adb104732328b7d >> Author: Alexander V. Chernikov >> AuthorDate: 2021-03-29 23:12:11 +0000 >> Commit: Alexander V. Chernikov >> CommitDate: 2021-03-29 23:12:11 +0000 >>=20 >> Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). >>=20 >> Recent rtsock changes widened epoch and covered = nhgrp_dump_sysctl(), >> resulting in `netstat -4On` triggering with KASSERT. >>=20 >> MFC after: 1 day >> --- >> sys/net/route/nhgrp_ctl.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >>=20 >> diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c >> index b228c3bcee37..2896730458b5 100644 >> --- a/sys/net/route/nhgrp_ctl.c >> +++ b/sys/net/route/nhgrp_ctl.c >> @@ -806,7 +806,9 @@ nhgrp_dump_sysctl(struct rib_head *rh, struct = sysctl_req=20 >> *w) >> sz =3D sizeof(struct rt_msghdr) + sizeof(struct nhgrp_external); >> sz +=3D 2 * sizeof(struct nhgrp_container); >> sz +=3D 2 * sizeof(struct nhgrp_nhop_external) * = RIB_MAX_MPATH_WIDTH; >> - buffer =3D malloc(sz, M_TEMP, M_WAITOK); >> + buffer =3D malloc(sz, M_TEMP, M_MOWAIT); > ^ > This appears to be a typo. Fixed typo, build, tested but forgot to amend the commit. 0c2a0e038002cba423161aeed8f358ffb4fb2836 should fix it. >=20 >> + if (buffer =3D=3D NULL) >> + return (ENOMEM); >>=20 >> NET_EPOCH_ENTER(et); >> NHOPS_RLOCK(ctl); >>=20 >=20 >=20 >=20 > --=20 > Cheers, > Cy Schubert > FreeBSD UNIX: Web: https://FreeBSD.org > NTP: Web: https://nwtime.org >=20 > The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Mon Mar 29 23:49:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 665CB5B094C; Mon, 29 Mar 2021 23:49:25 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8Tnc71lTz4vFd; Mon, 29 Mar 2021 23:49:24 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.66.148.124]) by shaw.ca with ESMTPA id R1dHlUdqiHmS3R1dIlpOC1; Mon, 29 Mar 2021 17:49:22 -0600 X-Authority-Analysis: v=2.4 cv=MaypB7zf c=1 sm=1 tr=0 ts=60626782 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=dESyimp9J3IA:10 a=sVRy8H1vAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=rExBHMwXyAQMdahpxk8A:9 a=CjuIK1q_8ugA:10 a=UJ0tAi3fqDAA:10 a=mL5YggztzNiiHV2pp1Gt:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 23F2D1C7; Mon, 29 Mar 2021 16:49:18 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 12TNnI7F007733; Mon, 29 Mar 2021 16:49:18 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202103292349.12TNnI7F007733@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: "Alexander V. Chernikov" cc: Cy Schubert , "Alexander V. Chernikov" , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 9fa8d1582b44 - main - Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). In-reply-to: <8FEA74E1-246F-45E3-9794-330029DCD53E@ipfw.ru> References: <202103292315.12TNFFmZ050152@gitrepo.freebsd.org> <202103292332.12TNWXSv007193@slippy.cwsent.com> <8FEA74E1-246F-45E3-9794-330029DCD53E@ipfw.ru> Comments: In-reply-to "Alexander V. Chernikov" message dated "Tue, 30 Mar 2021 00:44:52 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 29 Mar 2021 16:49:18 -0700 X-CMAE-Envelope: MS4xfFkSb9VbSto5qxK4NJ3P6ARLvp+N8Huv9AInsTnnOHJ9F7MJYk2lB3jhXFpcGV2wSTPgZoRgCDFa5y8uwQ5OqsjozpRNxqL+CSrxXbbUdnZfVZE99Xny Nh/UjG01A2lnsNSu0i8qnv98X/slMQ/sUOl77hbjDxiOVBCRAIf8ciYEvgrAxWcPobGrPjSUH4Cf0S5W0bOIPQbmJm+VEoEoYRc75PgPVs3pVtxRYTrhbwBZ IrKpBun1eQIPLdN9hhjYge5lHiWrpxJHld4lLMgn/+ankEctCCCyvFwcUHL9PuOL0ZfPEGznIHqlQM1CVVbt0H7o6y9T+SOg4EY1m/1Ffyj3a4nTeoN6l3do 8VYLSOmq X-Rspamd-Queue-Id: 4F8Tnc71lTz4vFd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 23:49:25 -0000 In message <8FEA74E1-246F-45E3-9794-330029DCD53E@ipfw.ru>, "Alexander V. Cherni kov" writes: > > > > On 30 Mar 2021, at 00:32, Cy Schubert wrote: > > > > In message <202103292315.12TNFFmZ050152@gitrepo.freebsd.org>, "Alexander V. > > > Che > > rnikov" writes: > >> The branch main has been updated by melifaro: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=9fa8d1582b44b4850d40699c9adb1 > 047 > >> 32328b7d > >> > >> commit 9fa8d1582b44b4850d40699c9adb104732328b7d > >> Author: Alexander V. Chernikov > >> AuthorDate: 2021-03-29 23:12:11 +0000 > >> Commit: Alexander V. Chernikov > >> CommitDate: 2021-03-29 23:12:11 +0000 > >> > >> Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). > >> > >> Recent rtsock changes widened epoch and covered nhgrp_dump_sysctl(), > >> resulting in `netstat -4On` triggering with KASSERT. > >> > >> MFC after: 1 day > >> --- > >> sys/net/route/nhgrp_ctl.c | 4 +++- > >> 1 file changed, 3 insertions(+), 1 deletion(-) > >> > >> diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c > >> index b228c3bcee37..2896730458b5 100644 > >> --- a/sys/net/route/nhgrp_ctl.c > >> +++ b/sys/net/route/nhgrp_ctl.c > >> @@ -806,7 +806,9 @@ nhgrp_dump_sysctl(struct rib_head *rh, struct sysctl_r > eq > >> *w) > >> sz = sizeof(struct rt_msghdr) + sizeof(struct nhgrp_external); > >> sz += 2 * sizeof(struct nhgrp_container); > >> sz += 2 * sizeof(struct nhgrp_nhop_external) * RIB_MAX_MPATH_WIDTH; > >> - buffer = malloc(sz, M_TEMP, M_WAITOK); > >> + buffer = malloc(sz, M_TEMP, M_MOWAIT); > > ^ > > This appears to be a typo. > Fixed typo, build, tested but forgot to amend the commit. > 0c2a0e038002cba423161aeed8f358ffb4fb2836 should fix it. Thanks. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Tue Mar 30 06:19:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 970005BBF77; Tue, 30 Mar 2021 06:19:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8fRK3hPcz3pNk; Tue, 30 Mar 2021 06:19:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DA48215EB; Tue, 30 Mar 2021 06:19:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12U6J9r0039682; Tue, 30 Mar 2021 06:19:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12U6J9Ln039681; Tue, 30 Mar 2021 06:19:09 GMT (envelope-from git) Date: Tue, 30 Mar 2021 06:19:09 GMT Message-Id: <202103300619.12U6J9Ln039681@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 27bf5dd3d403 - main - netmap: pkt-gen: allow -Z and -z to be used together MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27bf5dd3d40397fa7d20a17828de2801c8a94a4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 06:19:09 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=27bf5dd3d40397fa7d20a17828de2801c8a94a4b commit 27bf5dd3d40397fa7d20a17828de2801c8a94a4b Author: Vincenzo Maffione AuthorDate: 2021-03-30 06:13:07 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-30 06:18:46 +0000 netmap: pkt-gen: allow -Z and -z to be used together These options are used for generating random source/destination IP/ports within transmitted packets. MFC after: 1 week --- tools/tools/netmap/pkt-gen.c | 125 +++++++++++++++++++++++-------------------- 1 file changed, 66 insertions(+), 59 deletions(-) diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c index 55504c09ae58..ebc0ac977219 100644 --- a/tools/tools/netmap/pkt-gen.c +++ b/tools/tools/netmap/pkt-gen.c @@ -802,6 +802,25 @@ dump_payload(const char *_p, int len, struct netmap_ring *ring, int cur) #define uh_sum check #endif /* linux */ +static uint16_t +new_ip_sum(uint16_t ip_sum, uint32_t oaddr, uint32_t naddr) +{ + ip_sum = cksum_add(ip_sum, ~oaddr >> 16); + ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff); + ip_sum = cksum_add(ip_sum, naddr >> 16); + ip_sum = cksum_add(ip_sum, naddr & 0xffff); + return ip_sum; +} + +static uint16_t +new_udp_sum(uint16_t udp_sum, uint16_t oport, uint16_t nport) +{ + udp_sum = cksum_add(udp_sum, ~oport); + udp_sum = cksum_add(udp_sum, nport); + return udp_sum; +} + + static void update_ip(struct pkt *pkt, struct targ *t) { @@ -810,7 +829,7 @@ update_ip(struct pkt *pkt, struct targ *t) struct udphdr udp; uint32_t oaddr, naddr; uint16_t oport, nport; - uint16_t ip_sum, udp_sum; + uint16_t ip_sum = 0, udp_sum = 0; memcpy(&ip, &pkt->ipv4.ip, sizeof(ip)); memcpy(&udp, &pkt->ipv4.udp, sizeof(udp)); @@ -823,35 +842,28 @@ update_ip(struct pkt *pkt, struct targ *t) udp.uh_sport = nrand48(t->seed); naddr = ntohl(ip.ip_src.s_addr); nport = ntohs(udp.uh_sport); - break; - } - if (oport < g->src_ip.port1) { - nport = oport + 1; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + udp_sum = new_udp_sum(udp_sum, oport, nport); + } else { + if (oport < g->src_ip.port1) { + nport = oport + 1; + udp.uh_sport = htons(nport); + udp_sum = new_udp_sum(udp_sum, oport, nport); + break; + } + nport = g->src_ip.port0; udp.uh_sport = htons(nport); - break; - } - nport = g->src_ip.port0; - udp.uh_sport = htons(nport); - if (oaddr < g->src_ip.ipv4.end) { - naddr = oaddr + 1; + if (oaddr < g->src_ip.ipv4.end) { + naddr = oaddr + 1; + ip.ip_src.s_addr = htonl(naddr); + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + break; + } + naddr = g->src_ip.ipv4.start; ip.ip_src.s_addr = htonl(naddr); - break; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); } - naddr = g->src_ip.ipv4.start; - ip.ip_src.s_addr = htonl(naddr); - } while (0); - /* update checksums if needed */ - if (oaddr != naddr) { - ip_sum = cksum_add(ip_sum, ~oaddr >> 16); - ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff); - ip_sum = cksum_add(ip_sum, naddr >> 16); - ip_sum = cksum_add(ip_sum, naddr & 0xffff); - } - if (oport != nport) { - udp_sum = cksum_add(udp_sum, ~oport); - udp_sum = cksum_add(udp_sum, nport); - } - do { + naddr = oaddr = ntohl(ip.ip_dst.s_addr); nport = oport = ntohs(udp.uh_dport); if (g->options & OPT_RANDOM_DST) { @@ -859,34 +871,29 @@ update_ip(struct pkt *pkt, struct targ *t) udp.uh_dport = nrand48(t->seed); naddr = ntohl(ip.ip_dst.s_addr); nport = ntohs(udp.uh_dport); - break; - } - if (oport < g->dst_ip.port1) { - nport = oport + 1; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + udp_sum = new_udp_sum(udp_sum, oport, nport); + } else { + if (oport < g->dst_ip.port1) { + nport = oport + 1; + udp.uh_dport = htons(nport); + udp_sum = new_udp_sum(udp_sum, oport, nport); + break; + } + nport = g->dst_ip.port0; udp.uh_dport = htons(nport); - break; - } - nport = g->dst_ip.port0; - udp.uh_dport = htons(nport); - if (oaddr < g->dst_ip.ipv4.end) { - naddr = oaddr + 1; + if (oaddr < g->dst_ip.ipv4.end) { + naddr = oaddr + 1; + ip.ip_dst.s_addr = htonl(naddr); + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + break; + } + naddr = g->dst_ip.ipv4.start; ip.ip_dst.s_addr = htonl(naddr); - break; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); } - naddr = g->dst_ip.ipv4.start; - ip.ip_dst.s_addr = htonl(naddr); } while (0); /* update checksums */ - if (oaddr != naddr) { - ip_sum = cksum_add(ip_sum, ~oaddr >> 16); - ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff); - ip_sum = cksum_add(ip_sum, naddr >> 16); - ip_sum = cksum_add(ip_sum, naddr & 0xffff); - } - if (oport != nport) { - udp_sum = cksum_add(udp_sum, ~oport); - udp_sum = cksum_add(udp_sum, nport); - } if (udp_sum != 0) udp.uh_sum = ~cksum_add(~udp.uh_sum, htons(udp_sum)); if (ip_sum != 0) { @@ -939,14 +946,14 @@ update_ip6(struct pkt *pkt, struct targ *t) } naddr = ntohs(g->src_ip.ipv6.start.s6_addr16[group]); ip6.ip6_src.s6_addr16[group] = htons(naddr); - } while (0); - /* update checksums if needed */ - if (oaddr != naddr) - udp_sum = cksum_add(~oaddr, naddr); - if (oport != nport) - udp_sum = cksum_add(udp_sum, - cksum_add(~oport, nport)); - do { + + /* update checksums if needed */ + if (oaddr != naddr) + udp_sum = cksum_add(~oaddr, naddr); + if (oport != nport) + udp_sum = cksum_add(udp_sum, + cksum_add(~oport, nport)); + group = g->dst_ip.ipv6.egroup; naddr = oaddr = ntohs(ip6.ip6_dst.s6_addr16[group]); nport = oport = ntohs(udp.uh_dport); @@ -2504,7 +2511,7 @@ start_threads(struct glob_arg *g) { * using a single descriptor. */ for (i = 0; i < g->nthreads; i++) { - uint64_t seed = time(0) | (time(0) << 32); + uint64_t seed = (uint64_t)time(0) | ((uint64_t)time(0) << 32); t = &targs[i]; bzero(t, sizeof(*t)); From owner-dev-commits-src-all@freebsd.org Tue Mar 30 06:29:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AA6A5BC452; Tue, 30 Mar 2021 06:29:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8fgb2ZHFz3q6l; Tue, 30 Mar 2021 06:29:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46F4121D09; Tue, 30 Mar 2021 06:29:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12U6TlKB054176; Tue, 30 Mar 2021 06:29:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12U6TlCT054175; Tue, 30 Mar 2021 06:29:47 GMT (envelope-from git) Date: Tue, 30 Mar 2021 06:29:47 GMT Message-Id: <202103300629.12U6TlCT054175@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 51cc31088bf4 - main - netmap: bridge: fix transmission in busy-wait mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51cc31088bf4d23a6ad0bfe8851adaa049d750fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 06:29:47 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=51cc31088bf4d23a6ad0bfe8851adaa049d750fc commit 51cc31088bf4d23a6ad0bfe8851adaa049d750fc Author: Vincenzo Maffione AuthorDate: 2021-03-30 06:24:56 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-30 06:24:56 +0000 netmap: bridge: fix transmission in busy-wait mode In busy-wait mode (BUSYWAIT defined), NIOCTXSYNC should be performed after packets have been moved to the TX ring (rather than before). Before the change, moved packets may stall for an indefinite time in the TX ring. MFC after: 1 week --- tools/tools/netmap/bridge.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/tools/netmap/bridge.c b/tools/tools/netmap/bridge.c index 77d235bf6e08..0c8f56265ff4 100644 --- a/tools/tools/netmap/bridge.c +++ b/tools/tools/netmap/bridge.c @@ -17,6 +17,10 @@ #include #include +#if defined(_WIN32) +#define BUSYWAIT +#endif + static int verbose = 0; static int do_abort = 0; @@ -321,21 +325,19 @@ main(int argc, char **argv) pollfd[0].revents = pollfd[1].revents = 0; n0 = rx_slots_avail(pa); n1 = rx_slots_avail(pb); -#if defined(_WIN32) || defined(BUSYWAIT) +#ifdef BUSYWAIT if (n0) { - ioctl(pollfd[1].fd, NIOCTXSYNC, NULL); pollfd[1].revents = POLLOUT; } else { ioctl(pollfd[0].fd, NIOCRXSYNC, NULL); } if (n1) { - ioctl(pollfd[0].fd, NIOCTXSYNC, NULL); pollfd[0].revents = POLLOUT; } else { ioctl(pollfd[1].fd, NIOCRXSYNC, NULL); } ret = 1; -#else +#else /* !defined(BUSYWAIT) */ if (n0) pollfd[1].events |= POLLOUT; else @@ -347,7 +349,7 @@ main(int argc, char **argv) /* poll() also cause kernel to txsync/rxsync the NICs */ ret = poll(pollfd, 2, 2500); -#endif /* defined(_WIN32) || defined(BUSYWAIT) */ +#endif /* !defined(BUSYWAIT) */ if (ret <= 0 || verbose) D("poll %s [0] ev %x %x rx %d@%d tx %d," " [1] ev %x %x rx %d@%d tx %d", @@ -375,11 +377,19 @@ main(int argc, char **argv) D("error on fd1, rx [%d,%d,%d)", rx->head, rx->cur, rx->tail); } - if (pollfd[0].revents & POLLOUT) + if (pollfd[0].revents & POLLOUT) { ports_move(pb, pa, burst, msg_b2a); +#ifdef BUSYWAIT + ioctl(pollfd[0].fd, NIOCTXSYNC, NULL); +#endif + } - if (pollfd[1].revents & POLLOUT) + if (pollfd[1].revents & POLLOUT) { ports_move(pa, pb, burst, msg_a2b); +#ifdef BUSYWAIT + ioctl(pollfd[1].fd, NIOCTXSYNC, NULL); +#endif + } /* * We don't need ioctl(NIOCTXSYNC) on the two file descriptors. From owner-dev-commits-src-all@freebsd.org Tue Mar 30 08:01:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE0C25BF189; Tue, 30 Mar 2021 08:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8hj84bN4z3vyc; Tue, 30 Mar 2021 08:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9104423102; Tue, 30 Mar 2021 08:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12U81G6f089352; Tue, 30 Mar 2021 08:01:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12U81GXX089351; Tue, 30 Mar 2021 08:01:16 GMT (envelope-from git) Date: Tue, 30 Mar 2021 08:01:16 GMT Message-Id: <202103300801.12U81GXX089351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 923e7f7e1267 - stable/13 - Fix nexhtop group index array scaling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 923e7f7e12670e97b097a195e69c848a6e8773a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 08:01:16 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=923e7f7e12670e97b097a195e69c848a6e8773a2 commit 923e7f7e12670e97b097a195e69c848a6e8773a2 Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:00:17 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-30 07:34:31 +0000 Fix nexhtop group index array scaling. The current code has the limit of 127 nexthop groups due to the wrongly-checked bitmask_copy() return value. PR: 254303 Reported by: Aleks (cherry picked from commit 9095dc7da4cf0c484fb1160b2180b7329b09b107) --- sys/net/route/nhgrp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/route/nhgrp.c b/sys/net/route/nhgrp.c index c25f4f09865b..f6638b12ebea 100644 --- a/sys/net/route/nhgrp.c +++ b/sys/net/route/nhgrp.c @@ -243,8 +243,8 @@ consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, uint32_t new_id CHT_SLIST_RESIZE(&ctl->gr_head, mpath, nh_ptr, new_nh_buckets); } if (nh_idx_ptr != NULL) { - if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items)) - bitmask_swap(&ctl->nh_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); + if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items) == 0) + bitmask_swap(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); } NHOPS_WUNLOCK(ctl); From owner-dev-commits-src-all@freebsd.org Tue Mar 30 08:01:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CB445BF12C; Tue, 30 Mar 2021 08:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8hj940xlz3vwD; Tue, 30 Mar 2021 08:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A4A622F0F; Tue, 30 Mar 2021 08:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12U81He9089377; Tue, 30 Mar 2021 08:01:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12U81HoS089376; Tue, 30 Mar 2021 08:01:17 GMT (envelope-from git) Date: Tue, 30 Mar 2021 08:01:17 GMT Message-Id: <202103300801.12U81HoS089376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 145ca12d22a4 - stable/13 - Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 145ca12d22a40a9136ba6cd1ce434d3d044bddea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 08:01:17 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=145ca12d22a40a9136ba6cd1ce434d3d044bddea commit 145ca12d22a40a9136ba6cd1ce434d3d044bddea Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:12:11 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-30 07:36:04 +0000 Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). Recent rtsock changes widened epoch and covered nhgrp_dump_sysctl(), resulting in `netstat -4On` triggering with KASSERT. (cherry picked from commit 9fa8d1582b44b4850d40699c9adb104732328b7d) --- sys/net/route/nhgrp_ctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index b228c3bcee37..49866499ac86 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -806,7 +806,9 @@ nhgrp_dump_sysctl(struct rib_head *rh, struct sysctl_req *w) sz = sizeof(struct rt_msghdr) + sizeof(struct nhgrp_external); sz += 2 * sizeof(struct nhgrp_container); sz += 2 * sizeof(struct nhgrp_nhop_external) * RIB_MAX_MPATH_WIDTH; - buffer = malloc(sz, M_TEMP, M_WAITOK); + buffer = malloc(sz, M_TEMP, M_NOWAIT); + if (buffer == NULL) + return (ENOMEM); NET_EPOCH_ENTER(et); NHOPS_RLOCK(ctl); From owner-dev-commits-src-all@freebsd.org Tue Mar 30 08:47:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01D965C00DD; Tue, 30 Mar 2021 08:47:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8jkr6bm7z4SL2; Tue, 30 Mar 2021 08:47:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D562723981; Tue, 30 Mar 2021 08:47:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12U8lmU3049093; Tue, 30 Mar 2021 08:47:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12U8lmQb049092; Tue, 30 Mar 2021 08:47:48 GMT (envelope-from git) Date: Tue, 30 Mar 2021 08:47:48 GMT Message-Id: <202103300847.12U8lmQb049092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: b013912772ec - main - bhyve: change vq_getchain to return iovecs in both directions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b013912772ec9e135b52aaec5f70bc92a191ebdb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 08:47:49 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=b013912772ec9e135b52aaec5f70bc92a191ebdb commit b013912772ec9e135b52aaec5f70bc92a191ebdb Author: Ka Ho Ng AuthorDate: 2021-03-30 08:43:24 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-30 08:44:07 +0000 bhyve: change vq_getchain to return iovecs in both directions The old prototype requires callers to inspect flags of each descriptors to get the starting position of host-writable iovecs. vq_getchain() is changed to return a virtio request with the number of host-readable iovecs and host-writable iovecs instead. Callers can avoid boilerplate code of getting the start offset of host-writable iovecs. Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Reviewed by: afedorov Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D29433 --- usr.sbin/bhyve/pci_virtio_9p.c | 22 +++++++--------------- usr.sbin/bhyve/pci_virtio_block.c | 25 +++++++++++++------------ usr.sbin/bhyve/pci_virtio_console.c | 20 ++++++++++---------- usr.sbin/bhyve/pci_virtio_net.c | 12 +++++++----- usr.sbin/bhyve/pci_virtio_rnd.c | 6 +++--- usr.sbin/bhyve/pci_virtio_scsi.c | 34 +++++++++++++--------------------- usr.sbin/bhyve/virtio.c | 36 +++++++++++++++++++++--------------- usr.sbin/bhyve/virtio.h | 16 ++++++++++++++-- 8 files changed, 88 insertions(+), 83 deletions(-) diff --git a/usr.sbin/bhyve/pci_virtio_9p.c b/usr.sbin/bhyve/pci_virtio_9p.c index e27159eb22cb..fed18ce5a8cc 100644 --- a/usr.sbin/bhyve/pci_virtio_9p.c +++ b/usr.sbin/bhyve/pci_virtio_9p.c @@ -197,32 +197,24 @@ pci_vt9p_notify(void *vsc, struct vqueue_info *vq) struct iovec iov[VT9P_MAX_IOV]; struct pci_vt9p_softc *sc; struct pci_vt9p_request *preq; - uint16_t idx, n, i; - uint16_t flags[VT9P_MAX_IOV]; + struct vi_req req; + uint16_t n; sc = vsc; while (vq_has_descs(vq)) { - n = vq_getchain(vq, &idx, iov, VT9P_MAX_IOV, flags); + n = vq_getchain(vq, iov, VT9P_MAX_IOV, &req); preq = calloc(1, sizeof(struct pci_vt9p_request)); preq->vsr_sc = sc; - preq->vsr_idx = idx; + preq->vsr_idx = req.idx; preq->vsr_iov = iov; preq->vsr_niov = n; - preq->vsr_respidx = 0; - - /* Count readable descriptors */ - for (i = 0; i < n; i++) { - if (flags[i] & VRING_DESC_F_WRITE) - break; - - preq->vsr_respidx++; - } + preq->vsr_respidx = req.readable; for (int i = 0; i < n; i++) { DPRINTF(("vt9p: vt9p_notify(): desc%d base=%p, " - "len=%zu, flags=0x%04x\r\n", i, iov[i].iov_base, - iov[i].iov_len, flags[i])); + "len=%zu\r\n", i, iov[i].iov_base, + iov[i].iov_len)); } l9p_connection_recv(sc->vsc_conn, iov, preq->vsr_respidx, preq); diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c index 0dc58e49594b..8a172c54eda7 100644 --- a/usr.sbin/bhyve/pci_virtio_block.c +++ b/usr.sbin/bhyve/pci_virtio_block.c @@ -308,11 +308,11 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq) int err; ssize_t iolen; int writeop, type; + struct vi_req req; struct iovec iov[BLOCKIF_IOV_MAX + 2]; - uint16_t idx, flags[BLOCKIF_IOV_MAX + 2]; struct virtio_blk_discard_write_zeroes *discard; - n = vq_getchain(vq, &idx, iov, BLOCKIF_IOV_MAX + 2, flags); + n = vq_getchain(vq, iov, BLOCKIF_IOV_MAX + 2, &req); /* * The first descriptor will be the read-only fixed header, @@ -324,16 +324,16 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq) */ assert(n >= 2 && n <= BLOCKIF_IOV_MAX + 2); - io = &sc->vbsc_ios[idx]; - assert((flags[0] & VRING_DESC_F_WRITE) == 0); + io = &sc->vbsc_ios[req.idx]; + assert(req.readable != 0); assert(iov[0].iov_len == sizeof(struct virtio_blk_hdr)); vbh = (struct virtio_blk_hdr *)iov[0].iov_base; memcpy(&io->io_req.br_iov, &iov[1], sizeof(struct iovec) * (n - 2)); io->io_req.br_iovcnt = n - 2; io->io_req.br_offset = vbh->vbh_sector * VTBLK_BSIZE; io->io_status = (uint8_t *)iov[--n].iov_base; + assert(req.writable != 0); assert(iov[n].iov_len == 1); - assert(flags[n] & VRING_DESC_F_WRITE); /* * XXX @@ -342,16 +342,17 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq) */ type = vbh->vbh_type & ~VBH_FLAG_BARRIER; writeop = (type == VBH_OP_WRITE || type == VBH_OP_DISCARD); + /* + * - Write op implies read-only descriptor + * - Read/ident op implies write-only descriptor + * + * By taking away either the read-only fixed header or the write-only + * status iovec, the following condition should hold true. + */ + assert(n == (writeop ? req.readable : req.writable)); iolen = 0; for (i = 1; i < n; i++) { - /* - * - write op implies read-only descriptor, - * - read/ident op implies write-only descriptor, - * therefore test the inverse of the descriptor bit - * to the op. - */ - assert(((flags[i] & VRING_DESC_F_WRITE) == 0) == writeop); iolen += iov[i].iov_len; } io->io_req.br_resid = iolen; diff --git a/usr.sbin/bhyve/pci_virtio_console.c b/usr.sbin/bhyve/pci_virtio_console.c index 88d6c37f582e..6832a3f92774 100644 --- a/usr.sbin/bhyve/pci_virtio_console.c +++ b/usr.sbin/bhyve/pci_virtio_console.c @@ -415,10 +415,10 @@ pci_vtcon_sock_rx(int fd __unused, enum ev_type t __unused, void *arg) struct pci_vtcon_port *port; struct pci_vtcon_sock *sock = (struct pci_vtcon_sock *)arg; struct vqueue_info *vq; + struct vi_req req; struct iovec iov; static char dummybuf[2048]; int len, n; - uint16_t idx; port = sock->vss_port; vq = pci_vtcon_port_to_vq(port, true); @@ -441,7 +441,7 @@ pci_vtcon_sock_rx(int fd __unused, enum ev_type t __unused, void *arg) } do { - n = vq_getchain(vq, &idx, &iov, 1, NULL); + n = vq_getchain(vq, &iov, 1, &req); len = readv(sock->vss_conn_fd, &iov, n); if (len == 0 || (len < 0 && errno == EWOULDBLOCK)) { @@ -453,7 +453,7 @@ pci_vtcon_sock_rx(int fd __unused, enum ev_type t __unused, void *arg) return; } - vq_relchain(vq, idx, len); + vq_relchain(vq, req.idx, len); } while (vq_has_descs(vq)); vq_endchains(vq, 1); @@ -572,8 +572,8 @@ pci_vtcon_control_send(struct pci_vtcon_softc *sc, struct pci_vtcon_control *ctrl, const void *payload, size_t len) { struct vqueue_info *vq; + struct vi_req req; struct iovec iov; - uint16_t idx; int n; vq = pci_vtcon_port_to_vq(&sc->vsc_control_port, true); @@ -581,7 +581,7 @@ pci_vtcon_control_send(struct pci_vtcon_softc *sc, if (!vq_has_descs(vq)) return; - n = vq_getchain(vq, &idx, &iov, 1, NULL); + n = vq_getchain(vq, &iov, 1, &req); assert(n == 1); @@ -590,7 +590,7 @@ pci_vtcon_control_send(struct pci_vtcon_softc *sc, memcpy(iov.iov_base + sizeof(struct pci_vtcon_control), payload, len); - vq_relchain(vq, idx, sizeof(struct pci_vtcon_control) + len); + vq_relchain(vq, req.idx, sizeof(struct pci_vtcon_control) + len); vq_endchains(vq, 1); } @@ -601,14 +601,14 @@ pci_vtcon_notify_tx(void *vsc, struct vqueue_info *vq) struct pci_vtcon_softc *sc; struct pci_vtcon_port *port; struct iovec iov[1]; - uint16_t idx, n; - uint16_t flags[8]; + struct vi_req req; + uint16_t n; sc = vsc; port = pci_vtcon_vq_to_port(sc, vq); while (vq_has_descs(vq)) { - n = vq_getchain(vq, &idx, iov, 1, flags); + n = vq_getchain(vq, iov, 1, &req); assert(n >= 1); if (port != NULL) port->vsp_cb(port, port->vsp_arg, iov, 1); @@ -616,7 +616,7 @@ pci_vtcon_notify_tx(void *vsc, struct vqueue_info *vq) /* * Release this chain and handle more */ - vq_relchain(vq, idx, 0); + vq_relchain(vq, req.idx, 0); } vq_endchains(vq, 1); /* Generate interrupt if appropriate. */ } diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c index 0ea470a71b56..d253b081d13a 100644 --- a/usr.sbin/bhyve/pci_virtio_net.c +++ b/usr.sbin/bhyve/pci_virtio_net.c @@ -248,6 +248,7 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) struct virtio_mrg_rxbuf_info info[VTNET_MAXSEGS]; struct iovec iov[VTNET_MAXSEGS + 1]; struct vqueue_info *vq; + struct vi_req req; vq = &sc->vsc_queues[VTNET_RXQ]; @@ -288,8 +289,9 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) riov = iov; n_chains = 0; do { - int n = vq_getchain(vq, &info[n_chains].idx, riov, - VTNET_MAXSEGS - riov_len, NULL); + int n = vq_getchain(vq, riov, VTNET_MAXSEGS - riov_len, + &req); + info[n_chains].idx = req.idx; if (n == 0) { /* @@ -435,7 +437,7 @@ pci_vtnet_proctx(struct pci_vtnet_softc *sc, struct vqueue_info *vq) { struct iovec iov[VTNET_MAXSEGS + 1]; struct iovec *siov = iov; - uint16_t idx; + struct vi_req req; ssize_t len; int n; @@ -443,7 +445,7 @@ pci_vtnet_proctx(struct pci_vtnet_softc *sc, struct vqueue_info *vq) * Obtain chain of descriptors. The first descriptor also * contains the virtio-net header. */ - n = vq_getchain(vq, &idx, iov, VTNET_MAXSEGS, NULL); + n = vq_getchain(vq, iov, VTNET_MAXSEGS, &req); assert(n >= 1 && n <= VTNET_MAXSEGS); if (sc->vhdrlen != sc->be_vhdrlen) { @@ -473,7 +475,7 @@ pci_vtnet_proctx(struct pci_vtnet_softc *sc, struct vqueue_info *vq) * Return the processed chain to the guest, reporting * the number of bytes that we read. */ - vq_relchain(vq, idx, len); + vq_relchain(vq, req.idx, len); } /* Called on TX kick. */ diff --git a/usr.sbin/bhyve/pci_virtio_rnd.c b/usr.sbin/bhyve/pci_virtio_rnd.c index d51301b32534..1d2d6144f949 100644 --- a/usr.sbin/bhyve/pci_virtio_rnd.c +++ b/usr.sbin/bhyve/pci_virtio_rnd.c @@ -113,8 +113,8 @@ pci_vtrnd_notify(void *vsc, struct vqueue_info *vq) { struct iovec iov; struct pci_vtrnd_softc *sc; + struct vi_req req; int len; - uint16_t idx; sc = vsc; @@ -124,7 +124,7 @@ pci_vtrnd_notify(void *vsc, struct vqueue_info *vq) } while (vq_has_descs(vq)) { - vq_getchain(vq, &idx, &iov, 1, NULL); + vq_getchain(vq, &iov, 1, &req); len = read(sc->vrsc_fd, iov.iov_base, iov.iov_len); @@ -136,7 +136,7 @@ pci_vtrnd_notify(void *vsc, struct vqueue_info *vq) /* * Release this chain and handle more */ - vq_relchain(vq, idx, len); + vq_relchain(vq, req.idx, len); } vq_endchains(vq, 1); /* Generate interrupt if appropriate. */ } diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index eee9847494dc..aed2fe2dbb23 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -558,7 +558,8 @@ pci_vtscsi_controlq_notify(void *vsc, struct vqueue_info *vq) { struct pci_vtscsi_softc *sc; struct iovec iov[VTSCSI_MAXSEG]; - uint16_t idx, n; + struct vi_req req; + uint16_t n; void *buf = NULL; size_t bufsize; int iolen; @@ -566,7 +567,7 @@ pci_vtscsi_controlq_notify(void *vsc, struct vqueue_info *vq) sc = vsc; while (vq_has_descs(vq)) { - n = vq_getchain(vq, &idx, iov, VTSCSI_MAXSEG, NULL); + n = vq_getchain(vq, iov, VTSCSI_MAXSEG, &req); bufsize = iov_to_buf(iov, n, &buf); iolen = pci_vtscsi_control_handle(sc, buf, bufsize); buf_to_iov(buf + bufsize - iolen, iolen, iov, n, @@ -575,7 +576,7 @@ pci_vtscsi_controlq_notify(void *vsc, struct vqueue_info *vq) /* * Release this chain and handle more */ - vq_relchain(vq, idx, iolen); + vq_relchain(vq, req.idx, iolen); } vq_endchains(vq, 1); /* Generate interrupt if appropriate. */ free(buf); @@ -595,33 +596,23 @@ pci_vtscsi_requestq_notify(void *vsc, struct vqueue_info *vq) struct pci_vtscsi_queue *q; struct pci_vtscsi_request *req; struct iovec iov[VTSCSI_MAXSEG]; - uint16_t flags[VTSCSI_MAXSEG]; - uint16_t idx, n, i; - int readable; + struct vi_req vireq; + uint16_t n; sc = vsc; q = &sc->vss_queues[vq->vq_num - 2]; while (vq_has_descs(vq)) { - readable = 0; - n = vq_getchain(vq, &idx, iov, VTSCSI_MAXSEG, flags); - - /* Count readable descriptors */ - for (i = 0; i < n; i++) { - if (flags[i] & VRING_DESC_F_WRITE) - break; - - readable++; - } + n = vq_getchain(vq, iov, VTSCSI_MAXSEG, &vireq); req = calloc(1, sizeof(struct pci_vtscsi_request)); - req->vsr_idx = idx; + req->vsr_idx = vireq.idx; req->vsr_queue = q; - req->vsr_niov_in = readable; - req->vsr_niov_out = n - readable; + req->vsr_niov_in = vireq.readable; + req->vsr_niov_out = vireq.writable; memcpy(req->vsr_iov_in, iov, req->vsr_niov_in * sizeof(struct iovec)); - memcpy(req->vsr_iov_out, iov + readable, + memcpy(req->vsr_iov_out, iov + vireq.readable, req->vsr_niov_out * sizeof(struct iovec)); pthread_mutex_lock(&q->vsq_mtx); @@ -629,7 +620,8 @@ pci_vtscsi_requestq_notify(void *vsc, struct vqueue_info *vq) pthread_cond_signal(&q->vsq_cv); pthread_mutex_unlock(&q->vsq_mtx); - DPRINTF(("virtio-scsi: request enqueued", idx)); + DPRINTF(("virtio-scsi: request enqueued", + vireq.idx)); } } diff --git a/usr.sbin/bhyve/virtio.c b/usr.sbin/bhyve/virtio.c index 078a74b759df..7f0485cbb826 100644 --- a/usr.sbin/bhyve/virtio.c +++ b/usr.sbin/bhyve/virtio.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -213,15 +214,18 @@ vi_vq_init(struct virtio_softc *vs, uint32_t pfn) * descriptor. */ static inline void -_vq_record(int i, volatile struct vring_desc *vd, struct vmctx *ctx, - struct iovec *iov, int n_iov, uint16_t *flags) { +_vq_record(int i, volatile struct vring_desc *vd, + struct vmctx *ctx, struct iovec *iov, int n_iov, + struct vi_req *reqp) { if (i >= n_iov) return; iov[i].iov_base = paddr_guest2host(ctx, vd->addr, vd->len); iov[i].iov_len = vd->len; - if (flags != NULL) - flags[i] = vd->flags; + if ((vd->flags & VRING_DESC_F_WRITE) == 0) + reqp->readable++; + else + reqp->writable++; } #define VQ_MAX_DESCRIPTORS 512 /* see below */ @@ -253,11 +257,6 @@ _vq_record(int i, volatile struct vring_desc *vd, struct vmctx *ctx, * a larger iov array if needed, or supply a zero length to find * out how much space is needed). * - * If you want to verify the WRITE flag on each descriptor, pass a - * non-NULL "flags" pointer to an array of "uint16_t" of the same size - * as n_iov and we'll copy each "flags" field after unwinding any - * indirects. - * * If some descriptor(s) are invalid, this prints a diagnostic message * and returns -1. If no descriptors are ready now it simply returns 0. * @@ -265,12 +264,13 @@ _vq_record(int i, volatile struct vring_desc *vd, struct vmctx *ctx, * that vq_has_descs() does one). */ int -vq_getchain(struct vqueue_info *vq, uint16_t *pidx, - struct iovec *iov, int n_iov, uint16_t *flags) +vq_getchain(struct vqueue_info *vq, struct iovec *iov, int niov, + struct vi_req *reqp) { int i; u_int ndesc, n_indir; u_int idx, next; + struct vi_req req; volatile struct vring_desc *vdir, *vindir, *vp; struct vmctx *ctx; struct virtio_softc *vs; @@ -278,6 +278,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, vs = vq->vq_vs; name = vs->vs_vc->vc_name; + memset(&req, 0, sizeof(req)); /* * Note: it's the responsibility of the guest not to @@ -313,7 +314,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, * index, but we just abort if the count gets excessive. */ ctx = vs->vs_pi->pi_vmctx; - *pidx = next = vq->vq_avail->ring[idx & (vq->vq_qsize - 1)]; + req.idx = next = vq->vq_avail->ring[idx & (vq->vq_qsize - 1)]; vq->vq_last_avail++; for (i = 0; i < VQ_MAX_DESCRIPTORS; next = vdir->next) { if (next >= vq->vq_qsize) { @@ -325,7 +326,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, } vdir = &vq->vq_desc[next]; if ((vdir->flags & VRING_DESC_F_INDIRECT) == 0) { - _vq_record(i, vdir, ctx, iov, n_iov, flags); + _vq_record(i, vdir, ctx, iov, niov, &req); i++; } else if ((vs->vs_vc->vc_hv_caps & VIRTIO_RING_F_INDIRECT_DESC) == 0) { @@ -362,7 +363,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, name); return (-1); } - _vq_record(i, vp, ctx, iov, n_iov, flags); + _vq_record(i, vp, ctx, iov, niov, &req); if (++i > VQ_MAX_DESCRIPTORS) goto loopy; if ((vp->flags & VRING_DESC_F_NEXT) == 0) @@ -378,13 +379,18 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, } } if ((vdir->flags & VRING_DESC_F_NEXT) == 0) - return (i); + goto done; } + loopy: EPRINTLN( "%s: descriptor loop? count > %d - driver confused?", name, i); return (-1); + +done: + *reqp = req; + return (i); } /* diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h index c5730f71000e..e03fd5f710d1 100644 --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -371,6 +371,18 @@ vq_kick_disable(struct vqueue_info *vq) } struct iovec; + +/* + * Request description returned by vq_getchain. + * + * Writable iovecs start at iov[req.readable]. + */ +struct vi_req { + int readable; /* num of readable iovecs */ + int writable; /* num of writable iovecs */ + unsigned int idx; /* ring index */ +}; + void vi_softc_linkup(struct virtio_softc *vs, struct virtio_consts *vc, void *dev_softc, struct pci_devinst *pi, struct vqueue_info *queues); @@ -378,8 +390,8 @@ int vi_intr_init(struct virtio_softc *vs, int barnum, int use_msix); void vi_reset_dev(struct virtio_softc *); void vi_set_io_bar(struct virtio_softc *, int); -int vq_getchain(struct vqueue_info *vq, uint16_t *pidx, - struct iovec *iov, int n_iov, uint16_t *flags); +int vq_getchain(struct vqueue_info *vq, struct iovec *iov, int niov, + struct vi_req *reqp); void vq_retchains(struct vqueue_info *vq, uint16_t n_chains); void vq_relchain_prepare(struct vqueue_info *vq, uint16_t idx, uint32_t iolen); From owner-dev-commits-src-all@freebsd.org Tue Mar 30 09:42:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 177965C0D62; Tue, 30 Mar 2021 09:42:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8kyK09NDz4VT3; Tue, 30 Mar 2021 09:42:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECC5F245F3; Tue, 30 Mar 2021 09:42:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12U9gmpJ032435; Tue, 30 Mar 2021 09:42:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12U9gmig032434; Tue, 30 Mar 2021 09:42:48 GMT (envelope-from git) Date: Tue, 30 Mar 2021 09:42:48 GMT Message-Id: <202103300942.12U9gmig032434@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: c80a4b76ceac - main - ipdivert: check that PCB is still valid after taking INPCB_RLOCK. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c80a4b76ceacc5aab322e7ac1407eea8c90cb3b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 09:42:49 -0000 The branch main has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=c80a4b76ceacc5aab322e7ac1407eea8c90cb3b1 commit c80a4b76ceacc5aab322e7ac1407eea8c90cb3b1 Author: Andrey V. Elsukov AuthorDate: 2021-03-30 09:31:09 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-03-30 09:31:09 +0000 ipdivert: check that PCB is still valid after taking INPCB_RLOCK. We are inspecting PCBs of divert sockets under NET_EPOCH section, but PCB could be already detached and we should check INP_FREED flag when we took INP_RLOCK. PR: 254478 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29420 --- sys/netinet/ip_divert.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 65f1d263b5fa..70d3fbd1f230 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -280,6 +280,10 @@ divert_packet(struct mbuf *m, bool incoming) /* XXX why does only one socket match? */ if (inp->inp_lport == nport) { INP_RLOCK(inp); + if (__predict_false(inp->inp_flags2 & INP_FREED)) { + INP_RUNLOCK(inp); + continue; + } sa = inp->inp_socket; SOCKBUF_LOCK(&sa->so_rcv); if (sbappendaddr_locked(&sa->so_rcv, From owner-dev-commits-src-all@freebsd.org Tue Mar 30 09:53:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F3C85C1412; Tue, 30 Mar 2021 09:53:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8lBY72zsz4WHm; Tue, 30 Mar 2021 09:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4C1A241DD; Tue, 30 Mar 2021 09:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12U9rPZc046310; Tue, 30 Mar 2021 09:53:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12U9rPWw046309; Tue, 30 Mar 2021 09:53:25 GMT (envelope-from git) Date: Tue, 30 Mar 2021 09:53:25 GMT Message-Id: <202103300953.12U9rPWw046309@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 88024c4a520b - main - libnetmap: restore changes in 26c29e743bbdbb82762540f72d4bc449bae2e092 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88024c4a520bf762cf4154d730ad9784ed2acd90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 09:53:26 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=88024c4a520bf762cf4154d730ad9784ed2acd90 commit 88024c4a520bf762cf4154d730ad9784ed2acd90 Author: Vincenzo Maffione AuthorDate: 2021-03-30 09:42:50 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-30 09:53:14 +0000 libnetmap: restore changes in 26c29e743bbdbb82762540f72d4bc449bae2e092 Commit f8113f0a65ada9367bcbfa6e0d5d8a8451dd8ac2 accidentally reverted some fixes introduced by 26c29e743bbdbb82762540f72d4bc449bae2e092. This change restores them. --- lib/libnetmap/nmreq.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/libnetmap/nmreq.c b/lib/libnetmap/nmreq.c index 39ee53c818c5..390f791cb4dd 100644 --- a/lib/libnetmap/nmreq.c +++ b/lib/libnetmap/nmreq.c @@ -603,10 +603,9 @@ nmreq_options_decode(const char *opt, struct nmreq_opt_parser parsers[], struct nmreq_option * nmreq_find_option(struct nmreq_header *h, uint32_t t) { - struct nmreq_option *o; + struct nmreq_option *o = NULL; - for (o = (struct nmreq_option *)h->nr_options; o != NULL; - o = (struct nmreq_option *)o->nro_next) { + nmreq_foreach_option(h, o) { if (o->nro_reqtype == t) break; } @@ -633,8 +632,14 @@ nmreq_free_options(struct nmreq_header *h) { struct nmreq_option *o, *next; - for (o = (struct nmreq_option *)h->nr_options; o != NULL; o = next) { - next = (struct nmreq_option *)o->nro_next; + /* + * Note: can't use nmreq_foreach_option() here; it frees the + * list as it's walking and nmreq_foreach_option() isn't + * modification-safe. + */ + for (o = (struct nmreq_option *)(uintptr_t)h->nr_options; o != NULL; + o = next) { + next = (struct nmreq_option *)(uintptr_t)o->nro_next; free(o); } } From owner-dev-commits-src-all@freebsd.org Tue Mar 30 14:19:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF6265C7C8B; Tue, 30 Mar 2021 14:19:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8s655QxRz4mQ7; Tue, 30 Mar 2021 14:19:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABD7927CA9; Tue, 30 Mar 2021 14:19:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UEJv29012327; Tue, 30 Mar 2021 14:19:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UEJvnJ012326; Tue, 30 Mar 2021 14:19:57 GMT (envelope-from git) Date: Tue, 30 Mar 2021 14:19:57 GMT Message-Id: <202103301419.12UEJvnJ012326@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 59b2caef0537 - main - libsa: Remove conflicting .global/.weak directive MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 59b2caef0537661397caf2ce1398cf802cb864b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 14:19:57 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=59b2caef0537661397caf2ce1398cf802cb864b4 commit 59b2caef0537661397caf2ce1398cf802cb864b4 Author: Alex Richardson AuthorDate: 2021-03-30 13:52:31 +0000 Commit: Alex Richardson CommitDate: 2021-03-30 13:59:41 +0000 libsa: Remove conflicting .global/.weak directive LLVM12 complains if you change the symbol binding: `error: _longjmp changed binding to STB_GLOBAL` In this case LLVM actually ignored the weak directive and used the later .global, but GNU as would mark the symbol as weak. None of the other architectures mark the libsa _setjmp as weak so just drop this directive. --- stand/libsa/amd64/_setjmp.S | 1 - 1 file changed, 1 deletion(-) diff --git a/stand/libsa/amd64/_setjmp.S b/stand/libsa/amd64/_setjmp.S index 6d9a5fa13f8d..53ea6e9b5d52 100644 --- a/stand/libsa/amd64/_setjmp.S +++ b/stand/libsa/amd64/_setjmp.S @@ -63,7 +63,6 @@ ENTRY(_setjmp) ret END(_setjmp) - .weak CNAME(_longjmp) ENTRY(_longjmp) movq %rdi,%rdx /* Restore the mxcsr, but leave exception flags intact. */ From owner-dev-commits-src-all@freebsd.org Tue Mar 30 14:19:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0D1B5C785A; Tue, 30 Mar 2021 14:19:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8s666Qlhz4mMT; Tue, 30 Mar 2021 14:19:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF2D3277FE; Tue, 30 Mar 2021 14:19:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UEJwZB012352; Tue, 30 Mar 2021 14:19:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UEJwSS012351; Tue, 30 Mar 2021 14:19:58 GMT (envelope-from git) Date: Tue, 30 Mar 2021 14:19:58 GMT Message-Id: <202103301419.12UEJwSS012351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 69e18c9b7b12 - main - sys/dev/md: Drop unncessary __GLOBL(mfs_root) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69e18c9b7b12e7fd97a740d8748d8718021a1e34 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 14:19:59 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=69e18c9b7b12e7fd97a740d8748d8718021a1e34 commit 69e18c9b7b12e7fd97a740d8748d8718021a1e34 Author: Alex Richardson AuthorDate: 2021-03-30 13:53:41 +0000 Commit: Alex Richardson CommitDate: 2021-03-30 13:59:43 +0000 sys/dev/md: Drop unncessary __GLOBL(mfs_root) LLVM12 complains if you change the symbol binding: error: mfs_root_end changed binding to STB_WEAK [-Werror,-Winline-asm] error: mfs_root changed binding to STB_WEAK [-Werror,-Winline-asm] --- sys/dev/md/md.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 5c2cb2f25d2e..c5c90d9173ad 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -187,8 +187,6 @@ int mfs_root_size; #else extern volatile u_char __weak_symbol mfs_root; extern volatile u_char __weak_symbol mfs_root_end; -__GLOBL(mfs_root); -__GLOBL(mfs_root_end); #define mfs_root_size ((uintptr_t)(&mfs_root_end - &mfs_root)) #endif #endif From owner-dev-commits-src-all@freebsd.org Tue Mar 30 14:20:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFE705C7BA0; Tue, 30 Mar 2021 14:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8s682qQ1z4mJs; Tue, 30 Mar 2021 14:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C7492787E; Tue, 30 Mar 2021 14:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UEJxIS012377; Tue, 30 Mar 2021 14:19:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UEJxAw012376; Tue, 30 Mar 2021 14:19:59 GMT (envelope-from git) Date: Tue, 30 Mar 2021 14:19:59 GMT Message-Id: <202103301419.12UEJxAw012376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 85425bdc5a80 - main - resolv_test: Fix racy exit check, remove mutexes, and reduce output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 85425bdc5a80c948f99aa046f9c48512466806dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 14:20:00 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=85425bdc5a80c948f99aa046f9c48512466806dd commit 85425bdc5a80c948f99aa046f9c48512466806dd Author: Alex Richardson AuthorDate: 2021-03-30 14:00:16 +0000 Commit: Alex Richardson CommitDate: 2021-03-30 14:00:18 +0000 resolv_test: Fix racy exit check, remove mutexes, and reduce output Instead of polling nleft[i] (without appropriate memory barriers!) and using sleep() to detect the exit just call pthread_join() on all threads. Also replace the use of a mutex that guarding the increments with atomic fetch_add. This should reduce the runtime of this test on SMP systems. Finally, remove all the debug printfs unless DEBUG_OUTPUT is set in the environment. Test Plan: still fails sometimes on qemu (but maybe less often?) Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D29390 --- lib/libc/tests/resolv/resolv_test.c | 174 ++++++++++++++++++------------------ 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/lib/libc/tests/resolv/resolv_test.c b/lib/libc/tests/resolv/resolv_test.c index 12f1dca76a56..4f17469fa0cb 100644 --- a/lib/libc/tests/resolv/resolv_test.c +++ b/lib/libc/tests/resolv/resolv_test.c @@ -38,6 +38,7 @@ __RCSID("$NetBSD: resolv.c,v 1.6 2004/05/23 16:59:11 christos Exp $"); #include #include #include +#include #include #include #include @@ -57,15 +58,19 @@ enum method { }; static StringList *hosts = NULL; -static int *ask = NULL; -static int *got = NULL; +static _Atomic(int) *ask = NULL; +static _Atomic(int) *got = NULL; +static bool debug_output = 0; static void load(const char *); -static void resolvone(int, enum method); +static void resolvone(long, int, enum method); static void *resolvloop(void *); -static void run(int *, enum method); +static pthread_t run(int, enum method, long); -static pthread_mutex_t stats = PTHREAD_MUTEX_INITIALIZER; +#define DBG(...) do { \ + if (debug_output) \ + dprintf(STDOUT_FILENO, __VA_ARGS__); \ + } while (0) static void load(const char *fname) @@ -93,11 +98,11 @@ load(const char *fname) } static int -resolv_getaddrinfo(pthread_t self, char *host, int port) +resolv_getaddrinfo(long threadnum, char *host, int port, const char **errstr) { - char portstr[6], buf[1024], hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; + char portstr[6], hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; struct addrinfo hints, *res; - int error, len; + int error; snprintf(portstr, sizeof(portstr), "%d", port); memset(&hints, 0, sizeof(hints)); @@ -105,96 +110,85 @@ resolv_getaddrinfo(pthread_t self, char *host, int port) hints.ai_flags = AI_PASSIVE; hints.ai_socktype = SOCK_STREAM; error = getaddrinfo(host, portstr, &hints, &res); - len = snprintf(buf, sizeof(buf), "%p: host %s %s\n", - self, host, error ? "not found" : "ok"); - (void)write(STDOUT_FILENO, buf, len); if (error == 0) { + DBG("T%ld: host %s ok\n", threadnum, host); memset(hbuf, 0, sizeof(hbuf)); memset(pbuf, 0, sizeof(pbuf)); getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf), - pbuf, sizeof(pbuf), 0); - len = snprintf(buf, sizeof(buf), - "%p: reverse %s %s\n", self, hbuf, pbuf); - (void)write(STDOUT_FILENO, buf, len); - } - if (error == 0) + pbuf, sizeof(pbuf), 0); + DBG("T%ld: reverse %s %s\n", threadnum, hbuf, pbuf); freeaddrinfo(res); + } else { + *errstr = gai_strerror(error); + DBG("T%ld: host %s not found: %s\n", threadnum, host, *errstr); + } return error; } static int -resolv_gethostby(pthread_t self, char *host) +resolv_gethostby(long threadnum, char *host, const char **errstr) { char buf[1024]; struct hostent *hp, *hp2; - int len; hp = gethostbyname(host); - len = snprintf(buf, sizeof(buf), "%p: host %s %s\n", - self, host, (hp == NULL) ? "not found" : "ok"); - (void)write(STDOUT_FILENO, buf, len); if (hp) { + DBG("T%ld: host %s ok\n", threadnum, host); memcpy(buf, hp->h_addr, hp->h_length); hp2 = gethostbyaddr(buf, hp->h_length, hp->h_addrtype); if (hp2) { - len = snprintf(buf, sizeof(buf), - "%p: reverse %s\n", self, hp2->h_name); - (void)write(STDOUT_FILENO, buf, len); + DBG("T%ld: reverse %s\n", threadnum, hp2->h_name); } + } else { + *errstr = hstrerror(h_errno); + DBG("T%ld: host %s not found: %s\n", threadnum, host, *errstr); } - return hp ? 0 : -1; + return hp ? 0 : h_errno; } static int -resolv_getipnodeby(pthread_t self, char *host) +resolv_getipnodeby(long threadnum, char *host, const char **errstr) { char buf[1024]; struct hostent *hp, *hp2; - int len, h_error; + int error = 0; - hp = getipnodebyname(host, AF_INET, 0, &h_error); - len = snprintf(buf, sizeof(buf), "%p: host %s %s\n", - self, host, (hp == NULL) ? "not found" : "ok"); - (void)write(STDOUT_FILENO, buf, len); + hp = getipnodebyname(host, AF_INET, 0, &error); if (hp) { + DBG("T%ld: host %s ok\n", threadnum, host); memcpy(buf, hp->h_addr, hp->h_length); hp2 = getipnodebyaddr(buf, hp->h_length, hp->h_addrtype, - &h_error); + &error); if (hp2) { - len = snprintf(buf, sizeof(buf), - "%p: reverse %s\n", self, hp2->h_name); - (void)write(STDOUT_FILENO, buf, len); - } - if (hp2) + DBG("T%ld: reverse %s\n", threadnum, hp2->h_name); freehostent(hp2); - } - if (hp) + } freehostent(hp); - return hp ? 0 : -1; + } else { + *errstr = hstrerror(error); + DBG("T%ld: host %s not found: %s\n", threadnum, host, *errstr); + } + return hp ? 0 : error; } static void -resolvone(int n, enum method method) +resolvone(long threadnum, int n, enum method method) { - char buf[1024]; - pthread_t self = pthread_self(); + const char* errstr = NULL; size_t i = (random() & 0x0fffffff) % hosts->sl_cur; char *host = hosts->sl_str[i]; - int error, len; + int error; - len = snprintf(buf, sizeof(buf), "%p: %d resolving %s %d\n", - self, n, host, (int)i); - (void)write(STDOUT_FILENO, buf, len); - error = 0; + DBG("T%ld: %d resolving %s %zd\n", threadnum, n, host, i); switch (method) { case METHOD_GETADDRINFO: - error = resolv_getaddrinfo(self, host, i); + error = resolv_getaddrinfo(threadnum, host, i, &errstr); break; case METHOD_GETHOSTBY: - error = resolv_gethostby(self, host); + error = resolv_gethostby(threadnum, host, &errstr); break; case METHOD_GETIPNODEBY: - error = resolv_getipnodeby(self, host); + error = resolv_getipnodeby(threadnum, host, &errstr); break; default: /* UNREACHABLE */ @@ -203,38 +197,43 @@ resolvone(int n, enum method method) abort(); break; } - pthread_mutex_lock(&stats); - ask[i]++; - got[i] += error == 0; - pthread_mutex_unlock(&stats); + atomic_fetch_add_explicit(&ask[i], 1, memory_order_relaxed); + if (error == 0) + atomic_fetch_add_explicit(&got[i], 1, memory_order_relaxed); + else if (got[i] != 0) + fprintf(stderr, + "T%ld ERROR after previous success for %s: %d (%s)\n", + threadnum, hosts->sl_str[i], error, errstr); } struct resolvloop_args { - int *nhosts; + int nhosts; enum method method; + long threadnum; }; static void * resolvloop(void *p) { struct resolvloop_args *args = p; + int nhosts = args->nhosts; - if (*args->nhosts == 0) { + if (nhosts == 0) { free(args); return NULL; } - do - resolvone(*args->nhosts, args->method); - while (--(*args->nhosts)); + do { + resolvone(args->threadnum, nhosts, args->method); + } while (--nhosts); free(args); - return NULL; + return (void *)(uintptr_t)nhosts; } -static void -run(int *nhosts, enum method method) +static pthread_t +run(int nhosts, enum method method, long i) { - pthread_t self; + pthread_t t; int rc; struct resolvloop_args *args; @@ -244,59 +243,60 @@ run(int *nhosts, enum method method) args->nhosts = nhosts; args->method = method; - self = pthread_self(); - rc = pthread_create(&self, NULL, resolvloop, args); + args->threadnum = i + 1; + rc = pthread_create(&t, NULL, resolvloop, args); ATF_REQUIRE_MSG(rc == 0, "pthread_create failed: %s", strerror(rc)); + return t; } static int run_tests(const char *hostlist_file, enum method method) { size_t nthreads = NTHREADS; + pthread_t *threads; size_t nhosts = NHOSTS; size_t i; - int c, done, *nleft; + int c; hosts = sl_init(); srandom(1234); + debug_output = getenv("DEBUG_OUTPUT") != NULL; load(hostlist_file); ATF_REQUIRE_MSG(0 < hosts->sl_cur, "0 hosts in %s", hostlist_file); - nleft = malloc(nthreads * sizeof(int)); - ATF_REQUIRE(nleft != NULL); - ask = calloc(hosts->sl_cur, sizeof(int)); ATF_REQUIRE(ask != NULL); got = calloc(hosts->sl_cur, sizeof(int)); ATF_REQUIRE(got != NULL); + threads = calloc(nthreads, sizeof(pthread_t)); + ATF_REQUIRE(threads != NULL); + for (i = 0; i < nthreads; i++) { - nleft[i] = nhosts; - run(&nleft[i], method); + threads[i] = run(nhosts, method, i); } + /* Wait for all threads to join and check that they checked all hosts */ + for (i = 0; i < nthreads; i++) { + size_t remaining; - for (done = 0; !done;) { - done = 1; - for (i = 0; i < nthreads; i++) { - if (nleft[i] != 0) { - done = 0; - break; - } - } - sleep(1); + remaining = (uintptr_t)pthread_join(threads[i], NULL); + ATF_CHECK_EQ_MSG(0, remaining, + "Thread %zd still had %zd hosts to check!", i, remaining); } + c = 0; for (i = 0; i < hosts->sl_cur; i++) { - if (ask[i] != got[i] && got[i] != 0) { - printf("Error: host %s ask %d got %d\n", - hosts->sl_str[i], ask[i], got[i]); - c++; + if (got[i] != 0) { + ATF_CHECK_EQ_MSG(ask[i], got[i], + "Error: host %s ask %d got %d", hosts->sl_str[i], + ask[i], got[i]); + c += ask[i] != got[i]; } } - free(nleft); + free(threads); free(ask); free(got); sl_free(hosts, 1); From owner-dev-commits-src-all@freebsd.org Tue Mar 30 14:37:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2259E578778; Tue, 30 Mar 2021 14:37:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8sTs048Gz4pL7; Tue, 30 Mar 2021 14:37:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E962D77; Tue, 30 Mar 2021 14:37:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UEb4k2039852; Tue, 30 Mar 2021 14:37:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UEb4OP039851; Tue, 30 Mar 2021 14:37:04 GMT (envelope-from git) Date: Tue, 30 Mar 2021 14:37:04 GMT Message-Id: <202103301437.12UEb4OP039851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 4beb385813c8 - main - gdb: allow setting/removing hardware watchpoints MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4beb385813c8b1014f8250a31b07fdc09a059713 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 14:37:05 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=4beb385813c8b1014f8250a31b07fdc09a059713 commit 4beb385813c8b1014f8250a31b07fdc09a059713 Author: Mitchell Horne AuthorDate: 2021-03-08 19:03:45 +0000 Commit: Mitchell Horne CommitDate: 2021-03-30 14:36:41 +0000 gdb: allow setting/removing hardware watchpoints Handle the 'z' and 'Z' remote packets for manipulating hardware watchpoints. This could be expanded quite easily to support hardware or software breakpoints as well. https://sourceware.org/gdb/onlinedocs/gdb/Packets.html Reviewed by: cem, markj MFC after: 3 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. NetApp PR: 51 Differential Revision: https://reviews.freebsd.org/D29173 --- sys/arm64/arm64/debug_monitor.c | 5 +- sys/conf/files.arm | 3 +- sys/conf/files.x86 | 2 +- sys/gdb/gdb_main.c | 102 ++++++++++++++++++++++++++++++++++++++++ sys/x86/x86/mp_x86.c | 3 +- 5 files changed, 110 insertions(+), 5 deletions(-) diff --git a/sys/arm64/arm64/debug_monitor.c b/sys/arm64/arm64/debug_monitor.c index 845784129b4c..c3dce1883e68 100644 --- a/sys/arm64/arm64/debug_monitor.c +++ b/sys/arm64/arm64/debug_monitor.c @@ -28,6 +28,7 @@ */ #include "opt_ddb.h" +#include "opt_gdb.h" #include __FBSDID("$FreeBSD$"); @@ -181,7 +182,7 @@ dbg_wb_write_reg(int reg, int n, uint64_t val) isb(); } -#ifdef DDB +#if defined(DDB) || defined(GDB) void kdb_cpu_set_singlestep(void) { @@ -254,7 +255,9 @@ kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size) return (dbg_remove_watchpoint(NULL, addr, size)); } +#endif /* DDB || GDB */ +#ifdef DDB static const char * dbg_watchtype_str(uint32_t type) { diff --git a/sys/conf/files.arm b/sys/conf/files.arm index 69986585bdf6..a3b0d166f020 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -19,8 +19,7 @@ arm/arm/cpu_asm-v6.S standard arm/arm/db_disasm.c optional ddb arm/arm/db_interface.c optional ddb arm/arm/db_trace.c optional ddb -arm/arm/debug_monitor.c optional ddb armv6 -arm/arm/debug_monitor.c optional ddb armv7 +arm/arm/debug_monitor.c optional ddb | gdb arm/arm/disassem.c optional ddb arm/arm/dump_machdep.c standard arm/arm/elf_machdep.c standard diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index fd31d95fa162..0f83126e99a6 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -320,7 +320,7 @@ x86/x86/bus_machdep.c standard x86/x86/busdma_bounce.c standard x86/x86/busdma_machdep.c standard x86/x86/cpu_machdep.c standard -x86/x86/dbreg.c optional ddb +x86/x86/dbreg.c optional ddb | gdb x86/x86/dump_machdep.c standard x86/x86/fdt_machdep.c optional fdt x86/x86/identcpu.c standard diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c index a9e935ebfbb5..a4469fdf4997 100644 --- a/sys/gdb/gdb_main.c +++ b/sys/gdb/gdb_main.c @@ -618,6 +618,100 @@ gdb_handle_detach(void) #endif } +/* + * Handle a 'Z' packet: set a breakpoint or watchpoint. + * + * Currently, only watchpoints are supported. + */ +static void +gdb_z_insert(void) +{ + intmax_t addr, length; + char ztype; + int error; + + ztype = gdb_rx_char(); + if (gdb_rx_char() != ',' || gdb_rx_varhex(&addr) || + gdb_rx_char() != ',' || gdb_rx_varhex(&length)) { + error = EINVAL; + goto fail; + } + + switch (ztype) { + case '2': /* write watchpoint */ + error = kdb_cpu_set_watchpoint((vm_offset_t)addr, + (vm_size_t)length, KDB_DBG_ACCESS_W); + break; + case '3': /* read watchpoint */ + error = kdb_cpu_set_watchpoint((vm_offset_t)addr, + (vm_size_t)length, KDB_DBG_ACCESS_R); + break; + case '4': /* access (RW) watchpoint */ + error = kdb_cpu_set_watchpoint((vm_offset_t)addr, + (vm_size_t)length, KDB_DBG_ACCESS_RW); + break; + case '1': /* hardware breakpoint */ + case '0': /* software breakpoint */ + /* Not implemented. */ + gdb_tx_empty(); + return; + default: + error = EINVAL; + break; + } + if (error != 0) + goto fail; + gdb_tx_ok(); + return; +fail: + gdb_tx_err(error); + return; +} + +/* + * Handle a 'z' packet; clear a breakpoint or watchpoint. + * + * Currently, only watchpoints are supported. + */ +static void +gdb_z_remove(void) +{ + intmax_t addr, length; + char ztype; + int error; + + ztype = gdb_rx_char(); + if (gdb_rx_char() != ',' || gdb_rx_varhex(&addr) || + gdb_rx_char() != ',' || gdb_rx_varhex(&length)) { + error = EINVAL; + goto fail; + } + + switch (ztype) { + case '2': /* write watchpoint */ + case '3': /* read watchpoint */ + case '4': /* access (RW) watchpoint */ + error = kdb_cpu_clr_watchpoint((vm_offset_t)addr, + (vm_size_t)length); + break; + case '1': /* hardware breakpoint */ + case '0': /* software breakpoint */ + /* Not implemented. */ + gdb_tx_empty(); + return; + default: + error = EINVAL; + break; + } + if (error != 0) + goto fail; + gdb_tx_ok(); + return; +fail: + gdb_tx_err(error); + return; +} + static int gdb_trap(int type, int code) { @@ -868,6 +962,14 @@ gdb_trap(int type, int code) gdb_tx_err(ENOENT); break; } + case 'z': { /* Remove watchpoint. */ + gdb_z_remove(); + break; + } + case 'Z': { /* Set watchpoint. */ + gdb_z_insert(); + break; + } case EOF: /* Empty command. Treat as unknown command. */ /* FALLTHROUGH */ diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 0f528f6567ee..2dcdf923c467 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #endif #include "opt_cpu.h" #include "opt_ddb.h" +#include "opt_gdb.h" #include "opt_kstack_pages.h" #include "opt_pmap.h" #include "opt_sched.h" @@ -1520,7 +1521,7 @@ cpustop_handler_post(u_int cpu) */ invltlb_glob(); -#if defined(__amd64__) && defined(DDB) +#if defined(__amd64__) && (defined(DDB) || defined(GDB)) amd64_db_resume_dbreg(); #endif From owner-dev-commits-src-all@freebsd.org Tue Mar 30 14:37:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A0A15788C3; Tue, 30 Mar 2021 14:37:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8sTz3w6hz4p7d; Tue, 30 Mar 2021 14:37:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2E6320A; Tue, 30 Mar 2021 14:37:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UEbAbJ039975; Tue, 30 Mar 2021 14:37:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UEbA5e039974; Tue, 30 Mar 2021 14:37:10 GMT (envelope-from git) Date: Tue, 30 Mar 2021 14:37:10 GMT Message-Id: <202103301437.12UEbA5e039974@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 7446b0888d92 - main - gdb: report specific stop reason for watchpoints MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7446b0888d920124516284eaa32714d63353e2c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 14:37:12 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=7446b0888d920124516284eaa32714d63353e2c9 commit 7446b0888d920124516284eaa32714d63353e2c9 Author: Mitchell Horne AuthorDate: 2021-03-08 19:04:51 +0000 Commit: Mitchell Horne CommitDate: 2021-03-30 14:36:41 +0000 gdb: report specific stop reason for watchpoints The remote protocol allows for implementations to report more specific reasons for the break in execution back to the client [1]. This is entirely optional, so it is only implemented for amd64, arm64, and i386 at the moment. [1] https://sourceware.org/gdb/current/onlinedocs/gdb/Stop-Reply-Packets.html Reviewed by: jhb MFC after: 3 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. NetApp PR: 51 Differential Revision: https://reviews.freebsd.org/D29174 --- sys/amd64/amd64/gdb_machdep.c | 35 ++++++++++++++++++++++++++++++++++ sys/amd64/include/gdb_machdep.h | 1 + sys/arm/include/gdb_machdep.h | 6 ++++++ sys/arm64/arm64/gdb_machdep.c | 12 ++++++++++++ sys/arm64/include/gdb_machdep.h | 1 + sys/gdb/gdb_main.c | 3 ++- sys/i386/i386/gdb_machdep.c | 40 +++++++++++++++++++++++++++++++++++++-- sys/i386/include/gdb_machdep.h | 1 + sys/mips/include/gdb_machdep.h | 6 ++++++ sys/powerpc/include/gdb_machdep.h | 6 ++++++ 10 files changed, 108 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/gdb_machdep.c b/sys/amd64/amd64/gdb_machdep.c index 610096e1355d..176c770a3731 100644 --- a/sys/amd64/amd64/gdb_machdep.c +++ b/sys/amd64/amd64/gdb_machdep.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include void * gdb_cpu_getreg(int regnum, size_t *regsz) @@ -152,6 +153,40 @@ gdb_cpu_signal(int type, int code) return (SIGEMT); } +void +gdb_cpu_stop_reason(int type, int code) +{ + uintmax_t val; + + val = 0; + if (type == T_TRCTRAP) { + /* NB: 'code' contains the value of dr6 at the trap. */ + if ((code & DBREG_DR6_B(0)) != 0) { + val = rdr0(); + } + if ((code & DBREG_DR6_B(1)) != 0) { + val = rdr1(); + } + if ((code & DBREG_DR6_B(2)) != 0) { + val = rdr2(); + } + if ((code & DBREG_DR6_B(3)) != 0) { + val = rdr3(); + } + + /* + * TODO: validate the bits in DR7 to differentiate between a + * watchpoint trap and a hardware breakpoint trap (currently + * unsupported). + */ + if (val != 0) { + gdb_tx_str("watch:"); + gdb_tx_varhex(val); + gdb_tx_char(';'); + } + } +} + void * gdb_begin_write(void) { diff --git a/sys/amd64/include/gdb_machdep.h b/sys/amd64/include/gdb_machdep.h index 459d4f17e9d1..4379b8a74709 100644 --- a/sys/amd64/include/gdb_machdep.h +++ b/sys/amd64/include/gdb_machdep.h @@ -72,5 +72,6 @@ void *gdb_cpu_getreg(int, size_t *); void gdb_cpu_setreg(int, void *); int gdb_cpu_signal(int, int); void gdb_end_write(void *); +void gdb_cpu_stop_reason(int, int); #endif /* !_MACHINE_GDB_MACHDEP_H_ */ diff --git a/sys/arm/include/gdb_machdep.h b/sys/arm/include/gdb_machdep.h index 017025253bd5..5190c2a4097e 100644 --- a/sys/arm/include/gdb_machdep.h +++ b/sys/arm/include/gdb_machdep.h @@ -66,6 +66,12 @@ gdb_end_write(void *arg __unused) } +static __inline void +gdb_cpu_stop_reason(int type __unused, int code __unused) +{ + +} + void *gdb_cpu_getreg(int, size_t *); void gdb_cpu_setreg(int, void *); int gdb_cpu_signal(int, int); diff --git a/sys/arm64/arm64/gdb_machdep.c b/sys/arm64/arm64/gdb_machdep.c index dc0a7eeba692..b27e1edb3d7f 100644 --- a/sys/arm64/arm64/gdb_machdep.c +++ b/sys/arm64/arm64/gdb_machdep.c @@ -41,6 +41,7 @@ #include #include +#include void * gdb_cpu_getreg(int regnum, size_t *regsz) @@ -110,3 +111,14 @@ gdb_cpu_signal(int type, int code __unused) } return (SIGEMT); } + +void +gdb_cpu_stop_reason(int type, int code __unused) +{ + + if (type == EXCP_WATCHPT_EL1) { + gdb_tx_str("watch:"); + gdb_tx_varhex((uintmax_t)READ_SPECIALREG(far_el1)); + gdb_tx_char(';'); + } +} diff --git a/sys/arm64/include/gdb_machdep.h b/sys/arm64/include/gdb_machdep.h index 755c5d1657c0..17b46edd1a27 100644 --- a/sys/arm64/include/gdb_machdep.h +++ b/sys/arm64/include/gdb_machdep.h @@ -77,5 +77,6 @@ gdb_end_write(void *arg __unused) void *gdb_cpu_getreg(int, size_t *); void gdb_cpu_setreg(int, void *); int gdb_cpu_signal(int, int); +void gdb_cpu_stop_reason(int, int); #endif /* !_MACHINE_GDB_MACHDEP_H_ */ diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c index a4469fdf4997..c5e4ba608f29 100644 --- a/sys/gdb/gdb_main.c +++ b/sys/gdb/gdb_main.c @@ -741,8 +741,9 @@ gdb_trap(int type, int code) gdb_tx_char(':'); gdb_tx_reg(GDB_REG_PC); gdb_tx_char(';'); + gdb_cpu_stop_reason(type, code); gdb_tx_str("thread:"); - gdb_tx_varhex((long)kdb_thread->td_tid); + gdb_tx_varhex((uintmax_t)kdb_thread->td_tid); gdb_tx_char(';'); gdb_tx_end(); /* XXX check error condition. */ diff --git a/sys/i386/i386/gdb_machdep.c b/sys/i386/i386/gdb_machdep.c index fd522309dbb2..549c6de7ba1b 100644 --- a/sys/i386/i386/gdb_machdep.c +++ b/sys/i386/i386/gdb_machdep.c @@ -36,13 +36,15 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include +#include #include -#include -#include #include +#include void * gdb_cpu_getreg(int regnum, size_t *regsz) @@ -114,3 +116,37 @@ gdb_cpu_signal(int type, int code) } return (SIGEMT); } + +void +gdb_cpu_stop_reason(int type, int code) +{ + uintmax_t val; + + val = 0; + if (type == T_TRCTRAP) { + /* NB: 'code' contains the value of dr6 at the trap. */ + if ((code & DBREG_DR6_B(0)) != 0) { + val = rdr0(); + } + if ((code & DBREG_DR6_B(1)) != 0) { + val = rdr1(); + } + if ((code & DBREG_DR6_B(2)) != 0) { + val = rdr2(); + } + if ((code & DBREG_DR6_B(3)) != 0) { + val = rdr3(); + } + + /* + * TODO: validate the bits in DR7 to differentiate between a + * watchpoint trap and a hardware breakpoint trap (currently + * unsupported). + */ + if (val != 0) { + gdb_tx_str("watch:"); + gdb_tx_varhex(val); + gdb_tx_char(';'); + } + } +} diff --git a/sys/i386/include/gdb_machdep.h b/sys/i386/include/gdb_machdep.h index ef9500160be1..77eb70e2fb28 100644 --- a/sys/i386/include/gdb_machdep.h +++ b/sys/i386/include/gdb_machdep.h @@ -63,5 +63,6 @@ gdb_end_write(void *arg __unused) void *gdb_cpu_getreg(int, size_t *); void gdb_cpu_setreg(int, void *); int gdb_cpu_signal(int, int); +void gdb_cpu_stop_reason(int, int); #endif /* !_MACHINE_GDB_MACHDEP_H_ */ diff --git a/sys/mips/include/gdb_machdep.h b/sys/mips/include/gdb_machdep.h index 03378b760024..e8ff620edc88 100644 --- a/sys/mips/include/gdb_machdep.h +++ b/sys/mips/include/gdb_machdep.h @@ -64,6 +64,12 @@ gdb_end_write(void *arg __unused) } +static __inline void +gdb_cpu_stop_reason(int type __unused, int code __unused) +{ + +} + void *gdb_cpu_getreg(int, size_t *); void gdb_cpu_setreg(int, void *); int gdb_cpu_signal(int, int); diff --git a/sys/powerpc/include/gdb_machdep.h b/sys/powerpc/include/gdb_machdep.h index 41a9ab1f4fa7..5edf4d96cb7c 100644 --- a/sys/powerpc/include/gdb_machdep.h +++ b/sys/powerpc/include/gdb_machdep.h @@ -128,6 +128,12 @@ gdb_end_write(void *arg __unused) } +static __inline void +gdb_cpu_stop_reason(int type __unused, int code __unused) +{ + +} + void *gdb_cpu_getreg(int, size_t *); void gdb_cpu_setreg(int, void *); int gdb_cpu_signal(int, int); From owner-dev-commits-src-all@freebsd.org Tue Mar 30 14:52:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A5BE579137; Tue, 30 Mar 2021 14:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8sql2158z4qJ2; Tue, 30 Mar 2021 14:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37DF5688; Tue, 30 Mar 2021 14:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UEqZrG066734; Tue, 30 Mar 2021 14:52:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UEqZrT066733; Tue, 30 Mar 2021 14:52:35 GMT (envelope-from git) Date: Tue, 30 Mar 2021 14:52:35 GMT Message-Id: <202103301452.12UEqZrT066733@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 7069b4c6a4e5 - main - LinuxKPI/OFED: (re)move inetdevice.h implementation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7069b4c6a4e516e1435d8beb7a436d88193156d3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 14:52:35 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=7069b4c6a4e516e1435d8beb7a436d88193156d3 commit 7069b4c6a4e516e1435d8beb7a436d88193156d3 Author: Bjoern A. Zeeb AuthorDate: 2021-03-26 17:52:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-03-30 14:40:46 +0000 LinuxKPI/OFED: (re)move inetdevice.h implementation The two functions in linux/inetdevice.h are highly FreeBSD/ifnet specific. This is a result of struct net_device being mapped to struct ifnet. The only known consumer of these functions are two files in the ofed/infiniband code. As a first step of cleaning up copy linux/inetdevice.h to rdma/ib_addr_freebsd.h. (It stayed a separate file to preserve copyright and license of the original file; otherwise it could be merged into ib_addr.h where more EPOCH/vnet/.. are already used). Slightly rename the function to not conflict with LinuxKPI in the future. Remove the three last, now unneeded includes of inetdevice.h and zap linux/inetdevice.h to an empty header file with only the forward include to netdevice.h remaining. Sponsored-by: The FreeBSD Foundation MFC-after: 2 weeks Reviewed-by: hselasky, kib X-D-R: D29366 (extracted as further cleanup) Differential Revision: https://reviews.freebsd.org/D29434 --- .../linuxkpi/common/include/linux/inetdevice.h | 87 -------------------- sys/ofed/drivers/infiniband/core/ib_addr.c | 10 +-- sys/ofed/drivers/infiniband/core/ib_cma.c | 6 +- sys/ofed/include/rdma/ib_addr.h | 1 - sys/ofed/include/rdma/ib_addr_freebsd.h | 95 ++++++++++++++++++++++ 5 files changed, 103 insertions(+), 96 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/inetdevice.h b/sys/compat/linuxkpi/common/include/linux/inetdevice.h index 87c880392b71..41852e8fed81 100644 --- a/sys/compat/linuxkpi/common/include/linux/inetdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/inetdevice.h @@ -1,93 +1,6 @@ -/*- - * Copyright (c) 2010 Isilon Systems, Inc. - * Copyright (c) 2010 iX Systems, Inc. - * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ #ifndef _LINUX_INETDEVICE_H_ #define _LINUX_INETDEVICE_H_ #include -static inline struct net_device * -ip_dev_find(struct vnet *vnet, uint32_t addr) -{ - struct sockaddr_in sin; - struct epoch_tracker et; - struct ifaddr *ifa; - struct ifnet *ifp; - - memset(&sin, 0, sizeof(sin)); - sin.sin_addr.s_addr = addr; - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - NET_EPOCH_ENTER(et); - CURVNET_SET_QUIET(vnet); - ifa = ifa_ifwithaddr((struct sockaddr *)&sin); - CURVNET_RESTORE(); - if (ifa) { - ifp = ifa->ifa_ifp; - if_ref(ifp); - } else { - ifp = NULL; - } - NET_EPOCH_EXIT(et); - return (ifp); -} - -static inline struct net_device * -ip6_dev_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id) -{ - struct sockaddr_in6 sin6; - struct epoch_tracker et; - struct ifaddr *ifa; - struct ifnet *ifp; - - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_addr = addr; - sin6.sin6_len = sizeof(sin6); - sin6.sin6_family = AF_INET6; - if (IN6_IS_SCOPE_LINKLOCAL(&addr) || - IN6_IS_ADDR_MC_INTFACELOCAL(&addr)) { - /* embed the IPv6 scope ID */ - sin6.sin6_addr.s6_addr16[1] = htons(scope_id); - } - NET_EPOCH_ENTER(et); - CURVNET_SET_QUIET(vnet); - ifa = ifa_ifwithaddr((struct sockaddr *)&sin6); - CURVNET_RESTORE(); - if (ifa != NULL) { - ifp = ifa->ifa_ifp; - if_ref(ifp); - } else { - ifp = NULL; - } - NET_EPOCH_EXIT(et); - return (ifp); -} - #endif /* _LINUX_INETDEVICE_H_ */ diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index 7d0055032903..f8c1cb180af8 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -47,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -181,13 +181,13 @@ int rdma_translate_ip(const struct sockaddr *addr, } else switch (addr->sa_family) { #ifdef INET case AF_INET: - dev = ip_dev_find(dev_addr->net, + dev = ip_ifp_find(dev_addr->net, ((const struct sockaddr_in *)addr)->sin_addr.s_addr); break; #endif #ifdef INET6 case AF_INET6: - dev = ip6_dev_find(dev_addr->net, + dev = ip6_ifp_find(dev_addr->net, ((const struct sockaddr_in6 *)addr)->sin6_addr, 0); break; #endif @@ -325,7 +325,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, if (addr->bound_dev_if != 0) { ifp = dev_get_by_index(addr->net, addr->bound_dev_if); } else { - ifp = ip_dev_find(addr->net, src_in->sin_addr.s_addr); + ifp = ip_ifp_find(addr->net, src_in->sin_addr.s_addr); } /* check source interface */ @@ -516,7 +516,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, if (addr->bound_dev_if != 0) { ifp = dev_get_by_index(addr->net, addr->bound_dev_if); } else { - ifp = ip6_dev_find(addr->net, src_in->sin6_addr, 0); + ifp = ip6_ifp_find(addr->net, src_in->sin6_addr, 0); } /* check source interface */ diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 215a3c7aae35..717d7c70e9de 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -66,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1364,7 +1364,7 @@ static bool validate_ipv4_net_dev(struct net_device *net_dev, ipv4_is_loopback(saddr)) return false; - dst_dev = ip_dev_find(net_dev->if_vnet, daddr); + dst_dev = ip_ifp_find(net_dev->if_vnet, daddr); if (dst_dev != net_dev) { if (dst_dev != NULL) dev_put(dst_dev); @@ -1402,7 +1402,7 @@ static bool validate_ipv6_net_dev(struct net_device *net_dev, struct nhop_object *nh; bool ret; - dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr, + dst_dev = ip6_ifp_find(net_dev->if_vnet, dst_tmp.sin6_addr, net_dev->if_index); if (dst_dev != net_dev) { if (dst_dev != NULL) diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h index 15d6a937c4db..052fc636f617 100644 --- a/sys/ofed/include/rdma/ib_addr.h +++ b/sys/ofed/include/rdma/ib_addr.h @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include diff --git a/sys/ofed/include/rdma/ib_addr_freebsd.h b/sys/ofed/include/rdma/ib_addr_freebsd.h new file mode 100644 index 000000000000..5ce5f2f8a5ed --- /dev/null +++ b/sys/ofed/include/rdma/ib_addr_freebsd.h @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _RDMA_IB_ADDR_FREEBSD_H +#define _RDMA_IB_ADDR_FREEBSD_H + +#ifdef INET +static inline struct ifnet * +ip_ifp_find(struct vnet *vnet, uint32_t addr) +{ + struct sockaddr_in sin; + struct epoch_tracker et; + struct ifaddr *ifa; + struct ifnet *ifp; + + memset(&sin, 0, sizeof(sin)); + sin.sin_addr.s_addr = addr; + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; + NET_EPOCH_ENTER(et); + CURVNET_SET_QUIET(vnet); + ifa = ifa_ifwithaddr((struct sockaddr *)&sin); + CURVNET_RESTORE(); + if (ifa) { + ifp = ifa->ifa_ifp; + if_ref(ifp); + } else { + ifp = NULL; + } + NET_EPOCH_EXIT(et); + return (ifp); +} +#endif + +#ifdef INET6 +static inline struct ifnet * +ip6_ifp_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id) +{ + struct sockaddr_in6 sin6; + struct epoch_tracker et; + struct ifaddr *ifa; + struct ifnet *ifp; + + memset(&sin6, 0, sizeof(sin6)); + sin6.sin6_addr = addr; + sin6.sin6_len = sizeof(sin6); + sin6.sin6_family = AF_INET6; + if (IN6_IS_SCOPE_LINKLOCAL(&addr) || + IN6_IS_ADDR_MC_INTFACELOCAL(&addr)) { + /* embed the IPv6 scope ID */ + sin6.sin6_addr.s6_addr16[1] = htons(scope_id); + } + NET_EPOCH_ENTER(et); + CURVNET_SET_QUIET(vnet); + ifa = ifa_ifwithaddr((struct sockaddr *)&sin6); + CURVNET_RESTORE(); + if (ifa != NULL) { + ifp = ifa->ifa_ifp; + if_ref(ifp); + } else { + ifp = NULL; + } + NET_EPOCH_EXIT(et); + return (ifp); +} +#endif + +#endif /* _RDMA_IB_ADDR_FREEBSD_H */ From owner-dev-commits-src-all@freebsd.org Tue Mar 30 15:04:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4C11579C0C; Tue, 30 Mar 2021 15:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8t5D67w6z4rHm; Tue, 30 Mar 2021 15:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C58837A3; Tue, 30 Mar 2021 15:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UF4G6a082183; Tue, 30 Mar 2021 15:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UF4Gh4082182; Tue, 30 Mar 2021 15:04:16 GMT (envelope-from git) Date: Tue, 30 Mar 2021 15:04:16 GMT Message-Id: <202103301504.12UF4Gh4082182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: a42a0b77f0de - stable/11 - Fix array out of bound panic introduced in r306219. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: a42a0b77f0de636a91f79fa2fde8a507d88b79b7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 15:04:17 -0000 The branch stable/11 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=a42a0b77f0de636a91f79fa2fde8a507d88b79b7 commit a42a0b77f0de636a91f79fa2fde8a507d88b79b7 Author: Alexander Motin AuthorDate: 2019-05-28 18:32:04 +0000 Commit: Ryan Moeller CommitDate: 2021-03-30 15:02:24 +0000 Fix array out of bound panic introduced in r306219. As I see, different NICs in different configurations may have different numbers of TX and RX queues. The code was assuming 1:1 mapping between event queues (interrupts) and TX/RX queues. Since number of interrupts is set to maximum of TX and RX queues, when those two are different, the system is doomed. I have no documentation or deep knowledge about this hardware, so this change is based on general observations and code reading. If some of my guesses are wrong, please do better. I just confirmed HP NC550SFP NICs are working now. MFC after: 2 weeks Sponsored by: iXsystems, Inc. (cherry picked from commit 3582828053556ca0e05ed9aab3e78008a0595e09) --- sys/dev/oce/oce_if.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c index 1de38d4528fc..362bc1776890 100644 --- a/sys/dev/oce/oce_if.c +++ b/sys/dev/oce/oce_if.c @@ -2395,10 +2395,20 @@ oce_eqd_set_periodic(POCE_SOFTC sc) goto modify_eqd; } - rq = sc->rq[i]; - rxpkts = rq->rx_stats.rx_pkts; - wq = sc->wq[i]; - tx_reqs = wq->tx_stats.tx_reqs; + if (i == 0) { + rq = sc->rq[0]; + rxpkts = rq->rx_stats.rx_pkts; + } else + rxpkts = 0; + if (i + 1 < sc->nrqs) { + rq = sc->rq[i + 1]; + rxpkts += rq->rx_stats.rx_pkts; + } + if (i < sc->nwqs) { + wq = sc->wq[i]; + tx_reqs = wq->tx_stats.tx_reqs; + } else + tx_reqs = 0; now = ticks; if (!aic->ticks || now < aic->ticks || From owner-dev-commits-src-all@freebsd.org Tue Mar 30 15:05:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E9AB579C1D; Tue, 30 Mar 2021 15:05:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8t672Gl5z4rVm; Tue, 30 Mar 2021 15:05:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40D7E34A; Tue, 30 Mar 2021 15:05:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UF534b082414; Tue, 30 Mar 2021 15:05:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UF53bX082413; Tue, 30 Mar 2021 15:05:03 GMT (envelope-from git) Date: Tue, 30 Mar 2021 15:05:03 GMT Message-Id: <202103301505.12UF53bX082413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 7c1344084540 - main - arm: add options GDB to std.armv6 and std.armv7 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c134408454072666dd9338c285817ab6850f663 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 15:05:03 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=7c134408454072666dd9338c285817ab6850f663 commit 7c134408454072666dd9338c285817ab6850f663 Author: Mitchell Horne AuthorDate: 2021-03-04 20:53:12 +0000 Commit: Mitchell Horne CommitDate: 2021-03-30 15:04:24 +0000 arm: add options GDB to std.armv6 and std.armv7 There are now options for specifying the debug port via tunable (hw.fdt.dbgport) and device tree (/chosen/freebsd-dbgpath), so this can be usefully included in GENERIC. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29152 --- sys/arm/conf/std.armv6 | 1 + sys/arm/conf/std.armv7 | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/arm/conf/std.armv6 b/sys/arm/conf/std.armv6 index 6db6c7a16dd7..5f7fb1ebb221 100644 --- a/sys/arm/conf/std.armv6 +++ b/sys/arm/conf/std.armv6 @@ -63,6 +63,7 @@ options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use (turn off in stable branch): options DDB # Support DDB +options GDB # Support remote GDB #options DEADLKRES # Enable the deadlock resolver options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS diff --git a/sys/arm/conf/std.armv7 b/sys/arm/conf/std.armv7 index 0b842ad1f4e4..2d1dfa135780 100644 --- a/sys/arm/conf/std.armv7 +++ b/sys/arm/conf/std.armv7 @@ -63,6 +63,7 @@ options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use (turn off in stable branch): options DDB # Support DDB +options GDB # Support remote GDB #options DEADLKRES # Enable the deadlock resolver options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS From owner-dev-commits-src-all@freebsd.org Tue Mar 30 15:48:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BB8F57B165; Tue, 30 Mar 2021 15:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8v3k3KsXz4vKY; Tue, 30 Mar 2021 15:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63628FBC; Tue, 30 Mar 2021 15:48:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UFm2Kf038506; Tue, 30 Mar 2021 15:48:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UFm2Xs038505; Tue, 30 Mar 2021 15:48:02 GMT (envelope-from git) Date: Tue, 30 Mar 2021 15:48:02 GMT Message-Id: <202103301548.12UFm2Xs038505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 8ebda6e44bb6 - main - efifb,vbefb: implement vd_fini MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ebda6e44bb6ac9113e2a7fe65889811d894dd63 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 15:48:02 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=8ebda6e44bb6ac9113e2a7fe65889811d894dd63 commit 8ebda6e44bb6ac9113e2a7fe65889811d894dd63 Author: Greg V AuthorDate: 2021-03-30 15:46:17 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-30 15:47:49 +0000 efifb,vbefb: implement vd_fini This removes the pmap entry when switching away to e.g. drm fb. Differential Revision: https://reviews.freebsd.org/D29020 MFC After: 1 month --- sys/dev/vt/hw/efifb/efifb.c | 11 +++++++++++ sys/dev/vt/hw/vbefb/vbefb.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/sys/dev/vt/hw/efifb/efifb.c b/sys/dev/vt/hw/efifb/efifb.c index fb270d438c81..1d08bdd99ce7 100644 --- a/sys/dev/vt/hw/efifb/efifb.c +++ b/sys/dev/vt/hw/efifb/efifb.c @@ -50,12 +50,14 @@ __FBSDID("$FreeBSD$"); #include static vd_init_t vt_efifb_init; +static vd_fini_t vt_efifb_fini; static vd_probe_t vt_efifb_probe; static struct vt_driver vt_efifb_driver = { .vd_name = "efifb", .vd_probe = vt_efifb_probe, .vd_init = vt_efifb_init, + .vd_fini = vt_efifb_fini, .vd_blank = vt_fb_blank, .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, @@ -145,3 +147,12 @@ vt_efifb_init(struct vt_device *vd) return (CN_INTERNAL); } + +static void +vt_efifb_fini(struct vt_device *vd, void *softc) +{ + struct fb_info *info = softc; + + vt_fb_fini(vd, softc); + pmap_unmapdev(info->fb_vbase, info->fb_size); +} diff --git a/sys/dev/vt/hw/vbefb/vbefb.c b/sys/dev/vt/hw/vbefb/vbefb.c index c8789e3bddac..85f594e4ed21 100644 --- a/sys/dev/vt/hw/vbefb/vbefb.c +++ b/sys/dev/vt/hw/vbefb/vbefb.c @@ -50,12 +50,14 @@ __FBSDID("$FreeBSD$"); #include static vd_init_t vt_vbefb_init; +static vd_fini_t vt_vbefb_fini; static vd_probe_t vt_vbefb_probe; static struct vt_driver vt_vbefb_driver = { .vd_name = "vbefb", .vd_probe = vt_vbefb_probe, .vd_init = vt_vbefb_init, + .vd_fini = vt_vbefb_fini, .vd_blank = vt_fb_blank, .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, @@ -151,3 +153,12 @@ vt_vbefb_init(struct vt_device *vd) return (CN_INTERNAL); } + +static void +vt_vbefb_fini(struct vt_device *vd, void *softc) +{ + struct fb_info *info = softc; + + vt_fb_fini(vd, softc); + pmap_unmapdev(info->fb_vbase, info->fb_size); +} From owner-dev-commits-src-all@freebsd.org Tue Mar 30 17:38:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C26257ED23; Tue, 30 Mar 2021 17:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8xW82YfJz530v; Tue, 30 Mar 2021 17:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A98A2900; Tue, 30 Mar 2021 17:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UHcSLl092314; Tue, 30 Mar 2021 17:38:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UHcSdH092313; Tue, 30 Mar 2021 17:38:28 GMT (envelope-from git) Date: Tue, 30 Mar 2021 17:38:28 GMT Message-Id: <202103301738.12UHcSdH092313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 968ad154ce71 - main - fortune/freebsd-tips: Remove bogus fortune MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 968ad154ce71211737688b2236f0eb51ebac5826 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 17:38:28 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=968ad154ce71211737688b2236f0eb51ebac5826 commit 968ad154ce71211737688b2236f0eb51ebac5826 Author: Daniel Ebdrup Jensen AuthorDate: 2021-03-30 16:59:55 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-30 16:59:55 +0000 fortune/freebsd-tips: Remove bogus fortune The RCS IDs have been retired as of the move to git, so on 14-CURRENT and 13.0-STABLE this fortune returns the following. This fortune brought to you by: $FreeBSD$ While faintly amusing the first time, this might just cause confusion for folks, and in addition it's not the most useful of tips, so doesn't add much. Therefore it seems prudent to get rid of it. MFC: Not to 11-STABLE or 12-STABLE. --- usr.bin/fortune/datfiles/freebsd-tips | 3 --- 1 file changed, 3 deletions(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 46f5ec31f8d6..f25a94775d14 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -1,6 +1,3 @@ -This fortune brought to you by: -$FreeBSD$ -% Any user that is a member of the wheel group can use "su -" to simulate a root login. You can add a user to the wheel group by editing /etc/group. -- Konstantinos Konstantinidis From owner-dev-commits-src-all@freebsd.org Tue Mar 30 17:38:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C94657EF9D; Tue, 30 Mar 2021 17:38:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8xW93psTz52mX; Tue, 30 Mar 2021 17:38:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75C1E28A2; Tue, 30 Mar 2021 17:38:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UHcT2M092339; Tue, 30 Mar 2021 17:38:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UHcT0V092338; Tue, 30 Mar 2021 17:38:29 GMT (envelope-from git) Date: Tue, 30 Mar 2021 17:38:29 GMT Message-Id: <202103301738.12UHcT0V092338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 547817631948 - main - fortune/freebsd-tips: Remove errant spaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 547817631948f8a34a682ff0eebf88d3e55f1f05 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 17:38:29 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=547817631948f8a34a682ff0eebf88d3e55f1f05 commit 547817631948f8a34a682ff0eebf88d3e55f1f05 Author: Daniel Ebdrup Jensen AuthorDate: 2021-03-30 17:05:05 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-30 17:05:05 +0000 fortune/freebsd-tips: Remove errant spaces I noticed these errant spaces while removing a bogus fortune, and decided I might as well fix them. While here, reflow a line to it within 80 columns --- usr.bin/fortune/datfiles/freebsd-tips | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index f25a94775d14..31e6d31794e4 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -336,7 +336,7 @@ write This won't work if you don't have write permissions to the directory and probably won't be suitable if you're editing through a symbolic link. -If you have sudo(8) installed and permissions to use it, type +If you have sudo(8) installed and permissions to use it, type ``w ! sudo tee %'' to force a write. % You can adjust the volume of various parts of the sound system in your @@ -563,7 +563,7 @@ sysctl(8) tell you with the following command: sysctl hw.realmem The realmem value is memory before the kernel and modules are loaded, whereas -hw.physmem is what is left after they were loaded. +hw.physmem is what is left after they were loaded. The number of active CPUs is displayed using this command: @@ -573,7 +573,7 @@ sysctl hw.ncpu % When using ZFS as the file system the "df" command is reporting the pool size and not file system sizes. It also does not know about descendent ZFS -datasets, snapshots, quotas, and reservations with their individual space usage. +datasets, snapshots, quotas, and reservations with their individual space usage. Use the built-in "zfs list" command to get a better overview of space usage: zfs list -o space @@ -604,7 +604,7 @@ The zfs userspace command can display the quota and current space usage: # zfs userspace pool/home/foo -To unset a quota, assign "none" as the value. +To unset a quota, assign "none" as the value. -- Benedict Reuschling % ZFS can display I/O statistics for a given pool using the iostat subcommand. @@ -688,7 +688,7 @@ zfs list -H Another helpful option for script writers is -p, which displays the numbers in non-rounded, exact values: -zfs list -p +zfs list -p -- Benedict Reuschling % @@ -705,7 +705,7 @@ parameter to execute the destroy operation. -- Benedict Reuschling % You can delete a range of ZFS snapshots (a-z) in multiple ways. -The following will delete d and all earlier snapshots: +The following will delete d and all earlier snapshots: zfs destroy mypool/data@%d @@ -718,8 +718,8 @@ To delete all dataset snapshots: zfs destroy mypool/data@% Make sure to let ZFS perform a dry run (-n option) first and display (-v) what -it would do to confirm that the delete operation is removing exactly what you -intended. +it would do to confirm that the delete operation is removing exactly what you +intended. -- Benedict Reuschling % To set a custom ZFS property on the mypool pool, you need to provide it @@ -796,7 +796,8 @@ always have space left this way. -- Benedict Reuschling % -Sometimes a single slow HDD can cripple the performance of your entire system. You can spot one like this: +Sometimes a single slow HDD can cripple the performance of your entire system. +You can spot one like this: # gstat -I5s | sort -rn -k9 | head From owner-dev-commits-src-all@freebsd.org Tue Mar 30 17:38:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5DBC57F027; Tue, 30 Mar 2021 17:38:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8xWB6XJ9z52mg; Tue, 30 Mar 2021 17:38:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E9ED2166; Tue, 30 Mar 2021 17:38:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UHcUwU092362; Tue, 30 Mar 2021 17:38:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UHcUdx092361; Tue, 30 Mar 2021 17:38:30 GMT (envelope-from git) Date: Tue, 30 Mar 2021 17:38:30 GMT Message-Id: <202103301738.12UHcUdx092361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: c2a39987e6f1 - main - fortune/freebsd-tips: Add a few fortunes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2a39987e6f1dcd07aa03cb598675f1ca4662a1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 17:38:35 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c2a39987e6f1dcd07aa03cb598675f1ca4662a1c commit c2a39987e6f1dcd07aa03cb598675f1ca4662a1c Author: Daniel Ebdrup Jensen AuthorDate: 2021-03-30 17:35:50 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-30 17:35:50 +0000 fortune/freebsd-tips: Add a few fortunes These are fortunes I've used locally, probably for decades, so there's no reason why they shouldn't be available to everyone. --- usr.bin/fortune/datfiles/freebsd-tips | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 31e6d31794e4..2a37f98a37e5 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -803,3 +803,37 @@ You can spot one like this: -- Alan Somers % +FreeBSDs ps can create a dependency tree based on parent/child relationships +between processes, like this: + +$ ps -d + + -- Daniel Ebdrup Jensen +% +It is possible to get a meassure of the resident memory set: + +$ vmstat -o | awk 'NR>1 { t[$7] += $1 } \ +END { for (i in t) printf "%s %d\n",i,t[i] }' + +The rows have the following meaning: +df = default (not assigned a specific pager) +sw = swap +df = virtual +vn = vnode +ph = heap +md = memory device + +This will be reported in number of pages, so it needs to be multiplied by the +page size of the architecture which can be found via: + +$ sysctl -n hw.pagesize + + -- Daniel Ebdrup Jensen +% +To establish a serial connection to anything including a USB device, +nothing more than cu(1) is needed: + +$ cu -s 9600 -l /dev/ttyU0 + + -- Daniel Ebdrup Jensen +% From owner-dev-commits-src-all@freebsd.org Tue Mar 30 17:52:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1121C57F3D2; Tue, 30 Mar 2021 17:52:24 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8xqD0498z545k; Tue, 30 Mar 2021 17:52:24 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617126744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zQiLFjtrzYnMnyf47BAJazXOvYuVV6+yau6MZ53kLbI=; b=e0V5qoCSSY2ZCS0L+Xl/hrJxb5nR3HynlscXI6vuzAPXkOubIRVLbMiaYLQb39Qw18iDzs ysZNR0GxItFu7JEdSm6GWQsRE9VMbNPmrzKOrquZloQAe0s7zA1FpcJfZ42Hy+ma+RmwGX PX+abEO6ouGFoV0ltvmgZmFtBaHfJSiL3tkH6gJUWCya1qHRLfpCQjuooCamZj/p4Wdv78 XThWBxFeHip1HZTvgJ1Qb66gslsLI8k1PjaIYpZPzPh4uBcq9ae5NVkg5qxkofZWcAYXjZ FfVEHA1GEf60sQhTr+OVS1WIB8aMI1J31NTM/pVOLVd3gqUHb0UZXlHVlUJbMw== Received: by freefall.freebsd.org (Postfix, from userid 1033) id E66AB11B2A; Tue, 30 Mar 2021 17:52:23 +0000 (UTC) Date: Tue, 30 Mar 2021 17:52:23 +0000 From: Alexey Dokuchaev To: Daniel Ebdrup Jensen Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: c2a39987e6f1 - main - fortune/freebsd-tips: Add a few fortunes Message-ID: <20210330175223.GA12429@FreeBSD.org> References: <202103301738.12UHcUdx092361@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202103301738.12UHcUdx092361@gitrepo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617126744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zQiLFjtrzYnMnyf47BAJazXOvYuVV6+yau6MZ53kLbI=; b=LtjFJA4RIkScuNCz56bPXAcn+XpFVW2OhGKKCoGpv/FzK23sQZNX8xAFcyWrsnEg0r8WBa 7fhcqGSdN5FkNeReSJRyIivvCdMyD68EfNOnEPihe//7s3sOxLpIB+LCo7eVGPOvAhjEjW D5WGnrIfB0qsc/xjhcMZu4KDbVZjSOJEywxFk6KcYLkYB27+LZIcrMULJN5O2TvLhdP87g 9uHhH7zLiFu5x+6LnBjG1er+R9FFz1ZiQ8Nl+7PDpfdWbKbxKxM/ZIyr7c1E2kiBs+y9PL tk37GP2cSDc43OGVhAYEp0x1laGf4MxOQy+7UYeI85sbv9pTwbg1AxFmoDH95A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1617126744; a=rsa-sha256; cv=none; b=EcD6nEr5Q4UFDSvb9qF3pv694/pUnvgJGtaVvp6qtgM4k+YpH5V+6fyC8tGUUJUkzylcXK AH3Q93CJJ5jxfjnsod9AXCq7UCWAmSlk6Km3FNd9sC86/zclTH86NKcrCtbSKmKEtW4n1r gG/NVaV5EAFtG5trr1hFkwhnLA6OV+jWiq2LuXXKIQz80WR3BHohPbhEVw1CUiGI/ri/uE 4yFa6vpGPYR48saZtpEeQAeeZ8ow1gvg6KBMvLobuhjHAaxAm7E0JwbxK6JsWqfJ1gOs/9 OnQPcQr7zLhE9sFS4SoWngYKO0AOg0nIRkO1JwjbWSRRU6k7rAe9rADIYPk6NQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 17:52:24 -0000 On Tue, Mar 30, 2021 at 05:38:30PM +0000, Daniel Ebdrup Jensen wrote: > commit c2a39987e6f1dcd07aa03cb598675f1ca4662a1c > Author: Daniel Ebdrup Jensen > ... > +FreeBSDs ps can create a dependency tree based on parent/child relationships > +between processes, like this: You've probably meant "FreeBSD's ps(1)", but on a larger scale, do we really need to have random quotes of manpages' EXAMPLES in the quotes? ./danfe From owner-dev-commits-src-all@freebsd.org Tue Mar 30 18:07:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2166257FC36 for ; Tue, 30 Mar 2021 18:07:50 +0000 (UTC) (envelope-from debdrup@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8y920Rcwz54lG for ; Tue, 30 Mar 2021 18:07:50 +0000 (UTC) (envelope-from debdrup@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617127670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fjSUVUUumrLuVBJeebItDOmMEZtxY3RwouUx1xP1omY=; b=SqLpWuNGHnK4V4MYFhSNh3UwK+ID9slxoteyx2a35xzWXGJ/NSXnWffBQGUIM37fINe0rE wqNJCFk7HPO/oB/RrVDmhsJZK6uZ7ic1JnwkSLC0212DxrQEFiMVQkO2clJA2T7/I/fg3W KT/aIWoMBc5LHv0Pj4HR2eqt4KW10o/aA90idZk50ocu9RRkGTPIN6jJZMl1T9aoH/0fV3 JxUpreIfOZBWWIEfdKfhDh812HQZZuGPP8dVF6w21zVKT9NKQewIvNRRShdxQDfdhBRlR8 z+EwcpJQbOcgGJN66hiuMKmpdlaANhtJdnlZDQJIHhdSnW0dhEh8Uh+gzDhMhw== Received: by freefall.freebsd.org (Postfix, from userid 1471) id F198E11CBD; Tue, 30 Mar 2021 18:07:49 +0000 (UTC) Date: Tue, 30 Mar 2021 20:07:48 +0200 From: Daniel Ebdrup Jensen To: dev-commits-src-all@freebsd.org Subject: Re: git: c2a39987e6f1 - main - fortune/freebsd-tips: Add a few fortunes Message-ID: <20210330180748.dhpngo25t5w2zeh2@nerd-thinkpad.local> Mail-Followup-To: Daniel Ebdrup Jensen , dev-commits-src-all@freebsd.org References: <202103301738.12UHcUdx092361@gitrepo.freebsd.org> <20210330175223.GA12429@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="77ruon7lyibai3mq" Content-Disposition: inline In-Reply-To: <20210330175223.GA12429@FreeBSD.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617127670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fjSUVUUumrLuVBJeebItDOmMEZtxY3RwouUx1xP1omY=; b=tYiJtTJpvadkYjD6libiL9axkA4vggaKmzbKZy5YKACRgJY10MaxuarqLbAQlHCBVIp9Jl GKvVpKnvhu5BP7AHe99M+eD97yUqJ7fmY/dn9ItaGMcJEhFk33GEeBJ1TD6+ChhEp7yQod 2qW6KpAI92I+26m+dCgJmTib0eHUIuemVewjd+xXPNXei4U5bUehSJT6F7TRPok6A7PJne P4VeOWCgO5RHSRUYU6g9wj20HvH3BNqXAT1/M+ViLAWVjSiYl35GHS5mLnNa5wR3b37bdU yqA0o21v0Zdp5CwXfZolk8r2Ivg7k5ELc3ybs7cREjuccKGSwF5ehgnPWAk7WQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1617127670; a=rsa-sha256; cv=none; b=uHYKhPCWLqB1dTzFYwLotIOC2QKpkpBJl8IFT+PeOeVcpQ9AlPneAJFW3nJBAwNHys+Cgb /KPQlytHWPvdqZpqgJfS4NeVFqGRuu6dS2vYyZ4X4ZBw75az+LyOSmINYYE4F75yksZB6F yUnXHA2aueBVPtM915g5C1aR7i4UPDk04aztvA5ImmtUA0tfV+BLytuKna2GOeR+Xo5naY ggOEXlCNfwjgUHfADUeyAml+8rka4r6SjKEBuxMMJWVZ84e4kj5bo5Jb72iDPNKvt6iVbm FP4UU+0jd5qEF6IhaQYx3oahxLTITjlUf/WLoN3lNLZ+IbRaW2zMJ1NLSd3FMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 18:07:50 -0000 --77ruon7lyibai3mq Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline On Tue, Mar 30, 2021 at 05:52:23PM +0000, Alexey Dokuchaev wrote: >On Tue, Mar 30, 2021 at 05:38:30PM +0000, Daniel Ebdrup Jensen wrote: >> commit c2a39987e6f1dcd07aa03cb598675f1ca4662a1c >> Author: Daniel Ebdrup Jensen >> ... >> +FreeBSDs ps can create a dependency tree based on parent/child relationships >> +between processes, like this: > >You've probably meant "FreeBSD's ps(1)", but on a larger scale, do we >really need to have random quotes of manpages' EXAMPLES in the quotes? > >./danfe Hi Alexey, I guess that's a fair point, but how many people are in the habit of spending time on the regular, looking through manual pages? If I understand freebsd-tips, it's meant as a way to help people find things they might not otherwise be aware of? Yours, Daniel Ebdrup Jensen --77ruon7lyibai3mq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAABCgB9FiEEDonNJPbg/JLIMoS6Ps5hSHzN87oFAmBjaPRfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDBF ODlDRDI0RjZFMEZDOTJDODMyODRCQTNFQ0U2MTQ4N0NDREYzQkEACgkQPs5hSHzN 87ov3Qf/SKNnO4lJmsyRL5vQ9hFEOwe8Z7QCrfKQ4Xf6iZESeuNCV66MP1hNnpnF uZ72n/RcoisO3yhD97+Gc/U7KVV7qORyJCA/f5N/KLrfNZvuLevoScYia/weMPEO q+oM0NizKQUwKH/JoLnyE1wAGdJnqL2yw0rdG2EhA8kqGgW+ZmdIh9Bg649uaMSR R0qHsqBN9H5qqSjNUmvyclEu00UTu+3pr+lG2B4uCeaIlMfCktPSMx3KT20R11CS hB2yR628usQC9wJE0je1yxy3gvoyxzeZjggSVC3z4GGPo85cL5CYtpOAzPjmvObc TNNJR3YiVIqcMozHg3qvN4n66QvY0A== =sxpe -----END PGP SIGNATURE----- --77ruon7lyibai3mq-- From owner-dev-commits-src-all@freebsd.org Tue Mar 30 18:08:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2130F57FC45 for ; Tue, 30 Mar 2021 18:08:24 +0000 (UTC) (envelope-from 0100017884527dc3-aed27a3c-6fbe-44ed-947d-7c5f40bb0e67-000000@amazonses.com) Received: from a8-26.smtp-out.amazonses.com (a8-26.smtp-out.amazonses.com [54.240.8.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8y9g2HChz54rW for ; Tue, 30 Mar 2021 18:08:22 +0000 (UTC) (envelope-from 0100017884527dc3-aed27a3c-6fbe-44ed-947d-7c5f40bb0e67-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=dqtolf56kk3wpt62c3jnwboqvr7iedax; d=tarsnap.com; t=1617127702; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=DU52SEtC5EEordZsMQQ83fgQKZxFj+Uxl7RaEhDy4LQ=; b=Yw8HDLT/hDb3X7k5pTfY5jVCKWQ9EaDrtD5h0L3di8nKolFLmvq3KIUzJ84HV4JI HdteLAmDO/WhjtEKxiIL6ns3bYDhEyQNU23aqB4bRvjDK4NL5Pm0qV5PnXEup+k/akO uWyeqD2w3FizeGCcGPx01gs7O8e/xaheWA7oHa0U= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1617127702; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=DU52SEtC5EEordZsMQQ83fgQKZxFj+Uxl7RaEhDy4LQ=; b=UT+zjoxBEW6chJwEDMTKNYu0vUUCHYOsQ+HBfsfA8kOwaRvc88rgcz3xuTCA272q jjkCPJQjkF6R5RBUn12vUPr+y4cau+3lRLnl0bQlSVvqsVGcALnWTSwxghpBocRXieF BJgh57AZWi76aDeCW9n0sQs8fBj/6gCx+VA6yFQU= Subject: Re: git: c2a39987e6f1 - main - fortune/freebsd-tips: Add a few fortunes To: Alexey Dokuchaev , Daniel Ebdrup Jensen Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103301738.12UHcUdx092361@gitrepo.freebsd.org> <20210330175223.GA12429@FreeBSD.org> From: Colin Percival Message-ID: <0100017884527dc3-aed27a3c-6fbe-44ed-947d-7c5f40bb0e67-000000@email.amazonses.com> Date: Tue, 30 Mar 2021 18:08:22 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210330175223.GA12429@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2021.03.30-54.240.8.26 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-Rspamd-Queue-Id: 4F8y9g2HChz54rW X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tarsnap.com header.s=dqtolf56kk3wpt62c3jnwboqvr7iedax header.b=Yw8HDLT/; dkim=pass header.d=amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=UT+zjoxB; dmarc=pass (policy=none) header.from=tarsnap.com; spf=pass (mx1.freebsd.org: domain of 0100017884527dc3-aed27a3c-6fbe-44ed-947d-7c5f40bb0e67-000000@amazonses.com designates 54.240.8.26 as permitted sender) smtp.mailfrom=0100017884527dc3-aed27a3c-6fbe-44ed-947d-7c5f40bb0e67-000000@amazonses.com X-Spamd-Result: default: False [-1.20 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[tarsnap.com:s=dqtolf56kk3wpt62c3jnwboqvr7iedax,amazonses.com:s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:54.240.0.0/18]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RWL_MAILSPIKE_GOOD(0.00)[54.240.8.26:from]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[54.240.8.26:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[tarsnap.com:+,amazonses.com:+]; DMARC_POLICY_ALLOW(-0.50)[tarsnap.com,none]; RCVD_IN_DNSWL_NONE(0.00)[54.240.8.26:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[cperciva@tarsnap.com,0100017884527dc3-aed27a3c-6fbe-44ed-947d-7c5f40bb0e67-000000@amazonses.com]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[54.240.8.26:from]; ASN(0.00)[asn:14618, ipnet:54.240.8.0/21, country:US]; FORGED_MUA_THUNDERBIRD_MSGID_UNKNOWN(2.50)[]; FROM_NEQ_ENVFROM(0.00)[cperciva@tarsnap.com,0100017884527dc3-aed27a3c-6fbe-44ed-947d-7c5f40bb0e67-000000@amazonses.com]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 18:08:24 -0000 On 3/30/21 10:52 AM, Alexey Dokuchaev wrote: > On Tue, Mar 30, 2021 at 05:38:30PM +0000, Daniel Ebdrup Jensen wrote: >> commit c2a39987e6f1dcd07aa03cb598675f1ca4662a1c >> Author: Daniel Ebdrup Jensen >> ... >> +FreeBSDs ps can create a dependency tree based on parent/child relationships >> +between processes, like this: > > You've probably meant "FreeBSD's ps(1)", but on a larger scale, do we > really need to have random quotes of manpages' EXAMPLES in the quotes? Speaking as someone who has used FreeBSD for 20 years but didn't know about this functionality (and appreciates having it pointed out): Yes please! -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-dev-commits-src-all@freebsd.org Tue Mar 30 18:12:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2580D57FD62 for ; Tue, 30 Mar 2021 18:12:39 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8yGb0bygz553y; Tue, 30 Mar 2021 18:12:39 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617127959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eiG1jS0AfxYRyYysMpjM4YopwG8BP1NsnuDr0j+n6Ds=; b=gUeMjdJHnIQFeQ46kTPAu+NJ5O2oNjshDPqumDxTCw7zsTc8qJ8glyXJQ8A5lO3+fuRTAP 9TYMJVXfZNCh5DcMJTgSIGwmjdaspBsCw8f/ujm89lOHY1apCGQ+IvXZlnhKy/qywu8tET Vy8pAHdoa7fGbB46CfPJ/dSm2BYCr+ft2wZpydU1dv6ShQuDb73bqLre9Qn8kksO+lJqFG ixQvr+6iSt24NRJzahAgjPmQWAkX0Cb6si0XyzgiV2NI/599evESMh9lvk28dZPlHcRnKc zJEBbh2IRTEAYSk8ZVWkVZomA+LgMFO18en6E64yJ4s6Q07CZAyeeI40COWN/Q== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 03D8D11CF7; Tue, 30 Mar 2021 18:12:39 +0000 (UTC) Date: Tue, 30 Mar 2021 18:12:38 +0000 From: Alexey Dokuchaev To: Daniel Ebdrup Jensen , dev-commits-src-all@freebsd.org Subject: Re: git: c2a39987e6f1 - main - fortune/freebsd-tips: Add a few fortunes Message-ID: <20210330181238.GA36617@FreeBSD.org> References: <202103301738.12UHcUdx092361@gitrepo.freebsd.org> <20210330175223.GA12429@FreeBSD.org> <20210330180748.dhpngo25t5w2zeh2@nerd-thinkpad.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210330180748.dhpngo25t5w2zeh2@nerd-thinkpad.local> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617127959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eiG1jS0AfxYRyYysMpjM4YopwG8BP1NsnuDr0j+n6Ds=; b=VFYjg3tRreDVVCxo+lKX/TdYKlb1y+kkNSVd6zITha7ebyak4NUYXNDUD4u5QT0D8UlNOg mil79XsGD6GLISZMuns/vdduHE0NwQ4hf96jK3j+5R58JIIZXF60wCQjFWXvDGdaQaMvap jEbLCAtknVqxLch0fMPcGretXge7qE9bvwDZJPtsd1lZPADX5oMfF/2RNbjNY21WHXmBd0 BhurFkL8wkyHs68BJdPmnu1vdRK1GUFhvHRBtGrhPraxcJJINLyS/9gll5XOHuUhiau67p OxCIvC5h/QGgzvItRE8zMMFzBCp+cWbnLJ/GACj86ZyDWsNyGRPloh85HkWH1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1617127959; a=rsa-sha256; cv=none; b=SLeCHYBtbKgjlzRQIGxcsri7xAvJ6opLU0BjoirGr6YubHQegAaosa2D+fG/rB172fEqy2 VzYJjfQJI+yHlQfytwrgZSVHB7A8ev9CPvfYGxb4x1RQx2MLunCEDU/qxYSWYeC3aMZC8n OxGQtmQylcUslRuduxfTAOovtMfafIMI2Gtacpvk34ZcVLgQDJHKB2oyKKHuTV/PwCz+R4 CBsXvUlPIX1o6k3fUgV9Yu7zgL5rcx+HhKiDSzitVCoTrg6/hWixvdffQmun+N81GZUxsD c1zGT2AtuY7BqxrSzVJXBHKkGoZ0sEwdEX7Xad0kaSmmFB2q9NS8ujnmDQ6CwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 18:12:39 -0000 On Tue, Mar 30, 2021 at 08:07:48PM +0200, Daniel Ebdrup Jensen wrote: > On Tue, Mar 30, 2021 at 05:52:23PM +0000, Alexey Dokuchaev wrote: > >On Tue, Mar 30, 2021 at 05:38:30PM +0000, Daniel Ebdrup Jensen wrote: > >> commit c2a39987e6f1dcd07aa03cb598675f1ca4662a1c > >> Author: Daniel Ebdrup Jensen > >> ... > >> +FreeBSDs ps can create a dependency tree based on parent/child relationships > >> +between processes, like this: > > > >You've probably meant "FreeBSD's ps(1)", but on a larger scale, do we > >really need to have random quotes of manpages' EXAMPLES in the quotes? > > Hi Alexey, > > I guess that's a fair point, but how many people are in the habit of > spending time on the regular, looking through manual pages? At least, please fix the markup: add missing apostrophe and denote the command with "(1)" because "ps" itself is not a real unattached word. ./danfe From owner-dev-commits-src-all@freebsd.org Tue Mar 30 18:23:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E12D5A84B2; Tue, 30 Mar 2021 18:23:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8yWH3dThz55kP; Tue, 30 Mar 2021 18:23:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F7F63191; Tue, 30 Mar 2021 18:23:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UINdAr061356; Tue, 30 Mar 2021 18:23:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UINdqs061355; Tue, 30 Mar 2021 18:23:39 GMT (envelope-from git) Date: Tue, 30 Mar 2021 18:23:39 GMT Message-Id: <202103301823.12UINdqs061355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 076686fe0703 - main - cam: make sure to clear CCBs allocated on the stack MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 076686fe0703b906a05c9869609dd550bd4ed7ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 18:23:39 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=076686fe0703b906a05c9869609dd550bd4ed7ac commit 076686fe0703b906a05c9869609dd550bd4ed7ac Author: Edward Tomasz Napierala AuthorDate: 2021-03-30 18:15:11 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-30 18:15:43 +0000 cam: make sure to clear CCBs allocated on the stack This is required for small CCBs support, where we need to track whether the CCB was allocated from an UMA zone or not. There are no (intended) functional changes with the current source. Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D29484 --- sys/cam/cam_periph.c | 6 ++++++ sys/cam/cam_xpt.c | 5 +++++ sys/cam/scsi/scsi_da.c | 3 +++ sys/cam/scsi/scsi_xpt.c | 7 +++++++ 4 files changed, 21 insertions(+) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 98b9264f1069..3e1a19936825 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -746,6 +746,7 @@ camperiphfree(struct cam_periph *periph) union ccb ccb; void *arg; + memset(&ccb, 0, sizeof(ccb)); switch (periph->deferred_ac) { case AC_FOUND_DEVICE: ccb.ccb_h.func_code = XPT_GDEV_TYPE; @@ -1318,6 +1319,7 @@ cam_freeze_devq(struct cam_path *path) struct ccb_hdr ccb_h; CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_freeze_devq\n")); + memset(&ccb_h, 0, sizeof(ccb_h)); xpt_setup_ccb(&ccb_h, path, /*priority*/1); ccb_h.func_code = XPT_NOOP; ccb_h.flags = CAM_DEV_QFREEZE; @@ -1333,6 +1335,7 @@ cam_release_devq(struct cam_path *path, u_int32_t relsim_flags, CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_release_devq(%u, %u, %u, %d)\n", relsim_flags, openings, arg, getcount_only)); + memset(&crs, 0, sizeof(crs)); xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = getcount_only ? CAM_DEV_QFREEZE : 0; @@ -1456,6 +1459,7 @@ cam_periph_bus_settle(struct cam_periph *periph, u_int bus_settle) { struct ccb_getdevstats cgds; + memset(&cgds, 0, sizeof(cgds)); xpt_setup_ccb(&cgds.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgds.ccb_h.func_code = XPT_GDEV_STATS; xpt_action((union ccb *)&cgds); @@ -1527,6 +1531,7 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **orig_ccb, * First off, find out what the current * transaction counts are. */ + memset(&cgds, 0, sizeof(cgds)); xpt_setup_ccb(&cgds.ccb_h, ccb->ccb_h.path, CAM_PRIORITY_NORMAL); @@ -1645,6 +1650,7 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **orig, /* * Grab the inquiry data for this device. */ + memset(&cgd, 0, sizeof(cgd)); xpt_setup_ccb(&cgd.ccb_h, ccb->ccb_h.path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 24e16bebb2e7..b7bc2b74da6c 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -499,6 +499,7 @@ xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread * * This is an immediate CCB, so it's okay to * allocate it on the stack. */ + memset(&ccb, 0, sizeof(ccb)); /* * Create a path using the bus, target, and lun the @@ -2595,6 +2596,7 @@ xptsetasyncfunc(struct cam_ed *device, void *arg) if ((device->flags & CAM_DEV_UNCONFIGURED) != 0) return (1); + memset(&cgd, 0, sizeof(cgd)); xpt_compile_path(&path, NULL, device->target->bus->path_id, @@ -5078,6 +5080,7 @@ xpt_start_tags(struct cam_path *path) sim->max_tagged_dev_openings); xpt_dev_ccbq_resize(path, newopenings); xpt_async(AC_GETDEV_CHANGED, path, NULL); + memset(&crs, 0, sizeof(crs)); xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; @@ -5103,6 +5106,7 @@ xpt_stop_tags(struct cam_path *path) device->inq_flags &= ~SID_CmdQue; xpt_dev_ccbq_resize(path, sim->max_dev_openings); xpt_async(AC_GETDEV_CHANGED, path, NULL); + memset(&crs, 0, sizeof(crs)); xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; @@ -5260,6 +5264,7 @@ xpt_register_async(int event, ac_callback_t *cbfunc, void *cbarg, xptpath = 1; } + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, path, CAM_PRIORITY_NORMAL); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = event; diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index c13b51921745..baba5d9ed839 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -4879,6 +4879,7 @@ dadone_proberc(struct cam_periph *periph, union ccb *done_ccb) /*timeout*/0, /*getcount_only*/0); + memset(&cgd, 0, sizeof(cgd)); xpt_setup_ccb(&cgd.ccb_h, done_ccb->ccb_h.path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; @@ -6125,6 +6126,7 @@ dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector, * up with something that will make this a bootable * device. */ + memset(&ccg, 0, sizeof(ccg)); xpt_setup_ccb(&ccg.ccb_h, periph->path, CAM_PRIORITY_NORMAL); ccg.ccb_h.func_code = XPT_CALC_GEOMETRY; ccg.block_size = dp->secsize; @@ -6162,6 +6164,7 @@ dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector, min(sizeof(softc->rcaplong), rcap_len)) != 0)) { struct ccb_dev_advinfo cdai; + memset(&cdai, 0, sizeof(cdai)); xpt_setup_ccb(&cdai.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_RCAPLONG; diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 2ec1490c0edf..5db60fcccd01 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -1036,6 +1036,7 @@ proberequestdefaultnegotiation(struct cam_periph *periph) { struct ccb_trans_settings cts; + memset(&cts, 0, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; @@ -2306,6 +2307,7 @@ scsi_scan_lun(struct cam_periph *periph, struct cam_path *path, CAM_DEBUG(path, CAM_DEBUG_TRACE, ("scsi_scan_lun\n")); + memset(&cpi, 0, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); @@ -2432,6 +2434,7 @@ scsi_devise_transport(struct cam_path *path) struct scsi_inquiry_data *inq_buf; /* Get transport information from the SIM */ + memset(&cpi, 0, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); @@ -2492,6 +2495,7 @@ scsi_devise_transport(struct cam_path *path) */ /* Tell the controller what we think */ + memset(&cts, 0, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; @@ -2754,6 +2758,7 @@ scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path * Perform sanity checking against what the * controller and device can do. */ + memset(&cur_cts, 0, sizeof(cur_cts)); xpt_setup_ccb(&cur_cts.ccb_h, path, CAM_PRIORITY_NONE); cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cur_cts.type = cts->type; @@ -2937,6 +2942,7 @@ scsi_toggle_tags(struct cam_path *path) && (dev->inq_flags & (SID_Sync|SID_WBus16|SID_WBus32)) != 0)) { struct ccb_trans_settings cts; + memset(&cts, 0, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); cts.protocol = PROTO_SCSI; cts.protocol_version = PROTO_VERSION_UNSPECIFIED; @@ -3044,6 +3050,7 @@ _scsi_announce_periph(struct cam_periph *periph, u_int *speed, u_int *freq, stru return; /* Ask the SIM for its base transfer speed */ + memset(&cpi, 0, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); From owner-dev-commits-src-all@freebsd.org Tue Mar 30 18:34:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A95D05A90F3; Tue, 30 Mar 2021 18:34:07 +0000 (UTC) (envelope-from pstef@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8ylM4V39z57BK; Tue, 30 Mar 2021 18:34:07 +0000 (UTC) (envelope-from pstef@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617129247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JGpXTlHRZ16ArEKt/dk3B7r427jejpNuh7xJg0+4vg8=; b=qNwr6q94l8OuucedMcX8AkIxprW234wQAZYiPzMreuCLVo9Z7zKmxPKt2zWdpfkQnPFJGt JUDs6KaTznBEgLMBokJ7CefmEuyoCxAtzZA1m9q7k+feVLARQSOYyBtDahIJKOu7ij4xG2 t9tu1g4cBXyvavxGgIRiT9tPw4hzZ8zq9oCxJLLlvrqMxBmRzp9aYO/PYfcn00Oy/9zphZ phxZpR/8e9nQ6KNjIw3Hu3RzTW1sruKSwunF0Ezd1wLuxaCR7DbYvN6RB6z7odPwaGzh8q xCQD4IRR4SkhSilSZxGtZwPb+O9HrXoTFYL0ouEjIrRurEzdpMjyru9NrCLHMQ== Received: by freefall.freebsd.org (Postfix, from userid 1403) id 8740012641; Tue, 30 Mar 2021 18:34:07 +0000 (UTC) Date: Tue, 30 Mar 2021 20:34:07 +0200 From: "Piotr P. Stefaniak" To: Colin Percival Cc: Alexey Dokuchaev , Daniel Ebdrup Jensen , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: c2a39987e6f1 - main - fortune/freebsd-tips: Add a few fortunes Message-ID: <20210330183407.GA36170@freefall.freebsd.org> References: <202103301738.12UHcUdx092361@gitrepo.freebsd.org> <20210330175223.GA12429@FreeBSD.org> <0100017884527dea-3cdb0c79-18e2-4a99-9287-fba6900a5614-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <0100017884527dea-3cdb0c79-18e2-4a99-9287-fba6900a5614-000000@email.amazonses.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617129247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JGpXTlHRZ16ArEKt/dk3B7r427jejpNuh7xJg0+4vg8=; b=sRK/RWWxPRCinv6Fy6zUD533+fv2//jZX3tp/FZcphkxKBGGAe8AuqIsZPXcDEPGXLahyc p3hPS1RLCJoHYtPwf7Wb963rEwWb+DlH/QnpCeLHoh6vBYjAr+QvCNqvX6O/d+q8ceM9Ys 0Ln5pJR2dKzQio5CgdPB1J+QuAk8bk2jmVk5LjR7HkBY02Rz7UKSwnyaqUA8GEMkcoZYdo J6q6ulbfH+f2rG4+MCZNRrkaTc27oZ3cXkhLahEo4JW/3RMUE9yV2uwh1a938PVmbwFXpU kASH7e5NO7pzXvBuof8M1PXCzLHmW7S3KI9ybo5/T5Lga2F0aTowNaazAsf3rQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1617129247; a=rsa-sha256; cv=none; b=nr+29V9V7fZ1HEefsW2fH8gXYSrQJJY2/ihvnclJfHqA81JMiK0RWWV2sDPE+LQLlMjFOJ N9NJ5/EjetU2bdQBWxeZbbficwFjImOwjwFbLHutwYxCL16cpNmkk9zLWWskiRdHUZ3FQ5 WSwGQsqYuNVRzwAU20pkqpYS2Rrjh6Ez5qYimO7qXb2mXdqIhDtHLggJuTFRlC1JRSQKBk 2B+MG0NubOt677l+7d9VXkH0B464Y81/QzHnzPW0RTjGectoV3fKC/y0bH+zT33SgAt7pp 7eptS1RzXsDKBy+2s7XJ7tWll1ftMzFDtBmsMhOejIoCBVm3zWzAeouqjU8+uQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 18:34:07 -0000 On 2021-03-30 18:08:22, Colin Percival wrote: >On 3/30/21 10:52 AM, Alexey Dokuchaev wrote: >> On Tue, Mar 30, 2021 at 05:38:30PM +0000, Daniel Ebdrup Jensen wrote: >>> commit c2a39987e6f1dcd07aa03cb598675f1ca4662a1c >>> Author: Daniel Ebdrup Jensen >>> ... >>> +FreeBSDs ps can create a dependency tree based on parent/child relationships >>> +between processes, like this: >> >> You've probably meant "FreeBSD's ps(1)", but on a larger scale, do we >> really need to have random quotes of manpages' EXAMPLES in the quotes? Manual pages are often good as a reference, when you know what you're looking for or where to look, but they aren't great for discovery. I don't believe we have a good apropos(1). >Speaking as someone who has used FreeBSD for 20 years but didn't know about >this functionality (and appreciates having it pointed out): Yes please! I included some potentially interesting usage in commit message for ca8c0d5e811048ad67d0955642c5b486e9c0f3d2 Piotr From owner-dev-commits-src-all@freebsd.org Tue Mar 30 19:13:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16D5A5AAA29; Tue, 30 Mar 2021 19:13:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8zcX2D9rz3CW2; Tue, 30 Mar 2021 19:13:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F11A93F80; Tue, 30 Mar 2021 19:13:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UJDFsc031693; Tue, 30 Mar 2021 19:13:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UJDFYZ031692; Tue, 30 Mar 2021 19:13:15 GMT (envelope-from git) Date: Tue, 30 Mar 2021 19:13:15 GMT Message-Id: <202103301913.12UJDFYZ031692@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: 75e67b4920f2 - main - powerpc64: support superpages on pmap_mincore MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 75e67b4920f2d70b98bd1383966d17d541b7c46c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 19:13:17 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=75e67b4920f2d70b98bd1383966d17d541b7c46c commit 75e67b4920f2d70b98bd1383966d17d541b7c46c Author: Leandro Lupori AuthorDate: 2021-03-30 18:54:01 +0000 Commit: Leandro Lupori CommitDate: 2021-03-30 18:54:01 +0000 powerpc64: support superpages on pmap_mincore Now that superpages for HPT MMU has landed, finish implementation of pmap_mincore by adding support for superpages. Submitted by: Fernando Eckhardt Valle Reviewed by: bdragon, luporl MFC after: 1 week Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D29230 --- sys/powerpc/aim/mmu_oea64.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 1aa05501bd1b..0e9b15661758 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1400,13 +1400,15 @@ moea64_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) PMAP_LOCK(pmap); - /* XXX Add support for superpages */ pvo = moea64_pvo_find_va(pmap, addr); if (pvo != NULL) { pa = PVO_PADDR(pvo); m = PHYS_TO_VM_PAGE(pa); managed = (pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED; - val = MINCORE_INCORE; + if (PVO_IS_SP(pvo)) + val = MINCORE_INCORE | MINCORE_PSIND(1); + else + val = MINCORE_INCORE; } else { PMAP_UNLOCK(pmap); return (0); From owner-dev-commits-src-all@freebsd.org Tue Mar 30 21:39:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C72475AE863; Tue, 30 Mar 2021 21:39:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F92rj5DQyz3P2M; Tue, 30 Mar 2021 21:39:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A21045F12; Tue, 30 Mar 2021 21:39:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12ULd1xF034647; Tue, 30 Mar 2021 21:39:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ULd1ap034646; Tue, 30 Mar 2021 21:39:01 GMT (envelope-from git) Date: Tue, 30 Mar 2021 21:39:01 GMT Message-Id: <202103302139.12ULd1ap034646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: b8598e2ff65a - main - Add IPv4 fib lookup performance tests with uniform keys. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8598e2ff65ab82da0cf6861ee12f078b40bc252 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 21:39:01 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=b8598e2ff65ab82da0cf6861ee12f078b40bc252 commit b8598e2ff65ab82da0cf6861ee12f078b40bc252 Author: Alexander V. Chernikov AuthorDate: 2021-03-30 12:43:55 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-30 13:32:28 +0000 Add IPv4 fib lookup performance tests with uniform keys. Submitted by: zec MFC after: 1 week --- sys/tests/fib_lookup/fib_lookup.c | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/sys/tests/fib_lookup/fib_lookup.c b/sys/tests/fib_lookup/fib_lookup.c index 3dd1bb8d5a50..ea07e3d697c6 100644 --- a/sys/tests/fib_lookup/fib_lookup.c +++ b/sys/tests/fib_lookup/fib_lookup.c @@ -505,6 +505,58 @@ SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet_scan, CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, run_test_inet_scan, "I", "Execute fib4_lookup scan tests"); +static int +rnd_lps(SYSCTL_HANDLER_ARGS) +{ + struct epoch_tracker et; + struct in_addr *keys; + struct nhop_object **nhops; + + struct timespec ts_pre, ts_post; + uint64_t total_diff, lps; + int error; + int count = 0; + + error = sysctl_handle_int(oidp, &count, 0, req); + if (error != 0) + return (error); + if (count <= 0) + return (0); + + keys = malloc(sizeof(*keys) * count, M_TEMP, M_NOWAIT); + nhops = malloc(sizeof(*nhops) * count, M_TEMP, M_NOWAIT); + if (keys == NULL || nhops == NULL) { + free(keys, M_TEMP); + free(nhops, M_TEMP); + return (ENOMEM); + } + + printf("Preparing %d random keys...\n", count); + arc4random_buf(keys, sizeof(*keys) * count); + printf("Starting LPS test...\n"); + + NET_EPOCH_ENTER(et); + nanouptime(&ts_pre); + for (int i = 0; i < count; i++) + nhops[i] = fib4_lookup(RT_DEFAULT_FIB, keys[i], 0, NHR_NONE, 0); + nanouptime(&ts_post); + NET_EPOCH_EXIT(et); + + free(keys, M_TEMP); + free(nhops, M_TEMP); + + total_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 + + (ts_post.tv_nsec - ts_pre.tv_nsec); + lps = 1000000000ULL * count / total_diff; + printf("%d lookups in %zu nanoseconds, %lu.%06lu MLPS\n", + count, total_diff, lps / 1000000, lps % 1000000); + + return (0); +} +SYSCTL_PROC(_net_route_test, OID_AUTO, rnd_lps, + CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + 0, 0, rnd_lps, "I", + "Measure lookups per second using uniformly random keys"); static int test_fib_lookup_modevent(module_t mod, int type, void *unused) From owner-dev-commits-src-all@freebsd.org Tue Mar 30 21:49:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0CDA5AEC46; Tue, 30 Mar 2021 21:49:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F934d4hb4z3Pgc; Tue, 30 Mar 2021 21:49:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F9C15D40; Tue, 30 Mar 2021 21:49:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12ULnLku048256; Tue, 30 Mar 2021 21:49:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ULnLfe048255; Tue, 30 Mar 2021 21:49:21 GMT (envelope-from git) Date: Tue, 30 Mar 2021 21:49:21 GMT Message-Id: <202103302149.12ULnLfe048255@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 660045fb5360 - main - sh: improve emacs mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 660045fb5360d328da199ae78c89d5cc15b6d1ca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 21:49:21 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=660045fb5360d328da199ae78c89d5cc15b6d1ca commit 660045fb5360d328da199ae78c89d5cc15b6d1ca Author: Baptiste Daroussin AuthorDate: 2021-03-30 09:37:29 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-30 21:49:03 +0000 sh: improve emacs mode In emacs mode, force ^R to backware search the history This behaviour is the default in emacs mode for most of the other shells Note: Note that this can still be overridden via $EDITRC, ~/.editrc or a bind command after set -o emacs. MFC after: 1 week Approved by: jilles Reviewed by: jilles, arichardson, pstef Differential Revision: https://reviews.freebsd.org/D29494 --- bin/sh/histedit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 45a821736bc0..ba2bec357181 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -142,8 +142,10 @@ bad: if (el) { if (Vflag) el_set(el, EL_EDITOR, "vi"); - else if (Eflag) + else if (Eflag) { el_set(el, EL_EDITOR, "emacs"); + el_set(el, EL_BIND, "^R", "em-inc-search-prev", NULL); + } el_set(el, EL_BIND, "^I", "sh-complete", NULL); el_source(el, NULL); } From owner-dev-commits-src-all@freebsd.org Tue Mar 30 22:22:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FEEE5AFAAC; Tue, 30 Mar 2021 22:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F93pL1kLDz3hPx; Tue, 30 Mar 2021 22:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CA9467AA; Tue, 30 Mar 2021 22:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UMM2m9002452; Tue, 30 Mar 2021 22:22:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UMM28e002451; Tue, 30 Mar 2021 22:22:02 GMT (envelope-from git) Date: Tue, 30 Mar 2021 22:22:02 GMT Message-Id: <202103302222.12UMM28e002451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 18f3c5fe9207 - main - usr.sbin/services_mkdb: plug memory leak when line was blank. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 18f3c5fe9207fbd19360b8ddb23ba10a5ad3df68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 22:22:02 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=18f3c5fe9207fbd19360b8ddb23ba10a5ad3df68 commit 18f3c5fe9207fbd19360b8ddb23ba10a5ad3df68 Author: Xin LI AuthorDate: 2021-03-30 22:21:37 +0000 Commit: Xin LI CommitDate: 2021-03-30 22:21:37 +0000 usr.sbin/services_mkdb: plug memory leak when line was blank. Reviewed by: bapt MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29370 --- usr.sbin/services_mkdb/uniq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.sbin/services_mkdb/uniq.c b/usr.sbin/services_mkdb/uniq.c index 330a09fc10e1..c78b01ef27c5 100644 --- a/usr.sbin/services_mkdb/uniq.c +++ b/usr.sbin/services_mkdb/uniq.c @@ -120,12 +120,13 @@ comp(const char *origline, char **compline, size_t *len) for (p = (const unsigned char *)origline; l && *p && isspace(*p); p++, l--) continue; + if (*p == '\0' || l == 0) + return 0; + if ((cline = malloc(l + 1)) == NULL) err(1, "Cannot allocate %zu bytes", l + 1); (void)memcpy(cline, p, l); cline[l] = '\0'; - if (*cline == '\0') - return 0; complen = 0; hasalnum = 0; @@ -155,6 +156,11 @@ comp(const char *origline, char **compline, size_t *len) --complen; } *q = '\0'; + if (!hasalnum) { + free(cline); + cline = NULL; + complen = 0; + } *compline = cline; *len = complen; return hasalnum; From owner-dev-commits-src-all@freebsd.org Tue Mar 30 22:32:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D6F55B0C36; Tue, 30 Mar 2021 22:32:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F942227B2z3jNs; Tue, 30 Mar 2021 22:32:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BD0668F7; Tue, 30 Mar 2021 22:32:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UMWAOt014679; Tue, 30 Mar 2021 22:32:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UMWA9R014678; Tue, 30 Mar 2021 22:32:10 GMT (envelope-from git) Date: Tue, 30 Mar 2021 22:32:10 GMT Message-Id: <202103302232.12UMWA9R014678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 01ae8969a9ee - main - nfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01ae8969a9eed652fbd894faa5b31b1593079ed8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 22:32:10 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=01ae8969a9eed652fbd894faa5b31b1593079ed8 commit 01ae8969a9eed652fbd894faa5b31b1593079ed8 Author: Rick Macklem AuthorDate: 2021-03-30 21:31:05 +0000 Commit: Rick Macklem CommitDate: 2021-03-30 21:31:05 +0000 nfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts The NFSv4.1 (and 4.2 on 13) server incorrectly binds a new TCP connection to the back channel when first used by an RPC with a Sequence op in it (almost all of them). RFC5661 specifies that only the fore channel should be bound. This was done because early clients (including FreeBSD) did not do the required BindConnectionToSession RPC. Unfortunately, this breaks the Linux client when the "nconnects" mount option is used, since the server may do a callback on the incorrect TCP connection. This patch converts the server behaviour to that required by the RFC. It also makes the server test/indicate failure of the back channel more aggressively. Until this patch is applied to the server, the "nconnects" mount option is not recommended for a Linux NFSv4.1/4.2 client mount to the FreeBSD server. Reported by: bcodding@redhat.com Tested by: bcodding@redhat.com PR: 254560 MFC after: 1 week --- sys/fs/nfsserver/nfs_nfsdstate.c | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 1f6e8b7ef526..5ac37ed07cae 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -6209,7 +6209,6 @@ nfsrv_checksequence(struct nfsrv_descript *nd, uint32_t sequenceid, struct nfsdsession *sep; struct nfssessionhash *shp; int error; - SVCXPRT *savxprt; shp = NFSSESSIONHASH(nd->nd_sessionid); NFSLOCKSESSION(shp); @@ -6235,36 +6234,11 @@ nfsrv_checksequence(struct nfsrv_descript *nd, uint32_t sequenceid, nd->nd_maxreq = sep->sess_maxreq; nd->nd_maxresp = sep->sess_maxresp; - /* - * If this session handles the backchannel, save the nd_xprt for this - * RPC, since this is the one being used. - * RFC-5661 specifies that the fore channel will be implicitly - * bound by a Sequence operation. However, since some NFSv4.1 clients - * erroneously assumed that the back channel would be implicitly - * bound as well, do the implicit binding unless a - * BindConnectiontoSession has already been done on the session. - */ - savxprt = NULL; - if (sep->sess_clp->lc_req.nr_client != NULL && - sep->sess_cbsess.nfsess_xprt != nd->nd_xprt && - (sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0 && - (sep->sess_clp->lc_flags & LCL_DONEBINDCONN) == 0) { - NFSD_DEBUG(2, - "nfsrv_checksequence: implicit back channel bind\n"); - savxprt = sep->sess_cbsess.nfsess_xprt; - SVC_ACQUIRE(nd->nd_xprt); - nd->nd_xprt->xp_p2 = - sep->sess_clp->lc_req.nr_client->cl_private; - nd->nd_xprt->xp_idletimeout = 0; /* Disable timeout. */ - sep->sess_cbsess.nfsess_xprt = nd->nd_xprt; - } - *sflagsp = 0; - if (sep->sess_clp->lc_req.nr_client == NULL) + if (sep->sess_clp->lc_req.nr_client == NULL || + (sep->sess_clp->lc_flags & LCL_CBDOWN) != 0) *sflagsp |= NFSV4SEQ_CBPATHDOWN; NFSUNLOCKSESSION(shp); - if (savxprt != NULL) - SVC_RELEASE(savxprt); if (error == NFSERR_EXPIRED) { *sflagsp |= NFSV4SEQ_EXPIREDALLSTATEREVOKED; error = 0; @@ -6464,7 +6438,8 @@ nfsrv_bindconnsess(struct nfsrv_descript *nd, uint8_t *sessionid, int *foreaftp) nd->nd_xprt->xp_idletimeout = 0; sep->sess_cbsess.nfsess_xprt = nd->nd_xprt; sep->sess_crflags |= NFSV4CRSESS_CONNBACKCHAN; - clp->lc_flags |= LCL_DONEBINDCONN; + clp->lc_flags |= LCL_DONEBINDCONN | + LCL_NEEDSCBNULL; if (*foreaftp == NFSCDFS4_BACK) *foreaftp = NFSCDFS4_BACK; else From owner-dev-commits-src-all@freebsd.org Tue Mar 30 22:44:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 128795B120B; Tue, 30 Mar 2021 22:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F94JT3y3rz3k4j; Tue, 30 Mar 2021 22:44:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7648969F7; Tue, 30 Mar 2021 22:44:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UMifgK031977; Tue, 30 Mar 2021 22:44:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UMifwC031976; Tue, 30 Mar 2021 22:44:41 GMT (envelope-from git) Date: Tue, 30 Mar 2021 22:44:41 GMT Message-Id: <202103302244.12UMifwC031976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 2b98ea2e51a0 - main - UPDATING: Add an entry for commit 01ae8969a9ee. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b98ea2e51a0e38861dc8d29c2c716f2c19433d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 22:44:42 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=2b98ea2e51a0e38861dc8d29c2c716f2c19433d6 commit 2b98ea2e51a0e38861dc8d29c2c716f2c19433d6 Author: Rick Macklem AuthorDate: 2021-03-30 21:43:53 +0000 Commit: Rick Macklem CommitDate: 2021-03-30 21:43:53 +0000 UPDATING: Add an entry for commit 01ae8969a9ee. --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index edad902d0ab1..33956aa7f08c 100644 --- a/UPDATING +++ b/UPDATING @@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20210330: + Commit 01ae8969a9ee fixed the NFSv4.1/4.2 server so that it + handles binding of the back channel as required by RFC5661. + Until this patch is in your server, avoid use of the "nconnects" + mount option for Linux NFSv4.1/4.2 mounts. + 20210225: For 64-bit architectures the base system is now built with Position Independent Executable (PIE) support enabled by default. It may be From owner-dev-commits-src-all@freebsd.org Tue Mar 30 23:27:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE3095B2612; Tue, 30 Mar 2021 23:27:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F95GF4WyJz3m39; Tue, 30 Mar 2021 23:27:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E1607492; Tue, 30 Mar 2021 23:27:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UNRn8t088524; Tue, 30 Mar 2021 23:27:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UNRnXu088523; Tue, 30 Mar 2021 23:27:49 GMT (envelope-from git) Date: Tue, 30 Mar 2021 23:27:49 GMT Message-Id: <202103302327.12UNRnXu088523@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 8223717ce62c - main - x86: clear %db registers in new process MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8223717ce62c1ad0becc34ce69fe2d1771f3ba05 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 23:27:49 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8223717ce62c1ad0becc34ce69fe2d1771f3ba05 commit 8223717ce62c1ad0becc34ce69fe2d1771f3ba05 Author: Konstantin Belousov AuthorDate: 2021-03-30 15:40:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-30 23:07:35 +0000 x86: clear %db registers in new process Reported by: MichaÅ‚ Górny PR: 254661 Reviewed by: emaste, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D29496 --- sys/amd64/amd64/vm_machdep.c | 8 ++++++++ sys/i386/i386/vm_machdep.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index f64259decbff..98d212dc8771 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -229,6 +229,14 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) copy_thread(td1, td2); + /* Reset debug registers in the new process */ + pcb2->pcb_dr0 = 0; + pcb2->pcb_dr1 = 0; + pcb2->pcb_dr2 = 0; + pcb2->pcb_dr3 = 0; + pcb2->pcb_dr6 = 0; + pcb2->pcb_dr7 = 0; + /* Point mdproc and then copy over p1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index c04fb57db4b1..ed40ebe5d1c8 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -241,6 +241,14 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) copy_thread(td1, td2); + /* Reset debug registers in the new process */ + pcb2->pcb_dr0 = 0; + pcb2->pcb_dr1 = 0; + pcb2->pcb_dr2 = 0; + pcb2->pcb_dr3 = 0; + pcb2->pcb_dr6 = 0; + pcb2->pcb_dr7 = 0; + /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 01:10:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6087F5B65A8; Wed, 31 Mar 2021 01:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F97YB2KZ7z3sLk; Wed, 31 Mar 2021 01:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42D381077D; Wed, 31 Mar 2021 01:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12V1AsaD037087; Wed, 31 Mar 2021 01:10:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12V1AsHq037086; Wed, 31 Mar 2021 01:10:54 GMT (envelope-from git) Date: Wed, 31 Mar 2021 01:10:54 GMT Message-Id: <202103310110.12V1AsHq037086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brandon Bergren Subject: git: 74f6cb0f316b - main - [PowerPC] Remove unused IPI type count tracking. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74f6cb0f316bc0f8fae0b7f31d78d041dc4d509e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 01:10:54 -0000 The branch main has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=74f6cb0f316bc0f8fae0b7f31d78d041dc4d509e commit 74f6cb0f316bc0f8fae0b7f31d78d041dc4d509e Author: Justin Hibbits AuthorDate: 2020-09-24 15:00:31 +0000 Commit: Brandon Bergren CommitDate: 2021-03-31 01:03:06 +0000 [PowerPC] Remove unused IPI type count tracking. ipi_msg_count is inaccessible outside this file and is never read. It was introduced in the original SMP support code in r178628 and was never actually used anywhere. Remove it to slightly improve IPI performance. Submitted by: jhibbits MFC after: 1 week --- sys/powerpc/powerpc/mp_machdep.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c index 619c344b69a7..a9f2aaf36adc 100644 --- a/sys/powerpc/powerpc/mp_machdep.c +++ b/sys/powerpc/powerpc/mp_machdep.c @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); volatile static int ap_awake; volatile static u_int ap_letgo; volatile static u_quad_t ap_timebase; -static u_int ipi_msg_cnt[32]; static struct mtx ap_boot_mtx; struct pcb stoppcbs[MAXCPU]; @@ -309,7 +308,6 @@ powerpc_ipi_handler(void *arg) return (FILTER_STRAY); while ((msg = ffs(ipimask) - 1) != -1) { ipimask &= ~(1u << msg); - ipi_msg_cnt[msg]++; switch (msg) { case IPI_AST: CTR1(KTR_SMP, "%s: IPI_AST", __func__); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 01:17:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F7305B6B38; Wed, 31 Mar 2021 01:17:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F97hy0MNdz3sgx; Wed, 31 Mar 2021 01:17:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF5B010E9F; Wed, 31 Mar 2021 01:17:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12V1HbdA042233; Wed, 31 Mar 2021 01:17:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12V1HbJH042232; Wed, 31 Mar 2021 01:17:37 GMT (envelope-from git) Date: Wed, 31 Mar 2021 01:17:37 GMT Message-Id: <202103310117.12V1HbJH042232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 8dc8feb53da0 - main - Clean up a couple of MD warts in vm_fault_populate(): MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8dc8feb53da0c1a2301cb21c87b17a09d12e8fa7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 01:17:38 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=8dc8feb53da0c1a2301cb21c87b17a09d12e8fa7 commit 8dc8feb53da0c1a2301cb21c87b17a09d12e8fa7 Author: Jason A. Harmening AuthorDate: 2021-03-27 03:10:46 +0000 Commit: Jason A. Harmening CommitDate: 2021-03-31 01:15:55 +0000 Clean up a couple of MD warts in vm_fault_populate(): --Eliminate a big ifdef that encompassed all currently-supported architectures except mips and powerpc32. This applied to the case in which we've allocated a superpage but the pager-populated range is insufficient for a superpage mapping. For platforms that don't support superpages the check should be inexpensive as we shouldn't get a superpage in the first place. Make the normal-page fallback logic identical for all platforms and provide a simple implementation of pmap_ps_enabled() for MIPS and Book-E/AIM32 powerpc. --Apply the logic for handling pmap_enter() failure if a superpage mapping can't be supported due to additional protection policy. Use KERN_PROTECTION_FAILURE instead of KERN_FAILURE for this case, and note Intel PKU on amd64 as the first example of such protection policy. Reviewed by: kib, markj, bdragon Differential Revision: https://reviews.freebsd.org/D29439 --- sys/amd64/amd64/pmap.c | 2 +- sys/mips/include/pmap.h | 6 ++++++ sys/powerpc/aim/mmu_oea.c | 8 ++++++++ sys/powerpc/booke/pmap.c | 8 ++++++++ sys/vm/vm_fault.c | 26 +++++++++++++++----------- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index fc5f24d2c303..aa8810e05b63 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -7147,7 +7147,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, */ if (!pmap_pkru_same(pmap, va, va + NBPDR)) { pmap_abort_ptp(pmap, va, pdpg); - return (KERN_FAILURE); + return (KERN_PROTECTION_FAILURE); } if (va < VM_MAXUSER_ADDRESS && pmap->pm_type == PT_X86) { newpde &= ~X86_PG_PKU_MASK; diff --git a/sys/mips/include/pmap.h b/sys/mips/include/pmap.h index 77f75903ccd5..6678f8264ad7 100644 --- a/sys/mips/include/pmap.h +++ b/sys/mips/include/pmap.h @@ -190,6 +190,12 @@ pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) return (0); } +static inline bool +pmap_ps_enabled(pmap_t pmap __unused) +{ + return (false); +} + #endif /* _KERNEL */ #endif /* !LOCORE */ diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 44d8b9518b8e..cb0c905a53f3 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -327,6 +327,7 @@ void moea_scan_init(void); vm_offset_t moea_quick_enter_page(vm_page_t m); void moea_quick_remove_page(vm_offset_t addr); boolean_t moea_page_is_mapped(vm_page_t m); +bool moea_ps_enabled(pmap_t pmap); static int moea_map_user_ptr(pmap_t pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen); static int moea_decode_kernel_ptr(vm_offset_t addr, @@ -370,6 +371,7 @@ static struct pmap_funcs moea_methods = { .quick_enter_page = moea_quick_enter_page, .quick_remove_page = moea_quick_remove_page, .page_is_mapped = moea_page_is_mapped, + .ps_enabled = moea_ps_enabled, /* Internal interfaces */ .bootstrap = moea_bootstrap, @@ -1122,6 +1124,12 @@ moea_page_is_mapped(vm_page_t m) return (!LIST_EMPTY(&(m)->md.mdpg_pvoh)); } +bool +moea_ps_enabled(pmap_t pmap __unused) +{ + return (false); +} + /* * Map the given physical page at the specified virtual address in the * target pmap with the protection requested. If specified the page diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index 6bc96b222db8..6c48584096c5 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -354,6 +354,7 @@ static int mmu_booke_decode_kernel_ptr(vm_offset_t addr, int *is_user, vm_offset_t *decoded_addr); static void mmu_booke_page_array_startup(long); static boolean_t mmu_booke_page_is_mapped(vm_page_t m); +static bool mmu_booke_ps_enabled(pmap_t pmap); static struct pmap_funcs mmu_booke_methods = { /* pmap dispatcher interface */ @@ -396,6 +397,7 @@ static struct pmap_funcs mmu_booke_methods = { .quick_remove_page = mmu_booke_quick_remove_page, .page_array_startup = mmu_booke_page_array_startup, .page_is_mapped = mmu_booke_page_is_mapped, + .ps_enabled = mmu_booke_ps_enabled, /* Internal interfaces */ .bootstrap = mmu_booke_bootstrap, @@ -1226,6 +1228,12 @@ mmu_booke_page_is_mapped(vm_page_t m) return (!TAILQ_EMPTY(&(m)->md.pv_list)); } +static bool +mmu_booke_ps_enabled(pmap_t pmap __unused) +{ + return (false); +} + /* * Initialize pmap associated with process 0. */ diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 585e1544415d..dd112feefdcd 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -542,17 +542,13 @@ vm_fault_populate(struct faultstate *fs) pidx <= pager_last; pidx += npages, m = vm_page_next(&m[npages - 1])) { vaddr = fs->entry->start + IDX_TO_OFF(pidx) - fs->entry->offset; -#if defined(__aarch64__) || defined(__amd64__) || (defined(__arm__) && \ - __ARM_ARCH >= 6) || defined(__i386__) || defined(__riscv) || \ - defined(__powerpc64__) + psind = m->psind; if (psind > 0 && ((vaddr & (pagesizes[psind] - 1)) != 0 || pidx + OFF_TO_IDX(pagesizes[psind]) - 1 > pager_last || !pmap_ps_enabled(fs->map->pmap) || fs->wired)) psind = 0; -#else - psind = 0; -#endif + npages = atop(pagesizes[psind]); for (i = 0; i < npages; i++) { vm_fault_populate_check_page(&m[i]); @@ -561,8 +557,18 @@ vm_fault_populate(struct faultstate *fs) VM_OBJECT_WUNLOCK(fs->first_object); rv = pmap_enter(fs->map->pmap, vaddr, m, fs->prot, fs->fault_type | (fs->wired ? PMAP_ENTER_WIRED : 0), psind); -#if defined(__amd64__) - if (psind > 0 && rv == KERN_FAILURE) { + + /* + * pmap_enter() may fail for a superpage mapping if additional + * protection policies prevent the full mapping. + * For example, this will happen on amd64 if the entire + * address range does not share the same userspace protection + * key. Revert to single-page mappings if this happens. + */ + MPASS(rv == KERN_SUCCESS || + (psind > 0 && rv == KERN_PROTECTION_FAILURE)); + if (__predict_false(psind > 0 && + rv == KERN_PROTECTION_FAILURE)) { for (i = 0; i < npages; i++) { rv = pmap_enter(fs->map->pmap, vaddr + ptoa(i), &m[i], fs->prot, fs->fault_type | @@ -570,9 +576,7 @@ vm_fault_populate(struct faultstate *fs) MPASS(rv == KERN_SUCCESS); } } -#else - MPASS(rv == KERN_SUCCESS); -#endif + VM_OBJECT_WLOCK(fs->first_object); for (i = 0; i < npages; i++) { if ((fs->fault_flags & VM_FAULT_WIRE) != 0) From owner-dev-commits-src-all@freebsd.org Wed Mar 31 01:23:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0082B5B6D16; Wed, 31 Mar 2021 01:23:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F97r06bnNz3tKW; Wed, 31 Mar 2021 01:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5732111A9; Wed, 31 Mar 2021 01:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12V1NiHx055347; Wed, 31 Mar 2021 01:23:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12V1NiMc055346; Wed, 31 Mar 2021 01:23:44 GMT (envelope-from git) Date: Wed, 31 Mar 2021 01:23:44 GMT Message-Id: <202103310123.12V1NiMc055346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brandon Bergren Subject: git: 895a22583df2 - main - [PowerPC] Fix ISA_206 subword atomics MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 895a22583df2524e144571430112df6e14ae8d66 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 01:23:45 -0000 The branch main has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=895a22583df2524e144571430112df6e14ae8d66 commit 895a22583df2524e144571430112df6e14ae8d66 Author: Justin Hibbits AuthorDate: 2020-12-08 16:18:44 +0000 Commit: Brandon Bergren CommitDate: 2021-03-31 01:23:04 +0000 [PowerPC] Fix ISA_206 subword atomics The POWER7 subword atomics were not using the correct instructions for byte and halfword stores in the atomic_fcmpset code. This only affects builds with custom CFLAGS that have explicitly enabled ISA_206_ATOMICS. --- sys/powerpc/include/atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/powerpc/include/atomic.h b/sys/powerpc/include/atomic.h index aa03165de46c..0b383a4ebdf6 100644 --- a/sys/powerpc/include/atomic.h +++ b/sys/powerpc/include/atomic.h @@ -777,7 +777,7 @@ atomic_fcmpset_char(volatile u_char *p, u_char *cmpval, u_char newval) "b 2f\n\t" /* we've succeeded */ "1:\n\t" "stbcx. %0, 0, %3\n\t" /* clear reservation (74xx) */ - "stwx %0, 0, %7\n\t" + "stbx %0, 0, %7\n\t" "li %0, 0\n\t" /* failure - retval = 0 */ "2:\n\t" : "=&r" (ret), "=m" (*p), "=m" (*cmpval) @@ -802,7 +802,7 @@ atomic_fcmpset_short(volatile u_short *p, u_short *cmpval, u_short newval) "b 2f\n\t" /* we've succeeded */ "1:\n\t" "sthcx. %0, 0, %3\n\t" /* clear reservation (74xx) */ - "stwx %0, 0, %7\n\t" + "sthx %0, 0, %7\n\t" "li %0, 0\n\t" /* failure - retval = 0 */ "2:\n\t" : "=&r" (ret), "=m" (*p), "=m" (*cmpval) From owner-dev-commits-src-all@freebsd.org Wed Mar 31 01:28:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64F3F5B720E; Wed, 31 Mar 2021 01:28:22 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F97xL2DHlz3tl8; Wed, 31 Mar 2021 01:28:22 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com [66.111.4.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bdragon/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 38B652B04; Wed, 31 Mar 2021 01:28:22 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id DE09F27C005B; Tue, 30 Mar 2021 21:28:21 -0400 (EDT) Received: from imap38 ([10.202.2.88]) by compute3.internal (MEProxy); Tue, 30 Mar 2021 21:28:21 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudeiuddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdluddtmdenucfjughrpefofg ggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfuehrrghnughonhcuuegv rhhgrhgvnhdfuceosggurhgrghhonheshfhrvggvuefuffdrohhrgheqnecuggftrfgrth htvghrnhepteetleffuddvtddtuedvhfefheejvddvgfdvkedvfeethfegkedvkeelveeu vddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsg gurhgrghhonhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidquddtgedvfeeh keeigedqudekuddtkeehuddqsggurhgrghhonheppefhrhgvvgeuufffrdhorhhgsehimh grphdrtggt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 808E2CA005E; Tue, 30 Mar 2021 21:28:21 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249 Mime-Version: 1.0 Message-Id: <0d43e89e-b804-45cc-96df-937b0aba33bd@www.fastmail.com> In-Reply-To: <202103310123.12V1NiMc055346@gitrepo.freebsd.org> References: <202103310123.12V1NiMc055346@gitrepo.freebsd.org> Date: Tue, 30 Mar 2021 20:28:01 -0500 From: "Brandon Bergren" To: "Brandon Bergren" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 895a22583df2 - main - [PowerPC] Fix ISA_206 subword atomics Content-Type: text/plain X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 01:28:22 -0000 On Tue, Mar 30, 2021, at 8:23 PM, Brandon Bergren wrote: > The branch main has been updated by bdragon: Submitted by: jhibbits MFC after: 1 week From owner-dev-commits-src-all@freebsd.org Wed Mar 31 01:45:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 096D25B74F8; Wed, 31 Mar 2021 01:45:28 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F98K36ytdz3vcj; Wed, 31 Mar 2021 01:45:27 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (unknown [98.42.164.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 5D8212C42; Wed, 31 Mar 2021 01:45:27 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.46.21021202 Date: Tue, 30 Mar 2021 18:45:23 -0700 Subject: Re: 895a22583df2 - main - [PowerPC] Fix ISA_206 subword atomics From: Ravi Pokala To: Brandon Bergren , , , Message-ID: <779A6A95-0043-41C6-BF59-127CB34C5523@panasas.com> Thread-Topic: 895a22583df2 - main - [PowerPC] Fix ISA_206 subword atomics References: <202103310123.12V1NiMc055346@gitrepo.freebsd.org> <0d43e89e-b804-45cc-96df-937b0aba33bd@www.fastmail.com> In-Reply-To: <0d43e89e-b804-45cc-96df-937b0aba33bd@www.fastmail.com> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 01:45:28 -0000 -----Original Message----- From: on behalf of Brandon Bergren Date: 2021-03-30, Tuesday at 18:28 To: Brandon Bergren , , , Subject: Re: git: 895a22583df2 - main - [PowerPC] Fix ISA_206 subword atomics On Tue, Mar 30, 2021, at 8:23 PM, Brandon Bergren wrote: > The branch main has been updated by bdragon: Submitted by: jhibbits Isn't that implied by > Author: Justin Hibbits > AuthorDate: 2020-12-08 16:18:44 +0000 -Ravi (rpokala@) MFC after: 1 week From owner-dev-commits-src-all@freebsd.org Wed Mar 31 02:22:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E741A5B7C79; Wed, 31 Mar 2021 02:22:16 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F997X63ZRz4RNv; Wed, 31 Mar 2021 02:22:16 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com [66.111.4.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bdragon/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id C29663393; Wed, 31 Mar 2021 02:22:16 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id BA98827C0054; Tue, 30 Mar 2021 22:22:16 -0400 (EDT) Received: from imap38 ([10.202.2.88]) by compute3.internal (MEProxy); Tue, 30 Mar 2021 22:22:16 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudeiuddgheeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdluddtmdenucfjughrpefofgggkfgjfhffhffvufgtsehttdertder redtnecuhfhrohhmpedfuehrrghnughonhcuuegvrhhgrhgvnhdfuceosggurhgrghhonh eshfhrvggvuefuffdrohhrgheqnecuggftrfgrthhtvghrnhepteetleffuddvtddtuedv hfefheejvddvgfdvkedvfeethfegkedvkeelveeuvddunecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepsggurhgrghhonhdomhgvshhmthhprghu thhhphgvrhhsohhnrghlihhthidquddtgedvfeehkeeigedqudekuddtkeehuddqsggurh grghhonheppefhrhgvvgeuufffrdhorhhgsehimhgrphdrtggt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 54351CA005E; Tue, 30 Mar 2021 22:22:16 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249 Mime-Version: 1.0 Message-Id: <4398fa48-c384-47a2-a687-4578c0cfd567@www.fastmail.com> In-Reply-To: <779A6A95-0043-41C6-BF59-127CB34C5523@panasas.com> References: <202103310123.12V1NiMc055346@gitrepo.freebsd.org> <0d43e89e-b804-45cc-96df-937b0aba33bd@www.fastmail.com> <779A6A95-0043-41C6-BF59-127CB34C5523@panasas.com> Date: Tue, 30 Mar 2021 21:21:56 -0500 From: "Brandon Bergren" To: "Ravi Pokala" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: 895a22583df2 - main - [PowerPC] Fix ISA_206 subword atomics Content-Type: text/plain X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 02:22:17 -0000 On Tue, Mar 30, 2021, at 8:45 PM, Ravi Pokala wrote: > Submitted by: jhibbits > > Isn't that implied by > > > Author: Justin Hibbits > > AuthorDate: 2020-12-08 16:18:44 +0000 Yeah, it is. I wasn't entirely sure the attribution was going to show up correctly in the email until I tried it though. I'll leave it out in the future, thanks. -- Brandon Bergren bdragon@FreeBSD.org From owner-dev-commits-src-all@freebsd.org Wed Mar 31 04:05:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 477AD5BA2B6; Wed, 31 Mar 2021 04:05:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9CQJ0JF4z4XMN; Wed, 31 Mar 2021 04:05:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED2D2132BF; Wed, 31 Mar 2021 04:05:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12V45BME080866; Wed, 31 Mar 2021 04:05:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12V45BPN080865; Wed, 31 Mar 2021 04:05:11 GMT (envelope-from git) Date: Wed, 31 Mar 2021 04:05:11 GMT Message-Id: <202103310405.12V45BPN080865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brandon Bergren Subject: git: a5f07fa0c6b1 - main - powerpc/pseries: Add new hypercall definition, H_REGISTER_PROC_TBL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a5f07fa0c6b162964b414d00fab319fd13c61f57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 04:05:12 -0000 The branch main has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=a5f07fa0c6b162964b414d00fab319fd13c61f57 commit a5f07fa0c6b162964b414d00fab319fd13c61f57 Author: Justin Hibbits AuthorDate: 2020-08-16 16:01:49 +0000 Commit: Brandon Bergren CommitDate: 2021-03-31 02:22:21 +0000 powerpc/pseries: Add new hypercall definition, H_REGISTER_PROC_TBL This will be used by the Radix MMU on pseries. MFC after: 1 week --- sys/powerpc/pseries/phyp-hvcall.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/powerpc/pseries/phyp-hvcall.h b/sys/powerpc/pseries/phyp-hvcall.h index fdc6a774ce03..90f75807e56a 100644 --- a/sys/powerpc/pseries/phyp-hvcall.h +++ b/sys/powerpc/pseries/phyp-hvcall.h @@ -321,7 +321,9 @@ #define H_SET_MODE 0x31C /* Reserved ... */ #define H_GET_DMA_XLATES_L 0x324 -#define MAX_HCALL_OPCODE H_GET_DMA_XLATES_L +/* Reserved ... */ +#define H_REGISTER_PROC_TBL 0x37c +#define MAX_HCALL_OPCODE H_REGISTER_PROC_TBL int64_t phyp_hcall(uint64_t opcode, ...); int64_t phyp_pft_hcall(uint64_t opcode, uint64_t flags, uint64_t pteidx, From owner-dev-commits-src-all@freebsd.org Wed Mar 31 10:50:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 494EC5C3712; Wed, 31 Mar 2021 10:50:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9NQH1fpwz4tFh; Wed, 31 Mar 2021 10:50:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C6DB186C2; Wed, 31 Mar 2021 10:50:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VAolUN056375; Wed, 31 Mar 2021 10:50:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VAolnu056374; Wed, 31 Mar 2021 10:50:47 GMT (envelope-from git) Date: Wed, 31 Mar 2021 10:50:47 GMT Message-Id: <202103311050.12VAolnu056374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Jonathan T. Looney" Subject: git: a25c17022e2d - stable/13 - Fetch the sigfastblock value in syscalls that wait for signals MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jtl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a25c17022e2d6344dcbc6192af276d2798d76d44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 10:50:47 -0000 The branch stable/13 has been updated by jtl: URL: https://cgit.FreeBSD.org/src/commit/?id=a25c17022e2d6344dcbc6192af276d2798d76d44 commit a25c17022e2d6344dcbc6192af276d2798d76d44 Author: Jonathan T. Looney AuthorDate: 2021-03-12 18:14:17 +0000 Commit: Jonathan T. Looney CommitDate: 2021-03-30 23:39:57 +0000 Fetch the sigfastblock value in syscalls that wait for signals We have seen several cases of processes which have become "stuck" in kern_sigsuspend(). When this occurs, the kernel's td_sigblock_val is set to 0x10 (one block outstanding) and the userspace copy of the word is set to 0 (unblocked). Because the kernel's cached value shows that signals are blocked, kern_sigsuspend() blocks almost all signals, which means the process hangs indefinitely in sigsuspend(). It is not entirely clear what is causing this condition to occur. However, it seems to make sense to add some protection against this case by fetching the latest sigfastblock value from userspace for syscalls which will sleep waiting for signals. Here, the change is applied to kern_sigsuspend() and kern_sigtimedwait(). (cherry picked from commit dbec10e08808e375365fb2a2462f306e0cdfda32) --- sys/kern/kern_sig.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 7884b5be9f91..3d55405d3151 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1268,6 +1268,9 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, ksiginfo_t *ksi, ets.tv_nsec = 0; traced = false; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { timevalid = 1; @@ -1527,6 +1530,9 @@ kern_sigsuspend(struct thread *td, sigset_t mask) struct proc *p = td->td_proc; int has_sig, sig; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + /* * When returning from sigsuspend, we want * the old mask to be restored after the From owner-dev-commits-src-all@freebsd.org Wed Mar 31 11:19:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 570545C406F; Wed, 31 Mar 2021 11:19:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9P3P21PKz3BwZ; Wed, 31 Mar 2021 11:19:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3816D1895B; Wed, 31 Mar 2021 11:19:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VBJTR3090497; Wed, 31 Mar 2021 11:19:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VBJTRO090496; Wed, 31 Mar 2021 11:19:29 GMT (envelope-from git) Date: Wed, 31 Mar 2021 11:19:29 GMT Message-Id: <202103311119.12VBJTRO090496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 646bae45e102 - main - fortune/freebsd-tips: Fix markup and wording MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 646bae45e102df9fad5a1efa84b4c31f0e26d2cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 11:19:29 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=646bae45e102df9fad5a1efa84b4c31f0e26d2cb commit 646bae45e102df9fad5a1efa84b4c31f0e26d2cb Author: Daniel Ebdrup Jensen AuthorDate: 2021-03-31 11:10:30 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-31 11:10:30 +0000 fortune/freebsd-tips: Fix markup and wording 'ps' is not a word - rather, it is a utility with its own manual page. As every other utility referenced in the file has it, append the relevant manual section that ps(1) can be found in. While here, also wordsmith a sentence to avoid awkward phrasing, and fix a typo. Pointy hat to: me Reported by: danfe, brueffer, maxim --- usr.bin/fortune/datfiles/freebsd-tips | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 2a37f98a37e5..0b596dec4575 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -803,14 +803,14 @@ You can spot one like this: -- Alan Somers % -FreeBSDs ps can create a dependency tree based on parent/child relationships -between processes, like this: +FreeBSD's ps(1) can create a dependency tree based on parent/child +relationships between processes, like this: $ ps -d -- Daniel Ebdrup Jensen % -It is possible to get a meassure of the resident memory set: +It is possible to measure the resident memory set: $ vmstat -o | awk 'NR>1 { t[$7] += $1 } \ END { for (i in t) printf "%s %d\n",i,t[i] }' From owner-dev-commits-src-all@freebsd.org Wed Mar 31 11:38:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EF705C4CE2; Wed, 31 Mar 2021 11:38:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9PTR2lvdz3D2n; Wed, 31 Mar 2021 11:38:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5183F18DC2; Wed, 31 Mar 2021 11:38:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VBcZSB018610; Wed, 31 Mar 2021 11:38:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VBcZKp018609; Wed, 31 Mar 2021 11:38:35 GMT (envelope-from git) Date: Wed, 31 Mar 2021 11:38:35 GMT Message-Id: <202103311138.12VBcZKp018609@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e243367b6445 - main - mbuf: add a way to mark flowid as calculated from the internal headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e243367b644562c9410b39f8d78dafdb7e785d85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 11:38:35 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e243367b644562c9410b39f8d78dafdb7e785d85 commit e243367b644562c9410b39f8d78dafdb7e785d85 Author: Konstantin Belousov AuthorDate: 2021-02-12 13:38:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-31 11:38:26 +0000 mbuf: add a way to mark flowid as calculated from the internal headers In some settings offload might calculate hash from decapsulated packet. Reserve a bit in packet header rsstype to indicate that. Add m_adj_decap() that acts similarly to m_adj, but also either clear flowid if it is not marked as inner, or transfer it to the decapsulated header, clearing inner indicator. It depends on the internals of m_adj() that reuses the argument packet header for the result. Use m_adj_decap() for decapsulating vxlan(4) and gif(4) input packets. Reviewed by: ae, hselasky, np Sponsored by: Nvidia Networking / Mellanox Technologies MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28773 --- sys/kern/uipc_mbuf.c | 23 +++++++++++++++++++++++ sys/net/if_gif.c | 3 ++- sys/net/if_vxlan.c | 3 ++- sys/sys/mbuf.h | 12 +++++++++--- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 5296aac0edc4..f7852bc7dd7f 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -855,6 +855,29 @@ m_adj(struct mbuf *mp, int req_len) } } +void +m_adj_decap(struct mbuf *mp, int len) +{ + uint8_t rsstype; + + m_adj(mp, len); + if ((mp->m_flags & M_PKTHDR) != 0) { + /* + * If flowid was calculated by card from the inner + * headers, move flowid to the decapsulated mbuf + * chain, otherwise clear. This depends on the + * internals of m_adj, which keeps pkthdr as is, in + * particular not changing rsstype and flowid. + */ + rsstype = mp->m_pkthdr.rsstype; + if ((rsstype & M_HASHTYPE_INNER) != 0) { + M_HASHTYPE_SET(mp, rsstype & ~M_HASHTYPE_INNER); + } else { + M_HASHTYPE_CLEAR(mp); + } + } +} + /* * Rearange an mbuf chain so that len bytes are contiguous * and in the data area of an mbuf (so that mtod will work diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 1784d034ac2d..113bcb5c916e 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -540,7 +540,8 @@ gif_input(struct mbuf *m, struct ifnet *ifp, int proto, uint8_t ecn) m_freem(m); goto drop; } - m_adj(m, sizeof(struct etherip_header)); + + m_adj_decap(m, sizeof(struct etherip_header)); m->m_flags &= ~(M_BCAST|M_MCAST); m->m_pkthdr.rcvif = ifp; diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index d0d335dba9ed..0d69244ce64b 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -2780,8 +2780,9 @@ vxlan_rcv_udp_packet(struct mbuf *m, int offset, struct inpcb *inpcb, goto out; vni = ntohl(vxh->vxlh_vni) >> VXLAN_HDR_VNI_SHIFT; + /* Adjust to the start of the inner Ethernet frame. */ - m_adj(m, offset + sizeof(struct vxlan_header)); + m_adj_decap(m, offset + sizeof(struct vxlan_header)); error = vxlan_input(vso, vni, &m, srcsa); MPASS(error != 0 || m == NULL); diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 6aad1e36e710..371ae8feae46 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -532,6 +532,7 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) * https://docs.microsoft.com/en-us/windows-hardware/drivers/network/rss-hashing-types#ndishashipv6ex */ #define M_HASHTYPE_HASHPROP 0x80 /* has hash properties */ +#define M_HASHTYPE_INNER 0x40 /* calculated from inner headers */ #define M_HASHTYPE_HASH(t) (M_HASHTYPE_HASHPROP | (t)) /* Microsoft RSS standard hash types */ #define M_HASHTYPE_NONE 0 @@ -548,15 +549,19 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) #define M_HASHTYPE_RSS_UDP_IPV6_EX M_HASHTYPE_HASH(10)/* IPv6 UDP 4-tuple + * ext hdrs */ -#define M_HASHTYPE_OPAQUE 63 /* ordering, not affinity */ +#define M_HASHTYPE_OPAQUE 0x3f /* ordering, not affinity */ #define M_HASHTYPE_OPAQUE_HASH M_HASHTYPE_HASH(M_HASHTYPE_OPAQUE) /* ordering+hash, not affinity*/ #define M_HASHTYPE_CLEAR(m) ((m)->m_pkthdr.rsstype = 0) -#define M_HASHTYPE_GET(m) ((m)->m_pkthdr.rsstype) +#define M_HASHTYPE_GET(m) ((m)->m_pkthdr.rsstype & ~M_HASHTYPE_INNER) #define M_HASHTYPE_SET(m, v) ((m)->m_pkthdr.rsstype = (v)) #define M_HASHTYPE_TEST(m, v) (M_HASHTYPE_GET(m) == (v)) -#define M_HASHTYPE_ISHASH(m) (M_HASHTYPE_GET(m) & M_HASHTYPE_HASHPROP) +#define M_HASHTYPE_ISHASH(m) \ + (((m)->m_pkthdr.rsstype & M_HASHTYPE_HASHPROP) != 0) +#define M_HASHTYPE_SETINNER(m) do { \ + (m)->m_pkthdr.rsstype |= M_HASHTYPE_INNER; \ + } while (0) /* * External mbuf storage buffer types. @@ -792,6 +797,7 @@ int mb_unmapped_compress(struct mbuf *m); struct mbuf *mb_unmapped_to_ext(struct mbuf *m); void mb_free_notready(struct mbuf *m, int count); void m_adj(struct mbuf *, int); +void m_adj_decap(struct mbuf *, int); int m_apply(struct mbuf *, int, int, int (*)(void *, void *, u_int), void *); int m_append(struct mbuf *, int, c_caddr_t); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 11:38:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97E055C4A4C; Wed, 31 Mar 2021 11:38:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9PTS3lXSz3D2q; Wed, 31 Mar 2021 11:38:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 725C318D43; Wed, 31 Mar 2021 11:38:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VBcaRd018635; Wed, 31 Mar 2021 11:38:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VBcapY018634; Wed, 31 Mar 2021 11:38:36 GMT (envelope-from git) Date: Wed, 31 Mar 2021 11:38:36 GMT Message-Id: <202103311138.12VBcapY018634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: baacf701372b - main - vxlan: correct interface MTU when using hw offloads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: baacf701372bfeb3927c6b9e0b85d6eff198c6a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 11:38:36 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=baacf701372bfeb3927c6b9e0b85d6eff198c6a3 commit baacf701372bfeb3927c6b9e0b85d6eff198c6a3 Author: Konstantin Belousov AuthorDate: 2021-03-29 09:03:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-31 11:38:26 +0000 vxlan: correct interface MTU when using hw offloads Otherwise it breaks when offloading like checksum or TSO are used, because second (encapsulated) ip_output() processing passes fragments of the encapsulated packet down to the hardware interface. Diagnosed by: hselasky Reviewed by: np Sponsored by: Nvidia Networking / Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29501 --- share/man/man4/vxlan.4 | 15 +++++++++++++-- sys/net/if_vxlan.c | 17 +++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/share/man/man4/vxlan.4 b/share/man/man4/vxlan.4 index 1848897d97c9..99f3411c02d2 100644 --- a/share/man/man4/vxlan.4 +++ b/share/man/man4/vxlan.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2020 +.Dd March 30, 2021 .Dt VXLAN 4 .Os .Sh NAME @@ -175,13 +175,24 @@ The .Nm specification recommends the physical network MTU be configured to use jumbo frames to accommodate the encapsulated frame size. +.Pp +By default, the +.Nm +driver sets its MTU to usual ethernet MTU of 1500 bytes, reduced by +the size of vxlan headers prepended to the encapsulated packets. +.Pp Alternatively, the .Xr ifconfig 8 .Cm mtu -command may be used to reduce the MTU size on the +command may be used to set the fixed MTU size on the .Nm interface to allow the encapsulated frame to fit in the current MTU of the physical network. +If the +.Cm mtu +command was used, system no longer adjust the +.Nm +interface MTU on routing or address changes. .Sh HARDWARE The .Nm diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index 0d69244ce64b..f56ec23540a7 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -171,6 +171,7 @@ struct vxlan_softc { #define VXLAN_FLAG_INIT 0x0001 #define VXLAN_FLAG_TEARDOWN 0x0002 #define VXLAN_FLAG_LEARN 0x0004 +#define VXLAN_FLAG_USER_MTU 0x0008 uint32_t vxl_port_hash_key; uint16_t vxl_min_port; @@ -1620,6 +1621,8 @@ vxlan_setup_interface_hdrlen(struct vxlan_softc *sc) { struct ifnet *ifp; + VXLAN_LOCK_WASSERT(sc); + ifp = sc->vxl_ifp; ifp->if_hdrlen = ETHER_HDR_LEN + sizeof(struct vxlanudphdr); @@ -1627,6 +1630,9 @@ vxlan_setup_interface_hdrlen(struct vxlan_softc *sc) ifp->if_hdrlen += sizeof(struct ip); else if (VXLAN_SOCKADDR_IS_IPV6(&sc->vxl_dst_addr) != 0) ifp->if_hdrlen += sizeof(struct ip6_hdr); + + if ((sc->vxl_flags & VXLAN_FLAG_USER_MTU) == 0) + ifp->if_mtu = ETHERMTU - ifp->if_hdrlen; } static int @@ -2354,10 +2360,14 @@ vxlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VXLAN_MAX_MTU) + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VXLAN_MAX_MTU) { error = EINVAL; - else + } else { + VXLAN_WLOCK(sc); ifp->if_mtu = ifr->ifr_mtu; + sc->vxl_flags |= VXLAN_FLAG_USER_MTU; + VXLAN_WUNLOCK(sc); + } break; case SIOCSIFCAP: @@ -3211,7 +3221,10 @@ vxlan_clone_create(struct if_clone *ifc, int unit, caddr_t params) ether_ifattach(ifp, sc->vxl_hwaddr.octet); ifp->if_baudrate = 0; + + VXLAN_WLOCK(sc); vxlan_setup_interface_hdrlen(sc); + VXLAN_WUNLOCK(sc); return (0); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 13:12:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E934E5C7ABD; Wed, 31 Mar 2021 13:12:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9RZ55rXTz3L24; Wed, 31 Mar 2021 13:12:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB9F61A0B5; Wed, 31 Mar 2021 13:12:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VDCjSx057457; Wed, 31 Mar 2021 13:12:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDCjCx057456; Wed, 31 Mar 2021 13:12:45 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:12:45 GMT Message-Id: <202103311312.12VDCjCx057456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 343fee4cd023 - stable/13 - pfsync: Unconditionally push packets when requesting state updates MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 343fee4cd023da0f7ed64e19f3d2351083fe963c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 13:12:46 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=343fee4cd023da0f7ed64e19f3d2351083fe963c commit 343fee4cd023da0f7ed64e19f3d2351083fe963c Author: Thomas Kurschel AuthorDate: 2021-03-15 13:28:52 +0000 Commit: Kristof Provost CommitDate: 2021-03-31 13:09:08 +0000 pfsync: Unconditionally push packets when requesting state updates When we request a bulk sync we need to ensure we actually send out that request, not just buffer it until we have enough data to send a full packet. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29271 (cherry picked from commit 9f2e5184173f6af70306678b018270df9a9600f2) --- sys/netpfil/pf/if_pfsync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index cf2ff2ef0926..06bad556e885 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1960,7 +1960,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) nlen += sizeof(struct pfsync_subheader); if (b->b_len + nlen > sc->sc_ifp->if_mtu) { - pfsync_sendout(1, 0); + pfsync_sendout(0, 0); nlen = sizeof(struct pfsync_subheader) + sizeof(struct pfsync_upd_req); @@ -1968,6 +1968,8 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) TAILQ_INSERT_TAIL(&b->b_upd_req_list, item, ur_entry); b->b_len += nlen; + + pfsync_push(b); } static bool From owner-dev-commits-src-all@freebsd.org Wed Mar 31 13:12:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CCCF5C7AC4; Wed, 31 Mar 2021 13:12:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9RZ66vJ6z3L0D; Wed, 31 Mar 2021 13:12:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDCE41A2E0; Wed, 31 Mar 2021 13:12:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VDCkM8057481; Wed, 31 Mar 2021 13:12:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDCk2l057480; Wed, 31 Mar 2021 13:12:46 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:12:46 GMT Message-Id: <202103311312.12VDCk2l057480@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e99aa5c2cf6b - stable/13 - pf tests: pfsync bulk update test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e99aa5c2cf6b0eadcc29c62243d51de0eb36937c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 13:12:47 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e99aa5c2cf6b0eadcc29c62243d51de0eb36937c commit e99aa5c2cf6b0eadcc29c62243d51de0eb36937c Author: Kristof Provost AuthorDate: 2021-03-15 13:10:55 +0000 Commit: Kristof Provost CommitDate: 2021-03-31 13:09:08 +0000 pf tests: pfsync bulk update test Test that pfsync works as expected with bulk updates. That is, create some state before setting up the second firewall. Let that firewall request a bulk update so it can catch up, and check that it got the state which was created before it enable pfsync. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29272 (cherry picked from commit 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18) --- tests/sys/netpfil/pf/pfsync.sh | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh index d8cb0a13efb7..a6fc7ec9f7e9 100644 --- a/tests/sys/netpfil/pf/pfsync.sh +++ b/tests/sys/netpfil/pf/pfsync.sh @@ -112,8 +112,76 @@ defer_cleanup() pfsynct_cleanup } +atf_test_case "bulk" "cleanup" +bulk_head() +{ + atf_set descr 'Test bulk updates' + atf_set require.user root +} + +bulk_body() +{ + pfsynct_init + + epair_sync=$(vnet_mkepair) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail one ${epair_one}a ${epair_sync}a + vnet_mkjail two ${epair_two}a ${epair_sync}b + + # pfsync interface + jexec one ifconfig ${epair_sync}a 192.0.2.1/24 up + jexec one ifconfig ${epair_one}a 198.51.100.1/24 up + jexec one ifconfig pfsync0 \ + syncdev ${epair_sync}a \ + maxupd 1\ + up + jexec two ifconfig ${epair_two}a 198.51.100.2/24 up + jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up + + # Enable pf + jexec one pfctl -e + pft_set_rules one \ + "set skip on ${epair_sync}a" \ + "pass keep state" + jexec two pfctl -e + pft_set_rules two \ + "set skip on ${epair_sync}b" \ + "pass keep state" + + ifconfig ${epair_one}b 198.51.100.254/24 up + + # Create state prior to setting up pfsync + ping -c 1 -S 198.51.100.254 198.51.100.1 + + # Wait before setting up pfsync on two, so we don't accidentally catch + # the update anyway. + sleep 1 + + # Now set up pfsync in jail two + jexec two ifconfig pfsync0 \ + syncdev ${epair_sync}b \ + up + + # Give pfsync time to do its thing + sleep 2 + + jexec two pfctl -s states + if ! jexec two pfctl -s states | grep icmp | grep 198.51.100.1 | \ + grep 198.51.100.2 ; then + atf_fail "state not found on synced host" + fi +} + +bulk_cleanup() +{ + pfsynct_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" atf_add_test_case "defer" + atf_add_test_case "bulk" } From owner-dev-commits-src-all@freebsd.org Wed Mar 31 13:13:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9FFC5C7F2A; Wed, 31 Mar 2021 13:13:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9RZW4mhhz3L5J; Wed, 31 Mar 2021 13:13:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 959DA1A05A; Wed, 31 Mar 2021 13:13:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VDD7YQ057670; Wed, 31 Mar 2021 13:13:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDD7mC057669; Wed, 31 Mar 2021 13:13:07 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:13:07 GMT Message-Id: <202103311313.12VDD7mC057669@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: aab309b4134a - stable/12 - pfsync: Unconditionally push packets when requesting state updates MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: aab309b4134a1822fab48d799580e4afdf90ac4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 13:13:07 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=aab309b4134a1822fab48d799580e4afdf90ac4a commit aab309b4134a1822fab48d799580e4afdf90ac4a Author: Thomas Kurschel AuthorDate: 2021-03-15 13:28:52 +0000 Commit: Kristof Provost CommitDate: 2021-03-31 08:56:46 +0000 pfsync: Unconditionally push packets when requesting state updates When we request a bulk sync we need to ensure we actually send out that request, not just buffer it until we have enough data to send a full packet. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29271 (cherry picked from commit 9f2e5184173f6af70306678b018270df9a9600f2) --- sys/netpfil/pf/if_pfsync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index dc149ff486d5..65dd64b02bbd 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1959,7 +1959,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) nlen += sizeof(struct pfsync_subheader); if (b->b_len + nlen > sc->sc_ifp->if_mtu) { - pfsync_sendout(1, 0); + pfsync_sendout(0, 0); nlen = sizeof(struct pfsync_subheader) + sizeof(struct pfsync_upd_req); @@ -1967,6 +1967,8 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) TAILQ_INSERT_TAIL(&b->b_upd_req_list, item, ur_entry); b->b_len += nlen; + + pfsync_push(b); } static bool From owner-dev-commits-src-all@freebsd.org Wed Mar 31 13:13:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D25625C7D3C; Wed, 31 Mar 2021 13:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9RZX5Thgz3LMl; Wed, 31 Mar 2021 13:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADE481A05B; Wed, 31 Mar 2021 13:13:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VDD8i9057691; Wed, 31 Mar 2021 13:13:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDD8mJ057690; Wed, 31 Mar 2021 13:13:08 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:13:08 GMT Message-Id: <202103311313.12VDD8mJ057690@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: f8d706fdd106 - stable/12 - pf tests: pfsync bulk update test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f8d706fdd106f94ca048d809d504fef651d4a23e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 13:13:08 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f8d706fdd106f94ca048d809d504fef651d4a23e commit f8d706fdd106f94ca048d809d504fef651d4a23e Author: Kristof Provost AuthorDate: 2021-03-15 13:10:55 +0000 Commit: Kristof Provost CommitDate: 2021-03-31 08:57:24 +0000 pf tests: pfsync bulk update test Test that pfsync works as expected with bulk updates. That is, create some state before setting up the second firewall. Let that firewall request a bulk update so it can catch up, and check that it got the state which was created before it enable pfsync. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29272 (cherry picked from commit 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18) --- tests/sys/netpfil/pf/pfsync.sh | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh index 95209b832c62..8b94f6dee29f 100755 --- a/tests/sys/netpfil/pf/pfsync.sh +++ b/tests/sys/netpfil/pf/pfsync.sh @@ -87,8 +87,76 @@ defer_cleanup() pfsynct_cleanup } +atf_test_case "bulk" "cleanup" +bulk_head() +{ + atf_set descr 'Test bulk updates' + atf_set require.user root +} + +bulk_body() +{ + pfsynct_init + + epair_sync=$(vnet_mkepair) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail one ${epair_one}a ${epair_sync}a + vnet_mkjail two ${epair_two}a ${epair_sync}b + + # pfsync interface + jexec one ifconfig ${epair_sync}a 192.0.2.1/24 up + jexec one ifconfig ${epair_one}a 198.51.100.1/24 up + jexec one ifconfig pfsync0 \ + syncdev ${epair_sync}a \ + maxupd 1\ + up + jexec two ifconfig ${epair_two}a 198.51.100.2/24 up + jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up + + # Enable pf + jexec one pfctl -e + pft_set_rules one \ + "set skip on ${epair_sync}a" \ + "pass keep state" + jexec two pfctl -e + pft_set_rules two \ + "set skip on ${epair_sync}b" \ + "pass keep state" + + ifconfig ${epair_one}b 198.51.100.254/24 up + + # Create state prior to setting up pfsync + ping -c 1 -S 198.51.100.254 198.51.100.1 + + # Wait before setting up pfsync on two, so we don't accidentally catch + # the update anyway. + sleep 1 + + # Now set up pfsync in jail two + jexec two ifconfig pfsync0 \ + syncdev ${epair_sync}b \ + up + + # Give pfsync time to do its thing + sleep 2 + + jexec two pfctl -s states + if ! jexec two pfctl -s states | grep icmp | grep 198.51.100.1 | \ + grep 198.51.100.2 ; then + atf_fail "state not found on synced host" + fi +} + +bulk_cleanup() +{ + pfsynct_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" atf_add_test_case "defer" + atf_add_test_case "bulk" } From owner-dev-commits-src-all@freebsd.org Wed Mar 31 13:16:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D13595C7AEF; Wed, 31 Mar 2021 13:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9RfP5ZT8z3LlL; Wed, 31 Mar 2021 13:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE0A41A0B8; Wed, 31 Mar 2021 13:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VDGTSp058334; Wed, 31 Mar 2021 13:16:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDGT4B058333; Wed, 31 Mar 2021 13:16:29 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:16:29 GMT Message-Id: <202103311316.12VDGT4B058333@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 381ba4357c74 - stable/13 - Fix several dev_clone callbacks to avoid out-of-bounds reads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 381ba4357c7452d9a5ee38832f0adf47b2428a48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 13:16:29 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=381ba4357c7452d9a5ee38832f0adf47b2428a48 commit 381ba4357c7452d9a5ee38832f0adf47b2428a48 Author: Mark Johnston AuthorDate: 2021-03-28 15:08:36 +0000 Commit: Mark Johnston CommitDate: 2021-03-31 13:15:58 +0000 Fix several dev_clone callbacks to avoid out-of-bounds reads Use strncmp() instead of bcmp(), so that we don't have to find the minimum of the string lengths before comparing. Reviewed by: kib Reported by: KASAN Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29463 (cherry picked from commit 3428b6c050d102ba7f95514b29f4f5685d76b645) --- sys/dev/sound/pcm/dsp.c | 3 +-- sys/kern/kern_conf.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 0593a585b0fd..cce05f4ecf37 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -2294,8 +2294,7 @@ dsp_stdclone(char *name, char *namep, char *sep, int use_sep, int *u, int *c) size_t len; len = strlen(namep); - - if (bcmp(name, namep, len) != 0) + if (strncmp(name, namep, len) != 0) return (ENODEV); name += len; diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 29103f83c049..3a07c95e74d0 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -1255,7 +1255,7 @@ dev_stdclone(char *name, char **namep, const char *stem, int *unit) int u, i; i = strlen(stem); - if (bcmp(stem, name, i) != 0) + if (strncmp(stem, name, i) != 0) return (0); if (!isdigit(name[i])) return (0); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 13:16:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E583F5C7D68; Wed, 31 Mar 2021 13:16:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9RfQ6C50z3LqT; Wed, 31 Mar 2021 13:16:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C81DE1A05E; Wed, 31 Mar 2021 13:16:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VDGUPT058357; Wed, 31 Mar 2021 13:16:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDGUfs058356; Wed, 31 Mar 2021 13:16:30 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:16:30 GMT Message-Id: <202103311316.12VDGUfs058356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5e96fbdfc421 - stable/13 - amd64: Make KPDPphys local to pmap.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5e96fbdfc4218a4bdb1ca1e8b7ea85ba8fb808f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 13:16:31 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5e96fbdfc4218a4bdb1ca1e8b7ea85ba8fb808f3 commit 5e96fbdfc4218a4bdb1ca1e8b7ea85ba8fb808f3 Author: Mark Johnston AuthorDate: 2021-03-24 13:55:22 +0000 Commit: Mark Johnston CommitDate: 2021-03-31 13:16:11 +0000 amd64: Make KPDPphys local to pmap.c Sponsored by: The FreeBSD Foundation (cherry picked from commit 7ae2e703366e5ac56373509ececae53ecaa5bc59) --- sys/amd64/amd64/pmap.c | 2 +- sys/amd64/include/pmap.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index bd23fd176e88..54dbadfb95c3 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -419,7 +419,7 @@ static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ static u_int64_t KPTphys; /* phys addr of kernel level 1 */ static u_int64_t KPDphys; /* phys addr of kernel level 2 */ -u_int64_t KPDPphys; /* phys addr of kernel level 3 */ +static u_int64_t KPDPphys; /* phys addr of kernel level 3 */ u_int64_t KPML4phys; /* phys addr of kernel level 4 */ u_int64_t KPML5phys; /* phys addr of kernel level 5, if supported */ diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index ef69ba9b6f9f..8ba654cb2e7c 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -303,7 +303,6 @@ typedef u_int64_t pml5_entry_t; #define P5Dmap ((pd_entry_t *)(addr_P5Dmap)) extern int nkpt; /* Initial number of kernel page tables */ -extern u_int64_t KPDPphys; /* physical address of kernel level 3 */ extern u_int64_t KPML4phys; /* physical address of kernel level 4 */ extern u_int64_t KPML5phys; /* physical address of kernel level 5 */ From owner-dev-commits-src-all@freebsd.org Wed Mar 31 13:22:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 058C25781B9; Wed, 31 Mar 2021 13:22:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9Rnf6kV5z3Lyf; Wed, 31 Mar 2021 13:22:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9B261A711; Wed, 31 Mar 2021 13:22:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VDMk1P072106; Wed, 31 Mar 2021 13:22:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDMkn5072105; Wed, 31 Mar 2021 13:22:46 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:22:46 GMT Message-Id: <202103311322.12VDMkn5072105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f9fcb518e728 - stable/12 - Fix several dev_clone callbacks to avoid out-of-bounds reads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f9fcb518e7289489d8fc577565f21f95a51a33cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 13:22:47 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f9fcb518e7289489d8fc577565f21f95a51a33cd commit f9fcb518e7289489d8fc577565f21f95a51a33cd Author: Mark Johnston AuthorDate: 2021-03-28 15:08:36 +0000 Commit: Mark Johnston CommitDate: 2021-03-31 13:16:51 +0000 Fix several dev_clone callbacks to avoid out-of-bounds reads Use strncmp() instead of bcmp(), so that we don't have to find the minimum of the string lengths before comparing. Reviewed by: kib Reported by: KASAN Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29463 (cherry picked from commit 3428b6c050d102ba7f95514b29f4f5685d76b645) --- sys/dev/sound/pcm/dsp.c | 3 +-- sys/kern/kern_conf.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 100fe452d52b..7a3187807fa1 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -2295,8 +2295,7 @@ dsp_stdclone(char *name, char *namep, char *sep, int use_sep, int *u, int *c) size_t len; len = strlen(namep); - - if (bcmp(name, namep, len) != 0) + if (strncmp(name, namep, len) != 0) return (ENODEV); name += len; diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 089ec5bd6c3f..e1c67876241f 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -1256,7 +1256,7 @@ dev_stdclone(char *name, char **namep, const char *stem, int *unit) int u, i; i = strlen(stem); - if (bcmp(stem, name, i) != 0) + if (strncmp(stem, name, i) != 0) return (0); if (!isdigit(name[i])) return (0); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 13:22:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CD1B5C7FF6; Wed, 31 Mar 2021 13:22:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9Rnh0Vtdz3MQp; Wed, 31 Mar 2021 13:22:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F41751A1F1; Wed, 31 Mar 2021 13:22:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VDMlfi072132; Wed, 31 Mar 2021 13:22:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDMlOm072131; Wed, 31 Mar 2021 13:22:47 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:22:47 GMT Message-Id: <202103311322.12VDMlOm072131@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9be668867476 - stable/12 - amd64: Make KPDPphys local to pmap.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9be66886747651104235642e457b23b7fa090cb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 13:22:48 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9be66886747651104235642e457b23b7fa090cb0 commit 9be66886747651104235642e457b23b7fa090cb0 Author: Mark Johnston AuthorDate: 2021-03-24 13:55:22 +0000 Commit: Mark Johnston CommitDate: 2021-03-31 13:16:58 +0000 amd64: Make KPDPphys local to pmap.c Sponsored by: The FreeBSD Foundation (cherry picked from commit 7ae2e703366e5ac56373509ececae53ecaa5bc59) --- sys/amd64/amd64/pmap.c | 2 +- sys/amd64/include/pmap.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d67823729a48..c6f56c1cd73b 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -383,7 +383,7 @@ static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ static u_int64_t KPTphys; /* phys addr of kernel level 1 */ static u_int64_t KPDphys; /* phys addr of kernel level 2 */ -u_int64_t KPDPphys; /* phys addr of kernel level 3 */ +static u_int64_t KPDPphys; /* phys addr of kernel level 3 */ u_int64_t KPML4phys; /* phys addr of kernel level 4 */ static u_int64_t DMPDphys; /* phys addr of direct mapped level 2 */ diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 7176e9c6ef4d..3520594de9bd 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -274,7 +274,6 @@ typedef u_int64_t pml4_entry_t; #define PML4pml4e ((pd_entry_t *)(addr_PML4pml4e)) extern int nkpt; /* Initial number of kernel page tables */ -extern u_int64_t KPDPphys; /* physical address of kernel level 3 */ extern u_int64_t KPML4phys; /* physical address of kernel level 4 */ /* From owner-dev-commits-src-all@freebsd.org Wed Mar 31 16:01:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F80557CC93; Wed, 31 Mar 2021 16:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9WJd1krLz3m4x; Wed, 31 Mar 2021 16:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EBD11C59C; Wed, 31 Mar 2021 16:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VG1Lg3095910; Wed, 31 Mar 2021 16:01:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VG1Lbu095909; Wed, 31 Mar 2021 16:01:21 GMT (envelope-from git) Date: Wed, 31 Mar 2021 16:01:21 GMT Message-Id: <202103311601.12VG1Lbu095909@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 407e5a8d68aa - releng/13.0 - mn: report that this driver is removed in 14, not 13 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 407e5a8d68aaf0ea461f7568a1983e91a6d41de0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 16:01:21 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=407e5a8d68aaf0ea461f7568a1983e91a6d41de0 commit 407e5a8d68aaf0ea461f7568a1983e91a6d41de0 Author: Ed Maste AuthorDate: 2021-03-25 02:35:38 +0000 Commit: Ed Maste CommitDate: 2021-03-31 16:00:57 +0000 mn: report that this driver is removed in 14, not 13 (cherry picked from commit a66e75d9e2ddd9a84f8de204438282a25bb1a954) mn: bump deprecation version to 14 in man page as well Fixes: 66e75d9e2ddd ("mn: report that this driver is removed in 14, not 13") (cherry picked from commit 6acecf247f60fcd3ba9662d54c59fc7bd46fb67a) Approved by: re (gjb) --- share/man/man4/mn.4 | 4 ++-- sys/dev/mn/if_mn.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man4/mn.4 b/share/man/man4/mn.4 index f034a1b10d45..e67eb1e5284f 100644 --- a/share/man/man4/mn.4 +++ b/share/man/man4/mn.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 6, 2020 +.Dd March 24, 2021 .Dt MN 4 .Os .Sh NAME @@ -37,7 +37,7 @@ The .Nm driver is not present in -.Fx 13.0 +.Fx 14.0 and later. .Sh HARDWARE The diff --git a/sys/dev/mn/if_mn.c b/sys/dev/mn/if_mn.c index bb329b24c24e..7c7699656743 100644 --- a/sys/dev/mn/if_mn.c +++ b/sys/dev/mn/if_mn.c @@ -1392,7 +1392,7 @@ mn_attach (device_t self) default: printf(" Rev 0x%x\n", sc->f54r->vstr); } - gone_in_dev(self, 13, "sync serial (T1/E1) driver"); + gone_in_dev(self, 14, "sync serial (T1/E1) driver"); if (ng_make_node_common(&mntypestruct, &sc->node) != 0) { printf("ng_make_node_common failed\n"); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 16:02:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1628F57CF8A; Wed, 31 Mar 2021 16:02:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9WL3089Wz3mf3; Wed, 31 Mar 2021 16:02:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBEB61C5BE; Wed, 31 Mar 2021 16:02:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VG2Yk6097004; Wed, 31 Mar 2021 16:02:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VG2YDc097003; Wed, 31 Mar 2021 16:02:34 GMT (envelope-from git) Date: Wed, 31 Mar 2021 16:02:34 GMT Message-Id: <202103311602.12VG2YDc097003@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 42d99e4efa83 - releng/13.0 - arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 42d99e4efa83e1118b796967cdac6a5b7c190298 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 16:02:35 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=42d99e4efa83e1118b796967cdac6a5b7c190298 commit 42d99e4efa83e1118b796967cdac6a5b7c190298 Author: Ed Maste AuthorDate: 2021-03-17 14:10:41 +0000 Commit: Ed Maste CommitDate: 2021-03-31 16:01:54 +0000 arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs On FreeBSD/arm fill_fpregs, fill_dbregs are stubs that zero the reg struct and return success. set_fpregs and set_dbregs do nothing and return success. Provide the same implementation for arm64 COMPAT_FREEBSD32. Reviewed by: andrew Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29314 (cherry picked from commit 5be27cbf16c85ce95d21db57349f61494f851821) (cherry picked from commit db50c8123469e3eab07e931019bf6d4df2d55c78) --- sys/arm64/arm64/machdep.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 73b06beeba7e..d33eb3ff4b76 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -489,36 +489,35 @@ set_regs32(struct thread *td, struct reg32 *regs) return (0); } +/* XXX fill/set dbregs/fpregs are stubbed on 32-bit arm. */ int fill_fpregs32(struct thread *td, struct fpreg32 *regs) { - printf("ARM64TODO: fill_fpregs32"); - return (EDOOFUS); + memset(regs, 0, sizeof(*regs)); + return (0); } int set_fpregs32(struct thread *td, struct fpreg32 *regs) { - printf("ARM64TODO: set_fpregs32"); - return (EDOOFUS); + return (0); } int fill_dbregs32(struct thread *td, struct dbreg32 *regs) { - printf("ARM64TODO: fill_dbregs32"); - return (EDOOFUS); + memset(regs, 0, sizeof(*regs)); + return (0); } int set_dbregs32(struct thread *td, struct dbreg32 *regs) { - printf("ARM64TODO: set_dbregs32"); - return (EDOOFUS); + return (0); } #endif From owner-dev-commits-src-all@freebsd.org Wed Mar 31 16:07:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA85E57CE7A; Wed, 31 Mar 2021 16:07:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9WRQ4yfwz3n0L; Wed, 31 Mar 2021 16:07:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DA151C628; Wed, 31 Mar 2021 16:07:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VG7EAg097841; Wed, 31 Mar 2021 16:07:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VG7EV3097839; Wed, 31 Mar 2021 16:07:14 GMT (envelope-from git) Date: Wed, 31 Mar 2021 16:07:14 GMT Message-Id: <202103311607.12VG7EV3097839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 7745d7159777 - releng/13.0 - Tune DTrace 'aframes' for the FBT and profile providers on arm64. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 7745d71597771f193b1bfb0b4d8842cea16ef6d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 16:07:14 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7745d71597771f193b1bfb0b4d8842cea16ef6d4 commit 7745d71597771f193b1bfb0b4d8842cea16ef6d4 Author: Robert Watson AuthorDate: 2021-03-21 00:01:54 +0000 Commit: Ed Maste CommitDate: 2021-03-31 16:03:53 +0000 Tune DTrace 'aframes' for the FBT and profile providers on arm64. In both cases, too few frames were trimmed, leading to exception handling or DTrace internals being exposed in stack traces exposed by D's stack() primitive. Reviewed by: emaste, andrew Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D29356 (cherry picked from commit 599fb1d198ec6792ba062114d2589ca9f01a3568) (cherry picked from commit fcc700abe4fa85b0f0ec9d953436725533cecc17) --- sys/cddl/dev/fbt/aarch64/fbt_isa.c | 5 +++-- sys/cddl/dev/profile/profile.c | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/cddl/dev/fbt/aarch64/fbt_isa.c b/sys/cddl/dev/fbt/aarch64/fbt_isa.c index f15bc12291d3..6bc351ad74f6 100644 --- a/sys/cddl/dev/fbt/aarch64/fbt_isa.c +++ b/sys/cddl/dev/fbt/aarch64/fbt_isa.c @@ -44,6 +44,7 @@ #define FBT_PATCHVAL (AARCH64_BRK | AARCH64_BRK_IMM16_VAL) #define FBT_ENTRY "entry" #define FBT_RETURN "return" +#define FBT_AFRAMES 4 int fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t rval) @@ -141,7 +142,7 @@ fbt_provide_module_function(linker_file_t lf, int symindx, fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); fbt->fbtp_name = name; fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_ENTRY, 3, fbt); + name, FBT_ENTRY, FBT_AFRAMES, fbt); fbt->fbtp_patchpoint = instr; fbt->fbtp_ctl = lf; fbt->fbtp_loadcnt = lf->loadcnt; @@ -183,7 +184,7 @@ again: fbt->fbtp_name = name; if (retfbt == NULL) { fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_RETURN, 3, fbt); + name, FBT_RETURN, FBT_AFRAMES, fbt); } else { retfbt->fbtp_probenext = fbt; fbt->fbtp_id = retfbt->fbtp_id; diff --git a/sys/cddl/dev/profile/profile.c b/sys/cddl/dev/profile/profile.c index 4fc9f6f22eef..ca373f50a1a0 100644 --- a/sys/cddl/dev/profile/profile.c +++ b/sys/cddl/dev/profile/profile.c @@ -140,8 +140,7 @@ struct profile_probe_percpu; #endif #ifdef __aarch64__ -/* TODO: verify */ -#define PROF_ARTIFICIAL_FRAMES 10 +#define PROF_ARTIFICIAL_FRAMES 12 #endif #ifdef __riscv From owner-dev-commits-src-all@freebsd.org Wed Mar 31 16:07:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE84E57CE7C; Wed, 31 Mar 2021 16:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9WRR60Zwz3msG; Wed, 31 Mar 2021 16:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0FB51C355; Wed, 31 Mar 2021 16:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VG7FLt097868; Wed, 31 Mar 2021 16:07:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VG7F8n097867; Wed, 31 Mar 2021 16:07:15 GMT (envelope-from git) Date: Wed, 31 Mar 2021 16:07:15 GMT Message-Id: <202103311607.12VG7F8n097867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 6605a2a1634f - releng/13.0 - Teach DTrace that unaligned accesses are OK on aarch64, not just x86. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 6605a2a1634f5db4b9aeed33d0077399185992c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 16:07:15 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6605a2a1634f5db4b9aeed33d0077399185992c9 commit 6605a2a1634f5db4b9aeed33d0077399185992c9 Author: Robert Watson AuthorDate: 2021-03-22 01:50:00 +0000 Commit: Ed Maste CommitDate: 2021-03-31 16:05:26 +0000 Teach DTrace that unaligned accesses are OK on aarch64, not just x86. Reviewed by: andrew Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D29369 (cherry picked from commit fb581531c1a0e6f1bf5392a2e97ed39d21d6e1fd) (cherry picked from commit ba08ba5226ff8551ea3926ce49b8604b71c9cabf) --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index b212185a4578..ca6fa5481856 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -475,7 +475,7 @@ static kmutex_t dtrace_errlock; #define DTRACE_STORE(type, tomax, offset, what) \ *((type *)((uintptr_t)(tomax) + (uintptr_t)offset)) = (type)(what); -#ifndef __x86 +#if !defined(__x86) && !defined(__aarch64__) #define DTRACE_ALIGNCHECK(addr, size, flags) \ if (addr & (size - 1)) { \ *flags |= CPU_DTRACE_BADALIGN; \ From owner-dev-commits-src-all@freebsd.org Wed Mar 31 17:18:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C7095A8DBB; Wed, 31 Mar 2021 17:18:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9Y1L36cNz3t8x; Wed, 31 Mar 2021 17:18:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DDFB1D59D; Wed, 31 Mar 2021 17:18:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VHIEx9095771; Wed, 31 Mar 2021 17:18:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VHIE2N095769; Wed, 31 Mar 2021 17:18:14 GMT (envelope-from git) Date: Wed, 31 Mar 2021 17:18:14 GMT Message-Id: <202103311718.12VHIE2N095769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: c804c8f2c58b - main - Export sbuf_drain to orchestrate lock and drain action MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c804c8f2c58ba42d476de07fbceff9ac4dd95f0e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 17:18:14 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=c804c8f2c58ba42d476de07fbceff9ac4dd95f0e commit c804c8f2c58ba42d476de07fbceff9ac4dd95f0e Author: Richard Scheffenegger AuthorDate: 2021-03-31 16:25:53 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-31 17:17:37 +0000 Export sbuf_drain to orchestrate lock and drain action While exporting large amounts of data to a sysctl request, datastructures may need to be locked. Exporting the sbuf_drain function allows the coordination between drain events and held locks, to avoid stalls. PR: 254333 Reviewed By: jhb MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29481 --- sys/kern/subr_sbuf.c | 2 +- sys/sys/sbuf.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index 20a831aa75b2..66822115dbcb 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -383,7 +383,7 @@ sbuf_set_drain(struct sbuf *s, sbuf_drain_func *func, void *ctx) /* * Call the drain and process the return. */ -static int +int sbuf_drain(struct sbuf *s) { int len; diff --git a/sys/sys/sbuf.h b/sys/sys/sbuf.h index 10b59f360cd0..d87e3917b84c 100644 --- a/sys/sys/sbuf.h +++ b/sys/sys/sbuf.h @@ -95,6 +95,7 @@ int sbuf_vprintf(struct sbuf *, const char *, __va_list) int sbuf_nl_terminate(struct sbuf *); int sbuf_putc(struct sbuf *, int); void sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *); +int sbuf_drain(struct sbuf *); int sbuf_trim(struct sbuf *); int sbuf_error(const struct sbuf *); int sbuf_finish(struct sbuf *); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 17:25:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD5B25A9816; Wed, 31 Mar 2021 17:25:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9YBH5zlvz3v5T; Wed, 31 Mar 2021 17:25:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B97941D45B; Wed, 31 Mar 2021 17:25:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VHPxc9009460; Wed, 31 Mar 2021 17:25:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VHPxKA009459; Wed, 31 Mar 2021 17:25:59 GMT (envelope-from git) Date: Wed, 31 Mar 2021 17:25:59 GMT Message-Id: <202103311725.12VHPxKA009459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 869880463cc2 - main - tcp: drain tcp_hostcache_list in between per-bucket locks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 869880463cc2ce64e2e6599eaec880a981f3ced6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 17:25:59 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=869880463cc2ce64e2e6599eaec880a981f3ced6 commit 869880463cc2ce64e2e6599eaec880a981f3ced6 Author: Richard Scheffenegger AuthorDate: 2021-03-31 17:24:01 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-31 17:24:21 +0000 tcp: drain tcp_hostcache_list in between per-bucket locks Explicitly drain the sbuf after completing each hash bucket to minimize the work performed while holding the hash bucket lock. PR: 254333 MFC after: 2 weeks Reviewed By: tuexen, jhb, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29483 --- sys/netinet/tcp_hostcache.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 5fe905d9abf5..b6d0c0410df9 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -649,12 +649,13 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) return(error); } - /* Use a buffer for 16 lines */ - sbuf_new_for_sysctl(&sb, NULL, 16 * linesize, req); + /* Use a buffer sized for one full bucket */ + sbuf_new_for_sysctl(&sb, NULL, V_tcp_hostcache.bucket_limit * linesize, req); sbuf_printf(&sb, "\nIP address MTU SSTRESH RTT RTTVAR " " CWND SENDPIPE RECVPIPE HITS UPD EXP\n"); + sbuf_drain(&sb); #define msec(u) (((u) + 500) / 1000) for (i = 0; i < V_tcp_hostcache.hashsize; i++) { @@ -685,6 +686,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) hc_entry->rmx_expire); } THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + sbuf_drain(&sb); } #undef msec error = sbuf_finish(&sb); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 18:19:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 302C35AB4AE; Wed, 31 Mar 2021 18:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9ZMt0tyxz4Rs3; Wed, 31 Mar 2021 18:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D46A1DCF9; Wed, 31 Mar 2021 18:19:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VIJL3J079601; Wed, 31 Mar 2021 18:19:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VIJLDA079600; Wed, 31 Mar 2021 18:19:21 GMT (envelope-from git) Date: Wed, 31 Mar 2021 18:19:21 GMT Message-Id: <202103311819.12VIJLDA079600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 539489326947 - main - cxgbe/t4_tom: restore socket's protosw before entering TIME_WAIT. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 539489326947f2873f21b292941f8e5551f7c17b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 18:19:22 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=539489326947f2873f21b292941f8e5551f7c17b commit 539489326947f2873f21b292941f8e5551f7c17b Author: Navdeep Parhar AuthorDate: 2021-03-30 04:35:05 +0000 Commit: Navdeep Parhar CommitDate: 2021-03-31 17:54:32 +0000 cxgbe/t4_tom: restore socket's protosw before entering TIME_WAIT. This fixes a panic due to stale so->so_proto if t4_tom is unloaded and one or more connections that were previously offloaded are still around in TIME_WAIT state. Reviewed by: jhb@ MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29503 --- sys/dev/cxgbe/tom/t4_cpl_io.c | 2 ++ sys/dev/cxgbe/tom/t4_tom.c | 14 ++++++++++++-- sys/dev/cxgbe/tom/t4_tom.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 14a8181b57ef..7085be0844b7 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1260,6 +1260,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) break; case TCPS_FIN_WAIT_2: + restore_so_proto(so, inp->inp_vflag & INP_IPV6); tcp_twstart(tp); INP_UNLOCK_ASSERT(inp); /* safe, we have a ref on the inp */ NET_EPOCH_EXIT(et); @@ -1320,6 +1321,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_header *rss, switch (tp->t_state) { case TCPS_CLOSING: /* see TCPS_FIN_WAIT_2 in do_peer_close too */ + restore_so_proto(so, inp->inp_vflag & INP_IPV6); tcp_twstart(tp); release: INP_UNLOCK_ASSERT(inp); /* safe, we have a ref on the inp */ diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index df837cc50454..6a4b5e8f261e 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -79,9 +79,11 @@ __FBSDID("$FreeBSD$"); #include "tom/t4_tom.h" #include "tom/t4_tls.h" +static struct protosw *tcp_protosw; static struct protosw toe_protosw; static struct pr_usrreqs toe_usrreqs; +static struct protosw *tcp6_protosw; static struct protosw toe6_protosw; static struct pr_usrreqs toe6_usrreqs; @@ -263,6 +265,15 @@ offload_socket(struct socket *so, struct toepcb *toep) mtx_unlock(&td->toep_list_lock); } +void +restore_so_proto(struct socket *so, bool v6) +{ + if (v6) + so->so_proto = tcp6_protosw; + else + so->so_proto = tcp_protosw; +} + /* This is _not_ the normal way to "unoffload" a socket. */ void undo_offload_socket(struct socket *so) @@ -282,6 +293,7 @@ undo_offload_socket(struct socket *so) sb = &so->so_rcv; SOCKBUF_LOCK(sb); sb->sb_flags &= ~SB_NOCOALESCE; + restore_so_proto(so, inp->inp_vflag & INP_IPV6); SOCKBUF_UNLOCK(sb); tp->tod = NULL; @@ -1837,8 +1849,6 @@ t4_ctloutput_tom(struct socket *so, struct sockopt *sopt) static int t4_tom_mod_load(void) { - struct protosw *tcp_protosw, *tcp6_protosw; - /* CPL handlers */ t4_register_cpl_handler(CPL_GET_TCB_RPL, do_get_tcb_rpl); t4_register_shared_cpl_handler(CPL_L2T_WRITE_RPL, do_l2t_write_rpl2, diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 628857cfae17..68b3d29295f8 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -352,6 +352,7 @@ int init_toepcb(struct vi_info *, struct toepcb *); struct toepcb *hold_toepcb(struct toepcb *); void free_toepcb(struct toepcb *); void offload_socket(struct socket *, struct toepcb *); +void restore_so_proto(struct socket *, bool); void undo_offload_socket(struct socket *); void final_cpl_received(struct toepcb *); void insert_tid(struct adapter *, int, void *, int); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 18:24:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D55EF5AB4D6; Wed, 31 Mar 2021 18:24:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9ZTs5kd6z4SGd; Wed, 31 Mar 2021 18:24:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7ECD1DFFB; Wed, 31 Mar 2021 18:24:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VIOXJQ093181; Wed, 31 Mar 2021 18:24:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VIOX7G093180; Wed, 31 Mar 2021 18:24:33 GMT (envelope-from git) Date: Wed, 31 Mar 2021 18:24:33 GMT Message-Id: <202103311824.12VIOX7G093180@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 95e56d31e348 - main - tcp: Make hostcache.cache_count MPSAFE by using a counter_u64_t MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95e56d31e348594973affd0ea81d8f8383bc3031 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 18:24:33 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=95e56d31e348594973affd0ea81d8f8383bc3031 commit 95e56d31e348594973affd0ea81d8f8383bc3031 Author: Richard Scheffenegger AuthorDate: 2021-03-31 17:30:20 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-31 18:24:13 +0000 tcp: Make hostcache.cache_count MPSAFE by using a counter_u64_t Addressing the underlying root cause for cache_count to show unexpectedly high values, by protecting all arithmetic on that global variable by using counter(9). PR: 254333 Reviewed By: tuexen, #transport MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29510 --- sys/netinet/tcp_hostcache.c | 20 ++++++++++++-------- sys/netinet/tcp_hostcache.h | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index b6d0c0410df9..67da97405c3f 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -147,8 +147,8 @@ SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, bucketlimit, CTLFLAG_VNET | CTLFLAG_RDTUN, &VNET_NAME(tcp_hostcache.bucket_limit), 0, "Per-bucket hash limit for hostcache"); -SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, count, CTLFLAG_VNET | CTLFLAG_RD, - &VNET_NAME(tcp_hostcache.cache_count), 0, +SYSCTL_COUNTER_U64(_net_inet_tcp_hostcache, OID_AUTO, count, CTLFLAG_VNET | CTLFLAG_RD, + &VNET_NAME(tcp_hostcache.cache_count), "Current number of entries in hostcache"); SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, expire, CTLFLAG_VNET | CTLFLAG_RW, @@ -199,7 +199,8 @@ tcp_hc_init(void) /* * Initialize hostcache structures. */ - V_tcp_hostcache.cache_count = 0; + V_tcp_hostcache.cache_count = counter_u64_alloc(M_WAITOK); + counter_u64_zero(V_tcp_hostcache.cache_count); V_tcp_hostcache.hashsize = TCP_HOSTCACHE_HASHSIZE; V_tcp_hostcache.bucket_limit = TCP_HOSTCACHE_BUCKETLIMIT; V_tcp_hostcache.expire = TCP_HOSTCACHE_EXPIRE; @@ -267,6 +268,9 @@ tcp_hc_destroy(void) /* Purge all hc entries. */ tcp_hc_purge_internal(1); + /* Release the counter */ + counter_u64_free(V_tcp_hostcache.cache_count); + /* Free the uma zone and the allocated hash table. */ uma_zdestroy(V_tcp_hostcache.zone); @@ -374,7 +378,7 @@ tcp_hc_insert(struct in_conninfo *inc) * If the bucket limit is reached, reuse the least-used element. */ if (hc_head->hch_length >= V_tcp_hostcache.bucket_limit || - V_tcp_hostcache.cache_count >= V_tcp_hostcache.cache_limit) { + counter_u64_fetch(V_tcp_hostcache.cache_count) >= V_tcp_hostcache.cache_limit) { hc_entry = TAILQ_LAST(&hc_head->hch_bucket, hc_qhead); /* * At first we were dropping the last element, just to @@ -391,7 +395,7 @@ tcp_hc_insert(struct in_conninfo *inc) } TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q); V_tcp_hostcache.hashbase[hash].hch_length--; - V_tcp_hostcache.cache_count--; + counter_u64_add(V_tcp_hostcache.cache_count, -1); TCPSTAT_INC(tcps_hc_bucketoverflow); #if 0 uma_zfree(V_tcp_hostcache.zone, hc_entry); @@ -424,7 +428,7 @@ tcp_hc_insert(struct in_conninfo *inc) */ TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); V_tcp_hostcache.hashbase[hash].hch_length++; - V_tcp_hostcache.cache_count++; + counter_u64_add(V_tcp_hostcache.cache_count, 1); TCPSTAT_INC(tcps_hc_added); return hc_entry; @@ -640,7 +644,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) /* Optimize Buffer length query by sbin/sysctl */ if (req->oldptr == NULL) { - len = (V_tcp_hostcache.cache_count + 1) * linesize; + len = (counter_u64_fetch(V_tcp_hostcache.cache_count) + 1) * linesize; return (SYSCTL_OUT(req, NULL, len)); } @@ -712,7 +716,7 @@ tcp_hc_purge_internal(int all) hc_entry, rmx_q); uma_zfree(V_tcp_hostcache.zone, hc_entry); V_tcp_hostcache.hashbase[i].hch_length--; - V_tcp_hostcache.cache_count--; + counter_u64_add(V_tcp_hostcache.cache_count, -1); } else hc_entry->rmx_expire -= V_tcp_hostcache.prune; } diff --git a/sys/netinet/tcp_hostcache.h b/sys/netinet/tcp_hostcache.h index f4e1013aac60..b5237392acc2 100644 --- a/sys/netinet/tcp_hostcache.h +++ b/sys/netinet/tcp_hostcache.h @@ -69,16 +69,16 @@ struct hc_metrics { }; struct tcp_hostcache { - struct hc_head *hashbase; - uma_zone_t zone; - u_int hashsize; - u_int hashmask; - u_int bucket_limit; - u_int cache_count; - u_int cache_limit; - int expire; - int prune; - int purgeall; + struct hc_head *hashbase; + uma_zone_t zone; + u_int hashsize; + u_int hashmask; + u_int bucket_limit; + counter_u64_t cache_count; + u_int cache_limit; + int expire; + int prune; + int purgeall; }; #endif /* !_NETINET_TCP_HOSTCACHE_H_*/ From owner-dev-commits-src-all@freebsd.org Wed Mar 31 18:34:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6E915ABADE; Wed, 31 Mar 2021 18:34:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9ZjS5lhNz4T3y; Wed, 31 Mar 2021 18:34:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B84271E3D6; Wed, 31 Mar 2021 18:34:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VIYaLl007212; Wed, 31 Mar 2021 18:34:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VIYaNp007211; Wed, 31 Mar 2021 18:34:36 GMT (envelope-from git) Date: Wed, 31 Mar 2021 18:34:36 GMT Message-Id: <202103311834.12VIYaNp007211@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: b6d8f3b517de - main - powerpc/powermac: Constrain 'cpu_sleep()' for AIM to mpc745x MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b6d8f3b517dec010f3dfad1b33e9945eaa606be5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 18:34:36 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=b6d8f3b517dec010f3dfad1b33e9945eaa606be5 commit b6d8f3b517dec010f3dfad1b33e9945eaa606be5 Author: Justin Hibbits AuthorDate: 2021-03-31 16:54:11 +0000 Commit: Justin Hibbits CommitDate: 2021-03-31 18:34:06 +0000 powerpc/powermac: Constrain 'cpu_sleep()' for AIM to mpc745x Rename cpu_sleep() to mpc745x_sleep() to denote what it's actually intended for. This function is very G4-specific, and will not work on any other CPU. This will afterward eliminate a platform_smp_timebase_sync() call by directly updating the timebase instead. --- sys/powerpc/aim/aim_machdep.c | 4 +++- sys/powerpc/include/cpu.h | 6 +++++- sys/powerpc/powermac/platform_powermac.c | 13 ++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/sys/powerpc/aim/aim_machdep.c b/sys/powerpc/aim/aim_machdep.c index 0ce7cf03403f..b09089069c28 100644 --- a/sys/powerpc/aim/aim_machdep.c +++ b/sys/powerpc/aim/aim_machdep.c @@ -721,8 +721,9 @@ flush_disable_caches(void) mtmsr(msr); } +#ifndef __powerpc64__ void -cpu_sleep() +mpc745x_sleep() { static u_quad_t timebase = 0; static register_t sprgs[4]; @@ -785,3 +786,4 @@ cpu_sleep() enable_vec(curthread); powerpc_sync(); } +#endif diff --git a/sys/powerpc/include/cpu.h b/sys/powerpc/include/cpu.h index 9ae18e13900a..256e6d3eabf0 100644 --- a/sys/powerpc/include/cpu.h +++ b/sys/powerpc/include/cpu.h @@ -144,10 +144,14 @@ extern register_t lpcr; void cpu_halt(void); void cpu_reset(void); -void cpu_sleep(void); void flush_disable_caches(void); void fork_trampoline(void); void swi_vm(void *); int cpu_machine_check(struct thread *, struct trapframe *, int *); + +#ifndef __powerpc64__ +void mpc745x_sleep(void); +#endif + #endif /* _MACHINE_CPU_H_ */ diff --git a/sys/powerpc/powermac/platform_powermac.c b/sys/powerpc/powermac/platform_powermac.c index d08b3fe9181c..7f78bc63c1ab 100644 --- a/sys/powerpc/powermac/platform_powermac.c +++ b/sys/powerpc/powermac/platform_powermac.c @@ -68,7 +68,9 @@ static int powermac_smp_get_bsp(platform_t, struct cpuref *cpuref); static int powermac_smp_start_cpu(platform_t, struct pcpu *cpu); static void powermac_smp_timebase_sync(platform_t, u_long tb, int ap); static void powermac_reset(platform_t); +#ifndef __powerpc64__ static void powermac_sleep(platform_t); +#endif static platform_method_t powermac_methods[] = { PLATFORMMETHOD(platform_probe, powermac_probe), @@ -83,7 +85,9 @@ static platform_method_t powermac_methods[] = { PLATFORMMETHOD(platform_smp_timebase_sync, powermac_smp_timebase_sync), PLATFORMMETHOD(platform_reset, powermac_reset), +#ifndef __powerpc64__ PLATFORMMETHOD(platform_sleep, powermac_sleep), +#endif PLATFORMMETHOD_END }; @@ -404,10 +408,17 @@ powermac_reset(platform_t platform) OF_reboot(); } +#ifndef __powerpc64__ void powermac_sleep(platform_t platform) { + /* Only supports MPC745x for now. */ + if (!MPC745X_P(mfspr(SPR_PVR) >> 16)) { + printf("sleep only supported for G4 PowerMac hardware.\n"); + return; + } *(unsigned long *)0x80 = 0x100; - cpu_sleep(); + mpc745x_sleep(); } +#endif From owner-dev-commits-src-all@freebsd.org Wed Mar 31 18:34:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3D335ABCEA; Wed, 31 Mar 2021 18:34:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9ZjT6RMsz4T5Q; Wed, 31 Mar 2021 18:34:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D00051E458; Wed, 31 Mar 2021 18:34:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VIYbos007238; Wed, 31 Mar 2021 18:34:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VIYblM007237; Wed, 31 Mar 2021 18:34:37 GMT (envelope-from git) Date: Wed, 31 Mar 2021 18:34:37 GMT Message-Id: <202103311834.12VIYblM007237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 921716186f12 - main - powerpc/aim: Update timebase directly on resume instead of through platform MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 921716186f121a2f6a27178cb302415f37412a79 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 18:34:38 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=921716186f121a2f6a27178cb302415f37412a79 commit 921716186f121a2f6a27178cb302415f37412a79 Author: Justin Hibbits AuthorDate: 2021-03-31 16:54:27 +0000 Commit: Justin Hibbits CommitDate: 2021-03-31 18:34:06 +0000 powerpc/aim: Update timebase directly on resume instead of through platform This only works on single-CPU G4 systems, and more work is needed for dual-CPU systems. That said, platform sleep does not work, and this is currently only used for PMU-based CPU speed change. The elimination of the platform_smp_timebase_sync() call is so that the timebase sync rendezvous can be enhanced to perform better synchronization, which requires a full rendezvous. This would be impossible to do on this single-threaded run. --- sys/powerpc/aim/aim_machdep.c | 3 ++- sys/powerpc/aim/mp_cpudep.c | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/powerpc/aim/aim_machdep.c b/sys/powerpc/aim/aim_machdep.c index b09089069c28..784207e9a70d 100644 --- a/sys/powerpc/aim/aim_machdep.c +++ b/sys/powerpc/aim/aim_machdep.c @@ -768,7 +768,8 @@ mpc745x_sleep() while (1) mtmsr(msr); } - platform_smp_timebase_sync(timebase, 0); + /* XXX: The mttb() means this *only* works on single-CPU systems. */ + mttb(timebase); PCPU_SET(curthread, curthread); PCPU_SET(curpcb, curthread->td_pcb); pmap_activate(curthread); diff --git a/sys/powerpc/aim/mp_cpudep.c b/sys/powerpc/aim/mp_cpudep.c index b5931786f8f7..33aae520c4b2 100644 --- a/sys/powerpc/aim/mp_cpudep.c +++ b/sys/powerpc/aim/mp_cpudep.c @@ -311,9 +311,6 @@ cpudep_ap_setup() vers = mfpvr() >> 16; - /* The following is needed for restoring from sleep. */ - platform_smp_timebase_sync(0, 1); - switch(vers) { case IBM970: case IBM970FX: From owner-dev-commits-src-all@freebsd.org Wed Mar 31 19:41:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9CE05AD5EB; Wed, 31 Mar 2021 19:41:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9cBB4yfnz4XFV; Wed, 31 Mar 2021 19:41:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80ABB1F27C; Wed, 31 Mar 2021 19:41:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VJf6di000686; Wed, 31 Mar 2021 19:41:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VJf6S8000685; Wed, 31 Mar 2021 19:41:06 GMT (envelope-from git) Date: Wed, 31 Mar 2021 19:41:06 GMT Message-Id: <202103311941.12VJf6S8000685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: cf76495e0a30 - main - AMD-vi: Fix mismatched NULL checking in amdiommu teardown path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf76495e0a30043503ef126f0a485e314730a221 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 19:41:06 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=cf76495e0a30043503ef126f0a485e314730a221 commit cf76495e0a30043503ef126f0a485e314730a221 Author: Ka Ho Ng AuthorDate: 2021-03-31 19:30:21 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-31 19:34:34 +0000 AMD-vi: Fix mismatched NULL checking in amdiommu teardown path Sponsored by: The FreeBSD Foundation Approved by: lwhsu (mentor) MFC with: 74ada297e897 --- sys/amd64/vmm/amd/amdiommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/vmm/amd/amdiommu.c b/sys/amd64/vmm/amd/amdiommu.c index 26c4b10d7807..8dceb1aa241b 100644 --- a/sys/amd64/vmm/amd/amdiommu.c +++ b/sys/amd64/vmm/amd/amdiommu.c @@ -165,7 +165,7 @@ ivhd_teardown_intr(device_t dev) sc = device_get_softc(dev); - if (sc->event_res != NULL) { + if (sc->event_tag != NULL) { bus_teardown_intr(dev, sc->event_res, sc->event_tag); sc->event_tag = NULL; } From owner-dev-commits-src-all@freebsd.org Wed Mar 31 19:56:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D8925ADE16; Wed, 31 Mar 2021 19:56:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9cWQ2BXNz4Y9S; Wed, 31 Mar 2021 19:56:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A08A1F743; Wed, 31 Mar 2021 19:56:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VJu2Aa019211; Wed, 31 Mar 2021 19:56:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VJu2TK019210; Wed, 31 Mar 2021 19:56:02 GMT (envelope-from git) Date: Wed, 31 Mar 2021 19:56:02 GMT Message-Id: <202103311956.12VJu2TK019210@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Jonathan T. Looney" Subject: git: 40d278253d20 - releng/13.0 - Fetch the sigfastblock value in syscalls that wait for signals MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jtl X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 40d278253d205f35ec368c93b7400baddda1b81e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 19:56:02 -0000 The branch releng/13.0 has been updated by jtl: URL: https://cgit.FreeBSD.org/src/commit/?id=40d278253d205f35ec368c93b7400baddda1b81e commit 40d278253d205f35ec368c93b7400baddda1b81e Author: Jonathan T. Looney AuthorDate: 2021-03-12 18:14:17 +0000 Commit: Jonathan T. Looney CommitDate: 2021-03-31 19:55:24 +0000 Fetch the sigfastblock value in syscalls that wait for signals We have seen several cases of processes which have become "stuck" in kern_sigsuspend(). When this occurs, the kernel's td_sigblock_val is set to 0x10 (one block outstanding) and the userspace copy of the word is set to 0 (unblocked). Because the kernel's cached value shows that signals are blocked, kern_sigsuspend() blocks almost all signals, which means the process hangs indefinitely in sigsuspend(). It is not entirely clear what is causing this condition to occur. However, it seems to make sense to add some protection against this case by fetching the latest sigfastblock value from userspace for syscalls which will sleep waiting for signals. Here, the change is applied to kern_sigsuspend() and kern_sigtimedwait(). Approved by: re (gjb) (cherry picked from commit dbec10e08808e375365fb2a2462f306e0cdfda32) (cherry picked from commit a25c17022e2d6344dcbc6192af276d2798d76d44) --- sys/kern/kern_sig.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 7884b5be9f91..3d55405d3151 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1268,6 +1268,9 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, ksiginfo_t *ksi, ets.tv_nsec = 0; traced = false; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { timevalid = 1; @@ -1527,6 +1530,9 @@ kern_sigsuspend(struct thread *td, sigset_t mask) struct proc *p = td->td_proc; int has_sig, sig; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + /* * When returning from sigsuspend, we want * the old mask to be restored after the From owner-dev-commits-src-all@freebsd.org Wed Mar 31 20:09:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 424EA5AE3DA; Wed, 31 Mar 2021 20:09:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9cpj1SFzz4Z19; Wed, 31 Mar 2021 20:09:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24DAC1F92A; Wed, 31 Mar 2021 20:09:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VK9HvI034281; Wed, 31 Mar 2021 20:09:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VK9Hie034280; Wed, 31 Mar 2021 20:09:17 GMT (envelope-from git) Date: Wed, 31 Mar 2021 20:09:17 GMT Message-Id: <202103312009.12VK9Hie034280@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: b7fbdb5042c6 - releng/13.0 - Fix nexhtop group index array scaling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: b7fbdb5042c619221ee0b97573affcb8bcb59458 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 20:09:17 -0000 The branch releng/13.0 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=b7fbdb5042c619221ee0b97573affcb8bcb59458 commit b7fbdb5042c619221ee0b97573affcb8bcb59458 Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:00:17 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-31 20:00:10 +0000 Fix nexhtop group index array scaling. The current code has the limit of 127 nexthop groups due to the wrongly-checked bitmask_copy() return value. PR: 254303 Reported by: Aleks Approved by: re (gjb) (cherry picked from commit 923e7f7e12670e97b097a195e69c848a6e8773a2) --- sys/net/route/nhgrp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/route/nhgrp.c b/sys/net/route/nhgrp.c index c25f4f09865b..f6638b12ebea 100644 --- a/sys/net/route/nhgrp.c +++ b/sys/net/route/nhgrp.c @@ -243,8 +243,8 @@ consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, uint32_t new_id CHT_SLIST_RESIZE(&ctl->gr_head, mpath, nh_ptr, new_nh_buckets); } if (nh_idx_ptr != NULL) { - if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items)) - bitmask_swap(&ctl->nh_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); + if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items) == 0) + bitmask_swap(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); } NHOPS_WUNLOCK(ctl); From owner-dev-commits-src-all@freebsd.org Wed Mar 31 20:09:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 636D55AE4FA; Wed, 31 Mar 2021 20:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9cpk2MyLz4Z87; Wed, 31 Mar 2021 20:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 445A71F92B; Wed, 31 Mar 2021 20:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VK9ISi034304; Wed, 31 Mar 2021 20:09:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VK9IWZ034303; Wed, 31 Mar 2021 20:09:18 GMT (envelope-from git) Date: Wed, 31 Mar 2021 20:09:18 GMT Message-Id: <202103312009.12VK9IWZ034303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0e7f02a1a996 - releng/13.0 - Zero `struct weightened_nhop` fields in nhgrp_get_addition_group(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 0e7f02a1a996960895d7cf8a39a407bcdb43168c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 20:09:18 -0000 The branch releng/13.0 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0e7f02a1a996960895d7cf8a39a407bcdb43168c commit 0e7f02a1a996960895d7cf8a39a407bcdb43168c Author: Alexander V. Chernikov AuthorDate: 2021-03-20 08:26:03 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-31 20:00:10 +0000 Zero `struct weightened_nhop` fields in nhgrp_get_addition_group(). `struct weightened_nhop` has spare 32bit between the fields due to the alignment (on amd64). Not zeroing these spare bits results in duplicating nhop groups in the kernel due to the way how comparison works. Approved by: re (gjb) (cherry picked from commit 6f43c72b472ee78e04f1ebd347ca0ae7787ee876) --- sys/net/route/nhgrp_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index b329b907144f..b228c3bcee37 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -646,7 +646,7 @@ nhgrp_get_addition_group(struct rib_head *rh, struct route_nhop_data *rnd_orig, { struct nh_control *ctl = rh->nh_control; struct nhgrp_priv *nhg_priv; - struct weightened_nhop wn[2]; + struct weightened_nhop wn[2] = {}; int error; if (rnd_orig->rnd_nhop == NULL) { From owner-dev-commits-src-all@freebsd.org Wed Mar 31 20:59:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D18F5B07E4; Wed, 31 Mar 2021 20:59:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9dwQ384dz4dQ3; Wed, 31 Mar 2021 20:59:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EC3D20505; Wed, 31 Mar 2021 20:59:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VKxI4B003925; Wed, 31 Mar 2021 20:59:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VKxIOM003924; Wed, 31 Mar 2021 20:59:18 GMT (envelope-from git) Date: Wed, 31 Mar 2021 20:59:18 GMT Message-Id: <202103312059.12VKxIOM003924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 4084b1ab0413 - main - Fix `netstat -rs` reporting. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4084b1ab0413d15dab496b1c24c3875601c71438 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2021 20:59:18 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=4084b1ab0413d15dab496b1c24c3875601c71438 commit 4084b1ab0413d15dab496b1c24c3875601c71438 Author: Alexander V. Chernikov AuthorDate: 2021-03-31 20:56:26 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-31 20:59:10 +0000 Fix `netstat -rs` reporting. rttrash (unused but not yet delete entries) were eliminated during routing rework. Remove reading these symbols from the kernel. PR: 254681 Reported by: rashey@superbox.pl MFC after: immediately --- usr.bin/netstat/nlist_symbols | 1 - usr.bin/netstat/route.c | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/usr.bin/netstat/nlist_symbols b/usr.bin/netstat/nlist_symbols index afad45d353bd..1c09d81c0b98 100644 --- a/usr.bin/netstat/nlist_symbols +++ b/usr.bin/netstat/nlist_symbols @@ -39,7 +39,6 @@ all _rip6stat all _ripcbinfo all _rtree all _rtstat -all _rttrash all _sctpstat all _sfstat all _tcbinfo diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index ba47a4b56ac5..317e3ffb9607 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -699,19 +699,13 @@ void rt_stats(void) { struct rtstat rtstat; - u_long rtsaddr, rttaddr; - int rttrash; + u_long rtsaddr; if ((rtsaddr = nl[N_RTSTAT].n_value) == 0) { xo_emit("{W:rtstat: symbol not in namelist}\n"); return; } - if ((rttaddr = nl[N_RTTRASH].n_value) == 0) { - xo_emit("{W:rttrash: symbol not in namelist}\n"); - return; - } kread_counters(rtsaddr, (char *)&rtstat, sizeof (rtstat)); - kread(rttaddr, (char *)&rttrash, sizeof (rttrash)); xo_emit("{T:routing}:\n"); #define p(f, m) if (rtstat.f || sflag <= 1) \ @@ -728,9 +722,4 @@ rt_stats(void) p(rts_wildcard, "\t{:wildcard-uses/%ju} " "{N:/use%s of a wildcard route}\n"); #undef p - - if (rttrash || sflag <= 1) - xo_emit("\t{:unused-but-not-freed/%u} " - "{N:/route%s not in table but not freed}\n", - rttrash, plural(rttrash)); } From owner-dev-commits-src-all@freebsd.org Thu Apr 1 04:04:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 272155BAECF; Thu, 1 Apr 2021 04:04:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9qMY0gVTz3Jh6; Thu, 1 Apr 2021 04:04:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A05D25C5A; Thu, 1 Apr 2021 04:04:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13144uwN007066; Thu, 1 Apr 2021 04:04:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13144ubt007065; Thu, 1 Apr 2021 04:04:56 GMT (envelope-from git) Date: Thu, 1 Apr 2021 04:04:56 GMT Message-Id: <202104010404.13144ubt007065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e7ccd5b4187d - main - loader: create a generic vendor sub-menu place holder MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e7ccd5b4187d15cd91697f1f4e12cf40e3ce86c3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 04:04:57 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e7ccd5b4187d15cd91697f1f4e12cf40e3ce86c3 commit e7ccd5b4187d15cd91697f1f4e12cf40e3ce86c3 Author: Warner Losh AuthorDate: 2021-03-31 00:35:29 +0000 Commit: Warner Losh CommitDate: 2021-04-01 04:02:02 +0000 loader: create a generic vendor sub-menu place holder Add a dummy vendor menu entry on the main welcome menu. Vendors can override this in their local.lua file to create whatever sub-menu they need for their products. Also fix the adding a 'welcome' entry as well based on a suggestion from Kyle. Silly option menu code also from Kyle. They seem to work for me, but any transcription error is likely mine. Reviewed by: kevans@ (the vendor stuff) --- stand/lua/menu.lua | 5 ++++ stand/lua/menu.lua.8 | 83 +++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 78 insertions(+), 10 deletions(-) diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index f7ca0a486ee4..8bc614378d5b 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -257,6 +257,7 @@ menu.welcome = { menu_entries.zpool_checkpoints, menu_entries.boot_envs, menu_entries.chainload, + menu_entries.vendor, } end, all_entries = { @@ -400,6 +401,10 @@ menu.welcome = { end, alias = {"l", "L"}, }, + vendor = { + entry_type = core.MENU_ENTRY, + visible = false, + }, }, } diff --git a/stand/lua/menu.lua.8 b/stand/lua/menu.lua.8 index 4358981d4755..82863791903d 100644 --- a/stand/lua/menu.lua.8 +++ b/stand/lua/menu.lua.8 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2018 +.Dd March 31, 2021 .Dt MENU.LUA 8 .Os .Sh NAME @@ -204,19 +204,82 @@ To add another option to the welcome menu: local core = require("core") local menu = require("menu") +local my_entry = { + entry_type = core.MENU_ENTRY, + name = "Fancy Boot", + func = core.boot, +}, + +local stock_entries = menu.welcome.entries +function menu.welcome.entries() + local ents = stock_entries() + ents[#ents + 1] = my_entry + return ents +end +.Ed +.Pp +To create a vendor submenu or other vendor menu option, +override +.Ic menu.welcome.all_entires.vendor +like so: +.Pp +.Bd -literal -offset indent -compact +local core = require("core") +local menu = require("menu") + +-- Fill in with vendor specific entries +local vendor_options = { + entries = { + ... + }, +} + local welcome_entries = menu.welcome.all_entries -welcome_entries[#welcome_entries + 1] = { - entry_type = core.MENU_CAROUSEL_ENTRY, - carousel_id = "unique_boot_entry_name", - items = {"NO", "YES"}, - name = function(_, choice, _) - return "Option: " .. choice +welcome_entries.vendor = { + entry_type = core.MENU_SUBMENU, + name = color.highlight("V") .. "endor Options", + submenu = vendor_options, + alias = {"v", "V"}, +} +.Ed +In the above example, +.Ic vendor_options +is a local variable that defines the vendor submenu. +.Pp +To add an additional option, change the +.Ic menu.boot_options.entries +array. +The following illustrates this concept: +.Pp +.Bd -literal -offset indent -compact +-- This is a silly example that rotates local_option through the values +-- 0 to 4. local_option would still need to be used elsewhere. +local local_option = 0 + +-- The `entries` of a menu may either be a table or a function. In this +-- example we're augmenting a menu that just has a static table, but if we +-- wanted to be more robust then we would need to instead check the type +-- of `stock_options` here to determine our next move. +-- +-- If `entries` is a table, then the stock menu system won't be changing it +-- so we can just add our menu option as we do below. +-- +-- If `entries` is a function, then we would need to provide a new function to +-- replace `entries` that does a core.deepCopyTable() of the result and adds +-- the below item to it. The deep copy is necessary to avoid duplicating our +-- new menu item and allowing the menu to alter its behavior however it pleases. +local stock_options = menu.boot_options.entries +stock_options[#stock_options + 1] = { + entry_type = core.MENU_ENTRY, + name = function() + return color.highlight('L') .. + "ocal Option : " .. local_option end, - func = function(_, _, _) - loader.setenv("some_envvar", "some_value") + func = function() + local_option = (local_option + 1) % 5 end, + alias= {"l", "L"} } -.Ed .Sh SEE ALSO .Xr loader.conf 5 , .Xr core.lua 8 , From owner-dev-commits-src-all@freebsd.org Thu Apr 1 04:37:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A252E5BBE95; Thu, 1 Apr 2021 04:37:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9r4p2nXHz3LdZ; Thu, 1 Apr 2021 04:37:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E53C2652B; Thu, 1 Apr 2021 04:37:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1314bEgl049096; Thu, 1 Apr 2021 04:37:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1314bEpg049095; Thu, 1 Apr 2021 04:37:14 GMT (envelope-from git) Date: Thu, 1 Apr 2021 04:37:14 GMT Message-Id: <202104010437.1314bEpg049095@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 556e66b7b076 - main - luaboot: visible must be a function MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 556e66b7b0763d36ddf5af98d06a1a13090bb729 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 04:37:14 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=556e66b7b0763d36ddf5af98d06a1a13090bb729 commit 556e66b7b0763d36ddf5af98d06a1a13090bb729 Author: Warner Losh AuthorDate: 2021-04-01 04:34:50 +0000 Commit: Warner Losh CommitDate: 2021-04-01 04:35:52 +0000 luaboot: visible must be a function Visible needs to be a function. Looks like I tested the wrong thing. --- stand/lua/menu.lua | 4 +++- stand/lua/menu.lua.8 | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index 8bc614378d5b..a6470e9f70ef 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -403,7 +403,9 @@ menu.welcome = { }, vendor = { entry_type = core.MENU_ENTRY, - visible = false, + visible = function() + return false + end }, }, } diff --git a/stand/lua/menu.lua.8 b/stand/lua/menu.lua.8 index 82863791903d..38655414258f 100644 --- a/stand/lua/menu.lua.8 +++ b/stand/lua/menu.lua.8 @@ -240,6 +240,9 @@ welcome_entries.vendor = { name = color.highlight("V") .. "endor Options", submenu = vendor_options, alias = {"v", "V"}, + visible = function() + return true + end, } .Ed In the above example, From owner-dev-commits-src-all@freebsd.org Thu Apr 1 05:33:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 145585B6627; Thu, 1 Apr 2021 05:33:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9sLD03tqz4Zdf; Thu, 1 Apr 2021 05:33:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9248270FA; Thu, 1 Apr 2021 05:33:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1315XtpX032589; Thu, 1 Apr 2021 05:33:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1315Xtja032588; Thu, 1 Apr 2021 05:33:55 GMT (envelope-from git) Date: Thu, 1 Apr 2021 05:33:55 GMT Message-Id: <202104010533.1315Xtja032588@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 5a18515b3143 - main - sh: silence sanitizer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a18515b3143792135881ce64e2380115c4744c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 05:33:56 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=5a18515b3143792135881ce64e2380115c4744c1 commit 5a18515b3143792135881ce64e2380115c4744c1 Author: Piotr Pawel Stefaniak AuthorDate: 2021-04-01 05:31:03 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-04-01 05:31:03 +0000 sh: silence sanitizer Don't add 0 to a null pointer. Reviewed by: jilles --- bin/sh/memalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c index a2191771386d..7ea31af050e5 100644 --- a/bin/sh/memalloc.c +++ b/bin/sh/memalloc.c @@ -227,7 +227,10 @@ popstackmark(struct stackmark *mark) } stacknxt = mark->stacknxt; stacknleft = mark->stacknleft; - sstrend = stacknxt + stacknleft; + if (stacknleft != 0) + sstrend = stacknxt + stacknleft; + else + sstrend = stacknxt; INTON; } From owner-dev-commits-src-all@freebsd.org Thu Apr 1 07:31:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8985B5C16CF; Thu, 1 Apr 2021 07:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9vyN3WWsz4q3t; Thu, 1 Apr 2021 07:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B57494C; Thu, 1 Apr 2021 07:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1317Vurw099863; Thu, 1 Apr 2021 07:31:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1317Vuu5099862; Thu, 1 Apr 2021 07:31:56 GMT (envelope-from git) Date: Thu, 1 Apr 2021 07:31:56 GMT Message-Id: <202104010731.1317Vuu5099862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 03efa462b2ab - main - AMD-vi: Mixed format IVHD block should replace fixed format IVHD block MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03efa462b2ab3ae8166598363e9e83d4e5cf0398 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 07:31:56 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=03efa462b2ab3ae8166598363e9e83d4e5cf0398 commit 03efa462b2ab3ae8166598363e9e83d4e5cf0398 Author: Ka Ho Ng AuthorDate: 2021-04-01 01:15:19 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-01 07:31:24 +0000 AMD-vi: Mixed format IVHD block should replace fixed format IVHD block This fixes double IVHD_SETUP_INTR calls on the same IOMMU device. Sponsored by: The FreeBSD Foundation MFC with: 74ada297e897 Reported by: Oleg Ginzburg Reviewed by: grehan Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D29521 --- sys/amd64/vmm/amd/ivrs_drv.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sys/amd64/vmm/amd/ivrs_drv.c b/sys/amd64/vmm/amd/ivrs_drv.c index 6291895c212f..1cd76069d0a2 100644 --- a/sys/amd64/vmm/amd/ivrs_drv.c +++ b/sys/amd64/vmm/amd/ivrs_drv.c @@ -312,14 +312,22 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE1 *ivhd, struct amdvi_softc *softc) static bool ivhd_is_newer(ACPI_IVRS_HEADER *old, ACPI_IVRS_HEADER *new) { - /* - * Newer IVRS header type take precedence. - */ - if ((old->DeviceId == new->DeviceId) && - (old->Type == IVRS_TYPE_HARDWARE_LEGACY) && - ((new->Type == IVRS_TYPE_HARDWARE_EFR) || - (new->Type == IVRS_TYPE_HARDWARE_MIXED))) { - return (true); + if (old->DeviceId == new->DeviceId) { + /* + * Newer IVRS header type take precedence. + */ + if (old->Type == IVRS_TYPE_HARDWARE_LEGACY && + ((new->Type == IVRS_TYPE_HARDWARE_EFR) || + (new->Type == IVRS_TYPE_HARDWARE_MIXED))) + return (true); + + /* + * Mixed format IVHD header type take precedence + * over fixed format IVHD header types. + */ + if (old->Type == IVRS_TYPE_HARDWARE_EFR && + new->Type == IVRS_TYPE_HARDWARE_MIXED) + return (true); } return (false); From owner-dev-commits-src-all@freebsd.org Thu Apr 1 07:59:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84E835C261D; Thu, 1 Apr 2021 07:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9wZ53MM7z4sC0; Thu, 1 Apr 2021 07:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 662901289; Thu, 1 Apr 2021 07:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1317xPJU029950; Thu, 1 Apr 2021 07:59:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1317xPWJ029949; Thu, 1 Apr 2021 07:59:25 GMT (envelope-from git) Date: Thu, 1 Apr 2021 07:59:25 GMT Message-Id: <202104010759.1317xPWJ029949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 3802433d25c9 - stable/12 - Fix warning about signed comparison and drop WARNS for ktrdump(8). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3802433d25c9274fe71f024bbf260aa1450a3e1a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 07:59:25 -0000 The branch stable/12 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=3802433d25c9274fe71f024bbf260aa1450a3e1a commit 3802433d25c9274fe71f024bbf260aa1450a3e1a Author: Dmitry Chagin AuthorDate: 2021-03-24 07:51:25 +0000 Commit: Dmitry Chagin CommitDate: 2021-04-01 07:52:34 +0000 Fix warning about signed comparison and drop WARNS for ktrdump(8). Reviewed By: jhb, imp Differential Revision: https://reviews.freebsd.org/D29381 (cherry picked from commit 9e5aeba51b431256adfd18b087ee61b09bfd6a79) --- usr.bin/ktrdump/Makefile | 2 -- usr.bin/ktrdump/ktrdump.c | 14 +++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/usr.bin/ktrdump/Makefile b/usr.bin/ktrdump/Makefile index 63cd2cf2cea9..796569977f0f 100644 --- a/usr.bin/ktrdump/Makefile +++ b/usr.bin/ktrdump/Makefile @@ -4,6 +4,4 @@ PROG= ktrdump LIBADD= kvm MAN= ktrdump.8 -WARNS?= 2 - .include diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c index 750f138f5485..bbe8fb19aae9 100644 --- a/usr.bin/ktrdump/ktrdump.c +++ b/usr.bin/ktrdump/ktrdump.c @@ -56,11 +56,11 @@ __FBSDID("$FreeBSD$"); static void usage(void); static struct nlist nl[] = { - { "_ktr_version" }, - { "_ktr_entries" }, - { "_ktr_idx" }, - { "_ktr_buf" }, - { NULL } + { .n_name = "_ktr_version" }, + { .n_name = "_ktr_entries" }, + { .n_name = "_ktr_idx" }, + { .n_name = "_ktr_buf" }, + { .n_name = NULL } }; static int cflag; @@ -262,7 +262,7 @@ main(int ac, char **av) fprintf(out, "\n"); } - tlast = -1; + tlast = UINTPTR_MAX; /* * Now tear through the trace buffer. * @@ -327,7 +327,7 @@ next: if ((c = *p++) == '\0') if (tflag) { tnow = (uintmax_t)buf[i].ktr_timestamp; if (rflag) { - if (tlast == -1) + if (tlast == UINTPTR_MAX) tlast = tnow; fprintf(out, "%16ju ", !iflag ? tlast - tnow : tnow - tlast); From owner-dev-commits-src-all@freebsd.org Thu Apr 1 08:01:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E3845C2EA0; Thu, 1 Apr 2021 08:01:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9wcZ21MKz4sgC; Thu, 1 Apr 2021 08:01:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38A8C12A2; Thu, 1 Apr 2021 08:01:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13181YYO040931; Thu, 1 Apr 2021 08:01:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13181Y8Z040930; Thu, 1 Apr 2021 08:01:34 GMT (envelope-from git) Date: Thu, 1 Apr 2021 08:01:34 GMT Message-Id: <202104010801.13181Y8Z040930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: b4dc951c417e - stable/13 - Fix warning about signed comparison and drop WARNS for ktrdump(8). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b4dc951c417ec3afbc7064c1c7c4d2ce9fe03ad9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 08:01:34 -0000 The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b4dc951c417ec3afbc7064c1c7c4d2ce9fe03ad9 commit b4dc951c417ec3afbc7064c1c7c4d2ce9fe03ad9 Author: Dmitry Chagin AuthorDate: 2021-03-24 07:51:25 +0000 Commit: Dmitry Chagin CommitDate: 2021-04-01 07:55:03 +0000 Fix warning about signed comparison and drop WARNS for ktrdump(8). Reviewed By: jhb, imp Differential Revision: https://reviews.freebsd.org/D29381 (cherry picked from commit 9e5aeba51b431256adfd18b087ee61b09bfd6a79) --- usr.bin/ktrdump/Makefile | 2 -- usr.bin/ktrdump/ktrdump.c | 14 +++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/usr.bin/ktrdump/Makefile b/usr.bin/ktrdump/Makefile index 63cd2cf2cea9..796569977f0f 100644 --- a/usr.bin/ktrdump/Makefile +++ b/usr.bin/ktrdump/Makefile @@ -4,6 +4,4 @@ PROG= ktrdump LIBADD= kvm MAN= ktrdump.8 -WARNS?= 2 - .include diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c index 750f138f5485..bbe8fb19aae9 100644 --- a/usr.bin/ktrdump/ktrdump.c +++ b/usr.bin/ktrdump/ktrdump.c @@ -56,11 +56,11 @@ __FBSDID("$FreeBSD$"); static void usage(void); static struct nlist nl[] = { - { "_ktr_version" }, - { "_ktr_entries" }, - { "_ktr_idx" }, - { "_ktr_buf" }, - { NULL } + { .n_name = "_ktr_version" }, + { .n_name = "_ktr_entries" }, + { .n_name = "_ktr_idx" }, + { .n_name = "_ktr_buf" }, + { .n_name = NULL } }; static int cflag; @@ -262,7 +262,7 @@ main(int ac, char **av) fprintf(out, "\n"); } - tlast = -1; + tlast = UINTPTR_MAX; /* * Now tear through the trace buffer. * @@ -327,7 +327,7 @@ next: if ((c = *p++) == '\0') if (tflag) { tnow = (uintmax_t)buf[i].ktr_timestamp; if (rflag) { - if (tlast == -1) + if (tlast == UINTPTR_MAX) tlast = tnow; fprintf(out, "%16ju ", !iflag ? tlast - tnow : tnow - tlast); From owner-dev-commits-src-all@freebsd.org Thu Apr 1 08:03:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B29B25C3294; Thu, 1 Apr 2021 08:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9wgK4gSYz4sp0; Thu, 1 Apr 2021 08:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 932D613B9; Thu, 1 Apr 2021 08:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13183vHr043757; Thu, 1 Apr 2021 08:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13183vQe043756; Thu, 1 Apr 2021 08:03:57 GMT (envelope-from git) Date: Thu, 1 Apr 2021 08:03:57 GMT Message-Id: <202104010803.13183vQe043756@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 529a2a0f2765 - main - tcp: For hostcache performance, use atomics instead of counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 529a2a0f2765f6c57c50a5af6be242c03bf714e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 08:03:57 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=529a2a0f2765f6c57c50a5af6be242c03bf714e3 commit 529a2a0f2765f6c57c50a5af6be242c03bf714e3 Author: Richard Scheffenegger AuthorDate: 2021-04-01 08:00:32 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-01 08:03:30 +0000 tcp: For hostcache performance, use atomics instead of counters As accessing the tcp hostcache happens frequently on some classes of servers, it was recommended to use atomic_add/subtract rather than (per-CPU distributed) counters, which have to be summed up at high cost to cache efficiency. PR: 254333 MFC after: 2 weeks Sponsored by: NetApp, Inc. Reviewed By: #transport, tuexen, jtl Differential Revision: https://reviews.freebsd.org/D29522 --- sys/netinet/tcp_hostcache.c | 24 +++++++++++------------- sys/netinet/tcp_hostcache.h | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 67da97405c3f..87023cc1a760 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -147,8 +147,8 @@ SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, bucketlimit, CTLFLAG_VNET | CTLFLAG_RDTUN, &VNET_NAME(tcp_hostcache.bucket_limit), 0, "Per-bucket hash limit for hostcache"); -SYSCTL_COUNTER_U64(_net_inet_tcp_hostcache, OID_AUTO, count, CTLFLAG_VNET | CTLFLAG_RD, - &VNET_NAME(tcp_hostcache.cache_count), +SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, count, CTLFLAG_VNET | CTLFLAG_RD, + &VNET_NAME(tcp_hostcache.cache_count), 0, "Current number of entries in hostcache"); SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, expire, CTLFLAG_VNET | CTLFLAG_RW, @@ -199,8 +199,7 @@ tcp_hc_init(void) /* * Initialize hostcache structures. */ - V_tcp_hostcache.cache_count = counter_u64_alloc(M_WAITOK); - counter_u64_zero(V_tcp_hostcache.cache_count); + atomic_store_int(&V_tcp_hostcache.cache_count, 0); V_tcp_hostcache.hashsize = TCP_HOSTCACHE_HASHSIZE; V_tcp_hostcache.bucket_limit = TCP_HOSTCACHE_BUCKETLIMIT; V_tcp_hostcache.expire = TCP_HOSTCACHE_EXPIRE; @@ -268,9 +267,6 @@ tcp_hc_destroy(void) /* Purge all hc entries. */ tcp_hc_purge_internal(1); - /* Release the counter */ - counter_u64_free(V_tcp_hostcache.cache_count); - /* Free the uma zone and the allocated hash table. */ uma_zdestroy(V_tcp_hostcache.zone); @@ -378,7 +374,7 @@ tcp_hc_insert(struct in_conninfo *inc) * If the bucket limit is reached, reuse the least-used element. */ if (hc_head->hch_length >= V_tcp_hostcache.bucket_limit || - counter_u64_fetch(V_tcp_hostcache.cache_count) >= V_tcp_hostcache.cache_limit) { + atomic_load_int(&V_tcp_hostcache.cache_count) >= V_tcp_hostcache.cache_limit) { hc_entry = TAILQ_LAST(&hc_head->hch_bucket, hc_qhead); /* * At first we were dropping the last element, just to @@ -395,7 +391,7 @@ tcp_hc_insert(struct in_conninfo *inc) } TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q); V_tcp_hostcache.hashbase[hash].hch_length--; - counter_u64_add(V_tcp_hostcache.cache_count, -1); + atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); TCPSTAT_INC(tcps_hc_bucketoverflow); #if 0 uma_zfree(V_tcp_hostcache.zone, hc_entry); @@ -428,7 +424,7 @@ tcp_hc_insert(struct in_conninfo *inc) */ TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); V_tcp_hostcache.hashbase[hash].hch_length++; - counter_u64_add(V_tcp_hostcache.cache_count, 1); + atomic_add_int(&V_tcp_hostcache.cache_count, 1); TCPSTAT_INC(tcps_hc_added); return hc_entry; @@ -644,7 +640,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) /* Optimize Buffer length query by sbin/sysctl */ if (req->oldptr == NULL) { - len = (counter_u64_fetch(V_tcp_hostcache.cache_count) + 1) * linesize; + len = (atomic_load_int(&V_tcp_hostcache.cache_count) + 1) * + linesize; return (SYSCTL_OUT(req, NULL, len)); } @@ -654,7 +651,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) } /* Use a buffer sized for one full bucket */ - sbuf_new_for_sysctl(&sb, NULL, V_tcp_hostcache.bucket_limit * linesize, req); + sbuf_new_for_sysctl(&sb, NULL, V_tcp_hostcache.bucket_limit * + linesize, req); sbuf_printf(&sb, "\nIP address MTU SSTRESH RTT RTTVAR " @@ -716,7 +714,7 @@ tcp_hc_purge_internal(int all) hc_entry, rmx_q); uma_zfree(V_tcp_hostcache.zone, hc_entry); V_tcp_hostcache.hashbase[i].hch_length--; - counter_u64_add(V_tcp_hostcache.cache_count, -1); + atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); } else hc_entry->rmx_expire -= V_tcp_hostcache.prune; } diff --git a/sys/netinet/tcp_hostcache.h b/sys/netinet/tcp_hostcache.h index b5237392acc2..2f7035c0c6af 100644 --- a/sys/netinet/tcp_hostcache.h +++ b/sys/netinet/tcp_hostcache.h @@ -74,7 +74,7 @@ struct tcp_hostcache { u_int hashsize; u_int hashmask; u_int bucket_limit; - counter_u64_t cache_count; + u_int cache_count; u_int cache_limit; int expire; int prune; From owner-dev-commits-src-all@freebsd.org Thu Apr 1 08:04:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A7B85C2FFD; Thu, 1 Apr 2021 08:04:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9wgX3Ltdz4svR; Thu, 1 Apr 2021 08:04:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63DE21420; Thu, 1 Apr 2021 08:04:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131848ar043904; Thu, 1 Apr 2021 08:04:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131848X8043903; Thu, 1 Apr 2021 08:04:08 GMT (envelope-from git) Date: Thu, 1 Apr 2021 08:04:08 GMT Message-Id: <202104010804.131848X8043903@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: f5209bef0f61 - stable/13 - Get rid of i386 ref here as linux64 is a 64-bit module. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f5209bef0f6103d3ccc2380d438e85a8a8367e52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 08:04:08 -0000 The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=f5209bef0f6103d3ccc2380d438e85a8a8367e52 commit f5209bef0f6103d3ccc2380d438e85a8a8367e52 Author: Dmitry Chagin AuthorDate: 2021-03-24 15:56:46 +0000 Commit: Dmitry Chagin CommitDate: 2021-04-01 08:03:35 +0000 Get rid of i386 ref here as linux64 is a 64-bit module. Reviewed By: emaste, imp Differential Revision: https://reviews.freebsd.org/D29412 (cherry picked from commit 88588c4b7611a39cdf965c3c07d8fcc13ed553b4) --- sys/modules/linux64/Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile index ebc69168bd4a..c081151e3fc5 100644 --- a/sys/modules/linux64/Makefile +++ b/sys/modules/linux64/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ .PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" .PATH: ${SRCTOP}/sys/x86/linux .endif @@ -16,16 +16,13 @@ SRCS= linux_fork.c linux_dummy_machdep.c linux_file.c linux_event.c \ opt_compat.h opt_inet6.h opt_posix.h opt_usb.h \ vnode_if.h device_if.h bus_if.h \ linux_support.s -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" SRCS+= linux_dummy_x86.c .endif DPSRCS= assym.inc linux_genassym.c # XXX: for assym.inc SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h -.if ${MACHINE_CPUARCH} == "i386" -SRCS+= opt_apic.h -.endif CLEANFILES= linux_assym.h linux_genassym.o linux_locore.o \ genassym.o From owner-dev-commits-src-all@freebsd.org Thu Apr 1 08:20:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB1655C344D; Thu, 1 Apr 2021 08:20:39 +0000 (UTC) (envelope-from zec@fer.hr) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on060d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::60d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9x2b50LMz4vB3; Thu, 1 Apr 2021 08:20:39 +0000 (UTC) (envelope-from zec@fer.hr) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iNVR0QLjJb9kXUTkKJzhsu7mBDFLDbPLiUgzAaBNOmnpWEz45p+tExcNA9CSQ8vRp8oNUKguuztIRj9EBGq064qchCZehyML4NWcbNHIweTjrdnSvExzzyGtfluiX/U1YbdZ4+8l6f/vQSYig8GcODej0ExDf0PSTqb9a3E3qZLO8JuNIKPxOJUKC0p7JJsReQQxfvIsu156b8CvdkBoMBcXnQzVFIVAgJlK7LGQSN+ivhph1lKsOuXJzlMHkOYvHysR67CwA93/WSXTO05mo8brwpmuPTA20F94yYsHcdRnG+OpH9Iguy7CeCr+F2moeytOBOjEXFYt/gXIsnr7jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FkrIPdtncAHjN3maqzE6Cjqa2/LbfX/vOOCya4M0CAw=; b=hW6XMyJ1ze1ql3eor5EezO5NGK8rUpCtfTVfRGfgbgv0plKaTQX8Xkd5VfXy1u1SrhUBt4fb0ruvtvbScHblioUA9P89r/GRrtHxGvDH2+Kwk98BKIl8SNOmuiZsZ+FoppJwk9nKeGdvThVwxBxD4MLo9IS3LELnoT+D8N5oxdbs7viK/AIohVnNk1WUcG7dmTBlgLiq2lt+ZmZQ7hv9Sv7qcAGaDEpqd7jl9P3u3aHnbGhuY7tYyWnikE/Qv/Y6hwxt7o06bqWoNLQQ/PFM+sHPKMu8u2BiANYXKEB3OR/dPi6j60QThws+U1z+QXE9JYdt1oO41/JTPUWA80Qnng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fer.hr; dmarc=pass action=none header.from=fer.hr; dkim=pass header.d=fer.hr; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ferhr.onmicrosoft.com; s=selector2-ferhr-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FkrIPdtncAHjN3maqzE6Cjqa2/LbfX/vOOCya4M0CAw=; b=BPfrAYbLXalyL0EElc1axmIFutjC78w32HKDTXXL+yK9irhRw+GMS7DzGslKTqxqRTtQHBuaYbQGdOC4+AVWw0aEJG+UVs5OaUiUt8PVlhgeDUegaSzXIN+ZRNu30Lm5SX91zfAcCPGHFA0+SmZxYyg7q4D9outdAMQPuHi9NCk= Received: from VE1PR08MB4783.eurprd08.prod.outlook.com (2603:10a6:802:a9::16) by VI1PR08MB3086.eurprd08.prod.outlook.com (2603:10a6:803:46::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Thu, 1 Apr 2021 08:20:34 +0000 Received: from VE1PR08MB4783.eurprd08.prod.outlook.com ([fe80::2033:5b9c:c1fa:e9a1]) by VE1PR08MB4783.eurprd08.prod.outlook.com ([fe80::2033:5b9c:c1fa:e9a1%7]) with mapi id 15.20.3999.027; Thu, 1 Apr 2021 08:20:34 +0000 Date: Thu, 1 Apr 2021 10:20:35 +0200 From: Marko Zec To: Richard Scheffenegger Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 529a2a0f2765 - main - tcp: For hostcache performance, use atomics instead of counters Message-ID: <20210401102035.19636bea@x23> In-Reply-To: <202104010803.13183vQe043756@gitrepo.freebsd.org> References: <202104010803.13183vQe043756@gitrepo.freebsd.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; amd64-portbld-freebsd11.4) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Originating-IP: [31.147.109.165] X-ClientProxiedBy: VI1PR0102CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:802::31) To VE1PR08MB4783.eurprd08.prod.outlook.com (2603:10a6:802:a9::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from x23 (31.147.109.165) by VI1PR0102CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:802::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Thu, 1 Apr 2021 08:20:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37cd6c79-1297-4b85-2efd-08d8f4e705ad X-MS-TrafficTypeDiagnostic: VI1PR08MB3086: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:663; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q72FpdUZEdXbox5tcr5tBhoKUT47GQi6cDGHerVYhHD1W45iqNvUM2I5KUfrgcYAfcUwtq5FOTV+dq9k31oj6xYtCU2LpzGQOLQvuPMbQcYf1LdtGJgmD/11ecI+QDD5PEsD4fIcT2/ULLJNe37EwH9kwVZboPjj2ydhsOeyj5+sHR/NFq/gkjBRmH2Tyzap4+I8sc7bGvg2IIGKU84dvb90IHzsPG3jUwlwXQWDWT+72C7uUt9GuLXCCrDKroUHmN2iNqacFRPsUv6Umi213oUDrHXGJEBgFcAaXYd51gqG/2y/p3zYWV+fBg34Kkitn9kLm877UX6hJlOSmvg4La4A0oBhS5YR+DwwCbxIBNlQLDvxHa2bC7mNBHyTl5vPlu5IBmLSSsftT6IkSDO8IIDCgoEqfsC+CVjvO5vEc2+CFobvHPz5aX2s9xEfQQKtfi1NS7X0Wtr8SM0R80Tvgc+vQ7WOHi7LTbATjiwSj/hFmUmR5jdRyCv3fq2+VGYuj+qgPbPmZ3gEApTlqDjg2nyJ9DzNGl5n2Jyt38PZx49vsrbd4mGYcp/1MrQOzeM1EF749km4y8QqsQgGYZy/9sTWfbYEXkvN4ARqRnsF3jpBARMi8U286wtY54pk2VeClcJhvAatvbGGfQ/68zDuCMm65sPUWpZpCsccg3T4uf/G4cUhCFVnhkedv0NGgGrbgVXUeGXrHo8QGAbw9pPA4ZtfztadiVtpttGGrS7Zhp0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4783.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(366004)(346002)(39830400003)(136003)(376002)(9576002)(66476007)(26005)(6916009)(316002)(33716001)(2906002)(86362001)(966005)(8676002)(5660300002)(8936002)(9686003)(786003)(4326008)(38100700001)(450100002)(83380400001)(66556008)(66946007)(16526019)(186003)(55016002)(956004)(6496006)(478600001)(52116002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?fFGJ6MD94tOjh2gwNe0nimTTuicUsaq3Sn1+VTrE2QpUclRn+0XE3aA6Rh0U?= =?us-ascii?Q?zBcblspK1hkEIyDqYpPJoRnoL6ZkycGU4aGxLgE+52U1dwDiaR669GkZg+L0?= =?us-ascii?Q?o2jfMNPj99IFerYwtox0VXlq4CS2z1wH3YekQ3ytutrfq/fSUwCVmu+FGZRt?= =?us-ascii?Q?gGJBRf8DvnqwKnzTV9zmo4uNo+A0YyojJaqlaGzRVA5/egEf4AkKsAHnN9AP?= =?us-ascii?Q?sQ/XQWZ5WGDKiQvrd+RRdQlKp4nvKw17x7dgbCbwXsISlXYxIC2vybNj8+kC?= =?us-ascii?Q?cB9WkzEzVl+43ULWds3lxrl2HOd35iocQ5+24hJUcsj5H/repaD0YYGnZ/Du?= =?us-ascii?Q?oNpH0QaIACnhlD6+J/DhCdSeCqmBef2OCJqNPEQtC1dkApXZAIjuIOIWnVYA?= =?us-ascii?Q?BbZsKCi0sqK7JigLvt9XOQRW4lTsadbAhyCoHZp/z8ul3JWhVqQuttRILKpC?= =?us-ascii?Q?6HISU2LoB+GFNBOX2tdM/0yS5EO1O+VEvVkeUXTMf9402UXvI8swCEkIPJ51?= =?us-ascii?Q?u/s1bZEw+fHOyBYj9qA3vIsHR+27ch1qr2tDwsTti69XPfjnA1qjXwKg/cft?= =?us-ascii?Q?tjv4gASp3ubQI7dCCdh1c92MVwOkEexkVIBysOMKtvWxn1XDn4O2fA07Lsdt?= =?us-ascii?Q?pchC+FPwCCeulddxGl2M9xyuAEe2wWep9DufMH+UWUHB6VSvVXeJokHWHBKJ?= =?us-ascii?Q?ktYN2JiB0ociG/yrdM1kgkFEHzp5V+lDqzHIOOKVystSqBfam18Ow0TG/reZ?= =?us-ascii?Q?DTUl0kBs5sQdpm5yWv5aIR+oHFnGnBjamqu1D4bSMpNnth1enGpBYK/COeF4?= =?us-ascii?Q?O4sK4n/V0iCXpyicbbI04pBRGHG7imolfn51jwgTAM5wxU9RVH7SS20vr3fr?= =?us-ascii?Q?a3r+6IkGW4eBi7qbX9oBU+QJOdzw/ODObAr3P//KDmxbu7DkeuGq1QKU2z4R?= =?us-ascii?Q?AC2Qqjs4XgW0K/NjZaMSsN/acM+SJ2BtTWuIKV52y4LezTrn1LHKh7V2Fuh8?= =?us-ascii?Q?ZZq3J8U5rLkHe1e3/Z8c5NkUWWY4VyyXxqIPyz7w96phAptXjNR+DiYZA25z?= =?us-ascii?Q?+GKTi4ertSXZzkpKPFPh7Z1yk36oQimfeql7SKFdjlMtIfW0M/WopmXfglt0?= =?us-ascii?Q?1Q7z+Z3RNEhuXCScay/VFgEcrM8JEeELx1IIBw1BpQEJvONB6y3oN1Yx5zpG?= =?us-ascii?Q?xEw85u2Isf6qkvCqh/0Rok82cT68p2DwCDMIGowH036WuFD7MSO2PDzhFt/D?= =?us-ascii?Q?Vb4T7EduvBHiSEvxPjVRA87/7lP5if2zEx6rtPn+iv6PL4y7eCEVSy2IBUvx?= =?us-ascii?Q?qG5kbDg0E+W4H497f374leQC?= X-OriginatorOrg: fer.hr X-MS-Exchange-CrossTenant-Network-Message-Id: 37cd6c79-1297-4b85-2efd-08d8f4e705ad X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4783.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2021 08:20:34.5022 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: ca71eddc-cc7b-4e5b-95bd-55b658e696be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mSrukNoHb47hKEL7xJ5BtT+tsVT+8cT7ttFZqS7NAMV2xaGQLDudgs0N9q7MwTF3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3086 X-Rspamd-Queue-Id: 4F9x2b50LMz4vB3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 08:20:40 -0000 On Thu, 1 Apr 2021 08:03:57 GMT Richard Scheffenegger wrote: > The branch main has been updated by rscheff: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=529a2a0f2765f6c57c50a5af6be242c03bf714e3 > > commit 529a2a0f2765f6c57c50a5af6be242c03bf714e3 > Author: Richard Scheffenegger > AuthorDate: 2021-04-01 08:00:32 +0000 > Commit: Richard Scheffenegger > CommitDate: 2021-04-01 08:03:30 +0000 > > tcp: For hostcache performance, use atomics instead of counters Is that an April 1st joke, or for real, since it appears to have hit the tree? > As accessing the tcp hostcache happens frequently on some > classes of servers, it was recommended Recommended by whom? > to use atomic_add/subtract > rather than (per-CPU distributed) counters, which have to be > summed up at high cost to cache efficiency. Numbers? > > PR: 254333 > MFC after: 2 weeks > Sponsored by: NetApp, Inc. > Reviewed By: #transport, tuexen, jtl > Differential Revision: https://reviews.freebsd.org/D29522 > --- > sys/netinet/tcp_hostcache.c | 24 +++++++++++------------- > sys/netinet/tcp_hostcache.h | 2 +- > 2 files changed, 12 insertions(+), 14 deletions(-) > > diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c > index 67da97405c3f..87023cc1a760 100644 > --- a/sys/netinet/tcp_hostcache.c > +++ b/sys/netinet/tcp_hostcache.c > @@ -147,8 +147,8 @@ SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, > bucketlimit, CTLFLAG_VNET | CTLFLAG_RDTUN, > &VNET_NAME(tcp_hostcache.bucket_limit), 0, "Per-bucket hash limit for > hostcache"); > -SYSCTL_COUNTER_U64(_net_inet_tcp_hostcache, OID_AUTO, count, > CTLFLAG_VNET | CTLFLAG_RD, > - &VNET_NAME(tcp_hostcache.cache_count), > +SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, count, CTLFLAG_VNET | > CTLFLAG_RD, > + &VNET_NAME(tcp_hostcache.cache_count), 0, > "Current number of entries in hostcache"); > > SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, expire, CTLFLAG_VNET | > CTLFLAG_RW, @@ -199,8 +199,7 @@ tcp_hc_init(void) > /* > * Initialize hostcache structures. > */ > - V_tcp_hostcache.cache_count = counter_u64_alloc(M_WAITOK); > - counter_u64_zero(V_tcp_hostcache.cache_count); > + atomic_store_int(&V_tcp_hostcache.cache_count, 0); > V_tcp_hostcache.hashsize = TCP_HOSTCACHE_HASHSIZE; > V_tcp_hostcache.bucket_limit = TCP_HOSTCACHE_BUCKETLIMIT; > V_tcp_hostcache.expire = TCP_HOSTCACHE_EXPIRE; > @@ -268,9 +267,6 @@ tcp_hc_destroy(void) > /* Purge all hc entries. */ > tcp_hc_purge_internal(1); > > - /* Release the counter */ > - counter_u64_free(V_tcp_hostcache.cache_count); > - > /* Free the uma zone and the allocated hash table. */ > uma_zdestroy(V_tcp_hostcache.zone); > > @@ -378,7 +374,7 @@ tcp_hc_insert(struct in_conninfo *inc) > * If the bucket limit is reached, reuse the least-used > element. */ > if (hc_head->hch_length >= V_tcp_hostcache.bucket_limit || > - counter_u64_fetch(V_tcp_hostcache.cache_count) >= > V_tcp_hostcache.cache_limit) { > + atomic_load_int(&V_tcp_hostcache.cache_count) >= > V_tcp_hostcache.cache_limit) { hc_entry = > TAILQ_LAST(&hc_head->hch_bucket, hc_qhead); /* > * At first we were dropping the last element, just > to @@ -395,7 +391,7 @@ tcp_hc_insert(struct in_conninfo *inc) > } > TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q); > V_tcp_hostcache.hashbase[hash].hch_length--; > - counter_u64_add(V_tcp_hostcache.cache_count, -1); > + atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); > TCPSTAT_INC(tcps_hc_bucketoverflow); > #if 0 > uma_zfree(V_tcp_hostcache.zone, hc_entry); > @@ -428,7 +424,7 @@ tcp_hc_insert(struct in_conninfo *inc) > */ > TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); > V_tcp_hostcache.hashbase[hash].hch_length++; > - counter_u64_add(V_tcp_hostcache.cache_count, 1); > + atomic_add_int(&V_tcp_hostcache.cache_count, 1); > TCPSTAT_INC(tcps_hc_added); > > return hc_entry; > @@ -644,7 +640,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) > > /* Optimize Buffer length query by sbin/sysctl */ > if (req->oldptr == NULL) { > - len = > (counter_u64_fetch(V_tcp_hostcache.cache_count) + 1) * linesize; > + len = (atomic_load_int(&V_tcp_hostcache.cache_count) > + 1) * > + linesize; > return (SYSCTL_OUT(req, NULL, len)); > } > > @@ -654,7 +651,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) > } > > /* Use a buffer sized for one full bucket */ > - sbuf_new_for_sysctl(&sb, NULL, V_tcp_hostcache.bucket_limit > * linesize, req); > + sbuf_new_for_sysctl(&sb, NULL, V_tcp_hostcache.bucket_limit * > + linesize, req); > > sbuf_printf(&sb, > "\nIP address MTU SSTRESH RTT RTTVAR " > @@ -716,7 +714,7 @@ tcp_hc_purge_internal(int all) > hc_entry, rmx_q); > uma_zfree(V_tcp_hostcache.zone, > hc_entry); V_tcp_hostcache.hashbase[i].hch_length--; > - > counter_u64_add(V_tcp_hostcache.cache_count, -1); > + > atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); } else > hc_entry->rmx_expire -= > V_tcp_hostcache.prune; } > diff --git a/sys/netinet/tcp_hostcache.h b/sys/netinet/tcp_hostcache.h > index b5237392acc2..2f7035c0c6af 100644 > --- a/sys/netinet/tcp_hostcache.h > +++ b/sys/netinet/tcp_hostcache.h > @@ -74,7 +74,7 @@ struct tcp_hostcache { > u_int hashsize; > u_int hashmask; > u_int bucket_limit; > - counter_u64_t cache_count; > + u_int cache_count; > u_int cache_limit; > int expire; > int prune; From owner-dev-commits-src-all@freebsd.org Thu Apr 1 09:11:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEEB65C590C; Thu, 1 Apr 2021 09:11:44 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9y9X4G93z3F76; Thu, 1 Apr 2021 09:11:44 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from [IPv6:2a02:8109:1140:c3d:5411:2b1c:5f67:463d] (unknown [IPv6:2a02:8109:1140:c3d:5411:2b1c:5f67:463d]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 4E2AC782946C6; Thu, 1 Apr 2021 11:11:40 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 529a2a0f2765 - main - tcp: For hostcache performance, use atomics instead of counters From: Michael Tuexen In-Reply-To: <20210401102035.19636bea@x23> Date: Thu, 1 Apr 2021 11:11:39 +0200 Cc: Richard Scheffenegger , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <9F675C09-14B6-4117-A079-90068E1D1E65@macmic.franken.de> References: <202104010803.13183vQe043756@gitrepo.freebsd.org> <20210401102035.19636bea@x23> To: Marko Zec X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4F9y9X4G93z3F76 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 09:11:44 -0000 > On 1. Apr 2021, at 10:20, Marko Zec wrote: >=20 > On Thu, 1 Apr 2021 08:03:57 GMT > Richard Scheffenegger wrote: >=20 >> The branch main has been updated by rscheff: >>=20 >> URL: >> = https://cgit.FreeBSD.org/src/commit/?id=3D529a2a0f2765f6c57c50a5af6be242c0= 3bf714e3 >>=20 >> commit 529a2a0f2765f6c57c50a5af6be242c03bf714e3 >> Author: Richard Scheffenegger >> AuthorDate: 2021-04-01 08:00:32 +0000 >> Commit: Richard Scheffenegger >> CommitDate: 2021-04-01 08:03:30 +0000 >>=20 >> tcp: For hostcache performance, use atomics instead of counters >=20 > Is that an April 1st joke, or for real, since it appears to have hit > the tree? >=20 >> As accessing the tcp hostcache happens frequently on some >> classes of servers, it was recommended >=20 > Recommended by whom? See https://reviews.freebsd.org/D29510#661680 Best regards Michael >=20 >> to use atomic_add/subtract >> rather than (per-CPU distributed) counters, which have to be >> summed up at high cost to cache efficiency. >=20 > Numbers? >=20 >>=20 >> PR: 254333 >> MFC after: 2 weeks >> Sponsored by: NetApp, Inc. >> Reviewed By: #transport, tuexen, jtl >> Differential Revision: https://reviews.freebsd.org/D29522 >> --- >> sys/netinet/tcp_hostcache.c | 24 +++++++++++------------- >> sys/netinet/tcp_hostcache.h | 2 +- >> 2 files changed, 12 insertions(+), 14 deletions(-) >>=20 >> diff --git a/sys/netinet/tcp_hostcache.c = b/sys/netinet/tcp_hostcache.c >> index 67da97405c3f..87023cc1a760 100644 >> --- a/sys/netinet/tcp_hostcache.c >> +++ b/sys/netinet/tcp_hostcache.c >> @@ -147,8 +147,8 @@ SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, >> bucketlimit, CTLFLAG_VNET | CTLFLAG_RDTUN, >> &VNET_NAME(tcp_hostcache.bucket_limit), 0, "Per-bucket hash limit for >> hostcache");=20 >> -SYSCTL_COUNTER_U64(_net_inet_tcp_hostcache, OID_AUTO, count, >> CTLFLAG_VNET | CTLFLAG_RD, >> - &VNET_NAME(tcp_hostcache.cache_count), >> +SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, count, CTLFLAG_VNET | >> CTLFLAG_RD, >> + &VNET_NAME(tcp_hostcache.cache_count), 0, >> "Current number of entries in hostcache"); >>=20 >> SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, expire, CTLFLAG_VNET | >> CTLFLAG_RW, @@ -199,8 +199,7 @@ tcp_hc_init(void) >> /* >> * Initialize hostcache structures. >> */ >> - V_tcp_hostcache.cache_count =3D counter_u64_alloc(M_WAITOK); >> - counter_u64_zero(V_tcp_hostcache.cache_count); >> + atomic_store_int(&V_tcp_hostcache.cache_count, 0); >> V_tcp_hostcache.hashsize =3D TCP_HOSTCACHE_HASHSIZE; >> V_tcp_hostcache.bucket_limit =3D TCP_HOSTCACHE_BUCKETLIMIT; >> V_tcp_hostcache.expire =3D TCP_HOSTCACHE_EXPIRE; >> @@ -268,9 +267,6 @@ tcp_hc_destroy(void) >> /* Purge all hc entries. */ >> tcp_hc_purge_internal(1); >>=20 >> - /* Release the counter */ >> - counter_u64_free(V_tcp_hostcache.cache_count); >> - >> /* Free the uma zone and the allocated hash table. */ >> uma_zdestroy(V_tcp_hostcache.zone); >>=20 >> @@ -378,7 +374,7 @@ tcp_hc_insert(struct in_conninfo *inc) >> * If the bucket limit is reached, reuse the least-used >> element. */ >> if (hc_head->hch_length >=3D V_tcp_hostcache.bucket_limit || >> - counter_u64_fetch(V_tcp_hostcache.cache_count) >=3D >> V_tcp_hostcache.cache_limit) { >> + atomic_load_int(&V_tcp_hostcache.cache_count) >=3D >> V_tcp_hostcache.cache_limit) { hc_entry =3D >> TAILQ_LAST(&hc_head->hch_bucket, hc_qhead); /* >> * At first we were dropping the last element, just >> to @@ -395,7 +391,7 @@ tcp_hc_insert(struct in_conninfo *inc) >> } >> TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q); >> V_tcp_hostcache.hashbase[hash].hch_length--; >> - counter_u64_add(V_tcp_hostcache.cache_count, -1); >> + atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); >> TCPSTAT_INC(tcps_hc_bucketoverflow); >> #if 0 >> uma_zfree(V_tcp_hostcache.zone, hc_entry); >> @@ -428,7 +424,7 @@ tcp_hc_insert(struct in_conninfo *inc) >> */ >> TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); >> V_tcp_hostcache.hashbase[hash].hch_length++; >> - counter_u64_add(V_tcp_hostcache.cache_count, 1); >> + atomic_add_int(&V_tcp_hostcache.cache_count, 1); >> TCPSTAT_INC(tcps_hc_added); >>=20 >> return hc_entry; >> @@ -644,7 +640,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) >>=20 >> /* Optimize Buffer length query by sbin/sysctl */ >> if (req->oldptr =3D=3D NULL) { >> - len =3D >> (counter_u64_fetch(V_tcp_hostcache.cache_count) + 1) * linesize; >> + len =3D (atomic_load_int(&V_tcp_hostcache.cache_count) >> + 1) * >> + linesize; >> return (SYSCTL_OUT(req, NULL, len)); >> } >>=20 >> @@ -654,7 +651,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) >> } >>=20 >> /* Use a buffer sized for one full bucket */ >> - sbuf_new_for_sysctl(&sb, NULL, V_tcp_hostcache.bucket_limit >> * linesize, req); >> + sbuf_new_for_sysctl(&sb, NULL, V_tcp_hostcache.bucket_limit * >> + linesize, req); >>=20 >> sbuf_printf(&sb, >> "\nIP address MTU SSTRESH RTT RTTVAR " >> @@ -716,7 +714,7 @@ tcp_hc_purge_internal(int all) >> hc_entry, rmx_q); >> uma_zfree(V_tcp_hostcache.zone, >> hc_entry); V_tcp_hostcache.hashbase[i].hch_length--; >> - >> counter_u64_add(V_tcp_hostcache.cache_count, -1); >> + >> atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); } else >> hc_entry->rmx_expire -=3D >> V_tcp_hostcache.prune; } >> diff --git a/sys/netinet/tcp_hostcache.h = b/sys/netinet/tcp_hostcache.h >> index b5237392acc2..2f7035c0c6af 100644 >> --- a/sys/netinet/tcp_hostcache.h >> +++ b/sys/netinet/tcp_hostcache.h >> @@ -74,7 +74,7 @@ struct tcp_hostcache { >> u_int hashsize; >> u_int hashmask; >> u_int bucket_limit; >> - counter_u64_t cache_count; >> + u_int cache_count; >> u_int cache_limit; >> int expire; >> int prune; >=20 From owner-dev-commits-src-all@freebsd.org Thu Apr 1 09:16:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08E0F5C57AE; Thu, 1 Apr 2021 09:16:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9yHX6tTpz3FQF; Thu, 1 Apr 2021 09:16:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAD5F1F52; Thu, 1 Apr 2021 09:16:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1319GuOj042113; Thu, 1 Apr 2021 09:16:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319Guww042112; Thu, 1 Apr 2021 09:16:56 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:16:56 GMT Message-Id: <202104010916.1319Guww042112@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 484bc45f544a - stable/13 - MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 484bc45f544a10790e866d683ecfe05846107c09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 09:16:57 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=484bc45f544a10790e866d683ecfe05846107c09 commit 484bc45f544a10790e866d683ecfe05846107c09 Author: Hans Petter Selasky AuthorDate: 2021-03-09 16:41:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:13:10 +0000 MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. Differential Revision: https://reviews.freebsd.org/D28032 Suggested by: Shichun_Ma@Dell.com Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 31070b5bc77a499009a835650eb9d4bf2eceaa15) --- sys/dev/sound/usb/uaudio.c | 199 +++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 95 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 095078b47e65..538e4180f6de 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -945,6 +945,27 @@ uaudio_set_spdif_dummy(struct uaudio_softc *sc, int flags) return (0); } +static usb_error_t +uaudio_force_power_save(struct uaudio_softc *sc, uint8_t iface_index) +{ + struct usb_interface *iface; + usb_error_t err; + + iface = usbd_get_iface(sc->sc_udev, iface_index); + if (iface == NULL || iface->idesc == NULL) + return (USB_ERR_INVAL); + + /* check if correct alternate setting is already selected */ + if (iface->alt_index == 0) { + /* force power save mode by selecting default alternate setting */ + err = usbd_req_set_alt_interface_no(sc->sc_udev, NULL, iface_index, + iface->idesc->bAlternateSetting); + } else { + err = usbd_set_alt_interface_index(sc->sc_udev, iface_index, 0); + } + return (err); +} + static int uaudio_attach(device_t dev) { @@ -1019,16 +1040,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_play_chan[i].usb_alt[0].iface_index, - sc->sc_play_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_play_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_play_chan[i].num_alt; x++) { device_printf(dev, "Play[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1049,16 +1070,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_rec_chan[i].usb_alt[0].iface_index, - sc->sc_rec_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_rec_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_rec_chan[i].num_alt; x++) { device_printf(dev, "Record[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1307,7 +1328,7 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, uint32_t frames; uint32_t buf_size; uint16_t fps; - uint8_t set_alt; + uint8_t next_alt; uint8_t fps_shift; uint8_t operation; usb_error_t err; @@ -1319,22 +1340,51 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, usb_proc_explore_lock(sc->sc_udev); operation = chan->operation; - chan->operation = CHAN_OP_NONE; + switch (operation) { + case CHAN_OP_START: + case CHAN_OP_STOP: + chan->operation = CHAN_OP_NONE; + break; + default: + break; + } usb_proc_explore_unlock(sc->sc_udev); - mtx_lock(chan->pcm_mtx); - if (chan->cur_alt != chan->set_alt) - set_alt = chan->set_alt; - else - set_alt = CHAN_MAX_ALT; - mtx_unlock(chan->pcm_mtx); + switch (operation) { + case CHAN_OP_STOP: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); - if (set_alt >= chan->num_alt) - goto done; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = CHAN_MAX_ALT; + mtx_unlock(chan->pcm_mtx); - chan_alt = chan->usb_alt + set_alt; + /* + * The first alternate setting is typically used for + * power saving mode. Set this alternate setting as + * part of entering stop. + */ + err = usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, 0); + if (err) { + DPRINTF("setting of default alternate index failed: %s!\n", + usbd_errstr(err)); + } + return; - usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + case CHAN_OP_START: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + break; + + default: + return; + } + + mtx_lock(chan->pcm_mtx); + next_alt = chan->set_alt; + mtx_unlock(chan->pcm_mtx); + + chan_alt = chan->usb_alt + next_alt; err = usbd_set_alt_interface_index(sc->sc_udev, chan_alt->iface_index, chan_alt->iface_alt_index); @@ -1438,32 +1488,16 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, goto error; } - mtx_lock(chan->pcm_mtx); - chan->cur_alt = set_alt; - mtx_unlock(chan->pcm_mtx); - -done: #if (UAUDIO_NCHANBUFS != 2) -#error "please update code" +#error "Please update code below!" #endif - switch (operation) { - case CHAN_OP_START: - mtx_lock(chan->pcm_mtx); - usbd_transfer_start(chan->xfer[0]); - usbd_transfer_start(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - case CHAN_OP_STOP: - mtx_lock(chan->pcm_mtx); - usbd_transfer_stop(chan->xfer[0]); - usbd_transfer_stop(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - default: - break; - } - return; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = next_alt; + usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[1]); + mtx_unlock(chan->pcm_mtx); + return; error: usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); @@ -2746,27 +2780,24 @@ uaudio_chan_set_param_format(struct uaudio_chan *ch, uint32_t format) } static void -uaudio_chan_start_sub(struct uaudio_chan *ch) +uaudio_chan_reconfigure(struct uaudio_chan *ch, uint8_t operation) { struct uaudio_softc *sc = ch->priv_sc; - int do_start = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_start = 1; - } else { - ch->operation = CHAN_OP_START; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_start) { - usbd_transfer_start(ch->xfer[0]); - usbd_transfer_start(ch->xfer[1]); - } + + /* Check for shutdown. */ + if (ch->operation == CHAN_OP_DRAIN) + return; + + /* Set next operation. */ + ch->operation = operation; + + /* + * Because changing the alternate setting modifies the USB + * configuration, this part must be executed from the USB + * explore process. + */ + (void)usb_proc_explore_msignal(sc->sc_udev, + &sc->sc_config_msg[0], &sc->sc_config_msg[1]); } static int @@ -2819,10 +2850,10 @@ uaudio_chan_start(struct uaudio_chan *ch) * Start both endpoints because of need for * jitter information: */ - uaudio_chan_start_sub(&sc->sc_rec_chan[i]); - uaudio_chan_start_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_START); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_START); } else { - uaudio_chan_start_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_START); } } @@ -2830,30 +2861,6 @@ uaudio_chan_start(struct uaudio_chan *ch) usb_proc_explore_unlock(sc->sc_udev); } -static void -uaudio_chan_stop_sub(struct uaudio_chan *ch) -{ - struct uaudio_softc *sc = ch->priv_sc; - int do_stop = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_stop = 1; - } else { - ch->operation = CHAN_OP_STOP; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_stop) { - usbd_transfer_stop(ch->xfer[0]); - usbd_transfer_stop(ch->xfer[1]); - } -} - void uaudio_chan_stop(struct uaudio_chan *ch) { @@ -2882,10 +2889,10 @@ uaudio_chan_stop(struct uaudio_chan *ch) * Stop both endpoints in case the one was used for * jitter information: */ - uaudio_chan_stop_sub(&sc->sc_rec_chan[i]); - uaudio_chan_stop_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_STOP); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_STOP); } else { - uaudio_chan_stop_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_STOP); } } @@ -5961,9 +5968,11 @@ umidi_probe(device_t dev) if (usb_test_quirk(uaa, UQ_SINGLE_CMD_MIDI)) chan->single_command = 1; - if (usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, - chan->iface_alt_index)) { - DPRINTF("setting of alternate index failed!\n"); + error = usbd_set_alt_interface_index(sc->sc_udev, + chan->iface_index, chan->iface_alt_index); + if (error) { + DPRINTF("setting of alternate index failed: %s\n", + usbd_errstr(error)); goto detach; } usbd_set_parent_iface(sc->sc_udev, chan->iface_index, From owner-dev-commits-src-all@freebsd.org Thu Apr 1 09:18:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0A805C57D6; Thu, 1 Apr 2021 09:18:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9yKM5bqRz3FTV; Thu, 1 Apr 2021 09:18:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2F19231A; Thu, 1 Apr 2021 09:18:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1319IVtS042477; Thu, 1 Apr 2021 09:18:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319IVdP042476; Thu, 1 Apr 2021 09:18:31 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:18:31 GMT Message-Id: <202104010918.1319IVdP042476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 8d1867e2b749 - stable/12 - MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8d1867e2b749ee4d75d8e08fe177e25489e2913d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 09:18:31 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8d1867e2b749ee4d75d8e08fe177e25489e2913d commit 8d1867e2b749ee4d75d8e08fe177e25489e2913d Author: Hans Petter Selasky AuthorDate: 2021-03-09 16:41:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:16:39 +0000 MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. Differential Revision: https://reviews.freebsd.org/D28032 Suggested by: Shichun_Ma@Dell.com Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 31070b5bc77a499009a835650eb9d4bf2eceaa15) --- sys/dev/sound/usb/uaudio.c | 199 +++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 95 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 895456d84c58..e2e86fe5df63 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -946,6 +946,27 @@ uaudio_set_spdif_dummy(struct uaudio_softc *sc, int flags) return (0); } +static usb_error_t +uaudio_force_power_save(struct uaudio_softc *sc, uint8_t iface_index) +{ + struct usb_interface *iface; + usb_error_t err; + + iface = usbd_get_iface(sc->sc_udev, iface_index); + if (iface == NULL || iface->idesc == NULL) + return (USB_ERR_INVAL); + + /* check if correct alternate setting is already selected */ + if (iface->alt_index == 0) { + /* force power save mode by selecting default alternate setting */ + err = usbd_req_set_alt_interface_no(sc->sc_udev, NULL, iface_index, + iface->idesc->bAlternateSetting); + } else { + err = usbd_set_alt_interface_index(sc->sc_udev, iface_index, 0); + } + return (err); +} + static int uaudio_attach(device_t dev) { @@ -1020,16 +1041,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_play_chan[i].usb_alt[0].iface_index, - sc->sc_play_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_play_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_play_chan[i].num_alt; x++) { device_printf(dev, "Play[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1050,16 +1071,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_rec_chan[i].usb_alt[0].iface_index, - sc->sc_rec_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_rec_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_rec_chan[i].num_alt; x++) { device_printf(dev, "Record[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1310,7 +1331,7 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, uint32_t frames; uint32_t buf_size; uint16_t fps; - uint8_t set_alt; + uint8_t next_alt; uint8_t fps_shift; uint8_t operation; usb_error_t err; @@ -1322,22 +1343,51 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, usb_proc_explore_lock(sc->sc_udev); operation = chan->operation; - chan->operation = CHAN_OP_NONE; + switch (operation) { + case CHAN_OP_START: + case CHAN_OP_STOP: + chan->operation = CHAN_OP_NONE; + break; + default: + break; + } usb_proc_explore_unlock(sc->sc_udev); - mtx_lock(chan->pcm_mtx); - if (chan->cur_alt != chan->set_alt) - set_alt = chan->set_alt; - else - set_alt = CHAN_MAX_ALT; - mtx_unlock(chan->pcm_mtx); + switch (operation) { + case CHAN_OP_STOP: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); - if (set_alt >= chan->num_alt) - goto done; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = CHAN_MAX_ALT; + mtx_unlock(chan->pcm_mtx); - chan_alt = chan->usb_alt + set_alt; + /* + * The first alternate setting is typically used for + * power saving mode. Set this alternate setting as + * part of entering stop. + */ + err = usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, 0); + if (err) { + DPRINTF("setting of default alternate index failed: %s!\n", + usbd_errstr(err)); + } + return; - usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + case CHAN_OP_START: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + break; + + default: + return; + } + + mtx_lock(chan->pcm_mtx); + next_alt = chan->set_alt; + mtx_unlock(chan->pcm_mtx); + + chan_alt = chan->usb_alt + next_alt; err = usbd_set_alt_interface_index(sc->sc_udev, chan_alt->iface_index, chan_alt->iface_alt_index); @@ -1441,32 +1491,16 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, goto error; } - mtx_lock(chan->pcm_mtx); - chan->cur_alt = set_alt; - mtx_unlock(chan->pcm_mtx); - -done: #if (UAUDIO_NCHANBUFS != 2) -#error "please update code" +#error "Please update code below!" #endif - switch (operation) { - case CHAN_OP_START: - mtx_lock(chan->pcm_mtx); - usbd_transfer_start(chan->xfer[0]); - usbd_transfer_start(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - case CHAN_OP_STOP: - mtx_lock(chan->pcm_mtx); - usbd_transfer_stop(chan->xfer[0]); - usbd_transfer_stop(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - default: - break; - } - return; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = next_alt; + usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[1]); + mtx_unlock(chan->pcm_mtx); + return; error: usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); @@ -2758,27 +2792,24 @@ uaudio_chan_set_param_format(struct uaudio_chan *ch, uint32_t format) } static void -uaudio_chan_start_sub(struct uaudio_chan *ch) +uaudio_chan_reconfigure(struct uaudio_chan *ch, uint8_t operation) { struct uaudio_softc *sc = ch->priv_sc; - int do_start = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_start = 1; - } else { - ch->operation = CHAN_OP_START; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_start) { - usbd_transfer_start(ch->xfer[0]); - usbd_transfer_start(ch->xfer[1]); - } + + /* Check for shutdown. */ + if (ch->operation == CHAN_OP_DRAIN) + return; + + /* Set next operation. */ + ch->operation = operation; + + /* + * Because changing the alternate setting modifies the USB + * configuration, this part must be executed from the USB + * explore process. + */ + (void)usb_proc_explore_msignal(sc->sc_udev, + &sc->sc_config_msg[0], &sc->sc_config_msg[1]); } static int @@ -2831,10 +2862,10 @@ uaudio_chan_start(struct uaudio_chan *ch) * Start both endpoints because of need for * jitter information: */ - uaudio_chan_start_sub(&sc->sc_rec_chan[i]); - uaudio_chan_start_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_START); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_START); } else { - uaudio_chan_start_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_START); } } @@ -2842,30 +2873,6 @@ uaudio_chan_start(struct uaudio_chan *ch) usb_proc_explore_unlock(sc->sc_udev); } -static void -uaudio_chan_stop_sub(struct uaudio_chan *ch) -{ - struct uaudio_softc *sc = ch->priv_sc; - int do_stop = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_stop = 1; - } else { - ch->operation = CHAN_OP_STOP; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_stop) { - usbd_transfer_stop(ch->xfer[0]); - usbd_transfer_stop(ch->xfer[1]); - } -} - void uaudio_chan_stop(struct uaudio_chan *ch) { @@ -2894,10 +2901,10 @@ uaudio_chan_stop(struct uaudio_chan *ch) * Stop both endpoints in case the one was used for * jitter information: */ - uaudio_chan_stop_sub(&sc->sc_rec_chan[i]); - uaudio_chan_stop_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_STOP); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_STOP); } else { - uaudio_chan_stop_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_STOP); } } @@ -6001,9 +6008,11 @@ umidi_probe(device_t dev) if (usb_test_quirk(uaa, UQ_SINGLE_CMD_MIDI)) chan->single_command = 1; - if (usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, - chan->iface_alt_index)) { - DPRINTF("setting of alternate index failed!\n"); + error = usbd_set_alt_interface_index(sc->sc_udev, + chan->iface_index, chan->iface_alt_index); + if (error) { + DPRINTF("setting of alternate index failed: %s\n", + usbd_errstr(error)); goto detach; } usbd_set_parent_iface(sc->sc_udev, chan->iface_index, From owner-dev-commits-src-all@freebsd.org Thu Apr 1 09:19:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC4185C5476; Thu, 1 Apr 2021 09:19:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9yM36MzVz3FX9; Thu, 1 Apr 2021 09:19:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD95D1F55; Thu, 1 Apr 2021 09:19:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1319JxHv042817; Thu, 1 Apr 2021 09:19:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319Jx9x042816; Thu, 1 Apr 2021 09:19:59 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:19:59 GMT Message-Id: <202104010919.1319Jx9x042816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: ba535b10228f - stable/11 - MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: ba535b10228f0af8021f64890e25f44c446a6cd9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 09:20:00 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ba535b10228f0af8021f64890e25f44c446a6cd9 commit ba535b10228f0af8021f64890e25f44c446a6cd9 Author: Hans Petter Selasky AuthorDate: 2021-03-09 16:41:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:18:15 +0000 MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. Differential Revision: https://reviews.freebsd.org/D28032 Suggested by: Shichun_Ma@Dell.com Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 31070b5bc77a499009a835650eb9d4bf2eceaa15) --- sys/dev/sound/usb/uaudio.c | 199 +++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 95 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 2ccdaac63196..cd6037faaa0d 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -944,6 +944,27 @@ uaudio_set_spdif_dummy(struct uaudio_softc *sc, int flags) return (0); } +static usb_error_t +uaudio_force_power_save(struct uaudio_softc *sc, uint8_t iface_index) +{ + struct usb_interface *iface; + usb_error_t err; + + iface = usbd_get_iface(sc->sc_udev, iface_index); + if (iface == NULL || iface->idesc == NULL) + return (USB_ERR_INVAL); + + /* check if correct alternate setting is already selected */ + if (iface->alt_index == 0) { + /* force power save mode by selecting default alternate setting */ + err = usbd_req_set_alt_interface_no(sc->sc_udev, NULL, iface_index, + iface->idesc->bAlternateSetting); + } else { + err = usbd_set_alt_interface_index(sc->sc_udev, iface_index, 0); + } + return (err); +} + static int uaudio_attach(device_t dev) { @@ -1018,16 +1039,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_play_chan[i].usb_alt[0].iface_index, - sc->sc_play_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_play_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_play_chan[i].num_alt; x++) { device_printf(dev, "Play[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1048,16 +1069,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_rec_chan[i].usb_alt[0].iface_index, - sc->sc_rec_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_rec_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_rec_chan[i].num_alt; x++) { device_printf(dev, "Record[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1308,7 +1329,7 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, uint32_t frames; uint32_t buf_size; uint16_t fps; - uint8_t set_alt; + uint8_t next_alt; uint8_t fps_shift; uint8_t operation; usb_error_t err; @@ -1320,22 +1341,51 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, usb_proc_explore_lock(sc->sc_udev); operation = chan->operation; - chan->operation = CHAN_OP_NONE; + switch (operation) { + case CHAN_OP_START: + case CHAN_OP_STOP: + chan->operation = CHAN_OP_NONE; + break; + default: + break; + } usb_proc_explore_unlock(sc->sc_udev); - mtx_lock(chan->pcm_mtx); - if (chan->cur_alt != chan->set_alt) - set_alt = chan->set_alt; - else - set_alt = CHAN_MAX_ALT; - mtx_unlock(chan->pcm_mtx); + switch (operation) { + case CHAN_OP_STOP: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); - if (set_alt >= chan->num_alt) - goto done; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = CHAN_MAX_ALT; + mtx_unlock(chan->pcm_mtx); - chan_alt = chan->usb_alt + set_alt; + /* + * The first alternate setting is typically used for + * power saving mode. Set this alternate setting as + * part of entering stop. + */ + err = usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, 0); + if (err) { + DPRINTF("setting of default alternate index failed: %s!\n", + usbd_errstr(err)); + } + return; - usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + case CHAN_OP_START: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + break; + + default: + return; + } + + mtx_lock(chan->pcm_mtx); + next_alt = chan->set_alt; + mtx_unlock(chan->pcm_mtx); + + chan_alt = chan->usb_alt + next_alt; err = usbd_set_alt_interface_index(sc->sc_udev, chan_alt->iface_index, chan_alt->iface_alt_index); @@ -1439,32 +1489,16 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, goto error; } - mtx_lock(chan->pcm_mtx); - chan->cur_alt = set_alt; - mtx_unlock(chan->pcm_mtx); - -done: #if (UAUDIO_NCHANBUFS != 2) -#error "please update code" +#error "Please update code below!" #endif - switch (operation) { - case CHAN_OP_START: - mtx_lock(chan->pcm_mtx); - usbd_transfer_start(chan->xfer[0]); - usbd_transfer_start(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - case CHAN_OP_STOP: - mtx_lock(chan->pcm_mtx); - usbd_transfer_stop(chan->xfer[0]); - usbd_transfer_stop(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - default: - break; - } - return; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = next_alt; + usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[1]); + mtx_unlock(chan->pcm_mtx); + return; error: usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); @@ -2756,27 +2790,24 @@ uaudio_chan_set_param_format(struct uaudio_chan *ch, uint32_t format) } static void -uaudio_chan_start_sub(struct uaudio_chan *ch) +uaudio_chan_reconfigure(struct uaudio_chan *ch, uint8_t operation) { struct uaudio_softc *sc = ch->priv_sc; - int do_start = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_start = 1; - } else { - ch->operation = CHAN_OP_START; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_start) { - usbd_transfer_start(ch->xfer[0]); - usbd_transfer_start(ch->xfer[1]); - } + + /* Check for shutdown. */ + if (ch->operation == CHAN_OP_DRAIN) + return; + + /* Set next operation. */ + ch->operation = operation; + + /* + * Because changing the alternate setting modifies the USB + * configuration, this part must be executed from the USB + * explore process. + */ + (void)usb_proc_explore_msignal(sc->sc_udev, + &sc->sc_config_msg[0], &sc->sc_config_msg[1]); } static int @@ -2829,10 +2860,10 @@ uaudio_chan_start(struct uaudio_chan *ch) * Start both endpoints because of need for * jitter information: */ - uaudio_chan_start_sub(&sc->sc_rec_chan[i]); - uaudio_chan_start_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_START); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_START); } else { - uaudio_chan_start_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_START); } } @@ -2840,30 +2871,6 @@ uaudio_chan_start(struct uaudio_chan *ch) usb_proc_explore_unlock(sc->sc_udev); } -static void -uaudio_chan_stop_sub(struct uaudio_chan *ch) -{ - struct uaudio_softc *sc = ch->priv_sc; - int do_stop = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_stop = 1; - } else { - ch->operation = CHAN_OP_STOP; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_stop) { - usbd_transfer_stop(ch->xfer[0]); - usbd_transfer_stop(ch->xfer[1]); - } -} - void uaudio_chan_stop(struct uaudio_chan *ch) { @@ -2892,10 +2899,10 @@ uaudio_chan_stop(struct uaudio_chan *ch) * Stop both endpoints in case the one was used for * jitter information: */ - uaudio_chan_stop_sub(&sc->sc_rec_chan[i]); - uaudio_chan_stop_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_STOP); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_STOP); } else { - uaudio_chan_stop_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_STOP); } } @@ -5999,9 +6006,11 @@ umidi_probe(device_t dev) if (usb_test_quirk(uaa, UQ_SINGLE_CMD_MIDI)) chan->single_command = 1; - if (usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, - chan->iface_alt_index)) { - DPRINTF("setting of alternate index failed!\n"); + error = usbd_set_alt_interface_index(sc->sc_udev, + chan->iface_index, chan->iface_alt_index); + if (error) { + DPRINTF("setting of alternate index failed: %s\n", + usbd_errstr(error)); goto detach; } usbd_set_parent_iface(sc->sc_udev, chan->iface_index, From owner-dev-commits-src-all@freebsd.org Thu Apr 1 09:21:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 370595C5D11; Thu, 1 Apr 2021 09:21:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9yP16Nnjz3FnW; Thu, 1 Apr 2021 09:21:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A95FA2584; Thu, 1 Apr 2021 09:21:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1319Lcf4053025; Thu, 1 Apr 2021 09:21:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319LcpR053024; Thu, 1 Apr 2021 09:21:38 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:21:38 GMT Message-Id: <202104010921.1319LcpR053024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: eb008a6793db - stable/13 - MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: eb008a6793dbbda39ad0a2fb3136eb542d7424e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 09:21:44 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=eb008a6793dbbda39ad0a2fb3136eb542d7424e2 commit eb008a6793dbbda39ad0a2fb3136eb542d7424e2 Author: Hans Petter Selasky AuthorDate: 2021-03-25 15:55:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:19:42 +0000 MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback to mbuf clusters when jumbo frames are not available and it also doesn't account for the packet header and trailer mbuf. This causes a memory overwrite situation when IPOIB_CM is configured. While at it add a kernel assert to ensure the mapping array is not overwritten. PR: 254474 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 7 +++---- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h index 8a2b3333abb5..eb1cb87dc888 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h @@ -117,12 +117,11 @@ enum { IPOIB_ENCAP_LEN = 4, IPOIB_HEADER_LEN = IPOIB_ENCAP_LEN + INFINIBAND_ALEN, IPOIB_UD_MAX_MTU = 4 * 1024, -// IPOIB_UD_RX_SG = (IPOIB_UD_MAX_MTU / MJUMPAGESIZE), - IPOIB_UD_RX_SG = 2, + IPOIB_UD_RX_SG = 2, /* packet header and one cluster */ IPOIB_UD_TX_SG = (IPOIB_UD_MAX_MTU / MCLBYTES) + 2, IPOIB_CM_MAX_MTU = (64 * 1024), IPOIB_CM_TX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, - IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MJUMPAGESIZE), + IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, IPOIB_RX_RING_SIZE = 256, IPOIB_TX_RING_SIZE = 128, IPOIB_MAX_RX_SG = MAX(IPOIB_CM_RX_SG, IPOIB_UD_RX_SG), @@ -529,7 +528,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size, int max_frags); void ipoib_set_ethtool_ops(struct ifnet *dev); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 50c9a4f305e9..b61ebfd1495a 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -153,7 +153,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu); + sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu, IPOIB_CM_RX_SG); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c index cb52e3db75a4..a5db9a256204 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -112,7 +112,7 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int align, int size) + int align, int size, int max_frags) { struct mbuf *mb, *m; int i, j; @@ -122,6 +122,8 @@ ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { + MPASS(i < max_frags); + m->m_len = M_SIZE(m) - align; m->m_data += align; align = 0; @@ -174,9 +176,8 @@ static int ipoib_ib_post_receive(struct ipoib_dev_priv *priv, int id) static struct mbuf * ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { - return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - 0, priv->max_ib_mtu + IB_GRH_BYTES); + 0, priv->max_ib_mtu + IB_GRH_BYTES, IPOIB_UD_RX_SG); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) From owner-dev-commits-src-all@freebsd.org Thu Apr 1 09:22:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 713A05C5F00; Thu, 1 Apr 2021 09:22:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9yQB2kHqz3GMM; Thu, 1 Apr 2021 09:22:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5051A1F7F; Thu, 1 Apr 2021 09:22:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1319MgqD055673; Thu, 1 Apr 2021 09:22:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319MgGD055672; Thu, 1 Apr 2021 09:22:42 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:22:42 GMT Message-Id: <202104010922.1319MgGD055672@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 4316db31c2c8 - stable/12 - MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4316db31c2c861c60ba39af35f5a781ce7db95da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 09:22:42 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4316db31c2c861c60ba39af35f5a781ce7db95da commit 4316db31c2c861c60ba39af35f5a781ce7db95da Author: Hans Petter Selasky AuthorDate: 2021-03-25 15:55:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:20:44 +0000 MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback to mbuf clusters when jumbo frames are not available and it also doesn't account for the packet header and trailer mbuf. This causes a memory overwrite situation when IPOIB_CM is configured. While at it add a kernel assert to ensure the mapping array is not overwritten. PR: 254474 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 7 +++---- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h index 8a2b3333abb5..eb1cb87dc888 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h @@ -117,12 +117,11 @@ enum { IPOIB_ENCAP_LEN = 4, IPOIB_HEADER_LEN = IPOIB_ENCAP_LEN + INFINIBAND_ALEN, IPOIB_UD_MAX_MTU = 4 * 1024, -// IPOIB_UD_RX_SG = (IPOIB_UD_MAX_MTU / MJUMPAGESIZE), - IPOIB_UD_RX_SG = 2, + IPOIB_UD_RX_SG = 2, /* packet header and one cluster */ IPOIB_UD_TX_SG = (IPOIB_UD_MAX_MTU / MCLBYTES) + 2, IPOIB_CM_MAX_MTU = (64 * 1024), IPOIB_CM_TX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, - IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MJUMPAGESIZE), + IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, IPOIB_RX_RING_SIZE = 256, IPOIB_TX_RING_SIZE = 128, IPOIB_MAX_RX_SG = MAX(IPOIB_CM_RX_SG, IPOIB_UD_RX_SG), @@ -529,7 +528,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size, int max_frags); void ipoib_set_ethtool_ops(struct ifnet *dev); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index f9e0ada7275c..0e3198cc072c 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -153,7 +153,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu); + sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu, IPOIB_CM_RX_SG); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c index cb52e3db75a4..a5db9a256204 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -112,7 +112,7 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int align, int size) + int align, int size, int max_frags) { struct mbuf *mb, *m; int i, j; @@ -122,6 +122,8 @@ ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { + MPASS(i < max_frags); + m->m_len = M_SIZE(m) - align; m->m_data += align; align = 0; @@ -174,9 +176,8 @@ static int ipoib_ib_post_receive(struct ipoib_dev_priv *priv, int id) static struct mbuf * ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { - return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - 0, priv->max_ib_mtu + IB_GRH_BYTES); + 0, priv->max_ib_mtu + IB_GRH_BYTES, IPOIB_UD_RX_SG); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) From owner-dev-commits-src-all@freebsd.org Thu Apr 1 09:28:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 120B05C5F59; Thu, 1 Apr 2021 09:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9yXk01nXz3GXF; Thu, 1 Apr 2021 09:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7BE62608; Thu, 1 Apr 2021 09:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1319SL3C056631; Thu, 1 Apr 2021 09:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319SLuZ056630; Thu, 1 Apr 2021 09:28:21 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:28:21 GMT Message-Id: <202104010928.1319SLuZ056630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 9d03dfae43d2 - stable/11 - MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 9d03dfae43d2a1a91c846db38223bc33516d1130 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 09:28:22 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9d03dfae43d2a1a91c846db38223bc33516d1130 commit 9d03dfae43d2a1a91c846db38223bc33516d1130 Author: Hans Petter Selasky AuthorDate: 2021-03-25 15:55:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:25:55 +0000 MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback to mbuf clusters when jumbo frames are not available and it also doesn't account for the packet header and trailer mbuf. This causes a memory overwrite situation when IPOIB_CM is configured. While at it add a kernel assert to ensure the mapping array is not overwritten. PR: 254474 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 7 +++---- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h index c458eebd8f50..7c012bdcdb2c 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h @@ -115,12 +115,11 @@ enum { IPOIB_ENCAP_LEN = 4, IPOIB_HEADER_LEN = IPOIB_ENCAP_LEN + INFINIBAND_ALEN, IPOIB_UD_MAX_MTU = 4 * 1024, -// IPOIB_UD_RX_SG = (IPOIB_UD_MAX_MTU / MJUMPAGESIZE), - IPOIB_UD_RX_SG = 2, + IPOIB_UD_RX_SG = 2, /* packet header and one cluster */ IPOIB_UD_TX_SG = (IPOIB_UD_MAX_MTU / MCLBYTES) + 2, IPOIB_CM_MAX_MTU = (64 * 1024), IPOIB_CM_TX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, - IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MJUMPAGESIZE), + IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, IPOIB_RX_RING_SIZE = 256, IPOIB_TX_RING_SIZE = 128, IPOIB_MAX_RX_SG = MAX(IPOIB_CM_RX_SG, IPOIB_UD_RX_SG), @@ -538,7 +537,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size, int max_frags); void ipoib_set_ethtool_ops(struct ifnet *dev); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 5e6dea75f0ae..9bc584cbfe94 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -151,7 +151,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - priv->cm.max_cm_mtu); + priv->cm.max_cm_mtu, IPOIB_CM_RX_SG); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c index a144681ea0d8..5f5a7323b7e8 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -110,7 +110,7 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int size) + int size, int max_frags) { struct mbuf *mb, *m; int i, j; @@ -120,6 +120,8 @@ ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { + MPASS(i < max_frags); + m->m_len = M_SIZE(m); mb->m_pkthdr.len += m->m_len; rx_req->mapping[i] = ib_dma_map_single(priv->ca, @@ -170,9 +172,8 @@ static int ipoib_ib_post_receive(struct ipoib_dev_priv *priv, int id) static struct mbuf * ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { - return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - priv->max_ib_mtu + IB_GRH_BYTES); + priv->max_ib_mtu + IB_GRH_BYTES, IPOIB_UD_RX_SG); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) From owner-dev-commits-src-all@freebsd.org Thu Apr 1 09:35:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 588385C63DA; Thu, 1 Apr 2021 09:35:30 +0000 (UTC) (envelope-from zec@fer.hr) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0629.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1e::629]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9yhy0PKWz3HHv; Thu, 1 Apr 2021 09:35:29 +0000 (UTC) (envelope-from zec@fer.hr) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l4cZeiPa2IeQJBMPBGrgMuAE63iwJvHtgKIdUCANgNk4FUydvBQtpmNgC/ltVSJweIdJ8uwo5MYN1Yuml7a02z2D9GMy/iModbxYomV2BbhSZqG0GvgfNcYsFhN6erZppk9a4x/KMnhu2CxjJiMVcOSC+FgKuoHcv4F9rYMnOJOTTNlvdyOyGuYs1fag8aiXio4/k4xzLZujZZzVJy4vbW2r4Gl3zZ089C/e1rfnrv5pfGMM8LbGAgmPeqDgzWUKeJ7cnep4f4fHxHboLx0UiI01wvJcWT6xlQAWf5z5saLZtxh6CNZ1GYda4IyXn6vkf3tPVXtAYnnMFZFztOEKqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K/Fd0BrPhfPl475KFybRCDbWDbHK6F8MKzqD0ZV21Nw=; b=LDWyZLjMLGigrmC/CBfEQ6AnodWOQJSEzg9B0rE401AshY+V5gjdOJF337GeuAV1cOr8CK6Xs1/OG8yK3U4FCM0gnQieo8Y43XLZAoyWe+NF+zIa88emdw8aSuRYsxE5xyXqxW3rDcLTVo6Iga3gbzE7zHnfTjbPQVxKBHCLQvL6cHubcxQt77AWFuwYfqEckv4BYA/fgbr7tYB1RBuhPDEW91yzY4eRbcfxmyjiXWUPxKrAk0wmpuUywKdQxa6560orMpvbaOWwNGbsS1IBtUfRC1VP6h9/gQCbyWp6rUwKkLtOjAZWl/kAgs0WhZHm9DMesMyqvli8p/V/XgHzCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fer.hr; dmarc=pass action=none header.from=fer.hr; dkim=pass header.d=fer.hr; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ferhr.onmicrosoft.com; s=selector2-ferhr-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K/Fd0BrPhfPl475KFybRCDbWDbHK6F8MKzqD0ZV21Nw=; b=i19wu11h14I6+dUkEG+s8rm4MbD/nxz8UPoY2gzHgxQpEyJikN6TC/R5zCnj+Jo/WvlPQkEfbtfhvcgVykbKMveYY9b7VCH/T50LB6Kk8dWprCM9vq0PTChNYMthN2qyXyxPjn4yixZgAX4Kwsqx6uF0eVrcogybWwZfXl6Fso8= Received: from VE1PR08MB4783.eurprd08.prod.outlook.com (2603:10a6:802:a9::16) by VI1PR08MB5375.eurprd08.prod.outlook.com (2603:10a6:803:130::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Thu, 1 Apr 2021 09:35:26 +0000 Received: from VE1PR08MB4783.eurprd08.prod.outlook.com ([fe80::2033:5b9c:c1fa:e9a1]) by VE1PR08MB4783.eurprd08.prod.outlook.com ([fe80::2033:5b9c:c1fa:e9a1%7]) with mapi id 15.20.3999.027; Thu, 1 Apr 2021 09:35:26 +0000 Date: Thu, 1 Apr 2021 11:35:27 +0200 From: Marko Zec To: Michael Tuexen Cc: Richard Scheffenegger , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 529a2a0f2765 - main - tcp: For hostcache performance, use atomics instead of counters Message-ID: <20210401113527.4ff81a4c@x23> In-Reply-To: <9F675C09-14B6-4117-A079-90068E1D1E65@macmic.franken.de> References: <202104010803.13183vQe043756@gitrepo.freebsd.org> <20210401102035.19636bea@x23> <9F675C09-14B6-4117-A079-90068E1D1E65@macmic.franken.de> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; amd64-portbld-freebsd11.4) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Originating-IP: [31.147.109.165] X-ClientProxiedBy: VE1PR03CA0007.eurprd03.prod.outlook.com (2603:10a6:802:a0::19) To VE1PR08MB4783.eurprd08.prod.outlook.com (2603:10a6:802:a9::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from x23 (31.147.109.165) by VE1PR03CA0007.eurprd03.prod.outlook.com (2603:10a6:802:a0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.26 via Frontend Transport; Thu, 1 Apr 2021 09:35:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a724bfb2-9a4a-4d34-bce4-08d8f4f17ade X-MS-TrafficTypeDiagnostic: VI1PR08MB5375: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CWN4rciT27XuksYmbIFnldauC6Be0He536SAHyM/r7E5SKaIKLrcm55C43Vr+GQD0TtC0482nePPLiFUMMZkTyYdfUDySr5sYuAadXJD8v9d2r7ZBLUv9NufZT5KFcDbR4Ut0A+aC7g4yDxVytfzqEx1o2cLcI0bsdkxqifU/7wVyQd8AbHZIEKWyJwVnRouc8u8N63o3mZQmKtXmRLwlhs0FKrk5jT2xooxUyAIrpWe3dyuQ3zz2B2ODLDnIm9b9tEy5lEZIFtoR8e252K/Y0w6N043vWGRn33RZ7Rg1qq2wwuUdpOREkYgRpVHbMJa87+/lx0wmD0XslD/Dh1n+63U56Z/ec29pB1TTaq0FP4tRAaOwggXMAZSAY8cMnbPvwktEs23GV3YKm5FjdzQmFFVWFHVzDBAyqWoEbe7PijLfeUlvCh8TTFexmSwb3ZwR3xRGGoqpea7qr+6P3Un6d9vBrgYsnQ7ogH7olWqBBn0++lQU1cHH2cVwHswR1Pu6a4liRjBI+wQrWto5Ey00zjlfqpL0xqW+DhqMKtjBNBL+gYq3f8DhunI6p5WAikI5KUOblvtM4l4/BdaFcPOeqbfLGTS8ANpR9uLQPbOlP57lYZizHk3Vo82w96GkZs8hvG3R09ajhmqFDjPjEEZTYWvCeVuoaq6S8vVxqTZl69nCSv9O0rOgyB1Pt2dExNk9m4E56tRMiX3Wl3VUyQfmxOlDasTDk64GXV6PRBFbIc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4783.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(376002)(39850400004)(396003)(136003)(346002)(6916009)(38100700001)(86362001)(66556008)(83380400001)(316002)(956004)(478600001)(1076003)(786003)(966005)(4326008)(2906002)(33716001)(6496006)(9576002)(66476007)(5660300002)(52116002)(9686003)(26005)(55016002)(8676002)(16526019)(66946007)(186003)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?TkglHJN6W7Zx7oLVwBrN8DhpYmRUvzAOKruP0b2oZOJMwHBRKTwDFth7z1Bl?= =?us-ascii?Q?KzhxwD8HVrUPty3LLSDIqkWrzCFfZ3vgUkdVGvn68f+addxbRLa3vgdolEO0?= =?us-ascii?Q?ZxNk3aul8HYz9vnYvegFHRY3gT1KvIV+q121yIedBie4kSONTeGbQDFD6ute?= =?us-ascii?Q?xQDRcAxWDI9YTHQN0XzjMFj8b6/dh+gDLWJQOycaLH8R+P646I2RNMWBfJXa?= =?us-ascii?Q?D2R5lRPyrmpogxllO+U23Ohh2cnKCWLFsErIgL+3PVd97IFQN8x8V6ONBW2U?= =?us-ascii?Q?/sj2dwjD4CN/x7JgRPqq8a/ezQVKlyO5iPYuXZ3iKHyIJxjz1YHT85J5Xeon?= =?us-ascii?Q?fQIXBkicFejBRtbpcWfQRdIOJn70pO9HgyfjkEls/6IAWDA0f7Ry2vfDVFc/?= =?us-ascii?Q?MP4RFBoZkKuo4oFyblSGOnNslZ8sOgtF3IiMLn3XPeouOB4jaqdMDZbiWL3t?= =?us-ascii?Q?A/3jGproRLr0aFQkguCnEGonLUMlU58tGl0y3fq8EKPcU26wW7rnVXqMM6bS?= =?us-ascii?Q?zGAPVL6mAL4d3wya/5TMaQE9xa/L7EPvJ3WPjSCkfHPMLaOEsCubghfKv5FX?= =?us-ascii?Q?qlbYWEDcTr1C7Y+/sAMOm22TUnde0B05PbbhnC6ZIliPKZHUWc9tB8xp0agn?= =?us-ascii?Q?MGszkktxazw22TDytJPm6uy2scqJm5nQ1fequonFaCKuxaWHdE8LLtA+xdaN?= =?us-ascii?Q?NG9Di0hpogUDFBQcVmOHLK1o3sBWNMD24lH16ENXf4ImPEFkaTirsKDek/1H?= =?us-ascii?Q?dqIOb+B7s5ucunReFO+lLV5lH3vils0qiRWF9xPKnZHmN1amc+mk0ag+rdIM?= =?us-ascii?Q?o8AAzq7rjL4qY0+bC5zHuSrYPHQlQpoRM226FhkP54Zn1kcuUcM6GV+QyxsV?= =?us-ascii?Q?gaKpkx/mULnKNBhphPMPzNMigprI17pqiu8o/Qi16KyPwOFNUh/ms/fEwzNC?= =?us-ascii?Q?RBxJfrJGKiucC+NQrT7tS+38YUAzoY4qPkqxNMFwApJAUYwsCyRUF+ys3DMa?= =?us-ascii?Q?asr1quN49PGMVRirAAdVUgcIW0y1LrA5m7GnrBP9oEOicmq6+coKF+Zqtc9y?= =?us-ascii?Q?vX8rPVvOjULMzE3v+D6uLqbV+x3yy1ayBywnIJCT3OcXy4Wk9Csql9y4w2jL?= =?us-ascii?Q?8zrhhMzn2VNDQ6U7fDbZ3dsDnEWhK0rhK2R2ijxuduipKhKO402sLByZcJnq?= =?us-ascii?Q?hlFhPL9un1OzRpwrSCQlWLvFyUJzBLv/fZk+w37407v/cuCLiAxLrrm2fLfU?= =?us-ascii?Q?hpDLeJx3XCzuzg1y6iknCwr/gvpqj3Wc0Sn9w15LkWCqo797K6pQEL88Z+Dx?= =?us-ascii?Q?AMcegy5nDF6E+Z0v8xaB8L/T?= X-OriginatorOrg: fer.hr X-MS-Exchange-CrossTenant-Network-Message-Id: a724bfb2-9a4a-4d34-bce4-08d8f4f17ade X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4783.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2021 09:35:26.1287 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: ca71eddc-cc7b-4e5b-95bd-55b658e696be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /Nh1W98w6/Vd+W1VAvz+eeQP937A3N/BUrX7eUuZN/+lsJoIw3cblKKFn1UkhONr X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5375 X-Rspamd-Queue-Id: 4F9yhy0PKWz3HHv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 09:35:30 -0000 On Thu, 1 Apr 2021 11:11:39 +0200 Michael Tuexen wrote: > > On 1. Apr 2021, at 10:20, Marko Zec wrote: > > > > On Thu, 1 Apr 2021 08:03:57 GMT > > Richard Scheffenegger wrote: > > > >> The branch main has been updated by rscheff: > >> > >> URL: > >> https://cgit.FreeBSD.org/src/commit/?id=529a2a0f2765f6c57c50a5af6be242c03bf714e3 > >> > >> commit 529a2a0f2765f6c57c50a5af6be242c03bf714e3 > >> Author: Richard Scheffenegger > >> AuthorDate: 2021-04-01 08:00:32 +0000 > >> Commit: Richard Scheffenegger > >> CommitDate: 2021-04-01 08:03:30 +0000 > >> > >> tcp: For hostcache performance, use atomics instead of counters > >> > > > > Is that an April 1st joke, or for real, since it appears to have hit > > the tree? > > > >> As accessing the tcp hostcache happens frequently on some > >> classes of servers, it was recommended > > > > Recommended by whom? > See https://reviews.freebsd.org/D29510#661680 OK thanks... Perhaps if the commit note stated that it aims to eliminate counter_u64_fetch() from a hot path that would have spared the list from the noise from me... Cheers, Marko > > Best regards > Michael > > > >> to use atomic_add/subtract > >> rather than (per-CPU distributed) counters, which have to be > >> summed up at high cost to cache efficiency. > > > > Numbers? > > > >> > >> PR: 254333 > >> MFC after: 2 weeks > >> Sponsored by: NetApp, Inc. > >> Reviewed By: #transport, tuexen, jtl > >> Differential Revision: https://reviews.freebsd.org/D29522 > >> --- > >> sys/netinet/tcp_hostcache.c | 24 +++++++++++------------- > >> sys/netinet/tcp_hostcache.h | 2 +- > >> 2 files changed, 12 insertions(+), 14 deletions(-) > >> > >> diff --git a/sys/netinet/tcp_hostcache.c > >> b/sys/netinet/tcp_hostcache.c index 67da97405c3f..87023cc1a760 > >> 100644 --- a/sys/netinet/tcp_hostcache.c > >> +++ b/sys/netinet/tcp_hostcache.c > >> @@ -147,8 +147,8 @@ SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, > >> bucketlimit, CTLFLAG_VNET | CTLFLAG_RDTUN, > >> &VNET_NAME(tcp_hostcache.bucket_limit), 0, "Per-bucket hash limit > >> for hostcache"); > >> -SYSCTL_COUNTER_U64(_net_inet_tcp_hostcache, OID_AUTO, count, > >> CTLFLAG_VNET | CTLFLAG_RD, > >> - &VNET_NAME(tcp_hostcache.cache_count), > >> +SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, count, > >> CTLFLAG_VNET | CTLFLAG_RD, > >> + &VNET_NAME(tcp_hostcache.cache_count), 0, > >> "Current number of entries in hostcache"); > >> > >> SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, expire, CTLFLAG_VNET > >> | CTLFLAG_RW, @@ -199,8 +199,7 @@ tcp_hc_init(void) > >> /* > >> * Initialize hostcache structures. > >> */ > >> - V_tcp_hostcache.cache_count = counter_u64_alloc(M_WAITOK); > >> - counter_u64_zero(V_tcp_hostcache.cache_count); > >> + atomic_store_int(&V_tcp_hostcache.cache_count, 0); > >> V_tcp_hostcache.hashsize = TCP_HOSTCACHE_HASHSIZE; > >> V_tcp_hostcache.bucket_limit = TCP_HOSTCACHE_BUCKETLIMIT; > >> V_tcp_hostcache.expire = TCP_HOSTCACHE_EXPIRE; > >> @@ -268,9 +267,6 @@ tcp_hc_destroy(void) > >> /* Purge all hc entries. */ > >> tcp_hc_purge_internal(1); > >> > >> - /* Release the counter */ > >> - counter_u64_free(V_tcp_hostcache.cache_count); > >> - > >> /* Free the uma zone and the allocated hash table. */ > >> uma_zdestroy(V_tcp_hostcache.zone); > >> > >> @@ -378,7 +374,7 @@ tcp_hc_insert(struct in_conninfo *inc) > >> * If the bucket limit is reached, reuse the least-used > >> element. */ > >> if (hc_head->hch_length >= V_tcp_hostcache.bucket_limit || > >> - counter_u64_fetch(V_tcp_hostcache.cache_count) >= > >> V_tcp_hostcache.cache_limit) { > >> + atomic_load_int(&V_tcp_hostcache.cache_count) >= > >> V_tcp_hostcache.cache_limit) { hc_entry = > >> TAILQ_LAST(&hc_head->hch_bucket, hc_qhead); /* > >> * At first we were dropping the last element, just > >> to @@ -395,7 +391,7 @@ tcp_hc_insert(struct in_conninfo *inc) > >> } > >> TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, > >> rmx_q); V_tcp_hostcache.hashbase[hash].hch_length--; > >> - counter_u64_add(V_tcp_hostcache.cache_count, -1); > >> + atomic_subtract_int(&V_tcp_hostcache.cache_count, > >> 1); TCPSTAT_INC(tcps_hc_bucketoverflow); > >> #if 0 > >> uma_zfree(V_tcp_hostcache.zone, hc_entry); > >> @@ -428,7 +424,7 @@ tcp_hc_insert(struct in_conninfo *inc) > >> */ > >> TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); > >> V_tcp_hostcache.hashbase[hash].hch_length++; > >> - counter_u64_add(V_tcp_hostcache.cache_count, 1); > >> + atomic_add_int(&V_tcp_hostcache.cache_count, 1); > >> TCPSTAT_INC(tcps_hc_added); > >> > >> return hc_entry; > >> @@ -644,7 +640,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) > >> > >> /* Optimize Buffer length query by sbin/sysctl */ > >> if (req->oldptr == NULL) { > >> - len = > >> (counter_u64_fetch(V_tcp_hostcache.cache_count) + 1) * linesize; > >> + len = > >> (atomic_load_int(&V_tcp_hostcache.cache_count) > >> + 1) * > >> + linesize; > >> return (SYSCTL_OUT(req, NULL, len)); > >> } > >> > >> @@ -654,7 +651,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) > >> } > >> > >> /* Use a buffer sized for one full bucket */ > >> - sbuf_new_for_sysctl(&sb, NULL, > >> V_tcp_hostcache.bucket_limit > >> * linesize, req); > >> + sbuf_new_for_sysctl(&sb, NULL, > >> V_tcp_hostcache.bucket_limit * > >> + linesize, req); > >> > >> sbuf_printf(&sb, > >> "\nIP address MTU SSTRESH RTT > >> RTTVAR " @@ -716,7 +714,7 @@ tcp_hc_purge_internal(int all) > >> hc_entry, rmx_q); > >> uma_zfree(V_tcp_hostcache.zone, > >> hc_entry); V_tcp_hostcache.hashbase[i].hch_length--; > >> - > >> counter_u64_add(V_tcp_hostcache.cache_count, -1); > >> + > >> atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); } else > >> hc_entry->rmx_expire -= > >> V_tcp_hostcache.prune; } > >> diff --git a/sys/netinet/tcp_hostcache.h > >> b/sys/netinet/tcp_hostcache.h index b5237392acc2..2f7035c0c6af > >> 100644 --- a/sys/netinet/tcp_hostcache.h > >> +++ b/sys/netinet/tcp_hostcache.h > >> @@ -74,7 +74,7 @@ struct tcp_hostcache { > >> u_int hashsize; > >> u_int hashmask; > >> u_int bucket_limit; > >> - counter_u64_t cache_count; > >> + u_int cache_count; > >> u_int cache_limit; > >> int expire; > >> int prune; > > > From owner-dev-commits-src-all@freebsd.org Thu Apr 1 09:50:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D75BB5C698F; Thu, 1 Apr 2021 09:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9z1h5lvbz3Hqp; Thu, 1 Apr 2021 09:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B84C22A02; Thu, 1 Apr 2021 09:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1319o07Z085642; Thu, 1 Apr 2021 09:50:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319o0Kv085625; Thu, 1 Apr 2021 09:50:00 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:50:00 GMT Message-Id: <202104010950.1319o0Kv085625@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: ca32a11644b1 - stable/10 - MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/10 X-Git-Reftype: branch X-Git-Commit: ca32a11644b182ae9176631cdff1f4dcd7e49b32 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 09:50:00 -0000 The branch stable/10 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ca32a11644b182ae9176631cdff1f4dcd7e49b32 commit ca32a11644b182ae9176631cdff1f4dcd7e49b32 Author: Hans Petter Selasky AuthorDate: 2021-03-25 15:55:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:34:24 +0000 MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback to mbuf clusters when jumbo frames are not available and it also doesn't account for the packet header and trailer mbuf. This causes a memory overwrite situation when IPOIB_CM is configured. While at it add a kernel assert to ensure the mapping array is not overwritten. PR: 254474 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 7 +++---- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h index 3ddd19aba2f8..10a63593a937 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h @@ -111,12 +111,11 @@ enum { IPOIB_ENCAP_LEN = 4, IPOIB_HEADER_LEN = IPOIB_ENCAP_LEN + INFINIBAND_ALEN, IPOIB_UD_MAX_MTU = 4 * 1024, -// IPOIB_UD_RX_SG = (IPOIB_UD_MAX_MTU / MJUMPAGESIZE), - IPOIB_UD_RX_SG = 2, + IPOIB_UD_RX_SG = 2, /* packet header and one cluster */ IPOIB_UD_TX_SG = (IPOIB_UD_MAX_MTU / MCLBYTES) + 2, IPOIB_CM_MAX_MTU = (64 * 1024), IPOIB_CM_TX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, - IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MJUMPAGESIZE), + IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, IPOIB_RX_RING_SIZE = 256, IPOIB_TX_RING_SIZE = 128, IPOIB_MAX_RX_SG = MAX(IPOIB_CM_RX_SG, IPOIB_UD_RX_SG), @@ -533,7 +532,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size, int max_frags); void ipoib_set_ethtool_ops(struct ifnet *dev); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 03f903723d6f..bdd7ace6e5d6 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -148,7 +148,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - priv->cm.max_cm_mtu); + priv->cm.max_cm_mtu, IPOIB_CM_RX_SG); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 339e30500786..d4ea61a3aba5 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -107,7 +107,7 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int size) + int size, int max_frags) { struct mbuf *mb, *m; int i, j; @@ -117,6 +117,8 @@ ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { + MPASS(i < max_frags); + m->m_len = (m->m_flags & M_EXT) ? m->m_ext.ext_size : ((m->m_flags & M_PKTHDR) ? MHLEN : MLEN); mb->m_pkthdr.len += m->m_len; @@ -168,9 +170,8 @@ static int ipoib_ib_post_receive(struct ipoib_dev_priv *priv, int id) static struct mbuf * ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { - return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - priv->max_ib_mtu + IB_GRH_BYTES); + priv->max_ib_mtu + IB_GRH_BYTES, IPOIB_UD_RX_SG); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) From owner-dev-commits-src-all@freebsd.org Thu Apr 1 12:51:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3FC55CCF33; Thu, 1 Apr 2021 12:51:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB3344mn7z3llN; Thu, 1 Apr 2021 12:51:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96A3252A2; Thu, 1 Apr 2021 12:51:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131CpSD0051912; Thu, 1 Apr 2021 12:51:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131CpSGp051911; Thu, 1 Apr 2021 12:51:28 GMT (envelope-from git) Date: Thu, 1 Apr 2021 12:51:28 GMT Message-Id: <202104011251.131CpSGp051911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 02f26e98c7f4 - main - tcp: Add hash histogram output and validate bucket length accounting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02f26e98c7f4d43d6bd077421286da455e069146 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 12:51:28 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=02f26e98c7f4d43d6bd077421286da455e069146 commit 02f26e98c7f4d43d6bd077421286da455e069146 Author: Richard Scheffenegger AuthorDate: 2021-04-01 12:44:05 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-01 12:44:14 +0000 tcp: Add hash histogram output and validate bucket length accounting Provide a histogram output to check, if the hashsize or bucketlimit could be optimized. Also add some basic sanity checks around the accounting of the hash utilization. MFC after: 2 weeks Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29506 --- sys/netinet/tcp_hostcache.c | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 87023cc1a760..36439e90a611 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -121,6 +121,7 @@ VNET_DEFINE_STATIC(struct callout, tcp_hc_callout); static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *); static struct hc_metrics *tcp_hc_insert(struct in_conninfo *); static int sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS); +static int sysctl_tcp_hc_histo(SYSCTL_HANDLER_ARGS); static int sysctl_tcp_hc_purgenow(SYSCTL_HANDLER_ARGS); static void tcp_hc_purge_internal(int); static void tcp_hc_purge(void *); @@ -168,6 +169,11 @@ SYSCTL_PROC(_net_inet_tcp_hostcache, OID_AUTO, list, 0, 0, sysctl_tcp_hc_list, "A", "List of all hostcache entries"); +SYSCTL_PROC(_net_inet_tcp_hostcache, OID_AUTO, histo, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_MPSAFE, + 0, 0, sysctl_tcp_hc_histo, "A", + "Print a histogram of hostcache hashbucket utilization"); + SYSCTL_PROC(_net_inet_tcp_hostcache, OID_AUTO, purgenow, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, sysctl_tcp_hc_purgenow, "I", @@ -390,6 +396,11 @@ tcp_hc_insert(struct in_conninfo *inc) return NULL; } TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q); + KASSERT(V_tcp_hostcache.hashbase[hash].hch_length > 0 && + V_tcp_hostcache.hashbase[hash].hch_length <= + V_tcp_hostcache.bucket_limit, + ("tcp_hostcache: bucket length range violated at %u: %u", + hash, V_tcp_hostcache.hashbase[hash].hch_length)); V_tcp_hostcache.hashbase[hash].hch_length--; atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); TCPSTAT_INC(tcps_hc_bucketoverflow); @@ -424,6 +435,10 @@ tcp_hc_insert(struct in_conninfo *inc) */ TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); V_tcp_hostcache.hashbase[hash].hch_length++; + KASSERT(V_tcp_hostcache.hashbase[hash].hch_length < + V_tcp_hostcache.bucket_limit, + ("tcp_hostcache: bucket length too high at %u: %u", + hash, V_tcp_hostcache.hashbase[hash].hch_length)); atomic_add_int(&V_tcp_hostcache.cache_count, 1); TCPSTAT_INC(tcps_hc_added); @@ -696,6 +711,48 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) return(error); } +/* + * Sysctl function: prints a histogram of the hostcache hashbucket + * utilization. + */ +static int +sysctl_tcp_hc_histo(SYSCTL_HANDLER_ARGS) +{ + const int linesize = 50; + struct sbuf sb; + int i, error; + int *histo; + u_int hch_length; + + if (jailed_without_vnet(curthread->td_ucred) != 0) + return (EPERM); + + histo = (int *)malloc(sizeof(int) * (V_tcp_hostcache.bucket_limit + 1), + M_TEMP, M_NOWAIT|M_ZERO); + if (histo == NULL) + return(ENOMEM); + + for (i = 0; i < V_tcp_hostcache.hashsize; i++) { + hch_length = V_tcp_hostcache.hashbase[i].hch_length; + KASSERT(hch_length <= V_tcp_hostcache.bucket_limit, + ("tcp_hostcache: bucket limit exceeded at %u: %u", + i, hch_length)); + histo[hch_length]++; + } + + /* Use a buffer for 16 lines */ + sbuf_new_for_sysctl(&sb, NULL, 16 * linesize, req); + + sbuf_printf(&sb, "\nLength\tCount\n"); + for (i = 0; i <= V_tcp_hostcache.bucket_limit; i++) { + sbuf_printf(&sb, "%u\t%u\n", i, histo[i]); + } + error = sbuf_finish(&sb); + sbuf_delete(&sb); + free(histo, M_TEMP); + return(error); +} + /* * Caller has to make sure the curvnet is set properly. */ @@ -709,6 +766,11 @@ tcp_hc_purge_internal(int all) THC_LOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); TAILQ_FOREACH_SAFE(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q, hc_next) { + KASSERT(V_tcp_hostcache.hashbase[i].hch_length > 0 && + V_tcp_hostcache.hashbase[i].hch_length <= + V_tcp_hostcache.bucket_limit, + ("tcp_hostcache: bucket langth out of range at %u: %u", + i, V_tcp_hostcache.hashbase[i].hch_length)); if (all || hc_entry->rmx_expire <= 0) { TAILQ_REMOVE(&V_tcp_hostcache.hashbase[i].hch_bucket, hc_entry, rmx_q); From owner-dev-commits-src-all@freebsd.org Thu Apr 1 13:25:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A970F5CE2E8; Thu, 1 Apr 2021 13:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB3pY4Rn8z3nMC; Thu, 1 Apr 2021 13:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B8895A56; Thu, 1 Apr 2021 13:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131DPfX9095919; Thu, 1 Apr 2021 13:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131DPfXn095918; Thu, 1 Apr 2021 13:25:41 GMT (envelope-from git) Date: Thu, 1 Apr 2021 13:25:41 GMT Message-Id: <202104011325.131DPfXn095918@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 76af2649b078 - stable/13 - MFC 874b1a35486b570513680c3d456b062ba097e1d9: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 76af2649b078a6c1eb27d492710409c991cfc76f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 13:25:41 -0000 The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=76af2649b078a6c1eb27d492710409c991cfc76f commit 76af2649b078a6c1eb27d492710409c991cfc76f Author: Cy Schubert AuthorDate: 2021-03-23 03:11:58 +0000 Commit: Cy Schubert CommitDate: 2021-04-01 13:24:19 +0000 MFC 874b1a35486b570513680c3d456b062ba097e1d9: ipfilter: simplify ipf_proxy_check() return codes ipf_proxy_check() returns -1 for an error and 0 or 1 for success. ipf_proxy_check()'s callers check for error and if the return code is 0, they change it to 1 prior to returning to their callers. Simply by returning -1 or 1 we reduce complexity and cycles burned changing 0 to 1. (cherry picked from commit 874b1a35486b570513680c3d456b062ba097e1d9) --- sys/contrib/ipfilter/netinet/ip_nat.c | 4 +--- sys/contrib/ipfilter/netinet/ip_nat6.c | 4 +--- sys/contrib/ipfilter/netinet/ip_proxy.c | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 33d190c61a0a..084c79bbee9a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -5312,9 +5312,7 @@ ipf_nat_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDED(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_nat6.c b/sys/contrib/ipfilter/netinet/ip_nat6.c index 921eefc0ea3f..baa3c302504a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat6.c +++ b/sys/contrib/ipfilter/netinet/ip_nat6.c @@ -2976,9 +2976,7 @@ ipf_nat6_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDE6D(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index b4773bb6f358..87051b6e6839 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1048,9 +1048,8 @@ ipf_proxy_check(fin, nat) } aps->aps_bytes += fin->fin_plen; aps->aps_pkts++; - return 1; } - return 0; + return 1; } From owner-dev-commits-src-all@freebsd.org Thu Apr 1 13:25:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7033A5CE49D; Thu, 1 Apr 2021 13:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB3pg4fZnz3nJs; Thu, 1 Apr 2021 13:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE3B7527E; Thu, 1 Apr 2021 13:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131DPk4W096034; Thu, 1 Apr 2021 13:25:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131DPkC1096033; Thu, 1 Apr 2021 13:25:46 GMT (envelope-from git) Date: Thu, 1 Apr 2021 13:25:46 GMT Message-Id: <202104011325.131DPkC1096033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 671c492e884a - stable/12 - MFC 874b1a35486b570513680c3d456b062ba097e1d9: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 671c492e884ad51d7fed89c14fd5eb48d5a9567d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 13:25:49 -0000 The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=671c492e884ad51d7fed89c14fd5eb48d5a9567d commit 671c492e884ad51d7fed89c14fd5eb48d5a9567d Author: Cy Schubert AuthorDate: 2021-03-23 03:11:58 +0000 Commit: Cy Schubert CommitDate: 2021-04-01 13:24:11 +0000 MFC 874b1a35486b570513680c3d456b062ba097e1d9: ipfilter: simplify ipf_proxy_check() return codes ipf_proxy_check() returns -1 for an error and 0 or 1 for success. ipf_proxy_check()'s callers check for error and if the return code is 0, they change it to 1 prior to returning to their callers. Simply by returning -1 or 1 we reduce complexity and cycles burned changing 0 to 1. (cherry picked from commit 874b1a35486b570513680c3d456b062ba097e1d9) --- sys/contrib/ipfilter/netinet/ip_nat.c | 4 +--- sys/contrib/ipfilter/netinet/ip_nat6.c | 4 +--- sys/contrib/ipfilter/netinet/ip_proxy.c | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 6fdc006e88f0..bbf78877249c 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -5312,9 +5312,7 @@ ipf_nat_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDED(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_nat6.c b/sys/contrib/ipfilter/netinet/ip_nat6.c index 921eefc0ea3f..baa3c302504a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat6.c +++ b/sys/contrib/ipfilter/netinet/ip_nat6.c @@ -2976,9 +2976,7 @@ ipf_nat6_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDE6D(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index b4773bb6f358..87051b6e6839 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1048,9 +1048,8 @@ ipf_proxy_check(fin, nat) } aps->aps_bytes += fin->fin_plen; aps->aps_pkts++; - return 1; } - return 0; + return 1; } From owner-dev-commits-src-all@freebsd.org Thu Apr 1 13:26:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1C2C5CE4AB; Thu, 1 Apr 2021 13:26:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB3pw1HDVz3nSB; Thu, 1 Apr 2021 13:25:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABA27592B; Thu, 1 Apr 2021 13:25:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131DPvH7096167; Thu, 1 Apr 2021 13:25:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131DPv7B096166; Thu, 1 Apr 2021 13:25:57 GMT (envelope-from git) Date: Thu, 1 Apr 2021 13:25:57 GMT Message-Id: <202104011325.131DPv7B096166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: f4722627bce2 - stable/11 - MFC 874b1a35486b570513680c3d456b062ba097e1d9: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: f4722627bce29607179fa566c620cdda13fd96df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 13:26:01 -0000 The branch stable/11 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=f4722627bce29607179fa566c620cdda13fd96df commit f4722627bce29607179fa566c620cdda13fd96df Author: Cy Schubert AuthorDate: 2021-03-23 03:11:58 +0000 Commit: Cy Schubert CommitDate: 2021-04-01 13:23:59 +0000 MFC 874b1a35486b570513680c3d456b062ba097e1d9: ipfilter: simplify ipf_proxy_check() return codes ipf_proxy_check() returns -1 for an error and 0 or 1 for success. ipf_proxy_check()'s callers check for error and if the return code is 0, they change it to 1 prior to returning to their callers. Simply by returning -1 or 1 we reduce complexity and cycles burned changing 0 to 1. (cherry picked from commit 874b1a35486b570513680c3d456b062ba097e1d9) --- sys/contrib/ipfilter/netinet/ip_nat.c | 4 +--- sys/contrib/ipfilter/netinet/ip_nat6.c | 4 +--- sys/contrib/ipfilter/netinet/ip_proxy.c | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 6c6479dd1616..d5abe81ee84d 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -5312,9 +5312,7 @@ ipf_nat_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDED(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_nat6.c b/sys/contrib/ipfilter/netinet/ip_nat6.c index 921eefc0ea3f..baa3c302504a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat6.c +++ b/sys/contrib/ipfilter/netinet/ip_nat6.c @@ -2976,9 +2976,7 @@ ipf_nat6_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDE6D(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index b4773bb6f358..87051b6e6839 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1048,9 +1048,8 @@ ipf_proxy_check(fin, nat) } aps->aps_bytes += fin->fin_plen; aps->aps_pkts++; - return 1; } - return 0; + return 1; } From owner-dev-commits-src-all@freebsd.org Thu Apr 1 14:01:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9FFD5CF8F1; Thu, 1 Apr 2021 14:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB4bc4TsKz3qcb; Thu, 1 Apr 2021 14:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CF3B6054; Thu, 1 Apr 2021 14:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131E1Get049355; Thu, 1 Apr 2021 14:01:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131E1G1c049354; Thu, 1 Apr 2021 14:01:16 GMT (envelope-from git) Date: Thu, 1 Apr 2021 14:01:16 GMT Message-Id: <202104011401.131E1G1c049354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b8ae450f05e6 - main - traceroute6: Fix Capsicum rights for rcvsock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8ae450f05e62a851f444edaf7db2506ff99aa37 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 14:01:16 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b8ae450f05e62a851f444edaf7db2506ff99aa37 commit b8ae450f05e62a851f444edaf7db2506ff99aa37 Author: Mark Johnston AuthorDate: 2021-04-01 13:58:32 +0000 Commit: Mark Johnston CommitDate: 2021-04-01 14:00:29 +0000 traceroute6: Fix Capsicum rights for rcvsock - Always use distinct sockets for send and recv - Limit rights on the recv socket For ICMP6 we were using the same socket for both send and receive, and we limited rights on the socket such that it's impossible to receive anything. PR: 254623 Diagnosed by: Zhenlei Huang Reviewed by: oshogbo MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29523 --- usr.sbin/traceroute6/traceroute6.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 7663283a6c44..8449a9861302 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -578,8 +578,6 @@ main(int argc, char *argv[]) */ switch (useproto) { case IPPROTO_ICMPV6: - sndsock = rcvsock; - break; case IPPROTO_NONE: case IPPROTO_SCTP: case IPPROTO_TCP: @@ -928,7 +926,6 @@ main(int argc, char *argv[]) * namespaces (e.g filesystem) is restricted (see capsicum(4)). * We must connect(2) our socket before this point. */ - if (caph_enter_casper() < 0) { fprintf(stderr, "caph_enter_casper: %s\n", strerror(errno)); exit(1); @@ -940,6 +937,12 @@ main(int argc, char *argv[]) strerror(errno)); exit(1); } + cap_rights_init(&rights, CAP_RECV); + if (caph_rights_limit(rcvsock, &rights) < 0) { + fprintf(stderr, "caph_rights_limit rcvsock: %s\n", + strerror(errno)); + exit(1); + } /* * Main loop From owner-dev-commits-src-all@freebsd.org Thu Apr 1 14:32:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1357157936C; Thu, 1 Apr 2021 14:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB5HG70llz3stQ; Thu, 1 Apr 2021 14:32:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E34EA6850; Thu, 1 Apr 2021 14:32:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131EWAZF093505; Thu, 1 Apr 2021 14:32:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131EWA0Y093504; Thu, 1 Apr 2021 14:32:10 GMT (envelope-from git) Date: Thu, 1 Apr 2021 14:32:10 GMT Message-Id: <202104011432.131EWA0Y093504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: cb5f8694a522 - main - powernv: Include NUMA locality information in the CPU topology MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb5f8694a522ab9a80f9f0bd321d8f3ed818dd9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 14:32:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cb5f8694a522ab9a80f9f0bd321d8f3ed818dd9b commit cb5f8694a522ab9a80f9f0bd321d8f3ed818dd9b Author: Mark Johnston AuthorDate: 2021-04-01 14:25:57 +0000 Commit: Mark Johnston CommitDate: 2021-04-01 14:25:57 +0000 powernv: Include NUMA locality information in the CPU topology ULE uses this topology to try and preserve locality when migrating threads between CPUs and when performing work stealing. Ensure that on NUMA systems it will at least take the NUMA topology into account. Reviewed by: bdragon, jhibbits (previous version) Tested by: bdragon MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28580 --- sys/powerpc/powernv/platform_powernv.c | 66 +++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/sys/powerpc/powernv/platform_powernv.c b/sys/powerpc/powernv/platform_powernv.c index d7acc544c2ed..8c7da5c257ee 100644 --- a/sys/powerpc/powernv/platform_powernv.c +++ b/sys/powerpc/powernv/platform_powernv.c @@ -480,22 +480,72 @@ powernv_smp_probe_threads(platform_t plat) mp_ncores = mp_ncpus / nthreads; } +static struct cpu_group * +cpu_group_init(struct cpu_group *group, struct cpu_group *parent, + const cpuset_t *cpus, int children, int level, int flags) +{ + struct cpu_group *child; + + child = children != 0 ? smp_topo_alloc(children) : NULL; + + group->cg_parent = parent; + group->cg_child = child; + CPU_COPY(cpus, &group->cg_mask); + group->cg_count = CPU_COUNT(cpus); + group->cg_children = children; + group->cg_level = level; + group->cg_flags = flags; + + return (child); +} + static struct cpu_group * powernv_smp_topo(platform_t plat) { + struct cpu_group *core, *dom, *root; + cpuset_t corecpus, domcpus; + int cpuid, i, j, k, ncores; + if (mp_ncpus % smp_threads_per_core != 0) { - printf("WARNING: Irregular SMP topology. Performance may be " - "suboptimal (%d threads, %d on first core)\n", - mp_ncpus, smp_threads_per_core); + printf("%s: irregular SMP topology (%d threads, %d per core)\n", + __func__, mp_ncpus, smp_threads_per_core); return (smp_topo_none()); } - /* Don't do anything fancier for non-threaded SMP */ - if (smp_threads_per_core == 1) - return (smp_topo_none()); + root = smp_topo_alloc(1); + dom = cpu_group_init(root, NULL, &all_cpus, vm_ndomains, CG_SHARE_NONE, + 0); + + /* + * Redundant layers will be collapsed by the caller so we don't need a + * special case for a single domain. + */ + for (i = 0; i < vm_ndomains; i++, dom++) { + CPU_COPY(&cpuset_domain[i], &domcpus); + ncores = CPU_COUNT(&domcpus) / smp_threads_per_core; + KASSERT(CPU_COUNT(&domcpus) % smp_threads_per_core == 0, + ("%s: domain %d core count not divisible by thread count", + __func__, i)); + + core = cpu_group_init(dom, root, &domcpus, ncores, CG_SHARE_L3, + 0); + for (j = 0; j < ncores; j++, core++) { + /* + * Assume that consecutive CPU IDs correspond to sibling + * threads. + */ + CPU_ZERO(&corecpus); + for (k = 0; k < smp_threads_per_core; k++) { + cpuid = CPU_FFS(&domcpus) - 1; + CPU_CLR(cpuid, &domcpus); + CPU_SET(cpuid, &corecpus); + } + (void)cpu_group_init(core, dom, &corecpus, 0, + CG_SHARE_L1, CG_FLAG_SMT); + } + } - return (smp_topo_1level(CG_SHARE_L1, smp_threads_per_core, - CG_FLAG_SMT)); + return (root); } #endif From owner-dev-commits-src-all@freebsd.org Thu Apr 1 15:20:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B68857B70C; Thu, 1 Apr 2021 15:20:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB6M437R4z3wTd; Thu, 1 Apr 2021 15:20:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A09B70DA; Thu, 1 Apr 2021 15:20:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131FKWwi059440; Thu, 1 Apr 2021 15:20:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131FKWvR059439; Thu, 1 Apr 2021 15:20:32 GMT (envelope-from git) Date: Thu, 1 Apr 2021 15:20:32 GMT Message-Id: <202104011520.131FKWvR059439@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 9aef4e7c2bd4 - main - tcp: Shouldn't drain empty sbuf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9aef4e7c2bd4371e526e4e3feb26064d361ad8ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 15:20:32 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=9aef4e7c2bd4371e526e4e3feb26064d361ad8ce commit 9aef4e7c2bd4371e526e4e3feb26064d361ad8ce Author: Richard Scheffenegger AuthorDate: 2021-04-01 15:18:04 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-01 15:18:38 +0000 tcp: Shouldn't drain empty sbuf MFC after: 2 weeks Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29524 --- sys/netinet/tcp_hostcache.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 36439e90a611..a8c4b2b178cd 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -644,6 +644,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) const int linesize = 128; struct sbuf sb; int i, error, len; + bool do_drain = false; struct hc_metrics *hc_entry; char ip4buf[INET_ADDRSTRLEN]; #ifdef INET6 @@ -701,9 +702,16 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) hc_entry->rmx_hits, hc_entry->rmx_updates, hc_entry->rmx_expire); + do_drain = true; } THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); - sbuf_drain(&sb); + /* Need to track if sbuf has data, to avoid + * a KASSERT when calling sbuf_drain. + */ + if (do_drain) { + sbuf_drain(&sb); + do_drain = false; + } } #undef msec error = sbuf_finish(&sb); @@ -769,7 +777,7 @@ tcp_hc_purge_internal(int all) KASSERT(V_tcp_hostcache.hashbase[i].hch_length > 0 && V_tcp_hostcache.hashbase[i].hch_length <= V_tcp_hostcache.bucket_limit, - ("tcp_hostcache: bucket langth out of range at %u: %u", + ("tcp_hostcache: bucket length out of range at %u: %u", i, V_tcp_hostcache.hashbase[i].hch_length)); if (all || hc_entry->rmx_expire <= 0) { TAILQ_REMOVE(&V_tcp_hostcache.hashbase[i].hch_bucket, From owner-dev-commits-src-all@freebsd.org Thu Apr 1 16:56:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9CC957F8CE; Thu, 1 Apr 2021 16:56:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB8V34whnz4Xg9; Thu, 1 Apr 2021 16:56:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B9E910B8D; Thu, 1 Apr 2021 16:56:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131GuhuS090397; Thu, 1 Apr 2021 16:56:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131GuhCO090396; Thu, 1 Apr 2021 16:56:43 GMT (envelope-from git) Date: Thu, 1 Apr 2021 16:56:43 GMT Message-Id: <202104011656.131GuhCO090396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: f7488064d914 - stable/13 - nfsv4 pnfs client: fix updating of the layout stateid.seqid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f7488064d914fb13457035b19cdbc298bfee89b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 16:56:43 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f7488064d914fb13457035b19cdbc298bfee89b5 commit f7488064d914fb13457035b19cdbc298bfee89b5 Author: Rick Macklem AuthorDate: 2021-03-18 19:20:25 +0000 Commit: Rick Macklem CommitDate: 2021-04-01 16:53:47 +0000 nfsv4 pnfs client: fix updating of the layout stateid.seqid During a recent NFSv4 testing event a test server was replying NFSERR_OLDSTATEID for layout stateids presented to the server for LayoutReturn operations. Upon rereading RFC5661, it was apparent that the FreeBSD NFSv4.1/4.2 pNFS client did not maintain the seqid field of the layout stateid correctly. This patch is believed to correct the problem. Tested against a FreeBSD pNFS server with diagnostics added to check the stateid's seqid did not indicate problems. Unfortunately, testing aginst this server will not happen in the near future, so the fix may not be correct yet. (cherry picked from commit fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc) --- sys/fs/nfsclient/nfs_clstate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index a1aa7c04e8a3..227d82a5f7f3 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3495,11 +3495,18 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) len, stateid.seqid, 0, 0, NULL, recallp); + if (error == 0 && + stateid.seqid > + lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = + stateid.seqid; recallp = NULL; wakeup(clp); NFSCL_DEBUG(4, - "aft layrcal=%d\n", - error); + "aft layrcal=%d " + "layseqid=%d\n", + error, + lyp->nfsly_stateid.seqid); } else error = NFSERR_NOMATCHLAYOUT; @@ -4881,6 +4888,8 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, } else { if (retonclose != 0) lyp->nfsly_flags |= NFSLY_RETONCLOSE; + if (stateidp->seqid > lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = stateidp->seqid; TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); lyp->nfsly_timestamp = NFSD_MONOSEC + 120; @@ -4893,7 +4902,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, return (EPERM); } *lypp = lyp; - } else + } else if (stateidp->seqid > lyp->nfsly_stateid.seqid) lyp->nfsly_stateid.seqid = stateidp->seqid; /* Merge the new list of File Layouts into the list. */ From owner-dev-commits-src-all@freebsd.org Thu Apr 1 17:29:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 899245B0EEA; Thu, 1 Apr 2021 17:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB9DB3VRrz4ZMH; Thu, 1 Apr 2021 17:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B2B210DDE; Thu, 1 Apr 2021 17:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131HTk7W033459; Thu, 1 Apr 2021 17:29:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131HTkfA033458; Thu, 1 Apr 2021 17:29:46 GMT (envelope-from git) Date: Thu, 1 Apr 2021 17:29:46 GMT Message-Id: <202104011729.131HTkfA033458@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: e0ad785a5d29 - stable/13 - libevent1: fix layout of duplicated RB_ENTRY() definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e0ad785a5d29d33ff8f382ddf055950444cc92e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 17:29:46 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e0ad785a5d29d33ff8f382ddf055950444cc92e2 commit e0ad785a5d29d33ff8f382ddf055950444cc92e2 Author: Kyle Evans AuthorDate: 2021-03-24 04:31:02 +0000 Commit: Kyle Evans CommitDate: 2021-04-01 17:29:20 +0000 libevent1: fix layout of duplicated RB_ENTRY() definition 3a509754ded1 removed the color field from our definition, but libevent1 has a copy of it off to the side to prevent event.h consumers from *needing* to pull in sys/queue.h and sys/tree.h. Update the event.h definition so that we don't accidentally end up with two different views of struct event. This appears to have no functional effect on anything in tree, but this came up in a local patch to port if_switch(4) and related components from OpenBSD. (cherry picked from commit 64c01719e476923fe1b24e5a6c6012a677cd017f) --- contrib/pf/libevent/event.h | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/pf/libevent/event.h b/contrib/pf/libevent/event.h index 3f2032dd068e..0c19201611b5 100644 --- a/contrib/pf/libevent/event.h +++ b/contrib/pf/libevent/event.h @@ -73,7 +73,6 @@ struct { \ struct type *rbe_left; /* left element */ \ struct type *rbe_right; /* right element */ \ struct type *rbe_parent; /* parent element */ \ - int rbe_color; /* node color */ \ } #endif /* !RB_ENTRY */ From owner-dev-commits-src-all@freebsd.org Thu Apr 1 17:29:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 819235B0E2C; Thu, 1 Apr 2021 17:29:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB9D93Cnnz4ZTY; Thu, 1 Apr 2021 17:29:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CB6B11039; Thu, 1 Apr 2021 17:29:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131HTj0A033438; Thu, 1 Apr 2021 17:29:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131HTjLN033437; Thu, 1 Apr 2021 17:29:45 GMT (envelope-from git) Date: Thu, 1 Apr 2021 17:29:45 GMT Message-Id: <202104011729.131HTjLN033437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 223d6caabd2e - stable/13 - init: use explicit_bzero() for clearing passwords MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 223d6caabd2ebaa8f0498a4e33b3418661173dad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 17:29:45 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=223d6caabd2ebaa8f0498a4e33b3418661173dad commit 223d6caabd2ebaa8f0498a4e33b3418661173dad Author: Kyle Evans AuthorDate: 2021-03-03 03:38:37 +0000 Commit: Kyle Evans CommitDate: 2021-04-01 17:29:06 +0000 init: use explicit_bzero() for clearing passwords This is a nop in practice, because it cannot be proven that this particular bzero() is not significant. Make it explicit anyways, rather than relying on an implementation detail of how the password is collected. Discussed with: Andrew Gierth (cherry picked from commit 852f70b24043885f0e438e8fecedd482a9a96d5e) --- sbin/init/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index c5f3c121f7f9..943db9f26bd3 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -908,7 +908,7 @@ single_user(void) if (clear == NULL || *clear == '\0') _exit(0); password = crypt(clear, pp->pw_passwd); - bzero(clear, _PASSWORD_LEN); + explicit_bzero(clear, _PASSWORD_LEN); if (password != NULL && strcmp(password, pp->pw_passwd) == 0) break; From owner-dev-commits-src-all@freebsd.org Thu Apr 1 17:31:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF8D65B11A7; Thu, 1 Apr 2021 17:31:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB9G95NKhz4b7J; Thu, 1 Apr 2021 17:31:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB81711421; Thu, 1 Apr 2021 17:31:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131HVTmn042688; Thu, 1 Apr 2021 17:31:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131HVTV8042687; Thu, 1 Apr 2021 17:31:29 GMT (envelope-from git) Date: Thu, 1 Apr 2021 17:31:29 GMT Message-Id: <202104011731.131HVTV8042687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 4752dc88e64d - stable/12 - init: use explicit_bzero() for clearing passwords MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4752dc88e64dbd90ead7030057f2985297f3453b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 17:31:29 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4752dc88e64dbd90ead7030057f2985297f3453b commit 4752dc88e64dbd90ead7030057f2985297f3453b Author: Kyle Evans AuthorDate: 2021-03-03 03:38:37 +0000 Commit: Kyle Evans CommitDate: 2021-04-01 17:30:07 +0000 init: use explicit_bzero() for clearing passwords This is a nop in practice, because it cannot be proven that this particular bzero() is not significant. Make it explicit anyways, rather than relying on an implementation detail of how the password is collected. Discussed with: Andrew Gierth (cherry picked from commit 852f70b24043885f0e438e8fecedd482a9a96d5e) --- sbin/init/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index 1bb35dbe5803..59bcfb6893dd 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -911,7 +911,7 @@ single_user(void) if (clear == NULL || *clear == '\0') _exit(0); password = crypt(clear, pp->pw_passwd); - bzero(clear, _PASSWORD_LEN); + explicit_bzero(clear, _PASSWORD_LEN); if (password != NULL && strcmp(password, pp->pw_passwd) == 0) break; From owner-dev-commits-src-all@freebsd.org Thu Apr 1 21:07:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1AF295B7515; Thu, 1 Apr 2021 21:07:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBG2w0KkJz4q3m; Thu, 1 Apr 2021 21:07:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1C2F14040; Thu, 1 Apr 2021 21:07:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131L73rY041205; Thu, 1 Apr 2021 21:07:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131L733q041204; Thu, 1 Apr 2021 21:07:03 GMT (envelope-from git) Date: Thu, 1 Apr 2021 21:07:03 GMT Message-Id: <202104012107.131L733q041204@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Renato Botelho Subject: git: 345c30a94f64 - main - libfetch: Retry with proxy auth when server returns 407 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: garga X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 345c30a94f6425954163f1e0b075a75f603d27cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 21:07:04 -0000 The branch main has been updated by garga (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=345c30a94f6425954163f1e0b075a75f603d27cd commit 345c30a94f6425954163f1e0b075a75f603d27cd Author: Renato Botelho AuthorDate: 2021-04-01 21:02:57 +0000 Commit: Renato Botelho CommitDate: 2021-04-01 21:02:57 +0000 libfetch: Retry with proxy auth when server returns 407 PR: 220468 Submitted by: Egil Hasting (based on) Reviewed by: kevans, kp Approved by: kp MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29533 --- lib/libfetch/http.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index 7f37b7d67197..e61e23b1425a 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1387,6 +1388,8 @@ http_connect(struct url *URL, struct url *purl, const char *flags) int verbose; int af, val; int serrno; + bool isproxyauth = false; + http_auth_challenges_t proxy_challenges; #ifdef INET6 af = AF_UNSPEC; @@ -1404,18 +1407,58 @@ http_connect(struct url *URL, struct url *purl, const char *flags) curl = (purl != NULL) ? purl : URL; +retry: if ((conn = fetch_connect(curl->host, curl->port, af, verbose)) == NULL) /* fetch_connect() has already set an error code */ return (NULL); init_http_headerbuf(&headerbuf); if (strcmp(URL->scheme, SCHEME_HTTPS) == 0 && purl) { - http_cmd(conn, "CONNECT %s:%d HTTP/1.1", - URL->host, URL->port); - http_cmd(conn, "Host: %s:%d", - URL->host, URL->port); + init_http_auth_challenges(&proxy_challenges); + http_cmd(conn, "CONNECT %s:%d HTTP/1.1", URL->host, URL->port); + http_cmd(conn, "Host: %s:%d", URL->host, URL->port); + if (isproxyauth) { + http_auth_params_t aparams; + init_http_auth_params(&aparams); + if (*purl->user || *purl->pwd) { + aparams.user = strdup(purl->user); + aparams.password = strdup(purl->pwd); + } else if ((p = getenv("HTTP_PROXY_AUTH")) != NULL && + *p != '\0') { + if (http_authfromenv(p, &aparams) < 0) { + http_seterr(HTTP_NEED_PROXY_AUTH); + fetch_syserr(); + goto ouch; + } + } else if (fetch_netrc_auth(purl) == 0) { + aparams.user = strdup(purl->user); + aparams.password = strdup(purl->pwd); + } else { + /* + * No auth information found in system - exiting + * with warning. + */ + warnx("Missing username and/or password set"); + fetch_syserr(); + goto ouch; + } + http_authorize(conn, "Proxy-Authorization", + &proxy_challenges, &aparams, purl); + clean_http_auth_params(&aparams); + } http_cmd(conn, ""); - if (http_get_reply(conn) != HTTP_OK) { - http_seterr(conn->err); + /* Get reply from CONNECT Tunnel attempt */ + int httpreply = http_get_reply(conn); + if (httpreply != HTTP_OK) { + http_seterr(httpreply); + /* If the error is a 407/HTTP_NEED_PROXY_AUTH */ + if (httpreply == HTTP_NEED_PROXY_AUTH && + ! isproxyauth) { + /* Try again with authentication. */ + clean_http_headerbuf(&headerbuf); + fetch_close(conn); + isproxyauth = true; + goto retry; + } goto ouch; } /* Read and discard the rest of the proxy response */ From owner-dev-commits-src-all@freebsd.org Thu Apr 1 21:25:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3997D5B7A4A; Thu, 1 Apr 2021 21:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBGRw189yz4rMb; Thu, 1 Apr 2021 21:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A0E414518; Thu, 1 Apr 2021 21:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131LPGjL068995; Thu, 1 Apr 2021 21:25:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131LPFjM068994; Thu, 1 Apr 2021 21:25:15 GMT (envelope-from git) Date: Thu, 1 Apr 2021 21:25:15 GMT Message-Id: <202104012125.131LPFjM068994@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 516fe911a6b7 - main - cxgbe(4): Always use the per-VI callout to read interface stats. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 516fe911a6b7a2d2f245ebbc7837e5dc2e353703 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 21:25:16 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=516fe911a6b7a2d2f245ebbc7837e5dc2e353703 commit 516fe911a6b7a2d2f245ebbc7837e5dc2e353703 Author: Navdeep Parhar AuthorDate: 2021-04-01 07:57:19 +0000 Commit: Navdeep Parhar CommitDate: 2021-04-01 21:24:29 +0000 cxgbe(4): Always use the per-VI callout to read interface stats. There is no change in the source of the stats (t4_get_port_stats or t4_get_vi_stats) but the per-port callout is gone. Sponsored by: Chelsio Communications Reviewed by: jhb@ Differential Revision: https://reviews.freebsd.org/D29527 --- sys/dev/cxgbe/adapter.h | 5 ++--- sys/dev/cxgbe/t4_main.c | 46 +++++++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 88dbbf5d06ac..7dd4cb72c63c 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -237,8 +237,9 @@ struct vi_info { struct timeval last_refreshed; struct fw_vi_stats_vf stats; - + struct mtx tick_mtx; struct callout tick; + struct sysctl_ctx_list ctx; /* from ifconfig up to driver detach */ uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */ @@ -316,8 +317,6 @@ struct port_info { u_int tx_parse_error; int fcs_reg; uint64_t fcs_base; - - struct callout tick; }; #define IS_MAIN_VI(vi) ((vi) == &((vi)->pi->vi[0])) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index ad622e9999de..b8500984fb8a 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -1797,7 +1797,8 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) struct adapter *sc = vi->adapter; vi->xact_addr_filt = -1; - callout_init(&vi->tick, 1); + mtx_init(&vi->tick_mtx, "vi tick", NULL, MTX_DEF); + callout_init_mtx(&vi->tick, &vi->tick_mtx, 0); if (sc->flags & IS_VF || t4_tx_vm_wr != 0) vi->flags |= TX_USES_VM_WR; @@ -1921,8 +1922,6 @@ cxgbe_attach(device_t dev) struct vi_info *vi; int i, rc; - callout_init_mtx(&pi->tick, &pi->pi_lock, 0); - rc = cxgbe_vi_attach(dev, &pi->vi[0]); if (rc) return (rc); @@ -1991,7 +1990,6 @@ cxgbe_detach(device_t dev) } cxgbe_vi_detach(&pi->vi[0]); - callout_drain(&pi->tick); ifmedia_removeall(&pi->media); end_synchronized_op(sc, 0); @@ -5583,14 +5581,16 @@ cxgbe_init_synchronized(struct vi_info *vi) /* all ok */ pi->up_vis++; ifp->if_drv_flags |= IFF_DRV_RUNNING; + if (pi->link_cfg.link_ok) + t4_os_link_changed(pi); + PORT_UNLOCK(pi); + mtx_lock(&vi->tick_mtx); if (pi->nvi > 1 || sc->flags & IS_VF) callout_reset(&vi->tick, hz, vi_tick, vi); else - callout_reset(&pi->tick, hz, cxgbe_tick, pi); - if (pi->link_cfg.link_ok) - t4_os_link_changed(pi); - PORT_UNLOCK(pi); + callout_reset(&vi->tick, hz, cxgbe_tick, vi); + mtx_unlock(&vi->tick_mtx); done: if (rc != 0) cxgbe_uninit_synchronized(vi); @@ -5642,11 +5642,11 @@ cxgbe_uninit_synchronized(struct vi_info *vi) TXQ_UNLOCK(txq); } + mtx_lock(&vi->tick_mtx); + callout_stop(&vi->tick); + mtx_unlock(&vi->tick_mtx); + PORT_LOCK(pi); - if (pi->nvi > 1 || sc->flags & IS_VF) - callout_stop(&vi->tick); - else - callout_stop(&pi->tick); if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { PORT_UNLOCK(pi); return (0); @@ -6277,11 +6277,11 @@ read_vf_stat(struct adapter *sc, u_int vin, int reg) { u32 stats[2]; - mtx_assert(&sc->reg_lock, MA_OWNED); if (sc->flags & IS_VF) { stats[0] = t4_read_reg(sc, VF_MPS_REG(reg)); stats[1] = t4_read_reg(sc, VF_MPS_REG(reg + 4)); } else { + mtx_assert(&sc->reg_lock, MA_OWNED); t4_write_reg(sc, A_PL_INDIR_CMD, V_PL_AUTOINC(1) | V_PL_VFID(vin) | V_PL_ADDR(VF_MPS_REG(reg))); stats[0] = t4_read_reg(sc, A_PL_INDIR_DATA); @@ -6297,6 +6297,8 @@ t4_get_vi_stats(struct adapter *sc, u_int vin, struct fw_vi_stats_vf *stats) #define GET_STAT(name) \ read_vf_stat(sc, vin, A_MPS_VF_STAT_##name##_L) + if (!(sc->flags & IS_VF)) + mtx_lock(&sc->reg_lock); stats->tx_bcast_bytes = GET_STAT(TX_VF_BCAST_BYTES); stats->tx_bcast_frames = GET_STAT(TX_VF_BCAST_FRAMES); stats->tx_mcast_bytes = GET_STAT(TX_VF_MCAST_BYTES); @@ -6313,6 +6315,8 @@ t4_get_vi_stats(struct adapter *sc, u_int vin, struct fw_vi_stats_vf *stats) stats->rx_ucast_bytes = GET_STAT(RX_VF_UCAST_BYTES); stats->rx_ucast_frames = GET_STAT(RX_VF_UCAST_FRAMES); stats->rx_err_frames = GET_STAT(RX_VF_ERR_FRAMES); + if (!(sc->flags & IS_VF)) + mtx_unlock(&sc->reg_lock); #undef GET_STAT } @@ -6343,10 +6347,8 @@ vi_refresh_stats(struct adapter *sc, struct vi_info *vi) if (timevalcmp(&tv, &vi->last_refreshed, <)) return; - mtx_lock(&sc->reg_lock); t4_get_vi_stats(sc, vi->vin, &vi->stats); getmicrotime(&vi->last_refreshed); - mtx_unlock(&sc->reg_lock); } static void @@ -6380,13 +6382,14 @@ cxgbe_refresh_stats(struct adapter *sc, struct port_info *pi) static void cxgbe_tick(void *arg) { - struct port_info *pi = arg; - struct adapter *sc = pi->adapter; + struct vi_info *vi = arg; + struct adapter *sc = vi->adapter; - PORT_LOCK_ASSERT_OWNED(pi); - cxgbe_refresh_stats(sc, pi); + MPASS(IS_MAIN_VI(vi)); + mtx_assert(&vi->tick_mtx, MA_OWNED); - callout_schedule(&pi->tick, hz); + cxgbe_refresh_stats(sc, vi->pi); + callout_schedule(&vi->tick, hz); } void @@ -6395,8 +6398,9 @@ vi_tick(void *arg) struct vi_info *vi = arg; struct adapter *sc = vi->adapter; - vi_refresh_stats(sc, vi); + mtx_assert(&vi->tick_mtx, MA_OWNED); + vi_refresh_stats(sc, vi); callout_schedule(&vi->tick, hz); } From owner-dev-commits-src-all@freebsd.org Thu Apr 1 22:08:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 387FD5B8C93 for ; Thu, 1 Apr 2021 22:08:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBHPz6vj0z4tgC; Thu, 1 Apr 2021 22:08:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF92414D2D; Thu, 1 Apr 2021 22:08:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131M8dgQ025744; Thu, 1 Apr 2021 22:08:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131M8dIx025743; Thu, 1 Apr 2021 22:08:39 GMT (envelope-from git) Date: Thu, 1 Apr 2021 22:08:39 GMT Message-Id: <202104012208.131M8dIx025743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: 1e02e5b0ba86 - vendor/acpica - Import ACPICA 20210331. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/vendor/acpica X-Git-Reftype: branch X-Git-Commit: 1e02e5b0ba8634758c128dcb43c67342c7219cd4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 22:08:40 -0000 The branch vendor/acpica has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=1e02e5b0ba8634758c128dcb43c67342c7219cd4 commit 1e02e5b0ba8634758c128dcb43c67342c7219cd4 Author: Jung-uk Kim AuthorDate: 2021-04-01 22:01:03 +0000 Commit: Jung-uk Kim CommitDate: 2021-04-01 22:01:03 +0000 Import ACPICA 20210331. --- changes.txt | 40 +++ source/common/acfileio.c | 3 + source/common/ahids.c | 2 + source/common/ahpredef.c | 4 + source/common/ahtable.c | 3 + source/common/ahuuids.c | 1 + source/common/cmfsize.c | 2 +- source/common/dmrestag.c | 14 +- source/common/dmtable.c | 103 ++++++- source/common/dmtbdump1.c | 76 +++++ source/common/dmtbdump2.c | 468 ++++++++++++++++++++--------- source/common/dmtbdump3.c | 100 ++++++ source/common/dmtbinfo1.c | 34 ++- source/common/dmtbinfo2.c | 247 +++++++++++++-- source/common/dmtbinfo3.c | 72 +++++ source/compiler/aslallocate.c | 2 +- source/compiler/aslascii.c | 4 +- source/compiler/aslcompiler.h | 4 + source/compiler/aslcompiler.l | 1 + source/compiler/aslerror.c | 6 +- source/compiler/aslhelpers.y | 5 + source/compiler/aslmap.c | 1 + source/compiler/aslmessages.c | 3 +- source/compiler/aslmessages.h | 1 + source/compiler/aslnamesp.c | 3 +- source/compiler/aslopcodes.c | 2 +- source/compiler/asloperands.c | 2 +- source/compiler/aslparser.y | 2 +- source/compiler/aslprintf.c | 2 +- source/compiler/aslresource.c | 5 + source/compiler/aslresources.y | 20 +- source/compiler/aslrestype2s.c | 136 +++++++++ source/compiler/asltokens.y | 1 + source/compiler/asltransform.c | 5 + source/compiler/asltypes.y | 2 + source/compiler/dtcompiler.h | 15 + source/compiler/dttable1.c | 143 ++++++++- source/compiler/dttable2.c | 454 ++++++++++++++++++++++++---- source/compiler/dttemplate.h | 343 +++++++++++++-------- source/compiler/dtutils.c | 5 + source/components/disassembler/dmresrcl2.c | 90 +++++- source/components/events/evhandler.c | 7 + source/components/events/evregion.c | 75 +++-- source/components/events/evxfregn.c | 1 + source/components/namespace/nsaccess.c | 3 +- source/components/namespace/nsrepair2.c | 18 +- source/components/resources/rscalc.c | 4 +- source/components/resources/rsdump.c | 10 + source/components/resources/rsdumpinfo.c | 15 + source/components/resources/rsinfo.c | 6 +- source/components/resources/rslist.c | 10 +- source/components/resources/rsmisc.c | 18 ++ source/components/resources/rsserial.c | 70 +++++ source/components/utilities/utresdecode.c | 11 +- source/components/utilities/utresrc.c | 1 + source/include/acdisasm.h | 44 ++- source/include/acobject.h | 1 + source/include/acoutput.h | 2 +- source/include/acpixf.h | 2 +- source/include/acpredef.h | 15 + source/include/acresrc.h | 4 + source/include/acrestyp.h | 12 +- source/include/actbinfo.h | 26 +- source/include/actbl1.h | 63 +++- source/include/actbl2.h | 280 +++++++++++++++-- source/include/actbl3.h | 84 +++++- source/include/acutils.h | 1 + source/include/acuuid.h | 1 + source/include/amlresrc.h | 25 +- source/include/platform/acgcc.h | 2 +- source/tools/acpisrc/astable.c | 31 +- 71 files changed, 2787 insertions(+), 481 deletions(-) diff --git a/changes.txt b/changes.txt index e58f906382b5..0b71b266a6ba 100644 --- a/changes.txt +++ b/changes.txt @@ -1,3 +1,43 @@ +---------------------------------------- +31 March 2021. Summary of changes for version 20210331: + +This release is available at https://acpica.org/downloads, and includes +all ACPI 6.4 support + +1) ACPICA kernel-resident subsystem: +ACPI 6.4: iASL: deprecate DDBHandleObj keyword +Always create namespace nodes using AcpiNsCreateNode(). ACPICA is +allocating an object using kmalloc(), but then frees it +using kmem_cache_free(<"Acpi-Namespace" kmem_cache>). This is wrong. +Fixed a race condition in generic serial bus operation region handler. +Fixed by Hans de Goede. + +2) iASL Compiler/Disassembler and ACPICA tools: + +ACPI 6.4: NFIT: add Location Cookie field +ACPI 6.4: HMAT: add new fields/flags +ACPI 6.4: Add new flags in SRAT +ACPI 6.4: add SDEV secure access components +ACPI 6.4: add Csi2Bus resource template +ACPI 6.4: add support for PHAT table +ACPI 6.4: add support for PMTT table +Add disassembly support for the IVRS table. Compilation of the table is +not yet complete. +Fixed a potential infinite loop due to type mismatch. The for-loop is +using a UINT8 counter and comparing the upper +limit against a UINT32 AslGbl_ExpectedMessagesIndex maximum. In +the case where AslGbl_ExpectedMessagesIndex is > 255 the counter i +will wrap around to zero and the loop will never exit. I suspect +the AslGbl_ExpectedMessagesIndex is never that high, but fixing +this does future proof the code and cleans up static analysis +warnings.Colin King. +iASL/TableCompiler: update it with IORT table E.b revision changes. From +shamiali2008. +iASL/TableCompiler: Add compilation support for the VIOT table. Signed- +off-by: Jean-Philippe Brucker. +iASL/TableCompiler: Add compilation support for CEDT table. Also, update +the CEDT template. + ---------------------------------------- 05 January 2021. Summary of changes for version 20210105: diff --git a/source/common/acfileio.c b/source/common/acfileio.c index 628cf7a41b25..99f8972985ec 100644 --- a/source/common/acfileio.c +++ b/source/common/acfileio.c @@ -559,6 +559,9 @@ AcValidateTableHeader ( if (Actual < sizeof (ACPI_TABLE_HEADER)) { + fprintf (stderr, + "Could not read entire table header: Actual %u, Requested %u\n", + (UINT32) Actual, (UINT32) sizeof (ACPI_TABLE_HEADER)); return (AE_ERROR); } diff --git a/source/common/ahids.c b/source/common/ahids.c index 1e6edaf711c1..b58bc082054a 100644 --- a/source/common/ahids.c +++ b/source/common/ahids.c @@ -188,6 +188,8 @@ const AH_DEVICE_ID AslDeviceIds[] = {"ACPI0012", "NVDIMM Root Device"}, {"ACPI0013", "Generic Event Device"}, {"ACPI0014", "Wireless Power Calibration Device"}, + {"ACPI0015", "USB4 host interface device"}, + {"ACPI0016", "Compute Express Link Host Bridge"}, {"ADMA0F28", "Intel Audio DMA"}, {"AMCR0F28", "Intel Audio Machine Driver"}, {"ATK4001", "Asus Radio Control Button"}, diff --git a/source/common/ahpredef.c b/source/common/ahpredef.c index e6e2ffc75aa3..d92417d16ca4 100644 --- a/source/common/ahpredef.c +++ b/source/common/ahpredef.c @@ -200,12 +200,16 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_BMC", "Battery Maintenance Control", "Sets battery maintenance and control features"), AH_PREDEF ("_BMD", "Battery Maintenance Data", "Returns battery maintenance, control, and state data"), AH_PREDEF ("_BMS", "Battery Measurement Sampling Time", "Sets the battery measurement sampling time"), + AH_PREDEF ("_BPC", "Battery Power Characteristics", "Returns static values used to configure power threshold support in the platform firmware"), + AH_PREDEF ("_BPS", "Battery Power State", "Returns the power delivery capabilities of the battery at the present time"), + AH_PREDEF ("_BPT", "Battery Power Threshold", "Set a relative battery peak power capability change threshold"), AH_PREDEF ("_BQC", "Brightness Query Current", "Returns the current display brightness level"), AH_PREDEF ("_BST", "Battery Status", "Returns a Control Method Battery status block"), AH_PREDEF ("_BTH", "Battery Throttle Limit", "Thermal limit for charging and discharging"), AH_PREDEF ("_BTM", "Battery Time", "Returns the battery runtime"), AH_PREDEF ("_BTP", "Battery Trip Point", "Sets a Control Method Battery trip point"), AH_PREDEF ("_CBA", "Configuration Base Address", "Sets the base address for a PCI Express host bridge"), + AH_PREDEF ("_CBR", "CXL Host Bridge Register Info", "Get the memory location of CXL Host Bridge Registers"), AH_PREDEF ("_CCA", "Cache Coherency Attribute", "Returns a device's support level for cache coherency"), AH_PREDEF ("_CDM", "Clock Domain", "Returns a logical processor's clock domain identifier"), AH_PREDEF ("_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"), diff --git a/source/common/ahtable.c b/source/common/ahtable.c index ac3c416bb392..e318ddf39189 100644 --- a/source/common/ahtable.c +++ b/source/common/ahtable.c @@ -203,6 +203,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_BERT, "Boot Error Record Table"}, {ACPI_SIG_BGRT, "Boot Graphics Resource Table"}, {ACPI_SIG_BOOT, "Simple Boot Flag Table"}, + {ACPI_SIG_CEDT, "CXL Early Discovery Table"}, {ACPI_SIG_CPEP, "Corrected Platform Error Polling table"}, {ACPI_SIG_CSRT, "Core System Resource Table"}, {ACPI_SIG_DBG2, "Debug Port table type 2"}, @@ -231,6 +232,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_MSDM, "Microsoft Data Management table"}, {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, + {ACPI_SIG_PHAT, "Platform Health Assessment Table"}, {ACPI_SIG_PDTT, "Platform Debug Trigger Table"}, {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, {ACPI_SIG_PPTT, "Processor Properties Topology Table"}, @@ -251,6 +253,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_TCPA, "Trusted Computing Platform Alliance table"}, {ACPI_SIG_TPM2, "Trusted Platform Module hardware interface table"}, {ACPI_SIG_UEFI, "UEFI Boot Optimization Table"}, + {ACPI_SIG_VIOT, "Virtual I/O Translation Table"}, {ACPI_SIG_WAET, "Windows ACPI Emulated Devices Table"}, {ACPI_SIG_WDAT, "Watchdog Action Table"}, {ACPI_SIG_WDDT, "Watchdog Description Table"}, diff --git a/source/common/ahuuids.c b/source/common/ahuuids.c index 427f91694233..eef1c5688cfd 100644 --- a/source/common/ahuuids.c +++ b/source/common/ahuuids.c @@ -208,6 +208,7 @@ const AH_UUID Gbl_AcpiUuids[] = {"Device Graphs for _DSD", UUID_DEVICE_GRAPHS}, {"Hierarchical Data Extension", UUID_HIERARCHICAL_DATA_EXTENSION}, {"ARM Coresight Graph", UUID_CORESIGHT_GRAPH}, + {"USB4 Capabilities", UUID_USB4_CAPABILITIES}, {NULL, NULL} }; diff --git a/source/common/cmfsize.c b/source/common/cmfsize.c index e0c66e31d780..38ec915a989d 100644 --- a/source/common/cmfsize.c +++ b/source/common/cmfsize.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: cfsize - Common get file size function + * Module Name: cmfsize - Common get file size function * *****************************************************************************/ diff --git a/source/common/dmrestag.c b/source/common/dmrestag.c index d8a044069c93..59d5c4f4faeb 100644 --- a/source/common/dmrestag.c +++ b/source/common/dmrestag.c @@ -384,6 +384,14 @@ static const ACPI_RESOURCE_TAG AcpiDmGpioIoTags[] = /* Subtype tables for SerialBus descriptors */ +static const ACPI_RESOURCE_TAG AcpiDmCsi2SerialBusTags[] = /* ACPI 6.4 */ +{ + {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, + {( 7 * 8) + 0, ACPI_RESTAG_PHYTYPE}, + {( 7 * 8) + 2, ACPI_RESTAG_LOCALPORT}, + {0, NULL} +}; + static const ACPI_RESOURCE_TAG AcpiDmI2cSerialBusTags[] = { {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, @@ -424,6 +432,7 @@ static const ACPI_RESOURCE_TAG AcpiDmUartSerialBusTags[] = {0, NULL} }; + /* Subtype tables for PinFunction descriptor */ static const ACPI_RESOURCE_TAG AcpiDmPinFunctionTags[] = @@ -539,7 +548,8 @@ static const ACPI_RESOURCE_TAG *AcpiGbl_SerialResourceTags[] = NULL, /* 0x00 Reserved */ AcpiDmI2cSerialBusTags, /* 0x01 I2C SerialBus */ AcpiDmSpiSerialBusTags, /* 0x02 SPI SerialBus */ - AcpiDmUartSerialBusTags /* 0x03 UART SerialBus */ + AcpiDmUartSerialBusTags, /* 0x03 UART SerialBus */ + AcpiDmCsi2SerialBusTags /* 0x04 CSI2 SerialBus */ }; /* @@ -987,7 +997,7 @@ AcpiDmGetResourceTag ( case ACPI_RESOURCE_NAME_SERIAL_BUS: - /* SerialBus has 3 subtypes: I2C, SPI, and UART */ + /* SerialBus has 4 subtypes: I2C, SPI, UART, and CSI2 */ if ((Resource->CommonSerialBus.Type == 0) || (Resource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE)) diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 3e4c6c34153c..ffec889a06de 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -184,6 +184,12 @@ static const char *AcpiDmAsfSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmCedtSubnames[] = +{ + "CXL Host Bridge Structure", + "Unknown Subtable Type" /* Reserved */ +}; + static const char *AcpiDmDmarSubnames[] = { "Hardware Unit Definition", @@ -367,15 +373,24 @@ static const char *AcpiDmPcctSubnames[] = "HW-Reduced Comm Subspace Type2", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */ "Extended PCC Master Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE */ "Extended PCC Slave Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE */ + "HW Registers based Comm Subspace", /* ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE */ "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmPhatSubnames[] = +{ + "Firmware Version Data", /* ACPI_PHAT_TYPE_FW_VERSION_DATA */ + "Firmware Health Data", /* ACPI_PHAT_TYPE_FW_HEALTH_DATA */ + "Unknown Subtable Type" /* Reserved */ +}; + static const char *AcpiDmPmttSubnames[] = { "Socket", /* ACPI_PMTT_TYPE_SOCKET */ "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */ "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ - "Unknown Subtable Type" /* Reserved */ + "Unknown Subtable Type", /* Reserved */ + "Vendor Specific" /* ACPI_PMTT_TYPE_VENDOR */ }; static const char *AcpiDmPpttSubnames[] = @@ -434,6 +449,16 @@ static const char *AcpiDmLpitSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmViotSubnames[] = +{ + "Unknown Subtable Type", /* 0 -Reserved */ + "PCI Range", + "MMIO Endpoint", + "VirtIO-PCI IOMMU", + "VirtIO-MMIO IOMMU", + "Unknown Subtable Type" /* Reserved */ +}; + #define ACPI_FADT_PM_RESERVED 9 static const char *AcpiDmFadtProfiles[] = @@ -474,8 +499,8 @@ static const char *AcpiDmGasAccessWidth[] = * handler. This table must be NULL terminated. RSDP and FACS are * special-cased elsewhere. * - * Note: Any tables added here should be duplicated within AcpiSupportedTables - * in the file common/ahtable.c + * Note: Any tables added here should be duplicated within + * AcpiGbl_SupportedTables in the file common/ahtable.c * ******************************************************************************/ @@ -485,6 +510,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert}, {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt}, {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot}, + {ACPI_SIG_CEDT, NULL, AcpiDmDumpCedt, DtCompileCedt, TemplateCedt}, {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep}, {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt}, {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2}, @@ -512,6 +538,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt}, + {ACPI_SIG_PHAT, NULL, AcpiDmDumpPhat, DtCompilePhat, TemplatePhat}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt}, {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, @@ -529,6 +556,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2}, {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, + {ACPI_SIG_VIOT, AcpiDmTableInfoViot, AcpiDmDumpViot, DtCompileViot, TemplateViot}, {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat}, {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt}, @@ -936,6 +964,7 @@ AcpiDmDumpTable ( case ACPI_DMT_CHKSUM: case ACPI_DMT_SPACEID: case ACPI_DMT_ACCWIDTH: + case ACPI_DMT_CEDT: case ACPI_DMT_IVRS: case ACPI_DMT_GTDT: case ACPI_DMT_MADT: @@ -952,6 +981,7 @@ AcpiDmDumpTable ( case ACPI_DMT_ERSTACT: case ACPI_DMT_ERSTINST: case ACPI_DMT_DMAR_SCOPE: + case ACPI_DMT_VIOT: ByteLength = 1; break; @@ -961,6 +991,7 @@ AcpiDmDumpTable ( case ACPI_DMT_HEST: case ACPI_DMT_HMAT: case ACPI_DMT_NFIT: + case ACPI_DMT_PHAT: ByteLength = 2; break; @@ -1030,6 +1061,17 @@ AcpiDmDumpTable ( ByteLength = SubtableLength; break; + case ACPI_DMT_PMTT_VENDOR: + /* + * Calculate the length of the vendor data for the PMTT table: + * Length = (Current Subtable ptr + Subtable length) - + * Start of the vendor data (Target) + */ + ByteLength = ((ACPI_CAST_PTR (char, Table) + + (ACPI_CAST_PTR (ACPI_PMTT_HEADER, Table)->Length)) - + ACPI_CAST_PTR (char, Target)); + break; + case ACPI_DMT_STRING: ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1; @@ -1346,6 +1388,20 @@ AcpiDmDumpTable ( AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]); break; + case ACPI_DMT_CEDT: + + /* CEDT subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_CEDT_TYPE_RESERVED) + { + Temp8 = ACPI_CEDT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmCedtSubnames[Temp8]); + break; + case ACPI_DMT_DMAR: /* DMAR subtable types */ @@ -1559,16 +1615,33 @@ AcpiDmDumpTable ( AcpiDmPcctSubnames[Temp8]); break; + case ACPI_DMT_PHAT: + + /* PMTT subtable types */ + + Temp16 = *Target; + if (Temp16 > ACPI_PHAT_TYPE_RESERVED) + { + Temp16 = ACPI_PHAT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16(Target), + AcpiDmPhatSubnames[Temp16]); + break; + case ACPI_DMT_PMTT: /* PMTT subtable types */ Temp8 = *Target; - if (Temp8 > ACPI_PMTT_TYPE_RESERVED) + if (Temp8 == ACPI_PMTT_TYPE_VENDOR) + { + Temp8 = ACPI_PMTT_TYPE_RESERVED + 1; + } + else if (Temp8 > ACPI_PMTT_TYPE_RESERVED) { Temp8 = ACPI_PMTT_TYPE_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]); break; @@ -1599,6 +1672,8 @@ AcpiDmDumpTable ( break; case ACPI_DMT_RAW_BUFFER: + case ACPI_DMT_BUFFER: + case ACPI_DMT_PMTT_VENDOR: if (ByteLength == 0) { @@ -1606,8 +1681,7 @@ AcpiDmDumpTable ( break; } - AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength, - CurrentOffset, NULL); + AcpiDmDumpBuffer (Target, 0, ByteLength, 0, NULL); break; case ACPI_DMT_SDEV: @@ -1676,6 +1750,7 @@ AcpiDmDumpTable ( { case ACPI_IVRS_TYPE_HARDWARE1: case ACPI_IVRS_TYPE_HARDWARE2: + case ACPI_IVRS_TYPE_HARDWARE3: Name = AcpiDmIvrsSubnames[0]; break; @@ -1710,6 +1785,20 @@ AcpiDmDumpTable ( AcpiDmLpitSubnames[Temp32]); break; + case ACPI_DMT_VIOT: + + /* VIOT subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_VIOT_RESERVED) + { + Temp8 = ACPI_VIOT_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmViotSubnames[Temp8]); + break; + case ACPI_DMT_EXIT: return (AE_OK); diff --git a/source/common/dmtbdump1.c b/source/common/dmtbdump1.c index 72d667e9759a..8fc53acf49d8 100644 --- a/source/common/dmtbdump1.c +++ b/source/common/dmtbdump1.c @@ -329,6 +329,82 @@ AcpiDmDumpAsf ( } } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpCedt + * + * PARAMETERS: Table - A CEDT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a CEDT. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpCedt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_CEDT_HEADER *Subtable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_CEDT); + ACPI_DMTABLE_INFO *InfoTable; + + + /* There is no main table (other than the standard ACPI header) */ + + Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoCedtHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (Subtable->Type) + { + case ACPI_CEDT_TYPE_CHBS: + + InfoTable = AcpiDmTableInfoCedt0; + break; + + default: + + AcpiOsPrintf ("\n**** Unknown CEDT subtable type 0x%X\n\n", + Subtable->Type); + + /* Attempt to continue */ + + if (!Subtable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; + } + goto NextSubtable; + } + + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + +NextSubtable: + /* Point to next subtable */ + + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Subtable, + Subtable->Length); + } +} /******************************************************************************* * diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c index b8ece375a4f2..80d9d459778c 100644 --- a/source/common/dmtbdump2.c +++ b/source/common/dmtbdump2.c @@ -181,6 +181,7 @@ AcpiDmDumpIort ( ACPI_IORT_NODE *IortNode; ACPI_IORT_ITS_GROUP *IortItsGroup = NULL; ACPI_IORT_SMMU *IortSmmu = NULL; + ACPI_IORT_RMR *IortRmr = NULL; UINT32 Offset; UINT32 NodeOffset; UINT32 Length; @@ -188,6 +189,7 @@ AcpiDmDumpIort ( char *String; UINT32 i; UINT32 MappingByteLength; + UINT8 Revision; /* Main table */ @@ -198,6 +200,17 @@ AcpiDmDumpIort ( return; } + Revision = Table->Revision; + + /* Both IORT Rev E and E.a have known issues and are not supported */ + + if (Revision == 1 || Revision == 2) + { + AcpiOsPrintf ("\n**** Unsupported IORT revision 0x%X\n", + Revision); + return; + } + Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table); Offset = sizeof (ACPI_TABLE_IORT); @@ -221,8 +234,18 @@ AcpiDmDumpIort ( IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset); AcpiOsPrintf ("\n"); Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); - Status = AcpiDmDumpTable (Table->Length, Offset, - IortNode, Length, AcpiDmTableInfoIortHdr); + + if (Revision == 0) + { + Status = AcpiDmDumpTable (Table->Length, Offset, + IortNode, Length, AcpiDmTableInfoIortHdr); + } + else if (Revision >= 3) + { + Status = AcpiDmDumpTable (Table->Length, Offset, + IortNode, Length, AcpiDmTableInfoIortHdr3); + } + if (ACPI_FAILURE (Status)) { return; @@ -272,6 +295,13 @@ AcpiDmDumpIort ( Length = IortNode->Length - NodeOffset; break; + case ACPI_IORT_NODE_RMR: + + InfoTable = AcpiDmTableInfoIort6; + Length = IortNode->Length - NodeOffset; + IortRmr = ACPI_ADD_PTR (ACPI_IORT_RMR, IortNode, NodeOffset); + break; + default: AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n", @@ -391,7 +421,30 @@ AcpiDmDumpIort ( } break; - default: + case ACPI_IORT_NODE_RMR: + + /* Validate IortRmr to avoid compiler warnings */ + if (IortRmr) + { + NodeOffset = IortRmr->RmrOffset; + Length = sizeof (ACPI_IORT_RMR_DESC); + for (i = 0; i < IortRmr->RmrCount; i++) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + Length, AcpiDmTableInfoIort6a); + if (ACPI_FAILURE (Status)) + { + return; + } + + NodeOffset += Length; + } + } + break; + + default: break; } @@ -434,8 +487,6 @@ NextSubtable: * ******************************************************************************/ -static UINT8 EntrySizes[] = {4,8,16,32}; - void AcpiDmDumpIvrs ( ACPI_TABLE_HEADER *Table) @@ -445,6 +496,7 @@ AcpiDmDumpIvrs ( UINT32 EntryOffset; UINT32 EntryLength; UINT32 EntryType; + ACPI_IVRS_DEVICE_HID *HidSubtable; ACPI_IVRS_DE_HEADER *DeviceEntry; ACPI_IVRS_HEADER *Subtable; ACPI_DMTABLE_INFO *InfoTable; @@ -481,6 +533,7 @@ AcpiDmDumpIvrs ( break; case ACPI_IVRS_TYPE_HARDWARE2: + case ACPI_IVRS_TYPE_HARDWARE3: InfoTable = AcpiDmTableInfoIvrs01; break; @@ -520,7 +573,8 @@ AcpiDmDumpIvrs ( /* The hardware subtable can contain multiple device entries */ if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 || - Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2) + Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2 || + Subtable->Type == ACPI_IVRS_TYPE_HARDWARE3) { if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1) { @@ -545,11 +599,10 @@ AcpiDmDumpIvrs ( * * 00 = 4 byte * 01 = 8 byte - * 10 = 16 byte - currently no entries defined - * 11 = 32 byte - currently no entries defined + * 1x = variable length */ EntryType = DeviceEntry->Type; - EntryLength = EntrySizes [EntryType >> 6]; + EntryLength = EntryType >> 6 == 1 ? 8 : 4; switch (EntryType) { @@ -588,6 +641,14 @@ AcpiDmDumpIvrs ( InfoTable = AcpiDmTableInfoIvrs8c; break; + /* Variable-length entries */ + + case ACPI_IVRS_TYPE_HID: + + EntryLength = 22; + InfoTable = AcpiDmTableInfoIvrsHid; + break; + default: InfoTable = AcpiDmTableInfoIvrs4; AcpiOsPrintf ( @@ -606,9 +667,24 @@ AcpiDmDumpIvrs ( return; } + HidSubtable = ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, DeviceEntry); EntryOffset += EntryLength; DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, EntryLength); + + if (EntryType == ACPI_IVRS_TYPE_HID) + { + EntryLength = HidSubtable->UidLength; + Status = AcpiDmDumpTable (Table->Length, EntryOffset, + Table, EntryLength, AcpiDmTableInfoIvrsHid1); + if (ACPI_FAILURE (Status)) + { + return; + } + EntryOffset += EntryLength; + DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, + DeviceEntry, EntryLength); + } } } @@ -825,6 +901,11 @@ AcpiDmDumpMadt ( InfoTable = AcpiDmTableInfoMadt15; break; + case ACPI_MADT_TYPE_MULTIPROC_WAKEUP: + + InfoTable = AcpiDmTableInfoMadt16; + break; + default: AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", @@ -1380,6 +1461,11 @@ AcpiDmDumpPcct ( InfoTable = AcpiDmTableInfoPcct4; break; + case ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct5; + break; + default: AcpiOsPrintf ( @@ -1461,201 +1547,224 @@ AcpiDmDumpPdtt ( /******************************************************************************* * - * FUNCTION: AcpiDmDumpPmtt + * FUNCTION: AcpiDmDumpPhat * - * PARAMETERS: Table - A PMTT table + * PARAMETERS: Table - A PHAT table * * RETURN: None * - * DESCRIPTION: Format the contents of a PMTT. This table type consists - * of an open-ended number of subtables. + * DESCRIPTION: Format the contents of a PHAT. * ******************************************************************************/ void -AcpiDmDumpPmtt ( +AcpiDmDumpPhat ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_PMTT_HEADER *Subtable; - ACPI_PMTT_HEADER *MemSubtable; - ACPI_PMTT_HEADER *DimmSubtable; - ACPI_PMTT_DOMAIN *DomainArray; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_PHAT_HEADER *Subtable; + ACPI_PHAT_VERSION_DATA *VersionData; + UINT32 RecordCount; UINT32 Length = Table->Length; - UINT32 Offset = sizeof (ACPI_TABLE_PMTT); - UINT32 MemOffset; - UINT32 DimmOffset; - UINT32 DomainOffset; - UINT32 DomainCount; - + UINT32 Offset = sizeof (ACPI_TABLE_PHAT); + UINT32 SubtableLength; + UINT32 PathLength; + UINT32 VendorLength; - /* Main table */ - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt); - if (ACPI_FAILURE (Status)) - { - return; - } + Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, sizeof (ACPI_TABLE_PHAT)); - /* Subtables */ - - Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoPmttHdr); + Status = AcpiDmDumpTable (Length, 0, Subtable, + sizeof (ACPI_PHAT_HEADER), AcpiDmTableInfoPhatHdr); if (ACPI_FAILURE (Status)) { return; } - /* Only Socket subtables are expected at this level */ - - if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET) + switch (Subtable->Type) { - AcpiOsPrintf ( - "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", + case ACPI_PHAT_TYPE_FW_VERSION_DATA: + + InfoTable = AcpiDmTableInfoPhat0; + SubtableLength = sizeof (ACPI_PHAT_VERSION_DATA); + break; + + case ACPI_PHAT_TYPE_FW_HEALTH_DATA: + + InfoTable = AcpiDmTableInfoPhat1; + SubtableLength = sizeof (ACPI_PHAT_HEALTH_DATA); + break; + + default: + + AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n", Subtable->Type); + return; } - /* Dump the fixed-length portion of the subtable */ - - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoPmtt0); + Status = AcpiDmDumpTable (Length, 0, Subtable, + SubtableLength, InfoTable); if (ACPI_FAILURE (Status)) { return; } - /* Walk the memory controller subtables */ - - MemOffset = sizeof (ACPI_PMTT_SOCKET); - MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable, - sizeof (ACPI_PMTT_SOCKET)); - - while (((Offset + MemOffset) < Table->Length) && - (MemOffset < Subtable->Length)) + switch (Subtable->Type) { - /* Common subtable header */ + case ACPI_PHAT_TYPE_FW_VERSION_DATA: - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, - Offset + MemOffset, MemSubtable, - MemSubtable->Length, AcpiDmTableInfoPmttHdr); - if (ACPI_FAILURE (Status)) + VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA, Subtable); + RecordCount = VersionData->ElementCount; + while (RecordCount) { - return; + Status = AcpiDmDumpTable (Length, Offset, + ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_VERSION_DATA)), + sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a); + if (ACPI_FAILURE (Status)) + { + return; + } + + RecordCount--; } - /* Only memory controller subtables are expected at this level */ + break; + + case ACPI_PHAT_TYPE_FW_HEALTH_DATA: - if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER) + /* account for the null terminator */ + + PathLength = strlen (ACPI_ADD_PTR (char, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA))) + 1; + Status = AcpiDmDumpTable (Length, Offset, + ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)), + PathLength, AcpiDmTableInfoPhat1a); + if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ( - "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", - MemSubtable->Type); return; } *** 4803 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Apr 1 22:08:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35C215B8ABE for ; Thu, 1 Apr 2021 22:08:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBHQ116fsz4tMH; Thu, 1 Apr 2021 22:08:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1910E14B9D; Thu, 1 Apr 2021 22:08:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131M8f5x025774; Thu, 1 Apr 2021 22:08:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131M8eBA025773; Thu, 1 Apr 2021 22:08:40 GMT (envelope-from git) Date: Thu, 1 Apr 2021 22:08:40 GMT Message-Id: <202104012208.131M8eBA025773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: 82f5b12dc393 - Create tag vendor/acpica/20210331 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/tags/vendor/acpica/20210331 X-Git-Reftype: annotated tag X-Git-Commit: 82f5b12dc3930b02915cf462dec4d282c8cf641d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 22:08:41 -0000 The annotated tag vendor/acpica/20210331 has been created by jkim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/acpica/20210331 tag vendor/acpica/20210331 Tagger: Jung-uk Kim TaggerDate: 2021-04-01 22:06:46 +0000 Tag ACPICA 20210331. commit 1e02e5b0ba8634758c128dcb43c67342c7219cd4 Author: Jung-uk Kim AuthorDate: 2021-04-01 22:01:03 +0000 Commit: Jung-uk Kim CommitDate: 2021-04-01 22:01:03 +0000 Import ACPICA 20210331. From owner-dev-commits-src-all@freebsd.org Thu Apr 1 22:12:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C9335B8D8B; Thu, 1 Apr 2021 22:12:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBHVW700Vz4tnv; Thu, 1 Apr 2021 22:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2D1714ABF; Thu, 1 Apr 2021 22:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131MCZLH038660; Thu, 1 Apr 2021 22:12:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131MCZsK038659; Thu, 1 Apr 2021 22:12:35 GMT (envelope-from git) Date: Thu, 1 Apr 2021 22:12:35 GMT Message-Id: <202104012212.131MCZsK038659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: b43fe9eb4b33 - main - nfsd: silence rpcb_unset noise for NFSv4 only servers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b43fe9eb4b3365156016ae3477747a46fc094bb8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 22:12:36 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b43fe9eb4b3365156016ae3477747a46fc094bb8 commit b43fe9eb4b3365156016ae3477747a46fc094bb8 Author: Rick Macklem AuthorDate: 2021-04-01 22:09:03 +0000 Commit: Rick Macklem CommitDate: 2021-04-01 22:09:03 +0000 nfsd: silence rpcb_unset noise for NFSv4 only servers An NFSv4 only configuration does not register with rpcbind(). Without this patch a failure to rpcb_unset() is reported when the daemon is terminated for this case. This is harmless noise, but this patch avoids calling rpcb_unset() for the NFSv4 only case, avoiding the noise. When called with "-d", it still does the rpcb_unset(), assuming that the configuration might have been changed to NFSv4 only and unregistering with rpcbind() might still be needed. Reviewed by: freqlabs MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29449 --- usr.sbin/nfsd/nfsd.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/usr.sbin/nfsd/nfsd.c b/usr.sbin/nfsd/nfsd.c index 0eb9c2560cf1..0222d23f2312 100644 --- a/usr.sbin/nfsd/nfsd.c +++ b/usr.sbin/nfsd/nfsd.c @@ -101,6 +101,7 @@ static int stablefd = -1; /* Fd for the stable restart file */ static int backupfd; /* Fd for the backup stable restart file */ static const char *getopt_shortopts; static const char *getopt_usage; +static int nfs_minvers = NFS_VER2; static int minthreads_set; static int maxthreads_set; @@ -170,7 +171,6 @@ main(int argc, char **argv) int bindhostc, bindanyflag, rpcbreg, rpcbregcnt; int nfssvc_addsock; int longindex = 0; - int nfs_minvers = NFS_VER2; size_t nfs_minvers_size; const char *lopt; char **bindhost = NULL; @@ -307,6 +307,16 @@ main(int argc, char **argv) errx(1, "Out of memory"); } + if (unregister) { + /* + * Unregister before setting nfs_minvers, in case the + * value of vfs.nfsd.server_min_nfsvers has changed + * since registering with rpcbind. + */ + unregistration(); + exit (0); + } + nfs_minvers_size = sizeof(nfs_minvers); error = sysctlbyname("vfs.nfsd.server_min_nfsvers", &nfs_minvers, &nfs_minvers_size, NULL, 0); @@ -316,10 +326,6 @@ main(int argc, char **argv) nfs_minvers = NFS_VER2; } - if (unregister) { - unregistration(); - exit (0); - } if (reregister) { if (udpflag) { memset(&hints, 0, sizeof hints); @@ -935,8 +941,8 @@ reapchild(__unused int signo) static void unregistration(void) { - if ((!rpcb_unset(NFS_PROGRAM, 2, NULL)) || - (!rpcb_unset(NFS_PROGRAM, 3, NULL))) + if ((nfs_minvers == NFS_VER2 && !rpcb_unset(NFS_PROGRAM, 2, NULL)) || + (nfs_minvers <= NFS_VER3 && !rpcb_unset(NFS_PROGRAM, 3, NULL))) syslog(LOG_ERR, "rpcb_unset failed"); } From owner-dev-commits-src-all@freebsd.org Thu Apr 1 22:39:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 538285B9706; Thu, 1 Apr 2021 22:39:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBJ641xtwz3CCV; Thu, 1 Apr 2021 22:39:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3592315330; Thu, 1 Apr 2021 22:39:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131Mduom067178; Thu, 1 Apr 2021 22:39:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131Mduau067177; Thu, 1 Apr 2021 22:39:56 GMT (envelope-from git) Date: Thu, 1 Apr 2021 22:39:56 GMT Message-Id: <202104012239.131Mduau067177@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 4e6c2a1ee9af - main - nfsv4 client: factor loop contents out into a separate function MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e6c2a1ee9af05bf42187e8201af1d03a617834f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 22:39:56 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4e6c2a1ee9af05bf42187e8201af1d03a617834f commit 4e6c2a1ee9af05bf42187e8201af1d03a617834f Author: Rick Macklem AuthorDate: 2021-04-01 22:36:37 +0000 Commit: Rick Macklem CommitDate: 2021-04-01 22:36:37 +0000 nfsv4 client: factor loop contents out into a separate function Commit fdc9b2d50fe9 replaced a couple of while loops with LIST_FOREACH() loops. This patch factors the body of that loop out into a separate function called nfscl_checkown(). This prepares the code for future changes to use a hash table of lists for open searches via file handle. This patch should not result in a semantics change. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 63 +++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 6cb737606525..e310deff6cf9 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -102,6 +102,9 @@ static int nfscl_delegcnt = 0; static int nfscl_layoutcnt = 0; static int nfscl_getopen(struct nfsclownerhead *, u_int8_t *, int, u_int8_t *, u_int8_t *, u_int32_t, struct nfscllockowner **, struct nfsclopen **); +static bool nfscl_checkown(struct nfsclowner *, struct nfsclopen *, uint8_t *, + uint8_t *, struct nfscllockowner **, struct nfsclopen **, + struct nfsclopen **); static void nfscl_clrelease(struct nfsclclient *); static void nfscl_cleanclient(struct nfsclclient *); static void nfscl_expireclient(struct nfsclclient *, struct nfsmount *, @@ -652,7 +655,6 @@ nfscl_getopen(struct nfsclownerhead *ohp, u_int8_t *nfhp, int fhlen, { struct nfsclowner *owp; struct nfsclopen *op, *rop, *rop2; - struct nfscllockowner *lp; bool keep_looping; if (lpp != NULL) @@ -676,30 +678,9 @@ nfscl_getopen(struct nfsclownerhead *ohp, u_int8_t *nfhp, int fhlen, LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { if (op->nfso_fhlen == fhlen && !NFSBCMP(op->nfso_fh, nfhp, fhlen) - && (op->nfso_mode & mode) == mode) { - if (lpp != NULL) { - /* Now look for a matching lockowner. */ - LIST_FOREACH(lp, &op->nfso_lock, - nfsl_list) { - if (!NFSBCMP(lp->nfsl_owner, - lockown, - NFSV4CL_LOCKNAMELEN)) { - *lpp = lp; - rop = op; - keep_looping = false; - break; - } - } - } - if (rop == NULL && !NFSBCMP(owp->nfsow_owner, - openown, NFSV4CL_LOCKNAMELEN)) { - rop = op; - if (lpp == NULL) - keep_looping = false; - } - if (rop2 == NULL) - rop2 = op; - } + && (op->nfso_mode & mode) == mode) + keep_looping = nfscl_checkown(owp, op, openown, + lockown, lpp, &rop, &rop2); if (!keep_looping) break; } @@ -714,6 +695,38 @@ nfscl_getopen(struct nfsclownerhead *ohp, u_int8_t *nfhp, int fhlen, return (0); } +/* Check for an owner match. */ +static bool +nfscl_checkown(struct nfsclowner *owp, struct nfsclopen *op, uint8_t *openown, + uint8_t *lockown, struct nfscllockowner **lpp, struct nfsclopen **ropp, + struct nfsclopen **ropp2) +{ + struct nfscllockowner *lp; + bool keep_looping; + + keep_looping = true; + if (lpp != NULL) { + /* Now look for a matching lockowner. */ + LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { + if (!NFSBCMP(lp->nfsl_owner, lockown, + NFSV4CL_LOCKNAMELEN)) { + *lpp = lp; + *ropp = op; + return (false); + } + } + } + if (*ropp == NULL && !NFSBCMP(owp->nfsow_owner, openown, + NFSV4CL_LOCKNAMELEN)) { + *ropp = op; + if (lpp == NULL) + keep_looping = false; + } + if (*ropp2 == NULL) + *ropp2 = op; + return (keep_looping); +} + /* * Release use of an open owner. Called when open operations are done * with the open owner. From owner-dev-commits-src-all@freebsd.org Thu Apr 1 22:49:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E19AA5B98DA; Thu, 1 Apr 2021 22:49:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBJK663bvz3Cfg; Thu, 1 Apr 2021 22:49:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2C0815603; Thu, 1 Apr 2021 22:49:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131MnUAj081514; Thu, 1 Apr 2021 22:49:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131MnU5O081513; Thu, 1 Apr 2021 22:49:30 GMT (envelope-from git) Date: Thu, 1 Apr 2021 22:49:30 GMT Message-Id: <202104012249.131MnU5O081513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d2e076c37b09 - main - ossl: Don't encryt/decrypt too much data for chacha20. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2e076c37b0963a8be89684a656c4e1640dc7a3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 22:49:30 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d2e076c37b0963a8be89684a656c4e1640dc7a3e commit d2e076c37b0963a8be89684a656c4e1640dc7a3e Author: John Baldwin AuthorDate: 2021-04-01 22:42:18 +0000 Commit: John Baldwin CommitDate: 2021-04-01 22:49:07 +0000 ossl: Don't encryt/decrypt too much data for chacha20. The loops for Chacha20 and Chacha20+Poly1305 which encrypted/decrypted full blocks of data used the minimum of the input and output segment lengths to determine the size of the next chunk ('todo') to pass to Chacha20_ctr32(). However, the input and output segments could extend past the end of the ciphertext region into the tag (e.g. if a "plain" single mbuf contained an entire TLS record). If the length of the tag plus the length of the last partial block together were at least as large as a full Chacha20 block (64 bytes), then an extra block was encrypted/decrypted overlapping with the tag. Fix this by also capping the amount of data to encrypt/decrypt by the amount of remaining data in the ciphertext region ('resid'). Reported by: gallatin Reviewed by: cem, gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29517 --- sys/crypto/openssl/ossl_chacha20.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/crypto/openssl/ossl_chacha20.c b/sys/crypto/openssl/ossl_chacha20.c index a2bfb52cacd6..7fa1a297052e 100644 --- a/sys/crypto/openssl/ossl_chacha20.c +++ b/sys/crypto/openssl/ossl_chacha20.c @@ -88,7 +88,8 @@ ossl_chacha20(struct cryptop *crp, const struct crypto_session_params *csp) out = outseg; /* Figure out how many blocks we can encrypt/decrypt at once. */ - todo = rounddown(MIN(inlen, outlen), CHACHA_BLK_SIZE); + todo = rounddown(MIN(resid, MIN(inlen, outlen)), + CHACHA_BLK_SIZE); #ifdef __LP64__ /* ChaCha20_ctr32() assumes length is <= 4GB. */ @@ -218,7 +219,8 @@ ossl_chacha20_poly1305_encrypt(struct cryptop *crp, out = outseg; /* Figure out how many blocks we can encrypt/decrypt at once. */ - todo = rounddown(MIN(inlen, outlen), CHACHA_BLK_SIZE); + todo = rounddown(MIN(resid, MIN(inlen, outlen)), + CHACHA_BLK_SIZE); #ifdef __LP64__ /* ChaCha20_ctr32() assumes length is <= 4GB. */ @@ -389,7 +391,8 @@ ossl_chacha20_poly1305_decrypt(struct cryptop *crp, out = outseg; /* Figure out how many blocks we can encrypt/decrypt at once. */ - todo = rounddown(MIN(inlen, outlen), CHACHA_BLK_SIZE); + todo = rounddown(MIN(resid, MIN(inlen, outlen)), + CHACHA_BLK_SIZE); #ifdef __LP64__ /* ChaCha20_ctr32() assumes length is <= 4GB. */ From owner-dev-commits-src-all@freebsd.org Thu Apr 1 22:49:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C8A15B98DE; Thu, 1 Apr 2021 22:49:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBJK770dvz3Cfj; Thu, 1 Apr 2021 22:49:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3B5A15428; Thu, 1 Apr 2021 22:49:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131MnVZo081540; Thu, 1 Apr 2021 22:49:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131MnVNt081539; Thu, 1 Apr 2021 22:49:31 GMT (envelope-from git) Date: Thu, 1 Apr 2021 22:49:31 GMT Message-Id: <202104012249.131MnVNt081539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c86de1dab8e6 - main - cryptocheck: Expand the set of sizes tested by -z. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c86de1dab8e65bc9d11501ca51f2e152276cb94e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 22:49:32 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c86de1dab8e65bc9d11501ca51f2e152276cb94e commit c86de1dab8e65bc9d11501ca51f2e152276cb94e Author: John Baldwin AuthorDate: 2021-04-01 22:42:30 +0000 Commit: John Baldwin CommitDate: 2021-04-01 22:49:07 +0000 cryptocheck: Expand the set of sizes tested by -z. Test individual sizes up to the max encryption block length as well as a few sizes that include 1 full block and a partial block before doubling the size. Reviewed by: cem, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29518 --- tools/tools/crypto/cryptocheck.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index bd075d24e0f5..502ea04cd661 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -228,7 +228,7 @@ static const struct alg { static bool verbose; static int requested_crid; -static size_t aad_sizes[48], sizes[128]; +static size_t aad_sizes[48], sizes[EALG_MAX_BLOCK_LEN * 2]; static u_int naad_sizes, nsizes; static void @@ -1729,12 +1729,18 @@ main(int ac, char **av) if (nsizes == 0) { if (testall) { - for (i = 1; i <= 32; i++) { + for (i = 1; i <= EALG_MAX_BLOCK_LEN; i++) { sizes[nsizes] = i; nsizes++; } - base_size = 32; + for (i = EALG_MAX_BLOCK_LEN + 8; + i <= EALG_MAX_BLOCK_LEN * 2; i += 8) { + sizes[nsizes] = i; + nsizes++; + } + + base_size = EALG_MAX_BLOCK_LEN * 2; while (base_size * 2 < 240 * 1024) { base_size *= 2; assert(nsizes < nitems(sizes)); From owner-dev-commits-src-all@freebsd.org Thu Apr 1 23:00:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08D325B9D62; Thu, 1 Apr 2021 23:00:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBJYL6kJZz3DPV; Thu, 1 Apr 2021 23:00:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF483154BE; Thu, 1 Apr 2021 23:00:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131N061U098838; Thu, 1 Apr 2021 23:00:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131N06ZL098835; Thu, 1 Apr 2021 23:00:06 GMT (envelope-from git) Date: Thu, 1 Apr 2021 23:00:06 GMT Message-Id: <202104012300.131N06ZL098835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: e655b00a964f - stable/12 - nfsv4 pnfs client: fix updating of the layout stateid.seqid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e655b00a964f834995b5164dd1edeeafb6b74a44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 23:00:07 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e655b00a964f834995b5164dd1edeeafb6b74a44 commit e655b00a964f834995b5164dd1edeeafb6b74a44 Author: Rick Macklem AuthorDate: 2021-03-18 19:20:25 +0000 Commit: Rick Macklem CommitDate: 2021-04-01 22:56:56 +0000 nfsv4 pnfs client: fix updating of the layout stateid.seqid During a recent NFSv4 testing event a test server was replying NFSERR_OLDSTATEID for layout stateids presented to the server for LayoutReturn operations. Upon rereading RFC5661, it was apparent that the FreeBSD NFSv4.1/4.2 pNFS client did not maintain the seqid field of the layout stateid correctly. This patch is believed to correct the problem. Tested against a FreeBSD pNFS server with diagnostics added to check the stateid's seqid did not indicate problems. Unfortunately, testing aginst this server will not happen in the near future, so the fix may not be correct yet. (cherry picked from commit fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc) --- sys/fs/nfsclient/nfs_clstate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 4c219607af91..79a18a12f91f 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3469,11 +3469,18 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) len, stateid.seqid, 0, 0, NULL, recallp); + if (error == 0 && + stateid.seqid > + lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = + stateid.seqid; recallp = NULL; wakeup(clp); NFSCL_DEBUG(4, - "aft layrcal=%d\n", - error); + "aft layrcal=%d " + "layseqid=%d\n", + error, + lyp->nfsly_stateid.seqid); } else error = NFSERR_NOMATCHLAYOUT; @@ -4855,6 +4862,8 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, } else { if (retonclose != 0) lyp->nfsly_flags |= NFSLY_RETONCLOSE; + if (stateidp->seqid > lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = stateidp->seqid; TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); lyp->nfsly_timestamp = NFSD_MONOSEC + 120; @@ -4867,7 +4876,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, return (EPERM); } *lypp = lyp; - } else + } else if (stateidp->seqid > lyp->nfsly_stateid.seqid) lyp->nfsly_stateid.seqid = stateidp->seqid; /* Merge the new list of File Layouts into the list. */ From owner-dev-commits-src-all@freebsd.org Thu Apr 1 23:37:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3B495BA76C; Thu, 1 Apr 2021 23:37:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBKNT62lRz3Frf; Thu, 1 Apr 2021 23:37:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1D4615D4F; Thu, 1 Apr 2021 23:37:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131NbTa2051274; Thu, 1 Apr 2021 23:37:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131NbTtb051273; Thu, 1 Apr 2021 23:37:29 GMT (envelope-from git) Date: Thu, 1 Apr 2021 23:37:29 GMT Message-Id: <202104012337.131NbTtb051273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: cfd1ed46817c - main - Merge ACPICA 20210331. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cfd1ed46817c680fa7822bc523b054ff644055dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 23:37:30 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=cfd1ed46817c680fa7822bc523b054ff644055dc commit cfd1ed46817c680fa7822bc523b054ff644055dc Author: Jung-uk Kim AuthorDate: 2021-04-01 22:01:03 +0000 Commit: Jung-uk Kim CommitDate: 2021-04-01 23:36:59 +0000 Merge ACPICA 20210331. (cherry picked from commit 1e02e5b0ba8634758c128dcb43c67342c7219cd4) --- sys/contrib/dev/acpica/changes.txt | 40 ++ sys/contrib/dev/acpica/common/acfileio.c | 3 + sys/contrib/dev/acpica/common/ahids.c | 2 + sys/contrib/dev/acpica/common/ahpredef.c | 4 + sys/contrib/dev/acpica/common/ahtable.c | 3 + sys/contrib/dev/acpica/common/ahuuids.c | 1 + sys/contrib/dev/acpica/common/cmfsize.c | 2 +- sys/contrib/dev/acpica/common/dmrestag.c | 14 +- sys/contrib/dev/acpica/common/dmtable.c | 103 ++++- sys/contrib/dev/acpica/common/dmtbdump1.c | 76 ++++ sys/contrib/dev/acpica/common/dmtbdump2.c | 468 ++++++++++++++------- sys/contrib/dev/acpica/common/dmtbdump3.c | 100 +++++ sys/contrib/dev/acpica/common/dmtbinfo1.c | 34 +- sys/contrib/dev/acpica/common/dmtbinfo2.c | 247 +++++++++-- sys/contrib/dev/acpica/common/dmtbinfo3.c | 72 ++++ sys/contrib/dev/acpica/compiler/aslallocate.c | 2 +- sys/contrib/dev/acpica/compiler/aslascii.c | 4 +- sys/contrib/dev/acpica/compiler/aslcompiler.h | 4 + sys/contrib/dev/acpica/compiler/aslcompiler.l | 1 + sys/contrib/dev/acpica/compiler/aslerror.c | 6 +- sys/contrib/dev/acpica/compiler/aslhelpers.y | 5 + sys/contrib/dev/acpica/compiler/aslmap.c | 1 + sys/contrib/dev/acpica/compiler/aslmessages.c | 3 +- sys/contrib/dev/acpica/compiler/aslmessages.h | 1 + sys/contrib/dev/acpica/compiler/aslnamesp.c | 3 +- sys/contrib/dev/acpica/compiler/aslopcodes.c | 2 +- sys/contrib/dev/acpica/compiler/asloperands.c | 2 +- sys/contrib/dev/acpica/compiler/aslparser.y | 2 +- sys/contrib/dev/acpica/compiler/aslprintf.c | 2 +- sys/contrib/dev/acpica/compiler/aslresource.c | 5 + sys/contrib/dev/acpica/compiler/aslresources.y | 20 +- sys/contrib/dev/acpica/compiler/aslrestype2s.c | 136 ++++++ sys/contrib/dev/acpica/compiler/asltokens.y | 1 + sys/contrib/dev/acpica/compiler/asltransform.c | 5 + sys/contrib/dev/acpica/compiler/asltypes.y | 2 + sys/contrib/dev/acpica/compiler/dtcompiler.h | 15 + sys/contrib/dev/acpica/compiler/dttable1.c | 143 ++++++- sys/contrib/dev/acpica/compiler/dttable2.c | 454 +++++++++++++++++--- sys/contrib/dev/acpica/compiler/dttemplate.h | 343 +++++++++------ sys/contrib/dev/acpica/compiler/dtutils.c | 5 + .../dev/acpica/components/disassembler/dmresrcl2.c | 90 +++- .../dev/acpica/components/events/evhandler.c | 7 + .../dev/acpica/components/events/evregion.c | 75 ++-- .../dev/acpica/components/events/evxfregn.c | 1 + .../dev/acpica/components/namespace/nsaccess.c | 3 +- .../dev/acpica/components/namespace/nsrepair2.c | 18 +- .../dev/acpica/components/resources/rscalc.c | 4 +- .../dev/acpica/components/resources/rsdump.c | 10 + .../dev/acpica/components/resources/rsdumpinfo.c | 15 + .../dev/acpica/components/resources/rsinfo.c | 6 +- .../dev/acpica/components/resources/rslist.c | 10 +- .../dev/acpica/components/resources/rsmisc.c | 18 + .../dev/acpica/components/resources/rsserial.c | 70 +++ .../dev/acpica/components/utilities/utresdecode.c | 11 +- .../dev/acpica/components/utilities/utresrc.c | 1 + sys/contrib/dev/acpica/include/acdisasm.h | 44 +- sys/contrib/dev/acpica/include/acobject.h | 1 + sys/contrib/dev/acpica/include/acoutput.h | 2 +- sys/contrib/dev/acpica/include/acpixf.h | 2 +- sys/contrib/dev/acpica/include/acpredef.h | 15 + sys/contrib/dev/acpica/include/acresrc.h | 4 + sys/contrib/dev/acpica/include/acrestyp.h | 12 +- sys/contrib/dev/acpica/include/actbinfo.h | 26 +- sys/contrib/dev/acpica/include/actbl1.h | 63 ++- sys/contrib/dev/acpica/include/actbl2.h | 280 ++++++++++-- sys/contrib/dev/acpica/include/actbl3.h | 84 +++- sys/contrib/dev/acpica/include/acutils.h | 1 + sys/contrib/dev/acpica/include/acuuid.h | 1 + sys/contrib/dev/acpica/include/amlresrc.h | 25 +- sys/contrib/dev/acpica/include/platform/acgcc.h | 2 +- 70 files changed, 2757 insertions(+), 480 deletions(-) diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index e58f906382b5..0b71b266a6ba 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,3 +1,43 @@ +---------------------------------------- +31 March 2021. Summary of changes for version 20210331: + +This release is available at https://acpica.org/downloads, and includes +all ACPI 6.4 support + +1) ACPICA kernel-resident subsystem: +ACPI 6.4: iASL: deprecate DDBHandleObj keyword +Always create namespace nodes using AcpiNsCreateNode(). ACPICA is +allocating an object using kmalloc(), but then frees it +using kmem_cache_free(<"Acpi-Namespace" kmem_cache>). This is wrong. +Fixed a race condition in generic serial bus operation region handler. +Fixed by Hans de Goede. + +2) iASL Compiler/Disassembler and ACPICA tools: + +ACPI 6.4: NFIT: add Location Cookie field +ACPI 6.4: HMAT: add new fields/flags +ACPI 6.4: Add new flags in SRAT +ACPI 6.4: add SDEV secure access components +ACPI 6.4: add Csi2Bus resource template +ACPI 6.4: add support for PHAT table +ACPI 6.4: add support for PMTT table +Add disassembly support for the IVRS table. Compilation of the table is +not yet complete. +Fixed a potential infinite loop due to type mismatch. The for-loop is +using a UINT8 counter and comparing the upper +limit against a UINT32 AslGbl_ExpectedMessagesIndex maximum. In +the case where AslGbl_ExpectedMessagesIndex is > 255 the counter i +will wrap around to zero and the loop will never exit. I suspect +the AslGbl_ExpectedMessagesIndex is never that high, but fixing +this does future proof the code and cleans up static analysis +warnings.Colin King. +iASL/TableCompiler: update it with IORT table E.b revision changes. From +shamiali2008. +iASL/TableCompiler: Add compilation support for the VIOT table. Signed- +off-by: Jean-Philippe Brucker. +iASL/TableCompiler: Add compilation support for CEDT table. Also, update +the CEDT template. + ---------------------------------------- 05 January 2021. Summary of changes for version 20210105: diff --git a/sys/contrib/dev/acpica/common/acfileio.c b/sys/contrib/dev/acpica/common/acfileio.c index 5124e2d7f1ed..b93b14d3e654 100644 --- a/sys/contrib/dev/acpica/common/acfileio.c +++ b/sys/contrib/dev/acpica/common/acfileio.c @@ -559,6 +559,9 @@ AcValidateTableHeader ( if (Actual < sizeof (ACPI_TABLE_HEADER)) { + fprintf (stderr, + "Could not read entire table header: Actual %u, Requested %u\n", + (UINT32) Actual, (UINT32) sizeof (ACPI_TABLE_HEADER)); return (AE_ERROR); } diff --git a/sys/contrib/dev/acpica/common/ahids.c b/sys/contrib/dev/acpica/common/ahids.c index 6249fa40369a..35d17513a57b 100644 --- a/sys/contrib/dev/acpica/common/ahids.c +++ b/sys/contrib/dev/acpica/common/ahids.c @@ -188,6 +188,8 @@ const AH_DEVICE_ID AslDeviceIds[] = {"ACPI0012", "NVDIMM Root Device"}, {"ACPI0013", "Generic Event Device"}, {"ACPI0014", "Wireless Power Calibration Device"}, + {"ACPI0015", "USB4 host interface device"}, + {"ACPI0016", "Compute Express Link Host Bridge"}, {"ADMA0F28", "Intel Audio DMA"}, {"AMCR0F28", "Intel Audio Machine Driver"}, {"ATK4001", "Asus Radio Control Button"}, diff --git a/sys/contrib/dev/acpica/common/ahpredef.c b/sys/contrib/dev/acpica/common/ahpredef.c index 5f407bcbf2f4..89f8a784efd3 100644 --- a/sys/contrib/dev/acpica/common/ahpredef.c +++ b/sys/contrib/dev/acpica/common/ahpredef.c @@ -200,12 +200,16 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_BMC", "Battery Maintenance Control", "Sets battery maintenance and control features"), AH_PREDEF ("_BMD", "Battery Maintenance Data", "Returns battery maintenance, control, and state data"), AH_PREDEF ("_BMS", "Battery Measurement Sampling Time", "Sets the battery measurement sampling time"), + AH_PREDEF ("_BPC", "Battery Power Characteristics", "Returns static values used to configure power threshold support in the platform firmware"), + AH_PREDEF ("_BPS", "Battery Power State", "Returns the power delivery capabilities of the battery at the present time"), + AH_PREDEF ("_BPT", "Battery Power Threshold", "Set a relative battery peak power capability change threshold"), AH_PREDEF ("_BQC", "Brightness Query Current", "Returns the current display brightness level"), AH_PREDEF ("_BST", "Battery Status", "Returns a Control Method Battery status block"), AH_PREDEF ("_BTH", "Battery Throttle Limit", "Thermal limit for charging and discharging"), AH_PREDEF ("_BTM", "Battery Time", "Returns the battery runtime"), AH_PREDEF ("_BTP", "Battery Trip Point", "Sets a Control Method Battery trip point"), AH_PREDEF ("_CBA", "Configuration Base Address", "Sets the base address for a PCI Express host bridge"), + AH_PREDEF ("_CBR", "CXL Host Bridge Register Info", "Get the memory location of CXL Host Bridge Registers"), AH_PREDEF ("_CCA", "Cache Coherency Attribute", "Returns a device's support level for cache coherency"), AH_PREDEF ("_CDM", "Clock Domain", "Returns a logical processor's clock domain identifier"), AH_PREDEF ("_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"), diff --git a/sys/contrib/dev/acpica/common/ahtable.c b/sys/contrib/dev/acpica/common/ahtable.c index cf369e4c0695..3d3eee5b41b4 100644 --- a/sys/contrib/dev/acpica/common/ahtable.c +++ b/sys/contrib/dev/acpica/common/ahtable.c @@ -203,6 +203,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_BERT, "Boot Error Record Table"}, {ACPI_SIG_BGRT, "Boot Graphics Resource Table"}, {ACPI_SIG_BOOT, "Simple Boot Flag Table"}, + {ACPI_SIG_CEDT, "CXL Early Discovery Table"}, {ACPI_SIG_CPEP, "Corrected Platform Error Polling table"}, {ACPI_SIG_CSRT, "Core System Resource Table"}, {ACPI_SIG_DBG2, "Debug Port table type 2"}, @@ -231,6 +232,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_MSDM, "Microsoft Data Management table"}, {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, + {ACPI_SIG_PHAT, "Platform Health Assessment Table"}, {ACPI_SIG_PDTT, "Platform Debug Trigger Table"}, {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, {ACPI_SIG_PPTT, "Processor Properties Topology Table"}, @@ -251,6 +253,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_TCPA, "Trusted Computing Platform Alliance table"}, {ACPI_SIG_TPM2, "Trusted Platform Module hardware interface table"}, {ACPI_SIG_UEFI, "UEFI Boot Optimization Table"}, + {ACPI_SIG_VIOT, "Virtual I/O Translation Table"}, {ACPI_SIG_WAET, "Windows ACPI Emulated Devices Table"}, {ACPI_SIG_WDAT, "Watchdog Action Table"}, {ACPI_SIG_WDDT, "Watchdog Description Table"}, diff --git a/sys/contrib/dev/acpica/common/ahuuids.c b/sys/contrib/dev/acpica/common/ahuuids.c index 13c764d298a8..73585e81c4da 100644 --- a/sys/contrib/dev/acpica/common/ahuuids.c +++ b/sys/contrib/dev/acpica/common/ahuuids.c @@ -208,6 +208,7 @@ const AH_UUID Gbl_AcpiUuids[] = {"Device Graphs for _DSD", UUID_DEVICE_GRAPHS}, {"Hierarchical Data Extension", UUID_HIERARCHICAL_DATA_EXTENSION}, {"ARM Coresight Graph", UUID_CORESIGHT_GRAPH}, + {"USB4 Capabilities", UUID_USB4_CAPABILITIES}, {NULL, NULL} }; diff --git a/sys/contrib/dev/acpica/common/cmfsize.c b/sys/contrib/dev/acpica/common/cmfsize.c index 7026c17b43bc..eb419a94f9af 100644 --- a/sys/contrib/dev/acpica/common/cmfsize.c +++ b/sys/contrib/dev/acpica/common/cmfsize.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: cfsize - Common get file size function + * Module Name: cmfsize - Common get file size function * *****************************************************************************/ diff --git a/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c index 15ddb8f2da44..a430a6d7a1c7 100644 --- a/sys/contrib/dev/acpica/common/dmrestag.c +++ b/sys/contrib/dev/acpica/common/dmrestag.c @@ -384,6 +384,14 @@ static const ACPI_RESOURCE_TAG AcpiDmGpioIoTags[] = /* Subtype tables for SerialBus descriptors */ +static const ACPI_RESOURCE_TAG AcpiDmCsi2SerialBusTags[] = /* ACPI 6.4 */ +{ + {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, + {( 7 * 8) + 0, ACPI_RESTAG_PHYTYPE}, + {( 7 * 8) + 2, ACPI_RESTAG_LOCALPORT}, + {0, NULL} +}; + static const ACPI_RESOURCE_TAG AcpiDmI2cSerialBusTags[] = { {( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, @@ -424,6 +432,7 @@ static const ACPI_RESOURCE_TAG AcpiDmUartSerialBusTags[] = {0, NULL} }; + /* Subtype tables for PinFunction descriptor */ static const ACPI_RESOURCE_TAG AcpiDmPinFunctionTags[] = @@ -539,7 +548,8 @@ static const ACPI_RESOURCE_TAG *AcpiGbl_SerialResourceTags[] = NULL, /* 0x00 Reserved */ AcpiDmI2cSerialBusTags, /* 0x01 I2C SerialBus */ AcpiDmSpiSerialBusTags, /* 0x02 SPI SerialBus */ - AcpiDmUartSerialBusTags /* 0x03 UART SerialBus */ + AcpiDmUartSerialBusTags, /* 0x03 UART SerialBus */ + AcpiDmCsi2SerialBusTags /* 0x04 CSI2 SerialBus */ }; /* @@ -987,7 +997,7 @@ AcpiDmGetResourceTag ( case ACPI_RESOURCE_NAME_SERIAL_BUS: - /* SerialBus has 3 subtypes: I2C, SPI, and UART */ + /* SerialBus has 4 subtypes: I2C, SPI, UART, and CSI2 */ if ((Resource->CommonSerialBus.Type == 0) || (Resource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE)) diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index 565a76071aad..6f34e82c1b62 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -184,6 +184,12 @@ static const char *AcpiDmAsfSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmCedtSubnames[] = +{ + "CXL Host Bridge Structure", + "Unknown Subtable Type" /* Reserved */ +}; + static const char *AcpiDmDmarSubnames[] = { "Hardware Unit Definition", @@ -367,15 +373,24 @@ static const char *AcpiDmPcctSubnames[] = "HW-Reduced Comm Subspace Type2", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */ "Extended PCC Master Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE */ "Extended PCC Slave Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE */ + "HW Registers based Comm Subspace", /* ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE */ "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmPhatSubnames[] = +{ + "Firmware Version Data", /* ACPI_PHAT_TYPE_FW_VERSION_DATA */ + "Firmware Health Data", /* ACPI_PHAT_TYPE_FW_HEALTH_DATA */ + "Unknown Subtable Type" /* Reserved */ +}; + static const char *AcpiDmPmttSubnames[] = { "Socket", /* ACPI_PMTT_TYPE_SOCKET */ "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */ "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ - "Unknown Subtable Type" /* Reserved */ + "Unknown Subtable Type", /* Reserved */ + "Vendor Specific" /* ACPI_PMTT_TYPE_VENDOR */ }; static const char *AcpiDmPpttSubnames[] = @@ -434,6 +449,16 @@ static const char *AcpiDmLpitSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmViotSubnames[] = +{ + "Unknown Subtable Type", /* 0 -Reserved */ + "PCI Range", + "MMIO Endpoint", + "VirtIO-PCI IOMMU", + "VirtIO-MMIO IOMMU", + "Unknown Subtable Type" /* Reserved */ +}; + #define ACPI_FADT_PM_RESERVED 9 static const char *AcpiDmFadtProfiles[] = @@ -474,8 +499,8 @@ static const char *AcpiDmGasAccessWidth[] = * handler. This table must be NULL terminated. RSDP and FACS are * special-cased elsewhere. * - * Note: Any tables added here should be duplicated within AcpiSupportedTables - * in the file common/ahtable.c + * Note: Any tables added here should be duplicated within + * AcpiGbl_SupportedTables in the file common/ahtable.c * ******************************************************************************/ @@ -485,6 +510,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert}, {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt}, {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot}, + {ACPI_SIG_CEDT, NULL, AcpiDmDumpCedt, DtCompileCedt, TemplateCedt}, {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep}, {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt}, {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2}, @@ -512,6 +538,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt}, + {ACPI_SIG_PHAT, NULL, AcpiDmDumpPhat, DtCompilePhat, TemplatePhat}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt}, {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, @@ -529,6 +556,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2}, {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, + {ACPI_SIG_VIOT, AcpiDmTableInfoViot, AcpiDmDumpViot, DtCompileViot, TemplateViot}, {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat}, {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt}, @@ -936,6 +964,7 @@ AcpiDmDumpTable ( case ACPI_DMT_CHKSUM: case ACPI_DMT_SPACEID: case ACPI_DMT_ACCWIDTH: + case ACPI_DMT_CEDT: case ACPI_DMT_IVRS: case ACPI_DMT_GTDT: case ACPI_DMT_MADT: @@ -952,6 +981,7 @@ AcpiDmDumpTable ( case ACPI_DMT_ERSTACT: case ACPI_DMT_ERSTINST: case ACPI_DMT_DMAR_SCOPE: + case ACPI_DMT_VIOT: ByteLength = 1; break; @@ -961,6 +991,7 @@ AcpiDmDumpTable ( case ACPI_DMT_HEST: case ACPI_DMT_HMAT: case ACPI_DMT_NFIT: + case ACPI_DMT_PHAT: ByteLength = 2; break; @@ -1030,6 +1061,17 @@ AcpiDmDumpTable ( ByteLength = SubtableLength; break; + case ACPI_DMT_PMTT_VENDOR: + /* + * Calculate the length of the vendor data for the PMTT table: + * Length = (Current Subtable ptr + Subtable length) - + * Start of the vendor data (Target) + */ + ByteLength = ((ACPI_CAST_PTR (char, Table) + + (ACPI_CAST_PTR (ACPI_PMTT_HEADER, Table)->Length)) - + ACPI_CAST_PTR (char, Target)); + break; + case ACPI_DMT_STRING: ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1; @@ -1346,6 +1388,20 @@ AcpiDmDumpTable ( AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]); break; + case ACPI_DMT_CEDT: + + /* CEDT subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_CEDT_TYPE_RESERVED) + { + Temp8 = ACPI_CEDT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmCedtSubnames[Temp8]); + break; + case ACPI_DMT_DMAR: /* DMAR subtable types */ @@ -1559,16 +1615,33 @@ AcpiDmDumpTable ( AcpiDmPcctSubnames[Temp8]); break; + case ACPI_DMT_PHAT: + + /* PMTT subtable types */ + + Temp16 = *Target; + if (Temp16 > ACPI_PHAT_TYPE_RESERVED) + { + Temp16 = ACPI_PHAT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16(Target), + AcpiDmPhatSubnames[Temp16]); + break; + case ACPI_DMT_PMTT: /* PMTT subtable types */ Temp8 = *Target; - if (Temp8 > ACPI_PMTT_TYPE_RESERVED) + if (Temp8 == ACPI_PMTT_TYPE_VENDOR) + { + Temp8 = ACPI_PMTT_TYPE_RESERVED + 1; + } + else if (Temp8 > ACPI_PMTT_TYPE_RESERVED) { Temp8 = ACPI_PMTT_TYPE_RESERVED; } - AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPmttSubnames[Temp8]); break; @@ -1599,6 +1672,8 @@ AcpiDmDumpTable ( break; case ACPI_DMT_RAW_BUFFER: + case ACPI_DMT_BUFFER: + case ACPI_DMT_PMTT_VENDOR: if (ByteLength == 0) { @@ -1606,8 +1681,7 @@ AcpiDmDumpTable ( break; } - AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength, - CurrentOffset, NULL); + AcpiDmDumpBuffer (Target, 0, ByteLength, 0, NULL); break; case ACPI_DMT_SDEV: @@ -1676,6 +1750,7 @@ AcpiDmDumpTable ( { case ACPI_IVRS_TYPE_HARDWARE1: case ACPI_IVRS_TYPE_HARDWARE2: + case ACPI_IVRS_TYPE_HARDWARE3: Name = AcpiDmIvrsSubnames[0]; break; @@ -1710,6 +1785,20 @@ AcpiDmDumpTable ( AcpiDmLpitSubnames[Temp32]); break; + case ACPI_DMT_VIOT: + + /* VIOT subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_VIOT_RESERVED) + { + Temp8 = ACPI_VIOT_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmViotSubnames[Temp8]); + break; + case ACPI_DMT_EXIT: return (AE_OK); diff --git a/sys/contrib/dev/acpica/common/dmtbdump1.c b/sys/contrib/dev/acpica/common/dmtbdump1.c index b9b30dc2f4a5..d134c63f856a 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump1.c +++ b/sys/contrib/dev/acpica/common/dmtbdump1.c @@ -329,6 +329,82 @@ AcpiDmDumpAsf ( } } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpCedt + * + * PARAMETERS: Table - A CEDT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a CEDT. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpCedt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_CEDT_HEADER *Subtable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_CEDT); + ACPI_DMTABLE_INFO *InfoTable; + + + /* There is no main table (other than the standard ACPI header) */ + + Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoCedtHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (Subtable->Type) + { + case ACPI_CEDT_TYPE_CHBS: + + InfoTable = AcpiDmTableInfoCedt0; + break; + + default: + + AcpiOsPrintf ("\n**** Unknown CEDT subtable type 0x%X\n\n", + Subtable->Type); + + /* Attempt to continue */ + + if (!Subtable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; + } + goto NextSubtable; + } + + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + +NextSubtable: + /* Point to next subtable */ + + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Subtable, + Subtable->Length); + } +} /******************************************************************************* * diff --git a/sys/contrib/dev/acpica/common/dmtbdump2.c b/sys/contrib/dev/acpica/common/dmtbdump2.c index e5124a26d587..e3ab39b53078 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump2.c +++ b/sys/contrib/dev/acpica/common/dmtbdump2.c @@ -181,6 +181,7 @@ AcpiDmDumpIort ( ACPI_IORT_NODE *IortNode; ACPI_IORT_ITS_GROUP *IortItsGroup = NULL; ACPI_IORT_SMMU *IortSmmu = NULL; + ACPI_IORT_RMR *IortRmr = NULL; UINT32 Offset; UINT32 NodeOffset; UINT32 Length; @@ -188,6 +189,7 @@ AcpiDmDumpIort ( char *String; UINT32 i; UINT32 MappingByteLength; + UINT8 Revision; /* Main table */ @@ -198,6 +200,17 @@ AcpiDmDumpIort ( return; } + Revision = Table->Revision; + + /* Both IORT Rev E and E.a have known issues and are not supported */ + + if (Revision == 1 || Revision == 2) + { + AcpiOsPrintf ("\n**** Unsupported IORT revision 0x%X\n", + Revision); + return; + } + Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table); Offset = sizeof (ACPI_TABLE_IORT); @@ -221,8 +234,18 @@ AcpiDmDumpIort ( IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset); AcpiOsPrintf ("\n"); Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); - Status = AcpiDmDumpTable (Table->Length, Offset, - IortNode, Length, AcpiDmTableInfoIortHdr); + + if (Revision == 0) + { + Status = AcpiDmDumpTable (Table->Length, Offset, + IortNode, Length, AcpiDmTableInfoIortHdr); + } + else if (Revision >= 3) + { + Status = AcpiDmDumpTable (Table->Length, Offset, + IortNode, Length, AcpiDmTableInfoIortHdr3); + } + if (ACPI_FAILURE (Status)) { return; @@ -272,6 +295,13 @@ AcpiDmDumpIort ( Length = IortNode->Length - NodeOffset; break; + case ACPI_IORT_NODE_RMR: + + InfoTable = AcpiDmTableInfoIort6; + Length = IortNode->Length - NodeOffset; + IortRmr = ACPI_ADD_PTR (ACPI_IORT_RMR, IortNode, NodeOffset); + break; + default: AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n", @@ -391,7 +421,30 @@ AcpiDmDumpIort ( } break; - default: + case ACPI_IORT_NODE_RMR: + + /* Validate IortRmr to avoid compiler warnings */ + if (IortRmr) + { + NodeOffset = IortRmr->RmrOffset; + Length = sizeof (ACPI_IORT_RMR_DESC); + for (i = 0; i < IortRmr->RmrCount; i++) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + Length, AcpiDmTableInfoIort6a); + if (ACPI_FAILURE (Status)) + { + return; + } + + NodeOffset += Length; + } + } + break; + + default: break; } @@ -434,8 +487,6 @@ NextSubtable: * ******************************************************************************/ -static UINT8 EntrySizes[] = {4,8,16,32}; - void AcpiDmDumpIvrs ( ACPI_TABLE_HEADER *Table) @@ -445,6 +496,7 @@ AcpiDmDumpIvrs ( UINT32 EntryOffset; UINT32 EntryLength; UINT32 EntryType; + ACPI_IVRS_DEVICE_HID *HidSubtable; ACPI_IVRS_DE_HEADER *DeviceEntry; ACPI_IVRS_HEADER *Subtable; ACPI_DMTABLE_INFO *InfoTable; @@ -481,6 +533,7 @@ AcpiDmDumpIvrs ( break; case ACPI_IVRS_TYPE_HARDWARE2: + case ACPI_IVRS_TYPE_HARDWARE3: InfoTable = AcpiDmTableInfoIvrs01; break; @@ -520,7 +573,8 @@ AcpiDmDumpIvrs ( /* The hardware subtable can contain multiple device entries */ if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 || - Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2) + Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2 || + Subtable->Type == ACPI_IVRS_TYPE_HARDWARE3) { if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1) { @@ -545,11 +599,10 @@ AcpiDmDumpIvrs ( * * 00 = 4 byte * 01 = 8 byte - * 10 = 16 byte - currently no entries defined - * 11 = 32 byte - currently no entries defined + * 1x = variable length */ EntryType = DeviceEntry->Type; - EntryLength = EntrySizes [EntryType >> 6]; + EntryLength = EntryType >> 6 == 1 ? 8 : 4; switch (EntryType) { @@ -588,6 +641,14 @@ AcpiDmDumpIvrs ( InfoTable = AcpiDmTableInfoIvrs8c; break; + /* Variable-length entries */ + + case ACPI_IVRS_TYPE_HID: + + EntryLength = 22; + InfoTable = AcpiDmTableInfoIvrsHid; + break; + default: InfoTable = AcpiDmTableInfoIvrs4; AcpiOsPrintf ( @@ -606,9 +667,24 @@ AcpiDmDumpIvrs ( return; } + HidSubtable = ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, DeviceEntry); EntryOffset += EntryLength; DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, EntryLength); + + if (EntryType == ACPI_IVRS_TYPE_HID) + { + EntryLength = HidSubtable->UidLength; + Status = AcpiDmDumpTable (Table->Length, EntryOffset, + Table, EntryLength, AcpiDmTableInfoIvrsHid1); + if (ACPI_FAILURE (Status)) + { + return; + } + EntryOffset += EntryLength; + DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, + DeviceEntry, EntryLength); + } } } @@ -825,6 +901,11 @@ AcpiDmDumpMadt ( InfoTable = AcpiDmTableInfoMadt15; break; + case ACPI_MADT_TYPE_MULTIPROC_WAKEUP: + + InfoTable = AcpiDmTableInfoMadt16; + break; + default: AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", @@ -1380,6 +1461,11 @@ AcpiDmDumpPcct ( InfoTable = AcpiDmTableInfoPcct4; break; + case ACPI_PCCT_TYPE_HW_REG_COMM_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct5; + break; + default: AcpiOsPrintf ( @@ -1461,201 +1547,224 @@ AcpiDmDumpPdtt ( /******************************************************************************* * - * FUNCTION: AcpiDmDumpPmtt + * FUNCTION: AcpiDmDumpPhat * - * PARAMETERS: Table - A PMTT table + * PARAMETERS: Table - A PHAT table * * RETURN: None * - * DESCRIPTION: Format the contents of a PMTT. This table type consists - * of an open-ended number of subtables. + * DESCRIPTION: Format the contents of a PHAT. * ******************************************************************************/ void -AcpiDmDumpPmtt ( +AcpiDmDumpPhat ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_PMTT_HEADER *Subtable; - ACPI_PMTT_HEADER *MemSubtable; - ACPI_PMTT_HEADER *DimmSubtable; - ACPI_PMTT_DOMAIN *DomainArray; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_PHAT_HEADER *Subtable; + ACPI_PHAT_VERSION_DATA *VersionData; + UINT32 RecordCount; UINT32 Length = Table->Length; - UINT32 Offset = sizeof (ACPI_TABLE_PMTT); - UINT32 MemOffset; - UINT32 DimmOffset; - UINT32 DomainOffset; - UINT32 DomainCount; - + UINT32 Offset = sizeof (ACPI_TABLE_PHAT); + UINT32 SubtableLength; + UINT32 PathLength; + UINT32 VendorLength; - /* Main table */ - Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt); - if (ACPI_FAILURE (Status)) - { - return; - } + Subtable = ACPI_ADD_PTR (ACPI_PHAT_HEADER, Table, sizeof (ACPI_TABLE_PHAT)); - /* Subtables */ - - Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoPmttHdr); + Status = AcpiDmDumpTable (Length, 0, Subtable, + sizeof (ACPI_PHAT_HEADER), AcpiDmTableInfoPhatHdr); if (ACPI_FAILURE (Status)) { return; } - /* Only Socket subtables are expected at this level */ - - if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET) + switch (Subtable->Type) { - AcpiOsPrintf ( - "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", + case ACPI_PHAT_TYPE_FW_VERSION_DATA: + + InfoTable = AcpiDmTableInfoPhat0; + SubtableLength = sizeof (ACPI_PHAT_VERSION_DATA); + break; + + case ACPI_PHAT_TYPE_FW_HEALTH_DATA: + + InfoTable = AcpiDmTableInfoPhat1; + SubtableLength = sizeof (ACPI_PHAT_HEALTH_DATA); + break; + + default: + + AcpiOsPrintf ("\n**** Unknown PHAT subtable type 0x%X\n\n", Subtable->Type); + return; } - /* Dump the fixed-length portion of the subtable */ - - Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoPmtt0); + Status = AcpiDmDumpTable (Length, 0, Subtable, + SubtableLength, InfoTable); if (ACPI_FAILURE (Status)) { return; } - /* Walk the memory controller subtables */ - - MemOffset = sizeof (ACPI_PMTT_SOCKET); - MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable, - sizeof (ACPI_PMTT_SOCKET)); - - while (((Offset + MemOffset) < Table->Length) && - (MemOffset < Subtable->Length)) + switch (Subtable->Type) { - /* Common subtable header */ + case ACPI_PHAT_TYPE_FW_VERSION_DATA: - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, - Offset + MemOffset, MemSubtable, - MemSubtable->Length, AcpiDmTableInfoPmttHdr); - if (ACPI_FAILURE (Status)) + VersionData = ACPI_CAST_PTR (ACPI_PHAT_VERSION_DATA, Subtable); + RecordCount = VersionData->ElementCount; + while (RecordCount) { - return; + Status = AcpiDmDumpTable (Length, Offset, + ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_VERSION_DATA)), + sizeof (ACPI_PHAT_VERSION_ELEMENT), AcpiDmTableInfoPhat0a); + if (ACPI_FAILURE (Status)) + { + return; + } + + RecordCount--; } - /* Only memory controller subtables are expected at this level */ + break; + + case ACPI_PHAT_TYPE_FW_HEALTH_DATA: - if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER) + /* account for the null terminator */ + + PathLength = strlen (ACPI_ADD_PTR (char, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA))) + 1; + Status = AcpiDmDumpTable (Length, Offset, + ACPI_ADD_PTR (ACPI_PHAT_HEADER, Subtable, sizeof (ACPI_PHAT_HEALTH_DATA)), + PathLength, AcpiDmTableInfoPhat1a); + if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ( - "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", - MemSubtable->Type); return; *** 4684 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Apr 2 00:26:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C616F5BBD93; Fri, 2 Apr 2021 00:26:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBLSv5Fw6z3HyL; Fri, 2 Apr 2021 00:26:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A786816915; Fri, 2 Apr 2021 00:26:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1320QNRX021502; Fri, 2 Apr 2021 00:26:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1320QNjA021501; Fri, 2 Apr 2021 00:26:23 GMT (envelope-from git) Date: Fri, 2 Apr 2021 00:26:23 GMT Message-Id: <202104020026.1320QNjA021501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: f8a134d0ef1d - releng/13.0 - 13.0: update to RC5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: f8a134d0ef1d430efb24b4e6bd6cd58a07ebc376 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 00:26:23 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=f8a134d0ef1d430efb24b4e6bd6cd58a07ebc376 commit f8a134d0ef1d430efb24b4e6bd6cd58a07ebc376 Author: Glen Barber AuthorDate: 2021-04-02 00:26:03 +0000 Commit: Glen Barber CommitDate: 2021-04-02 00:26:03 +0000 13.0: update to RC5 Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 79d64cfbfb2a..1afb885e9c9d 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="RC4" +BRANCH="RC5" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-all@freebsd.org Fri Apr 2 00:30:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A7825BC0A0; Fri, 2 Apr 2021 00:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBLYD0HN4z3JLW; Fri, 2 Apr 2021 00:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC316160EB; Fri, 2 Apr 2021 00:30:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1320U79T025075; Fri, 2 Apr 2021 00:30:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1320U7iP025073; Fri, 2 Apr 2021 00:30:07 GMT (envelope-from git) Date: Fri, 2 Apr 2021 00:30:07 GMT Message-Id: <202104020030.1320U7iP025073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: fd1c5c6cfca5 - stable/12 - nfsv4 client: fix forced dismount when sleeping on nfsv4lck MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fd1c5c6cfca58a47bc087b0722360f76024a2594 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 00:30:08 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fd1c5c6cfca58a47bc087b0722360f76024a2594 commit fd1c5c6cfca58a47bc087b0722360f76024a2594 Author: Rick Macklem AuthorDate: 2021-03-19 21:09:33 +0000 Commit: Rick Macklem CommitDate: 2021-04-02 00:26:44 +0000 nfsv4 client: fix forced dismount when sleeping on nfsv4lck During a recent NFSv4 testing event a test server caused a hang where "umount -N" failed. The renew thread was sleeping on "nfsv4lck" and the "umount" was sleeping, waiting for the renew thread to terminate. This is the first of two patches that is hoped to fix the renew thread so that it will terminate when "umount -N" is done on the mount. nfsv4_lock() checks for forced dismount, but only after it wakes up from msleep(). Without this patch, a wakeup() call was required. This patch adds a 1second timeout on the msleep(), so that it will wake up and see the forced dismount flag. Normally a wakeup() will occur in less than 1second, but if a premature return from msleep() does occur, it will simply loop around and msleep() again. While here, replace the nfsmsleep() wrapper that was used for portability with the actual msleep() call and make the same change for nfsv4_getref(). (cherry picked from commit 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6) --- sys/fs/nfs/nfs_commonsubs.c | 10 ++++------ sys/fs/nfs/nfs_var.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 7c54b503b286..9c6bee466272 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2224,7 +2224,7 @@ nfsmout: */ int nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, - void *mutex, struct mount *mp) + struct mtx *mutex, struct mount *mp) { if (isleptp) @@ -2252,8 +2252,7 @@ nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4lck", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4lck", hz); if (iwantlock && !(lp->nfslock_lock & NFSV4LOCK_LOCK) && lp->nfslock_usecnt == 0) { lp->nfslock_lock &= ~NFSV4LOCK_LOCKWANTED; @@ -2303,7 +2302,7 @@ nfsv4_relref(struct nfsv4lock *lp) * return without getting a refcnt for that case. */ void -nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, +nfsv4_getref(struct nfsv4lock *lp, int *isleptp, struct mtx *mutex, struct mount *mp) { @@ -2319,8 +2318,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4gr", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4gr", hz); } if (mp != NULL && NFSCL_FORCEDISM(mp)) return; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 08701b68bb40..4bc1101e3b8d 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -325,10 +325,10 @@ int nfsv4_loadattr(struct nfsrv_descript *, vnode_t, struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *, struct nfsfsinfo *, NFSACL_T *, int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *); -int nfsv4_lock(struct nfsv4lock *, int, int *, void *, struct mount *); +int nfsv4_lock(struct nfsv4lock *, int, int *, struct mtx *, struct mount *); void nfsv4_unlock(struct nfsv4lock *, int); void nfsv4_relref(struct nfsv4lock *); -void nfsv4_getref(struct nfsv4lock *, int *, void *, struct mount *); +void nfsv4_getref(struct nfsv4lock *, int *, struct mtx *, struct mount *); int nfsv4_getref_nonblock(struct nfsv4lock *); int nfsv4_testlock(struct nfsv4lock *); int nfsrv_mtostr(struct nfsrv_descript *, char *, int); From owner-dev-commits-src-all@freebsd.org Fri Apr 2 00:39:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C6375BBC91; Fri, 2 Apr 2021 00:39:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBLmb41g3z3JxS; Fri, 2 Apr 2021 00:39:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78232168BA; Fri, 2 Apr 2021 00:39:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1320dxuH036097; Fri, 2 Apr 2021 00:39:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1320dxW9036096; Fri, 2 Apr 2021 00:39:59 GMT (envelope-from git) Date: Fri, 2 Apr 2021 00:39:59 GMT Message-Id: <202104020039.1320dxW9036096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 320a5f34acf6 - stable/13 - nfsv4 client: fix forced dismount when sleeping on nfsv4lck MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 320a5f34acf6da39a7b3c6cee3ba60822ec3ac08 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 00:39:59 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=320a5f34acf6da39a7b3c6cee3ba60822ec3ac08 commit 320a5f34acf6da39a7b3c6cee3ba60822ec3ac08 Author: Rick Macklem AuthorDate: 2021-03-19 21:09:33 +0000 Commit: Rick Macklem CommitDate: 2021-04-02 00:36:58 +0000 nfsv4 client: fix forced dismount when sleeping on nfsv4lck During a recent NFSv4 testing event a test server caused a hang where "umount -N" failed. The renew thread was sleeping on "nfsv4lck" and the "umount" was sleeping, waiting for the renew thread to terminate. This is the first of two patches that is hoped to fix the renew thread so that it will terminate when "umount -N" is done on the mount. nfsv4_lock() checks for forced dismount, but only after it wakes up from msleep(). Without this patch, a wakeup() call was required. This patch adds a 1second timeout on the msleep(), so that it will wake up and see the forced dismount flag. Normally a wakeup() will occur in less than 1second, but if a premature return from msleep() does occur, it will simply loop around and msleep() again. While here, replace the nfsmsleep() wrapper that was used for portability with the actual msleep() call and make the same change for nfsv4_getref(). (cherry picked from commit 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6) --- sys/fs/nfs/nfs_commonsubs.c | 10 ++++------ sys/fs/nfs/nfs_var.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index d44ff122a95c..e9b2af17d8b4 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2252,7 +2252,7 @@ nfsmout: */ int nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, - void *mutex, struct mount *mp) + struct mtx *mutex, struct mount *mp) { if (isleptp) @@ -2280,8 +2280,7 @@ nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4lck", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4lck", hz); if (iwantlock && !(lp->nfslock_lock & NFSV4LOCK_LOCK) && lp->nfslock_usecnt == 0) { lp->nfslock_lock &= ~NFSV4LOCK_LOCKWANTED; @@ -2331,7 +2330,7 @@ nfsv4_relref(struct nfsv4lock *lp) * return without getting a refcnt for that case. */ void -nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, +nfsv4_getref(struct nfsv4lock *lp, int *isleptp, struct mtx *mutex, struct mount *mp) { @@ -2347,8 +2346,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4gr", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4gr", hz); } if (mp != NULL && NFSCL_FORCEDISM(mp)) return; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 0a1fe3ce053d..aba5c5124e72 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -335,10 +335,10 @@ int nfsv4_loadattr(struct nfsrv_descript *, vnode_t, struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *, struct nfsfsinfo *, NFSACL_T *, int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *); -int nfsv4_lock(struct nfsv4lock *, int, int *, void *, struct mount *); +int nfsv4_lock(struct nfsv4lock *, int, int *, struct mtx *, struct mount *); void nfsv4_unlock(struct nfsv4lock *, int); void nfsv4_relref(struct nfsv4lock *); -void nfsv4_getref(struct nfsv4lock *, int *, void *, struct mount *); +void nfsv4_getref(struct nfsv4lock *, int *, struct mtx *, struct mount *); int nfsv4_getref_nonblock(struct nfsv4lock *); int nfsv4_testlock(struct nfsv4lock *); int nfsrv_mtostr(struct nfsrv_descript *, char *, int); From owner-dev-commits-src-all@freebsd.org Fri Apr 2 01:20:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 789C95BD239; Fri, 2 Apr 2021 01:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBMgc34LZz3M8V; Fri, 2 Apr 2021 01:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C9FF172AA; Fri, 2 Apr 2021 01:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1321Kidj000530; Fri, 2 Apr 2021 01:20:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1321KidV000529; Fri, 2 Apr 2021 01:20:44 GMT (envelope-from git) Date: Fri, 2 Apr 2021 01:20:44 GMT Message-Id: <202104020120.1321KidV000529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: 429f71bf08d2 - main - ACPICA: Fix build with options ACPI_DEBUG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 429f71bf08d2b2b82363c82063e799f5e6e25c91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 01:20:44 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=429f71bf08d2b2b82363c82063e799f5e6e25c91 commit 429f71bf08d2b2b82363c82063e799f5e6e25c91 Author: Jung-uk Kim AuthorDate: 2021-04-02 01:18:49 +0000 Commit: Jung-uk Kim CommitDate: 2021-04-02 01:18:49 +0000 ACPICA: Fix build with options ACPI_DEBUG --- sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c index 7a5abbc65823..3134c041fe54 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c @@ -769,7 +769,9 @@ AcpiDmCsi2SerialBusDescriptor ( AcpiDmDumpSerialBusVendorData (Resource, Level); AcpiOsPrintf (")\n"); +#ifndef _KERNEL MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); +#endif } From owner-dev-commits-src-all@freebsd.org Fri Apr 2 02:10:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E120E5BE0D4; Fri, 2 Apr 2021 02:10:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBNn965R2z3PRn; Fri, 2 Apr 2021 02:10:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3FC117F03; Fri, 2 Apr 2021 02:10:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1322Abpp070242; Fri, 2 Apr 2021 02:10:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1322AbGX070241; Fri, 2 Apr 2021 02:10:37 GMT (envelope-from git) Date: Fri, 2 Apr 2021 02:10:37 GMT Message-Id: <202104020210.1322AbGX070241@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: e2b247fac21e - main - Remove bt.4 man page. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2b247fac21e3b82f84cc56c7caf94f6ec3e78b0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 02:10:37 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=e2b247fac21e3b82f84cc56c7caf94f6ec3e78b0 commit e2b247fac21e3b82f84cc56c7caf94f6ec3e78b0 Author: Cy Schubert AuthorDate: 2021-03-29 05:14:36 +0000 Commit: Cy Schubert CommitDate: 2021-04-02 02:09:54 +0000 Remove bt.4 man page. r339568 (a1db7455b75d7557fd171a537e2d95aceb20846e) removed bt(4). This revision removes the man page Reviewed by: emaste (previous version) Differential Revision: https://reviews.freebsd.org/D29480 --- ObsoleteFiles.inc | 3 + share/man/man4/Makefile | 1 - share/man/man4/bt.4 | 174 ------------------------------------------------ 3 files changed, 3 insertions(+), 175 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 94abddf5ac14..de5808958c69 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20210401: remove bt(4) man page +OLD_FILES+=usr/share/man/man4/bt.4.gz + # 20210322: retire mn(4) sync serial driver OLD_FILES+=usr/share/man/man4/if_mn.4.gz OLD_FILES+=usr/share/man/man4/mn.4.gz diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index f5a8f98b5bab..026b1c0faf31 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -84,7 +84,6 @@ MAN= aac.4 \ bnxt.4 \ bpf.4 \ bridge.4 \ - bt.4 \ bwi.4 \ bwn.4 \ ${_bytgpio.4} \ diff --git a/share/man/man4/bt.4 b/share/man/man4/bt.4 deleted file mode 100644 index ebdebae22837..000000000000 --- a/share/man/man4/bt.4 +++ /dev/null @@ -1,174 +0,0 @@ -.\" -.\" Copyright (c) 1994 Jordan Hubbard -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd August 18, 2020 -.Dt BT 4 -.Os -.Sh NAME -.Nm bt -.Nd Buslogic/Mylex MultiMaster SCSI host adapter driver -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following lines in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device isa" -.Cd "device scbus" -.Cd "device bt" -.Pp -In -.Pa /boot/device.hints : -.Cd hint.bt.0.at="isa" -.Cd hint.bt.0.port="0x330" -.Ed -.Sh DEPRECATION NOTICE -This driver is scheduled for removal prior to the release of -.Fx 13.0 . -.Sh DESCRIPTION -This driver provides access to the -.Tn SCSI -bus connected to a Buslogic/Mylex MultiMaster or compatible controller: -.Bd -ragged -offset indent -MultiMaster "W" Series Host Adapters: -.Bl -column "BT-956CD " "ISA " "Commands " "Description" -.Em "Adapter" Ta Em "Bus" Ta Em "Commands" Ta Em "Description" -BT-948 PCI 192 Ultra SCSI-3 -BT-958 PCI 192 Wide Ultra SCSI-3 -BT-958D PCI 192 Wide Differential Ultra SCSI-3 -.El -.Pp -MultiMaster "C" Series Host Adapters: -.Bl -column "BT-956CD " "ISA " "Commands " "Description" -.Em "Adapter" Ta Em "Bus" Ta Em "Commands" Ta Em "Description" -BT-946C PCI 100 Fast SCSI-2 -BT-956C PCI 100 Wide Fast SCSI-2 -BT-956CD PCI 100 Wide Differential Fast SCSI-2 -BT-445C VLB 100 Fast SCSI-2 -BT-545C ISA 50 Fast SCSI-2 -BT-540CF ISA 50 Fast SCSI-2 -.El -.Pp -MultiMaster "S" Series Host Adapters: -.Bl -column "BT-956CD " "ISA " "Commands " "Description" -.Em "Adapter" Ta Em "Bus" Ta Em "Commands" Ta Em "Description" -BT-445S VLB 30 Fast SCSI-2 -BT-545S ISA 30 Fast SCSI-2 -BT-542D ISA 30 Differential Fast SCSI-2 -BT-542B ISA 30 SCSI-2 (542B revision H) -.El -.Pp -MultiMaster "A" Series Host Adapters: -.Bl -column "BT-956CD " "ISA " "Commands " "Description" -.Em "Adapter" Ta Em "Bus" Ta Em "Commands" Ta Em "Description" -BT-542B ISA 30 SCSI-2 (542B revisions A - G) -.El -.Ed -.Pp -Tagged queueing is supported on 'W' series adapters, 'C' series adapters -with firmware of rev 4.42 and higher, and 'S' series adapters with firmware -of rev 3.35 and higher. -.Pp -Boards with certain firmware revisions may lock up under heavy load to -certain devices, especially if tagged queueing is used. -Should you encounter -a problem with your adapter, contact Mylex technical support and ensure you -have the latest firmware for your controller. -.Sh HARDWARE -The -.Nm -driver supports the following BusLogic MultiMaster -.Dq W , -.Dq C , -.Dq S , -and -.Dq A -series and compatible SCSI host adapters: -.Pp -.Bl -bullet -compact -.It -BusLogic BT-445C -.It -BusLogic BT-445S -.It -BusLogic BT-540CF -.It -BusLogic BT-542B -.It -BusLogic BT-542B -.It -BusLogic BT-542D -.It -BusLogic BT-545C -.It -BusLogic BT-545S -.It -BusLogic/BusTek BT-640 -.It -BusLogic BT-946C -.It -BusLogic BT-948 -.It -BusLogic BT-956C -.It -BusLogic BT-956CD -.It -BusLogic BT-958 -.It -BusLogic BT-958D -.It -Storage Dimensions SDC3211B / SDC3211F -.El -.Sh SEE ALSO -.Xr cd 4 , -.Xr da 4 , -.Xr sa 4 , -.Xr scsi 4 -.Sh HISTORY -The -.Nm -driver first appeared in the -.Bx 386 -patch kit. -.Sh AUTHORS -.An -nosplit -.An Julian Elischer -wrote a driver for the Multimaster cards that appeared in the -.Bx 386 -patch kit. -The driver was rewritten by -.An Justin T. Gibbs -to take advantage of new board features and work with the CAM SCSI framework in -.Fx 3.0 . -.Pp -Special thanks to -.An Leonard N. Zubkoff -for writing such a complete and well documented Mylex/BusLogic MultiMaster -driver for Linux. -Support in this driver for the wide range of MultiMaster -controllers and firmware revisions, with their otherwise undocumented quirks, -would not have been possible without his efforts. From owner-dev-commits-src-all@freebsd.org Fri Apr 2 02:18:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 505925BEAF0; Fri, 2 Apr 2021 02:18:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBNxz1p3jz3Pq2; Fri, 2 Apr 2021 02:18:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C5F717C4F; Fri, 2 Apr 2021 02:18:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1322IFCR076167; Fri, 2 Apr 2021 02:18:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1322IFZ3076166; Fri, 2 Apr 2021 02:18:15 GMT (envelope-from git) Date: Fri, 2 Apr 2021 02:18:15 GMT Message-Id: <202104020218.1322IFZ3076166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lawrence Stewart Subject: git: 1eb402e47af3 - main - stats(3): Improve t-digest merging of samples which result in mu adjustment underflow. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lstewart X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1eb402e47af35b3980e6bd51ec462de3a3faa2c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 02:18:15 -0000 The branch main has been updated by lstewart: URL: https://cgit.FreeBSD.org/src/commit/?id=1eb402e47af35b3980e6bd51ec462de3a3faa2c8 commit 1eb402e47af35b3980e6bd51ec462de3a3faa2c8 Author: Lawrence Stewart AuthorDate: 2021-04-02 01:29:29 +0000 Commit: Lawrence Stewart CommitDate: 2021-04-02 02:17:53 +0000 stats(3): Improve t-digest merging of samples which result in mu adjustment underflow. Allow the calculation of the mu adjustment factor to underflow instead of rejecting the VOI sample from the digest and logging an error. This trades off some (currently unquantified) additional centroid error in exchange for better fidelity of the distribution's density, which is the right trade off at the moment until follow up work to better handle and track accumulated error can be undertaken. Obtained from: Netflix MFC after: immediately --- sys/kern/subr_stats.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_stats.c b/sys/kern/subr_stats.c index 9dd874fcbcf8..946999263898 100644 --- a/sys/kern/subr_stats.c +++ b/sys/kern/subr_stats.c @@ -3255,9 +3255,41 @@ stats_v1_vsd_tdgst_add(enum vsd_dtype vs_dtype, struct voistatdata_tdgst *tdgst, if (is32bit) { ctd32 = (struct voistatdata_tdgstctd32 *)closest; error = Q_QSUBQ(&x, ctd32->mu); + /* + * The following calculation "x / (cnt + weight)" + * computes the amount by which to adjust the centroid's + * mu value in order to merge in the VOI sample. + * + * It can underflow (Q_QDIVI() returns ERANGE) when the + * user centroids' fractional precision (which is + * inherited by 'x') is too low to represent the result. + * + * A sophisticated approach to dealing with this issue + * would minimise accumulation of error by tracking + * underflow per centroid and making an adjustment when + * a LSB's worth of underflow has accumulated. + * + * A simpler approach is to let the result underflow + * i.e. merge the VOI sample into the centroid without + * adjusting the centroid's mu, and rely on the user to + * specify their t-digest with sufficient centroid + * fractional precision such that the accumulation of + * error from multiple underflows is of no material + * consequence to the centroid's final value of mu. + * + * For the moment, the latter approach is employed by + * simply ignoring ERANGE here. + * + * XXXLAS: Per-centroid underflow tracking is likely too + * onerous, but it probably makes sense to accumulate a + * single underflow error variable across all centroids + * and report it as part of the digest to provide + * additional visibility into the digest's fidelity. + */ error = error ? error : Q_QDIVI(&x, ctd32->cnt + weight); - if (error || (error = Q_QADDQ(&ctd32->mu, x))) { + if ((error && error != ERANGE) + || (error = Q_QADDQ(&ctd32->mu, x))) { #ifdef DIAGNOSTIC KASSERT(!error, ("%s: unexpected error %d", __func__, error)); @@ -3276,7 +3308,9 @@ stats_v1_vsd_tdgst_add(enum vsd_dtype vs_dtype, struct voistatdata_tdgst *tdgst, error = Q_QSUBQ(&x, ctd64->mu); error = error ? error : Q_QDIVI(&x, ctd64->cnt + weight); - if (error || (error = Q_QADDQ(&ctd64->mu, x))) { + /* Refer to is32bit ERANGE discussion above. */ + if ((error && error != ERANGE) + || (error = Q_QADDQ(&ctd64->mu, x))) { KASSERT(!error, ("%s: unexpected error %d", __func__, error)); return (error); From owner-dev-commits-src-all@freebsd.org Fri Apr 2 02:46:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34C295BF5B9; Fri, 2 Apr 2021 02:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBPZq130xz3RFB; Fri, 2 Apr 2021 02:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1692C18780; Fri, 2 Apr 2021 02:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1322kg0p017796; Fri, 2 Apr 2021 02:46:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1322kgH5017795; Fri, 2 Apr 2021 02:46:42 GMT (envelope-from git) Date: Fri, 2 Apr 2021 02:46:42 GMT Message-Id: <202104020246.1322kgH5017795@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lawrence Stewart Subject: git: 9141b58b50a8 - stable/13 - stats(3): Improve t-digest merging of samples which result in mu adjustment underflow. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lstewart X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9141b58b50a86a94667a79f221dcba59240ce3f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 02:46:43 -0000 The branch stable/13 has been updated by lstewart: URL: https://cgit.FreeBSD.org/src/commit/?id=9141b58b50a86a94667a79f221dcba59240ce3f4 commit 9141b58b50a86a94667a79f221dcba59240ce3f4 Author: Lawrence Stewart AuthorDate: 2021-04-02 01:29:29 +0000 Commit: Lawrence Stewart CommitDate: 2021-04-02 02:29:55 +0000 stats(3): Improve t-digest merging of samples which result in mu adjustment underflow. Allow the calculation of the mu adjustment factor to underflow instead of rejecting the VOI sample from the digest and logging an error. This trades off some (currently unquantified) additional centroid error in exchange for better fidelity of the distribution's density, which is the right trade off at the moment until follow up work to better handle and track accumulated error can be undertaken. Obtained from: Netflix MFC after: immediately (cherry picked from commit 1eb402e47af35b3980e6bd51ec462de3a3faa2c8) --- sys/kern/subr_stats.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_stats.c b/sys/kern/subr_stats.c index 9dd874fcbcf8..946999263898 100644 --- a/sys/kern/subr_stats.c +++ b/sys/kern/subr_stats.c @@ -3255,9 +3255,41 @@ stats_v1_vsd_tdgst_add(enum vsd_dtype vs_dtype, struct voistatdata_tdgst *tdgst, if (is32bit) { ctd32 = (struct voistatdata_tdgstctd32 *)closest; error = Q_QSUBQ(&x, ctd32->mu); + /* + * The following calculation "x / (cnt + weight)" + * computes the amount by which to adjust the centroid's + * mu value in order to merge in the VOI sample. + * + * It can underflow (Q_QDIVI() returns ERANGE) when the + * user centroids' fractional precision (which is + * inherited by 'x') is too low to represent the result. + * + * A sophisticated approach to dealing with this issue + * would minimise accumulation of error by tracking + * underflow per centroid and making an adjustment when + * a LSB's worth of underflow has accumulated. + * + * A simpler approach is to let the result underflow + * i.e. merge the VOI sample into the centroid without + * adjusting the centroid's mu, and rely on the user to + * specify their t-digest with sufficient centroid + * fractional precision such that the accumulation of + * error from multiple underflows is of no material + * consequence to the centroid's final value of mu. + * + * For the moment, the latter approach is employed by + * simply ignoring ERANGE here. + * + * XXXLAS: Per-centroid underflow tracking is likely too + * onerous, but it probably makes sense to accumulate a + * single underflow error variable across all centroids + * and report it as part of the digest to provide + * additional visibility into the digest's fidelity. + */ error = error ? error : Q_QDIVI(&x, ctd32->cnt + weight); - if (error || (error = Q_QADDQ(&ctd32->mu, x))) { + if ((error && error != ERANGE) + || (error = Q_QADDQ(&ctd32->mu, x))) { #ifdef DIAGNOSTIC KASSERT(!error, ("%s: unexpected error %d", __func__, error)); @@ -3276,7 +3308,9 @@ stats_v1_vsd_tdgst_add(enum vsd_dtype vs_dtype, struct voistatdata_tdgst *tdgst, error = Q_QSUBQ(&x, ctd64->mu); error = error ? error : Q_QDIVI(&x, ctd64->cnt + weight); - if (error || (error = Q_QADDQ(&ctd64->mu, x))) { + /* Refer to is32bit ERANGE discussion above. */ + if ((error && error != ERANGE) + || (error = Q_QADDQ(&ctd64->mu, x))) { KASSERT(!error, ("%s: unexpected error %d", __func__, error)); return (error); From owner-dev-commits-src-all@freebsd.org Fri Apr 2 03:13:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDB535BF976; Fri, 2 Apr 2021 03:13:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBQ9q50tpz3j08; Fri, 2 Apr 2021 03:13:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EACC189B4; Fri, 2 Apr 2021 03:13:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1323DZtM060030; Fri, 2 Apr 2021 03:13:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1323DZht060029; Fri, 2 Apr 2021 03:13:35 GMT (envelope-from git) Date: Fri, 2 Apr 2021 03:13:35 GMT Message-Id: <202104020313.1323DZht060029@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 3f56bc79860e - main - vfs: add vfs_smr_quiesce MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f56bc79860ec20f0e53de42dab1c117ee68e37b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 03:13:35 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3f56bc79860ec20f0e53de42dab1c117ee68e37b commit 3f56bc79860ec20f0e53de42dab1c117ee68e37b Author: Mateusz Guzik AuthorDate: 2021-03-30 14:44:10 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-02 03:11:05 +0000 vfs: add vfs_smr_quiesce This can be used to observe all CPUs not executing while within vfs_smr_enter. --- sys/sys/vnode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index f05b03c74c82..3bb6936a27b2 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1112,6 +1112,7 @@ int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); #define VFS_SMR() vfs_smr #define vfs_smr_enter() smr_enter(VFS_SMR()) #define vfs_smr_exit() smr_exit(VFS_SMR()) +#define vfs_smr_quiesce() quiesce_all_critical() #define vfs_smr_entered_load(ptr) smr_entered_load((ptr), VFS_SMR()) #define VFS_SMR_ASSERT_ENTERED() SMR_ASSERT_ENTERED(VFS_SMR()) #define VFS_SMR_ASSERT_NOT_ENTERED() SMR_ASSERT_NOT_ENTERED(VFS_SMR()) From owner-dev-commits-src-all@freebsd.org Fri Apr 2 03:13:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE6435BF977; Fri, 2 Apr 2021 03:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBQ9r61Cdz3jRR; Fri, 2 Apr 2021 03:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C140A18C29; Fri, 2 Apr 2021 03:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1323Da6C060054; Fri, 2 Apr 2021 03:13:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1323DaEE060053; Fri, 2 Apr 2021 03:13:36 GMT (envelope-from git) Date: Fri, 2 Apr 2021 03:13:36 GMT Message-Id: <202104020313.1323DaEE060053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: dc532884d582 - main - cache: fix resizing in face of lockless lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc532884d582db6da833d598e4bb37ad1880947c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 03:13:36 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dc532884d582db6da833d598e4bb37ad1880947c commit dc532884d582db6da833d598e4bb37ad1880947c Author: Mateusz Guzik AuthorDate: 2021-03-29 19:17:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-02 03:11:05 +0000 cache: fix resizing in face of lockless lookup Reported by: pho Tested by: pho --- sys/kern/vfs_cache.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 106 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 8cae0260cbf0..3f09f37a7415 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -455,6 +455,9 @@ static long cache_lock_vnodes_cel_3_failures; DEBUGNODE_ULONG(vnodes_cel_3_failures, cache_lock_vnodes_cel_3_failures, "Number of times 3-way vnode locking failed"); +static void cache_fplookup_lockout(void); +static void cache_fplookup_restore(void); + static void cache_zap_locked(struct namecache *ncp); static int vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, size_t *buflen); @@ -2549,11 +2552,76 @@ cache_vnode_init(struct vnode *vp) cache_prehash(vp); } +/* + * Induce transient cache misses for lockless operation in cache_lookup() by + * using a temporary hash table. + * + * This will force a fs lookup. + * + * Synchronisation is done in 2 steps, calling vfs_smr_quiesce each time + * to observe all CPUs not performing the lookup. + */ +static void +cache_changesize_set_temp(struct nchashhead *temptbl, u_long temphash) +{ + + MPASS(temphash < nchash); + /* + * Change the size. The new size is smaller and can safely be used + * against the existing table. All lookups which now hash wrong will + * result in a cache miss, which all callers are supposed to know how + * to handle. + */ + atomic_store_long(&nchash, temphash); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + /* + * At this point everyone sees the updated hash value, but they still + * see the old table. + */ + atomic_store_ptr(&nchashtbl, temptbl); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + /* + * At this point everyone sees the updated table pointer and size pair. + */ +} + +/* + * Set the new hash table. + * + * Similarly to cache_changesize_set_temp(), this has to synchronize against + * lockless operation in cache_lookup(). + */ +static void +cache_changesize_set_new(struct nchashhead *new_tbl, u_long new_hash) +{ + + MPASS(nchash < new_hash); + /* + * Change the pointer first. This wont result in out of bounds access + * since the temporary table is guaranteed to be smaller. + */ + atomic_store_ptr(&nchashtbl, new_tbl); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + /* + * At this point everyone sees the updated pointer value, but they + * still see the old size. + */ + atomic_store_long(&nchash, new_hash); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + /* + * At this point everyone sees the updated table pointer and size pair. + */ +} + void cache_changesize(u_long newmaxvnodes) { - struct nchashhead *new_nchashtbl, *old_nchashtbl; - u_long new_nchash, old_nchash; + struct nchashhead *new_nchashtbl, *old_nchashtbl, *temptbl; + u_long new_nchash, old_nchash, temphash; struct namecache *ncp; uint32_t hash; u_long newncsize; @@ -2570,30 +2638,36 @@ cache_changesize(u_long newmaxvnodes) ncfreetbl(new_nchashtbl); return; } + + temptbl = nchinittbl(1, &temphash); + /* * Move everything from the old hash table to the new table. * None of the namecache entries in the table can be removed * because to do so, they have to be removed from the hash table. */ + cache_fplookup_lockout(); cache_lock_all_vnodes(); cache_lock_all_buckets(); old_nchashtbl = nchashtbl; old_nchash = nchash; - nchashtbl = new_nchashtbl; - nchash = new_nchash; + cache_changesize_set_temp(temptbl, temphash); for (i = 0; i <= old_nchash; i++) { while ((ncp = CK_SLIST_FIRST(&old_nchashtbl[i])) != NULL) { hash = cache_get_hash(ncp->nc_name, ncp->nc_nlen, ncp->nc_dvp); CK_SLIST_REMOVE(&old_nchashtbl[i], ncp, namecache, nc_hash); - CK_SLIST_INSERT_HEAD(NCHHASH(hash), ncp, nc_hash); + CK_SLIST_INSERT_HEAD(&new_nchashtbl[hash & new_nchash], ncp, nc_hash); } } ncsize = newncsize; cache_recalc_neg_min(ncnegminpct); + cache_changesize_set_new(new_nchashtbl, new_nchash); cache_unlock_all_buckets(); cache_unlock_all_vnodes(); + cache_fplookup_restore(); ncfreetbl(old_nchashtbl); + ncfreetbl(temptbl); } /* @@ -3666,6 +3740,33 @@ syscal_vfs_cache_fast_lookup(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, &cache_fast_lookup, 0, syscal_vfs_cache_fast_lookup, "IU", ""); +/* + * Disable lockless lookup and observe all CPUs not executing it. + * + * Used when resizing the hash table. + * + * TODO: no provisions are made to handle tweaking of the knob at the same time + */ +static void +cache_fplookup_lockout(void) +{ + bool on; + + on = atomic_load_char(&cache_fast_lookup_enabled); + if (on) { + atomic_store_char(&cache_fast_lookup_enabled, false); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + } +} + +static void +cache_fplookup_restore(void) +{ + + cache_fast_lookup_enabled_recalc(); +} + /* * Components of nameidata (or objects it can point to) which may * need restoring in case fast path lookup fails. From owner-dev-commits-src-all@freebsd.org Fri Apr 2 03:13:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FE345BFF83; Fri, 2 Apr 2021 03:13:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBQ9t0qryz3jGC; Fri, 2 Apr 2021 03:13:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E99D718BB2; Fri, 2 Apr 2021 03:13:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1323Db5A060081; Fri, 2 Apr 2021 03:13:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1323DbQZ060080; Fri, 2 Apr 2021 03:13:37 GMT (envelope-from git) Date: Fri, 2 Apr 2021 03:13:37 GMT Message-Id: <202104020313.1323DbQZ060080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f79bd71def7a - main - cache: add high level overview MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f79bd71def7a03b3a1b043cae7b908b36a05f41c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 03:13:38 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f79bd71def7a03b3a1b043cae7b908b36a05f41c commit f79bd71def7a03b3a1b043cae7b908b36a05f41c Author: Mateusz Guzik AuthorDate: 2021-02-11 15:39:28 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-02 03:11:05 +0000 cache: add high level overview Differential Revision: https://reviews.freebsd.org/D28675 --- sys/kern/vfs_cache.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 3f09f37a7415..649ee9b9783b 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -82,6 +82,131 @@ __FBSDID("$FreeBSD$"); #include +/* + * High level overview of name caching in the VFS layer. + * + * Originally caching was implemented as part of UFS, later extracted to allow + * use by other filesystems. A decision was made to make it optional and + * completely detached from the rest of the kernel, which comes with limitations + * outlined near the end of this comment block. + * + * This fundamental choice needs to be revisited. In the meantime, the current + * state is described below. Significance of all notable routines is explained + * in comments placed above their implementation. Scattered thoroughout the + * file are TODO comments indicating shortcomings which can be fixed without + * reworking everything (most of the fixes will likely be reusable). Various + * details are omitted from this explanation to not clutter the overview, they + * have to be checked by reading the code and associated commentary. + * + * Keep in mind that it's individual path components which are cached, not full + * paths. That is, for a fully cached path "foo/bar/baz" there are 3 entries, + * one for each name. + * + * I. Data organization + * + * Entries are described by "struct namecache" objects and stored in a hash + * table. See cache_get_hash for more information. + * + * "struct vnode" contains pointers to source entries (names which can be found + * when traversing through said vnode), destination entries (names of that + * vnode (see "Limitations" for a breakdown on the subject) and a pointer to + * the parent vnode. + * + * The (directory vnode; name) tuple reliably determines the target entry if + * it exists. + * + * Since there are no small locks at this time (all are 32 bytes in size on + * LP64), the code works around the problem by introducing lock arrays to + * protect hash buckets and vnode lists. + * + * II. Filesystem integration + * + * Filesystems participating in name caching do the following: + * - set vop_lookup routine to vfs_cache_lookup + * - set vop_cachedlookup to whatever can perform the lookup if the above fails + * - if they support lockless lookup (see below), vop_fplookup_vexec and + * vop_fplookup_symlink are set along with the MNTK_FPLOOKUP flag on the + * mount point + * - call cache_purge or cache_vop_* routines to eliminate stale entries as + * applicable + * - call cache_enter to add entries depending on the MAKEENTRY flag + * + * With the above in mind, there are 2 entry points when doing lookups: + * - ... -> namei -> cache_fplookup -- this is the default + * - ... -> VOP_LOOKUP -> vfs_cache_lookup -- normally only called by namei + * should the above fail + * + * Example code flow how an entry is added: + * ... -> namei -> cache_fplookup -> cache_fplookup_noentry -> VOP_LOOKUP -> + * vfs_cache_lookup -> VOP_CACHEDLOOKUP -> ufs_lookup_ino -> cache_enter + * + * III. Performance considerations + * + * For lockless case forward lookup avoids any writes to shared areas apart + * from the terminal path component. In other words non-modifying lookups of + * different files don't suffer any scalability problems in the namecache. + * Looking up the same file is limited by VFS and goes beyond the scope of this + * file. + * + * At least on amd64 the single-threaded bottleneck for long paths is hashing + * (see cache_get_hash). There are cases where the code issues acquire fence + * multiple times, they can be combined on architectures which suffer from it. + * + * For locked case each encountered vnode has to be referenced and locked in + * order to be handed out to the caller (normally that's namei). This + * introduces significant hit single-threaded and serialization multi-threaded. + * + * Reverse lookup (e.g., "getcwd") fully scales provided it is fully cached -- + * avoids any writes to shared areas to any components. + * + * Unrelated insertions are partially serialized on updating the global entry + * counter and possibly serialized on colliding bucket or vnode locks. + * + * IV. Observability + * + * Note not everything has an explicit dtrace probe nor it should have, thus + * some of the one-liners below depend on implementation details. + * + * Examples: + * + * # Check what lookups failed to be handled in a lockless manner. Column 1 is + * # line number, column 2 is status code (see cache_fpl_status) + * dtrace -n 'vfs:fplookup:lookup:done { @[arg1, arg2] = count(); }' + * + * # Lengths of names added by binary name + * dtrace -n 'fbt::cache_enter_time:entry { @[execname] = quantize(args[2]->cn_namelen); }' + * + * # Same as above but only those which exceed 64 characters + * dtrace -n 'fbt::cache_enter_time:entry /args[2]->cn_namelen > 64/ { @[execname] = quantize(args[2]->cn_namelen); }' + * + * # Who is performing lookups with spurious slashes (e.g., "foo//bar") and what + * # path is it + * dtrace -n 'fbt::cache_fplookup_skip_slashes:entry { @[execname, stringof(args[0]->cnp->cn_pnbuf)] = count(); }' + * + * V. Limitations and implementation defects + * + * - since it is possible there is no entry for an open file, tools like + * "procstat" may fail to resolve fd -> vnode -> path to anything + * - even if a filesystem adds an entry, it may get purged (e.g., due to memory + * shortage) in which case the above problem applies + * - hardlinks are not tracked, thus if a vnode is reachable in more than one + * way, resolving a name may return a different path than the one used to + * open it (even if said path is still valid) + * - by default entries are not added for newly created files + * - adding an entry may need to evict negative entry first, which happens in 2 + * distinct places (evicting on lookup, adding in a later VOP) making it + * impossible to simply reuse it + * - there is a simple scheme to evict negative entries as the cache is approaching + * its capacity, but it is very unclear if doing so is a good idea to begin with + * - vnodes are subject to being recycled even if target inode is left in memory, + * which loses the name cache entries when it perhaps should not. in case of tmpfs + * names get duplicated -- kept by filesystem itself and namecache separately + * - struct namecache has a fixed size and comes in 2 variants, often wasting space. + * now hard to replace with malloc due to dependence on SMR. + * - lack of better integration with the kernel also turns nullfs into a layered + * filesystem instead of something which can take advantage of caching + */ + static SYSCTL_NODE(_vfs, OID_AUTO, cache, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Name cache"); From owner-dev-commits-src-all@freebsd.org Fri Apr 2 06:47:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 375BF5C4549; Fri, 2 Apr 2021 06:47:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBVwn15Rgz3vj8; Fri, 2 Apr 2021 06:47:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17FBD1B902; Fri, 2 Apr 2021 06:47:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1326laHF054413; Fri, 2 Apr 2021 06:47:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1326laIK054412; Fri, 2 Apr 2021 06:47:36 GMT (envelope-from git) Date: Fri, 2 Apr 2021 06:47:36 GMT Message-Id: <202104020647.1326laIK054412@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 66671ae589c3 - main - netmap: fix typo bug in netmap_compute_buf_len MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66671ae589c3c605c9ededa8980ce3fc4b27e642 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 06:47:37 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=66671ae589c3c605c9ededa8980ce3fc4b27e642 commit 66671ae589c3c605c9ededa8980ce3fc4b27e642 Author: Vincenzo Maffione AuthorDate: 2021-04-02 06:42:34 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-02 06:47:28 +0000 netmap: fix typo bug in netmap_compute_buf_len --- sys/dev/netmap/netmap.c | 2 +- sys/dev/netmap/netmap_kern.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index 18de5ef205eb..a9ddb5fb5728 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -2412,7 +2412,7 @@ netmap_compute_buf_len(struct netmap_priv_d *priv) maxframe = mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; if (maxframe < target) { - target = kring->offset_gap; + target = maxframe; } } diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index d9ae6a4f2054..0239a385270b 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -832,7 +832,7 @@ struct netmap_adapter { * current NETMAP_BUF_SIZE (b) of the memory region used by the * adapter. We want the largest supported l such that o + l <= b. * If m is known to be <= b - o, the callback may also choose the - * largest l <= b, ignoring the offset. The buf_align field is + * largest l <= m, ignoring the offset. The buf_align field is * most important for TX rings when there are offsets. The user * will see this value in the ring->buf_align field. Misaligned * offsets will cause the corresponding packets to be silently From owner-dev-commits-src-all@freebsd.org Fri Apr 2 07:01:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CB935C4C07; Fri, 2 Apr 2021 07:01:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBWF91l4kz4Qnt; Fri, 2 Apr 2021 07:01:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E9431B9BC; Fri, 2 Apr 2021 07:01:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13271nPa079189; Fri, 2 Apr 2021 07:01:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13271nqR079187; Fri, 2 Apr 2021 07:01:49 GMT (envelope-from git) Date: Fri, 2 Apr 2021 07:01:49 GMT Message-Id: <202104020701.13271nqR079187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 45c67e8f6b56 - main - netmap: several typo fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45c67e8f6b56b9744f01142747fadf291fe3fad2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 07:01:49 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=45c67e8f6b56b9744f01142747fadf291fe3fad2 commit 45c67e8f6b56b9744f01142747fadf291fe3fad2 Author: Vincenzo Maffione AuthorDate: 2021-04-02 07:01:20 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-02 07:01:20 +0000 netmap: several typo fixes No functional changes intended. --- lib/libnetmap/libnetmap.h | 4 ++-- sys/dev/netmap/if_vtnet_netmap.h | 2 +- sys/dev/netmap/netmap.c | 18 +++++++++--------- sys/dev/netmap/netmap_bdg.c | 2 +- sys/dev/netmap/netmap_freebsd.c | 2 +- sys/dev/netmap/netmap_generic.c | 2 +- sys/dev/netmap/netmap_kern.h | 14 +++++++------- sys/dev/netmap/netmap_kloop.c | 12 ++++++------ sys/dev/netmap/netmap_mem2.c | 10 +++++----- sys/dev/netmap/netmap_mem2.h | 4 ++-- sys/dev/netmap/netmap_monitor.c | 4 ++-- sys/dev/netmap/netmap_vale.c | 4 ++-- sys/net/netmap.h | 8 ++++---- sys/net/netmap_user.h | 12 ++++++------ tests/sys/netmap/ctrl-api-test.c | 10 ++++++++++ tools/tools/netmap/lb.c | 2 +- tools/tools/netmap/pkt-gen.c | 2 +- usr.sbin/valectl/valectl.8 | 8 ++++---- 18 files changed, 65 insertions(+), 55 deletions(-) diff --git a/lib/libnetmap/libnetmap.h b/lib/libnetmap/libnetmap.h index ff03babc04b1..129189aab87d 100644 --- a/lib/libnetmap/libnetmap.h +++ b/lib/libnetmap/libnetmap.h @@ -418,7 +418,7 @@ struct nmreq_pools_info* nmport_extmem_getinfo(struct nmport_d *d); * @initial the initial offset for all the slots * @maxoff the maximum offset * @bits the number of bits of slot->ptr to use for the offsets - * @mingap the minimum gap betwen offsets (in shared buffers) + * @mingap the minimum gap between offsets (in shared buffers) * * With this option the lower @bits bits of the ptr field in the netmap_slot * can be used to specify an offset into the buffer. All offsets will be set @@ -440,7 +440,7 @@ struct nmreq_pools_info* nmport_extmem_getinfo(struct nmport_d *d); * starting o bytes in the buffer. Note that the address of the packet must * comply with any alignment constraints that the port may have, or the result * will be undefined. The user may read the alignment constraint in the new - * ring->buf_align field. It is also possibile that empty slots already come + * ring->buf_align field. It is also possible that empty slots already come * with a non-zero offset o specified in the offset field. In this case, the * user will have to write the packet at an offset o' >= o. * diff --git a/sys/dev/netmap/if_vtnet_netmap.h b/sys/dev/netmap/if_vtnet_netmap.h index cd652938bca5..a05781255218 100644 --- a/sys/dev/netmap/if_vtnet_netmap.h +++ b/sys/dev/netmap/if_vtnet_netmap.h @@ -114,7 +114,7 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int flags) virtqueue_notify(vq); /* Update hwcur depending on where we stopped. */ - kring->nr_hwcur = nm_i; /* note we migth break early */ + kring->nr_hwcur = nm_i; /* note we might break early */ } /* Free used slots. We only consider our own used buffers, recognized diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index a9ddb5fb5728..4835c47d2785 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -193,7 +193,7 @@ ports attached to the switch) * always attached to a bridge. * Persistent VALE ports must must be created separately, and i * then attached like normal NICs. The NIOCREGIF we are examining - * will find them only if they had previosly been created and + * will find them only if they had previously been created and * attached (see VALE_CTL below). * * - netmap_pipe_adapter [netmap_pipe.c] @@ -994,7 +994,7 @@ netmap_mem_restore(struct netmap_adapter *na) static void netmap_mem_drop(struct netmap_adapter *na) { - /* if the native allocator had been overrided on regif, + /* if the native allocator had been overridden on regif, * restore it now and drop the temporary one */ if (netmap_mem_deref(na->nm_mem, na)) { @@ -1072,7 +1072,7 @@ netmap_do_unregif(struct netmap_priv_d *priv) } } - /* possibily decrement counter of tx_si/rx_si users */ + /* possibly decrement counter of tx_si/rx_si users */ netmap_unset_ringid(priv); /* delete the nifp */ netmap_mem_if_delete(na, priv->np_nifp); @@ -1154,7 +1154,7 @@ netmap_dtor(void *data) * they will be forwarded to the hw TX rings, saving the application * from doing the same task in user-space. * - * Transparent fowarding can be enabled per-ring, by setting the NR_FORWARD + * Transparent forwarding can be enabled per-ring, by setting the NR_FORWARD * flag, or globally with the netmap_fwd sysctl. * * The transfer NIC --> host is relatively easy, just encapsulate @@ -1618,7 +1618,7 @@ netmap_get_na(struct nmreq_header *hdr, netmap_adapter_get(ret); /* - * if the adapter supports the host rings and it is not alread open, + * if the adapter supports the host rings and it is not already open, * try to set the number of host rings as requested by the user */ if (((*na)->na_flags & NAF_HOST_RINGS) && (*na)->active_fds == 0) { @@ -2042,7 +2042,7 @@ netmap_krings_get(struct netmap_priv_d *priv) priv->np_qlast[NR_RX]); /* first round: check that all the requested rings - * are neither alread exclusively owned, nor we + * are neither already exclusively owned, nor we * want exclusive ownership when they are already in use */ foreach_selected_ring(priv, t, i, kring) { @@ -2597,7 +2597,7 @@ netmap_do_regif(struct netmap_priv_d *priv, struct netmap_adapter *na, if (error) goto err_rel_excl; - /* compute and validate the buf lenghts */ + /* compute and validate the buf lengths */ error = netmap_compute_buf_len(priv); if (error) goto err_rel_excl; @@ -2719,7 +2719,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, } /* Make a kernel-space copy of the user-space nr_body. - * For convenince, the nr_body pointer and the pointers + * For convenience, the nr_body pointer and the pointers * in the options list will be replaced with their * kernel-space counterparts. The original pointers are * saved internally and later restored by nmreq_copyout @@ -3312,7 +3312,7 @@ nmreq_opt_size_by_type(uint32_t nro_reqtype, uint64_t nro_size) * The list of options is copied and the pointers adjusted. The * original pointers are saved before the option they belonged. * - * The option table has an entry for every availabe option. Entries + * The option table has an entry for every available option. Entries * for options that have not been passed contain NULL. * */ diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c index 57659f3a7a6e..103a3b00762e 100644 --- a/sys/dev/netmap/netmap_bdg.c +++ b/sys/dev/netmap/netmap_bdg.c @@ -951,7 +951,7 @@ nm_bdg_ctl_polling_stop(struct netmap_adapter *na) bps->configured = false; nm_os_free(bps); bna->na_polling_state = NULL; - /* reenable interrupts */ + /* re-enable interrupts */ nma_intr_enable(bna->hwna, 1); return 0; } diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index a47cb508de04..de3fbaaffea6 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -264,7 +264,7 @@ nm_os_csum_tcpudp_ipv4(struct nm_iphdr *iph, void *data, #ifdef INET uint16_t pseudolen = datalen + iph->protocol; - /* Compute and insert the pseudo-header cheksum. */ + /* Compute and insert the pseudo-header checksum. */ *check = in_pseudo(iph->saddr, iph->daddr, htobe16(pseudolen)); /* Compute the checksum on TCP/UDP header + payload diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c index f999576736fb..2068e9fd4359 100644 --- a/sys/dev/netmap/netmap_generic.c +++ b/sys/dev/netmap/netmap_generic.c @@ -446,7 +446,7 @@ generic_mbuf_destructor(struct mbuf *m) /* * First, clear the event mbuf. * In principle, the event 'm' should match the one stored - * on ring 'r'. However we check it explicitely to stay + * on ring 'r'. However we check it explicitly to stay * safe against lower layers (qdisc, driver, etc.) changing * MBUF_TXQ(m) under our feet. If the match is not found * on 'r', we try to see if it belongs to some other ring. diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index 0239a385270b..cc452657d8d5 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -294,7 +294,7 @@ struct nm_bridge; struct netmap_priv_d; struct nm_bdg_args; -/* os-specific NM_SELINFO_T initialzation/destruction functions */ +/* os-specific NM_SELINFO_T initialization/destruction functions */ int nm_os_selinfo_init(NM_SELINFO_T *, const char *name); void nm_os_selinfo_uninit(NM_SELINFO_T *); @@ -485,7 +485,7 @@ struct netmap_kring { struct netmap_adapter *na; /* the adapter that wants to be notified when this kring has - * new slots avaialable. This is usually the same as the above, + * new slots available. This is usually the same as the above, * but wrappers may let it point to themselves */ struct netmap_adapter *notify_na; @@ -562,7 +562,7 @@ struct netmap_kring { */ uint64_t hwbuf_len; - /* required aligment (in bytes) for the buffers used by this ring. + /* required alignment (in bytes) for the buffers used by this ring. * Netmap buffers are aligned to cachelines, which should suffice * for most NICs. If the user is passing offsets, though, we need * to check that the resulting buf address complies with any @@ -570,7 +570,7 @@ struct netmap_kring { */ uint64_t buf_align; - /* harware specific logic for the selection of the hwbuf_len */ + /* hardware specific logic for the selection of the hwbuf_len */ int (*nm_bufcfg)(struct netmap_kring *kring, uint64_t target); int (*save_notify)(struct netmap_kring *kring, int flags); @@ -709,7 +709,7 @@ struct nm_config_info { /* * default type for the magic field. - * May be overriden in glue code. + * May be overridden in glue code. */ #ifndef NM_OS_MAGIC #define NM_OS_MAGIC uint32_t @@ -827,7 +827,7 @@ struct netmap_adapter { * (l) and kring->buf_align fields. The l value is most important * for RX rings, where we want to disallow writes outside of the * netmap buffer. The l value must be computed taking into account - * the stipulated max_offset (o), possibily increased if there are + * the stipulated max_offset (o), possibly increased if there are * alignment constraints, the maxframe (m), if known, and the * current NETMAP_BUF_SIZE (b) of the memory region used by the * adapter. We want the largest supported l such that o + l <= b. @@ -1680,7 +1680,7 @@ extern int netmap_debug; /* for debugging */ #define netmap_debug (0) #endif /* !CONFIG_NETMAP_DEBUG */ enum { /* debug flags */ - NM_DEBUG_ON = 1, /* generic debug messsages */ + NM_DEBUG_ON = 1, /* generic debug messages */ NM_DEBUG_HOST = 0x2, /* debug host stack */ NM_DEBUG_RXSYNC = 0x10, /* debug on rxsync/txsync */ NM_DEBUG_TXSYNC = 0x20, diff --git a/sys/dev/netmap/netmap_kloop.c b/sys/dev/netmap/netmap_kloop.c index 0b89d89bf144..8d9edd4be5f5 100644 --- a/sys/dev/netmap/netmap_kloop.c +++ b/sys/dev/netmap/netmap_kloop.c @@ -222,7 +222,7 @@ netmap_sync_kloop_tx_ring(const struct sync_kloop_ring_args *a) if (unlikely(kring->nm_sync(kring, shadow_ring.flags))) { if (!a->busy_wait) { - /* Reenable notifications. */ + /* Re-enable notifications. */ csb_ktoa_kick_enable(csb_ktoa, 1); } nm_prerr("txsync() failed"); @@ -267,7 +267,7 @@ netmap_sync_kloop_tx_ring(const struct sync_kloop_ring_args *a) * go to sleep, waiting for a kick from the application when new * new slots are ready for transmission. */ - /* Reenable notifications. */ + /* Re-enable notifications. */ csb_ktoa_kick_enable(csb_ktoa, 1); /* Double check, with store-load memory barrier. */ nm_stld_barrier(); @@ -356,7 +356,7 @@ netmap_sync_kloop_rx_ring(const struct sync_kloop_ring_args *a) if (unlikely(kring->nm_sync(kring, shadow_ring.flags))) { if (!a->busy_wait) { - /* Reenable notifications. */ + /* Re-enable notifications. */ csb_ktoa_kick_enable(csb_ktoa, 1); } nm_prerr("rxsync() failed"); @@ -402,7 +402,7 @@ netmap_sync_kloop_rx_ring(const struct sync_kloop_ring_args *a) * go to sleep, waiting for a kick from the application when new receive * slots are available. */ - /* Reenable notifications. */ + /* Re-enable notifications. */ csb_ktoa_kick_enable(csb_ktoa, 1); /* Double check, with store-load memory barrier. */ nm_stld_barrier(); @@ -1000,7 +1000,7 @@ netmap_pt_guest_txsync(struct nm_csb_atok *atok, struct nm_csb_ktoa *ktoa, * space is available. */ if (nm_kr_wouldblock(kring) && !(kring->nr_kflags & NKR_NOINTR)) { - /* Reenable notifications. */ + /* Re-enable notifications. */ atok->appl_need_kick = 1; /* Double check, with store-load memory barrier. */ nm_stld_barrier(); @@ -1061,7 +1061,7 @@ netmap_pt_guest_rxsync(struct nm_csb_atok *atok, struct nm_csb_ktoa *ktoa, * completed. */ if (nm_kr_wouldblock(kring) && !(kring->nr_kflags & NKR_NOINTR)) { - /* Reenable notifications. */ + /* Re-enable notifications. */ atok->appl_need_kick = 1; /* Double check, with store-load memory barrier. */ nm_stld_barrier(); diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c index 069e0fa75b34..5edfc38e108d 100644 --- a/sys/dev/netmap/netmap_mem2.c +++ b/sys/dev/netmap/netmap_mem2.c @@ -167,7 +167,7 @@ struct netmap_mem_d { u_int flags; #define NETMAP_MEM_FINALIZED 0x1 /* preallocation done */ -#define NETMAP_MEM_HIDDEN 0x8 /* beeing prepared */ +#define NETMAP_MEM_HIDDEN 0x8 /* being prepared */ #define NETMAP_MEM_NOMAP 0x10 /* do not map/unmap pdevs */ int lasterr; /* last error for curr config */ int active; /* active users */ @@ -176,7 +176,7 @@ struct netmap_mem_d { struct netmap_obj_pool pools[NETMAP_POOLS_NR]; nm_memid_t nm_id; /* allocator identifier */ - int nm_grp; /* iommu groupd id */ + int nm_grp; /* iommu group id */ /* list of all existing allocators, sorted by nm_id */ struct netmap_mem_d *prev, *next; @@ -856,7 +856,7 @@ netmap_mem2_ofstophys(struct netmap_mem_d* nmd, vm_ooffset_t offset) * * 2a - cycle all the objects in every pool, get the list * of the physical address descriptors - * 2b - calculate the offset in the array of pages desciptor in the + * 2b - calculate the offset in the array of pages descriptor in the * main MDL * 2c - copy the descriptors of the object in the main MDL * @@ -1408,7 +1408,7 @@ netmap_finalize_obj_allocator(struct netmap_obj_pool *p) if (p->lut) { /* if the lut is already there we assume that also all the - * clusters have already been allocated, possibily by somebody + * clusters have already been allocated, possibly by somebody * else (e.g., extmem). In the latter case, the alloc_done flag * will remain at zero, so that we will not attempt to * deallocate the clusters by ourselves in @@ -1984,7 +1984,7 @@ netmap_mem2_rings_create(struct netmap_mem_d *nmd, struct netmap_adapter *na) u_int len, ndesc; if (!netmap_mem_ring_needed(kring)) { - /* uneeded, or already created by somebody else */ + /* unneeded, or already created by somebody else */ if (netmap_debug & NM_DEBUG_MEM) nm_prinf("NOT creating ring %s (ring %p, users %d neekring %d)", kring->name, ring, kring->users, kring->nr_kflags & NKR_NEEDRING); diff --git a/sys/dev/netmap/netmap_mem2.h b/sys/dev/netmap/netmap_mem2.h index c0e039b42128..61eeb4569b1e 100644 --- a/sys/dev/netmap/netmap_mem2.h +++ b/sys/dev/netmap/netmap_mem2.h @@ -57,7 +57,7 @@ * of the object, and from there locate the offset from the beginning * of the region. * - * The invididual allocators manage a pool of memory for objects of + * The individual allocators manage a pool of memory for objects of * the same size. * The pool is split into smaller clusters, whose size is a * multiple of the page size. The cluster size is chosen @@ -70,7 +70,7 @@ * Allocation scans the bitmap; this is done only on attach, so we are not * too worried about performance * - * For each allocator we can define (thorugh sysctl) the size and + * For each allocator we can define (through sysctl) the size and * number of each object. Memory is allocated at the first use of a * netmap file descriptor, and can be freed when all such descriptors * have been released (including unmapping the memory). diff --git a/sys/dev/netmap/netmap_monitor.c b/sys/dev/netmap/netmap_monitor.c index 9e5d57f7ff0f..4827c2a7585f 100644 --- a/sys/dev/netmap/netmap_monitor.c +++ b/sys/dev/netmap/netmap_monitor.c @@ -483,7 +483,7 @@ netmap_monitor_stop(struct netmap_adapter *na) netmap_adapter_put(next->priv.np_na); /* nop if null */ next->priv.np_na = NULL; } - /* orhpan the zmon list */ + /* orphan the zmon list */ if (z->next != NULL) z->next->zmon_list[t].prev = NULL; z->next = NULL; @@ -601,7 +601,7 @@ netmap_zmon_parent_sync(struct netmap_kring *kring, int flags, enum txrx tx) mring = mkring->ring; mlim = mkring->nkr_num_slots - 1; - /* get the relased slots (rel_slots) */ + /* get the released slots (rel_slots) */ if (tx == NR_TX) { beg = kring->nr_hwtail + 1; error = kring->mon_sync(kring, flags); diff --git a/sys/dev/netmap/netmap_vale.c b/sys/dev/netmap/netmap_vale.c index db3321a4ff83..aac4cfe6736a 100644 --- a/sys/dev/netmap/netmap_vale.c +++ b/sys/dev/netmap/netmap_vale.c @@ -578,7 +578,7 @@ do { \ static __inline uint32_t nm_vale_rthash(const uint8_t *addr) { - uint32_t a = 0x9e3779b9, b = 0x9e3779b9, c = 0; // hask key + uint32_t a = 0x9e3779b9, b = 0x9e3779b9, c = 0; // hash key b += addr[5] << 8; b += addr[4]; @@ -1369,7 +1369,7 @@ nm_vi_destroy(const char *name) goto err; } - /* also make sure that nobody is using the inferface */ + /* also make sure that nobody is using the interface */ if (NETMAP_OWNED_BY_ANY(&vpna->up) || vpna->up.na_refcount > 1 /* any ref besides the one in nm_vi_create()? */) { error = EBUSY; diff --git a/sys/net/netmap.h b/sys/net/netmap.h index 57480cba4ebd..9b4b46472def 100644 --- a/sys/net/netmap.h +++ b/sys/net/netmap.h @@ -147,7 +147,7 @@ * netmap:foo*, or another registration should be done to open at least a * NIC TX queue in netmap mode. * - * + Netmap is not currently able to deal with intercepted trasmit mbufs which + * + Netmap is not currently able to deal with intercepted transmit mbufs which * require offloadings like TSO, UFO, checksumming offloadings, etc. It is * responsibility of the user to disable those offloadings (e.g. using * ifconfig on FreeBSD or ethtool -K on Linux) for an interface that is being @@ -311,7 +311,7 @@ struct netmap_ring { /* the alignment requirement, in bytes, for the start * of the packets inside the buffers. * User programs should take this alignment into - * account when specifing buffer-offsets in TX slots. + * account when specifying buffer-offsets in TX slots. */ const uint64_t buf_align; @@ -494,7 +494,7 @@ struct netmap_if { /* Header common to all request options. */ struct nmreq_option { - /* Pointer ot the next option. */ + /* Pointer to the next option. */ uint64_t nro_next; /* Option type. */ uint32_t nro_reqtype; @@ -980,7 +980,7 @@ struct nmreq_opt_offsets { /* optional initial offset value, to be set in all slots. */ uint64_t nro_initial_offset; /* number of bits in the lower part of the 'ptr' field to be - * used as the offset field. On output the (possibily larger) + * used as the offset field. On output the (possibly larger) * effective number of bits is returned. * 0 means: use the whole ptr field. */ diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h index eb1a7057972d..27f8592eed85 100644 --- a/sys/net/netmap_user.h +++ b/sys/net/netmap_user.h @@ -55,7 +55,7 @@ * To compute the next index in a circular ring you can use * i = nm_ring_next(ring, i); * - * To ease porting apps from pcap to netmap we supply a few fuctions + * To ease porting apps from pcap to netmap we supply a few functions * that can be called to open, close, read and write on netmap in a way * similar to libpcap. Note that the read/write function depend on * an ioctl()/select()/poll() being issued to refill rings or push @@ -133,7 +133,7 @@ ((offset) & (ring)->offset_mask); } while (0) /* obtain the start of the buffer pointed to by a ring's slot, taking the - * offset field into accout + * offset field into account */ #define NETMAP_BUF_OFFSET(ring, slot) \ (NETMAP_BUF(ring, (slot)->buf_idx) + NETMAP_ROFFSET(ring, slot)) @@ -322,7 +322,7 @@ typedef void (*nm_cb_t)(u_char *, const struct nm_pkthdr *, const u_char *d); * nm_open() opens a file descriptor, binds to a port and maps memory. * * ifname (netmap:foo or vale:foo) is the port name - * a suffix can indicate the follwing: + * a suffix can indicate the following: * ^ bind the host (sw) ring pair * * bind host and NIC ring pairs * -NN bind individual NIC ring pair @@ -701,7 +701,7 @@ nm_parse(const char *ifname, struct nm_desc *d, char *err) nr_flags = NR_REG_PIPE_MASTER; p_state = P_GETNUM; break; - case '}': /* pipe (slave endoint) */ + case '}': /* pipe (slave endpoint) */ nr_flags = NR_REG_PIPE_SLAVE; p_state = P_GETNUM; break; @@ -991,11 +991,11 @@ nm_close(struct nm_desc *d) return 0; } + static int nm_mmap(struct nm_desc *d, const struct nm_desc *parent) { - if (d->done_mmap) - return 0; + //XXX TODO: check if mmap is already done if (IS_NETMAP_DESC(parent) && parent->mem && parent->req.nr_arg2 == d->req.nr_arg2) { diff --git a/tests/sys/netmap/ctrl-api-test.c b/tests/sys/netmap/ctrl-api-test.c index 73c4f8e1c39c..cea78141fbe4 100644 --- a/tests/sys/netmap/ctrl-api-test.c +++ b/tests/sys/netmap/ctrl-api-test.c @@ -27,6 +27,16 @@ * $FreeBSD$ */ +/* + * This program contains a suite of unit tests for the netmap control device. + * + * On FreeBSD, you can run these tests with Kyua once installed in the system: + * # kyua test -k /usr/tests/sys/netmap/Kyuafile + * + * On Linux, you can run them directly: + * # ./ctrl-api-test + */ + #include #include #include diff --git a/tools/tools/netmap/lb.c b/tools/tools/netmap/lb.c index 37fe97cc6ed4..778360d9ed6a 100644 --- a/tools/tools/netmap/lb.c +++ b/tools/tools/netmap/lb.c @@ -498,7 +498,7 @@ init_groups(void) * when the need to drop arises, we roll it back to head. */ struct morefrag { - uint16_t last_flag; /* for intput rings */ + uint16_t last_flag; /* for input rings */ uint32_t last_hash; /* for input rings */ uint32_t shadow_head; /* for output rings */ }; diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c index ebc0ac977219..c958af3b9781 100644 --- a/tools/tools/netmap/pkt-gen.c +++ b/tools/tools/netmap/pkt-gen.c @@ -3149,7 +3149,7 @@ main(int arc, char **argv) if (g.virt_header) { /* Set the virtio-net header length, since the user asked - * for it explicitely. */ + * for it explicitly. */ set_vnet_hdr_len(&g); } else { /* Check whether the netmap port we opened requires us to send diff --git a/usr.sbin/valectl/valectl.8 b/usr.sbin/valectl/valectl.8 index a85118cae7c1..83bddea9207f 100644 --- a/usr.sbin/valectl/valectl.8 +++ b/usr.sbin/valectl/valectl.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 31, 2020 +.Dd April 2, 2021 .Dt VALECTL 8 .Os .Sh NAME @@ -97,7 +97,7 @@ The name must be different from any other network interface already present in the system. .It Fl r Ar interface Destroy the persistent VALE port with name -.Ar inteface . +.Ar interface . .It Fl l Ar valeSSS:PPP Show the internal bridge number and port number of the given switch port. .It Fl p Ar valeSSS:PPP @@ -150,7 +150,7 @@ Using this option you can let them share memory with other ports. Pass 1 as .Ar memid to use the global memory region already shared by all -harware netmap ports. +hardware netmap ports. .El .Sh SEE ALSO .Xr netmap 4 , @@ -158,6 +158,6 @@ harware netmap ports. .Sh AUTHORS .An -nosplit .Nm -was written by +has been written by .An Michio Honda at NetApp. From owner-dev-commits-src-all@freebsd.org Fri Apr 2 08:44:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A558B5C8665; Fri, 2 Apr 2021 08:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBYW74H8Cz4Z0G; Fri, 2 Apr 2021 08:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 861521CF3B; Fri, 2 Apr 2021 08:44:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1328i3QU023343; Fri, 2 Apr 2021 08:44:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1328i31O023342; Fri, 2 Apr 2021 08:44:03 GMT (envelope-from git) Date: Fri, 2 Apr 2021 08:44:03 GMT Message-Id: <202104020844.1328i31O023342@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: a78109d5db87 - main - Partially revert r248770. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a78109d5db87b08785a822770e2e4fdb15f921b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 08:44:03 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=a78109d5db87b08785a822770e2e4fdb15f921b6 commit a78109d5db87b08785a822770e2e4fdb15f921b6 Author: Dmitry Chagin AuthorDate: 2021-04-02 08:43:17 +0000 Commit: Dmitry Chagin CommitDate: 2021-04-02 08:43:17 +0000 Partially revert r248770. Under geom(4) nvme_ns_bio_process() is on the path where sleep is prohibited as g_io_shedule_down() calls THREAD_NO_SLEEPNG() before geom->start(). Reviewed By: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29539 --- sys/dev/nvme/nvme_ns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index f14a2f631387..82ab48efa826 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -473,7 +473,7 @@ nvme_ns_bio_process(struct nvme_namespace *ns, struct bio *bp, case BIO_DELETE: dsm_range = malloc(sizeof(struct nvme_dsm_range), M_NVME, - M_ZERO | M_WAITOK); + M_ZERO | M_NOWAIT); if (!dsm_range) { err = ENOMEM; break; From owner-dev-commits-src-all@freebsd.org Fri Apr 2 10:12:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5DEF5CA5FB; Fri, 2 Apr 2021 10:12:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBbTS5j9Xz4g71; Fri, 2 Apr 2021 10:12:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B68761DC75; Fri, 2 Apr 2021 10:12:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132ACi4i049102; Fri, 2 Apr 2021 10:12:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132ACiJ6049101; Fri, 2 Apr 2021 10:12:44 GMT (envelope-from git) Date: Fri, 2 Apr 2021 10:12:44 GMT Message-Id: <202104021012.132ACiJ6049101@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4ded022d3b89 - main - mlx5: remove dependency on ifnet specifics of linux/netdevice.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ded022d3b8948e92c8f8353364ff2c79d720e68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 10:12:44 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4ded022d3b8948e92c8f8353364ff2c79d720e68 commit 4ded022d3b8948e92c8f8353364ff2c79d720e68 Author: Bjoern A. Zeeb AuthorDate: 2021-03-30 15:58:55 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-04-02 10:01:30 +0000 mlx5: remove dependency on ifnet specifics of linux/netdevice.h Rename the last remaining bits depending on ifnet from linux/netdevice.h instead of using the compat macros. This helps clearing up struct netdevice being struct ifnet from linux/netdevice.h. Sponsored-by: The FreeBSD Foundation MFC-after: 2 weeks Reviewed-by: hselasky, kib X-D-R: D29366 Differential Revision: https://reviews.freebsd.org/D29497 --- sys/dev/mlx5/mlx5_en/en.h | 1 - sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 3 ++- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 27 ++++++++++++++------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index b990bb754962..2ec47fa96a6d 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index b9828f1da466..0420b294de80 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -627,7 +628,7 @@ struct mlx5_roce { * netdev pointer */ rwlock_t netdev_lock; - struct net_device *netdev; + struct ifnet *netdev; struct notifier_block nb; atomic_t next_port; }; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index f2485d13d791..c2a01b26de1c 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -93,7 +93,7 @@ mlx5_ib_port_link_layer(struct ib_device *device, u8 port_num) return mlx5_port_type_cap_to_rdma_ll(port_type_cap); } -static bool mlx5_netdev_match(struct net_device *ndev, +static bool mlx5_netdev_match(struct ifnet *ndev, struct mlx5_core_dev *mdev, const char *dname) { @@ -107,7 +107,7 @@ static bool mlx5_netdev_match(struct net_device *ndev, static int mlx5_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { - struct net_device *ndev = netdev_notifier_info_to_dev(ptr); + struct ifnet *ndev = netdev_notifier_info_to_dev(ptr); struct mlx5_ib_dev *ibdev = container_of(this, struct mlx5_ib_dev, roce.nb); @@ -124,7 +124,7 @@ static int mlx5_netdev_event(struct notifier_block *this, case NETDEV_UP: case NETDEV_DOWN: { - struct net_device *upper = NULL; + struct ifnet *upper = NULL; if ((upper == ndev || (!upper && ndev == ibdev->roce.netdev)) && ibdev->ib_active) { @@ -146,18 +146,18 @@ static int mlx5_netdev_event(struct notifier_block *this, return NOTIFY_DONE; } -static struct net_device *mlx5_ib_get_netdev(struct ib_device *device, +static struct ifnet *mlx5_ib_get_netdev(struct ib_device *device, u8 port_num) { struct mlx5_ib_dev *ibdev = to_mdev(device); - struct net_device *ndev; + struct ifnet *ndev; - /* Ensure ndev does not disappear before we invoke dev_hold() + /* Ensure ndev does not disappear before we invoke if_ref() */ read_lock(&ibdev->roce.netdev_lock); ndev = ibdev->roce.netdev; if (ndev) - dev_hold(ndev); + if_ref(ndev); read_unlock(&ibdev->roce.netdev_lock); return ndev; @@ -283,7 +283,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, { struct mlx5_ib_dev *dev = to_mdev(device); u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {}; - struct net_device *ndev; + struct ifnet *ndev; enum ib_mtu ndev_ib_mtu; u16 qkey_viol_cntr; u32 eth_prot_oper; @@ -328,14 +328,15 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, if (!ndev) return 0; - if (netif_running(ndev) && netif_carrier_ok(ndev)) { + if (ndev->if_drv_flags & IFF_DRV_RUNNING && + ndev->if_link_state == LINK_STATE_UP) { props->state = IB_PORT_ACTIVE; props->phys_state = 5; } ndev_ib_mtu = iboe_get_mtu(ndev->if_mtu); - dev_put(ndev); + if_rele(ndev); props->active_mtu = min(props->max_mtu, ndev_ib_mtu); return 0; @@ -437,7 +438,7 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num, if (!attr.ndev) return 0; - dev_put(attr.ndev); + if_rele(attr.ndev); if (attr.gid_type != IB_GID_TYPE_ROCE_UDP_ENCAP) return 0; @@ -459,7 +460,7 @@ int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num, if (!attr.ndev) return -ENODEV; - dev_put(attr.ndev); + if_rele(attr.ndev); *gid_type = attr.gid_type; @@ -3060,7 +3061,7 @@ static void mlx5_remove_roce_notifier(struct mlx5_ib_dev *dev) static int mlx5_enable_roce(struct mlx5_ib_dev *dev) { VNET_ITERATOR_DECL(vnet_iter); - struct net_device *idev; + struct ifnet *idev; int err; /* Check if mlx5en net device already exists */ From owner-dev-commits-src-all@freebsd.org Fri Apr 2 10:15:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC1D75CAB1B; Fri, 2 Apr 2021 10:15:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBbX56Pgtz4gK1; Fri, 2 Apr 2021 10:15:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEA321E484; Fri, 2 Apr 2021 10:15:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132AF1Bf049570; Fri, 2 Apr 2021 10:15:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132AF1Rh049569; Fri, 2 Apr 2021 10:15:01 GMT (envelope-from git) Date: Fri, 2 Apr 2021 10:15:01 GMT Message-Id: <202104021015.132AF1Rh049569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 37c3241a4316 - main - LinuxKPI: treat firmware file names more lenient MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 37c3241a43160dd236bd4767fce46e846cb17227 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 10:15:02 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=37c3241a43160dd236bd4767fce46e846cb17227 commit 37c3241a43160dd236bd4767fce46e846cb17227 Author: Bjoern A. Zeeb AuthorDate: 2021-03-31 15:25:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-04-02 10:03:39 +0000 LinuxKPI: treat firmware file names more lenient A lot of firmware files have a "-" in the name. That "-" is a problem when dealing with shell variables or loader (e.g., auto-loading .ko). It may thus often be convenient to generate firmware kernel object files with s/-/_/g in the name. In order to automatically find them from drivers using LinuxKPI also substitue the '-' for a '_' like we do for '/' and '.' already. Reviewed-by: hselasky, manu (ok) MFC-after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29514 --- sys/compat/linuxkpi/common/src/linux_firmware.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c index 75147a311827..289779c5246c 100644 --- a/sys/compat/linuxkpi/common/src/linux_firmware.c +++ b/sys/compat/linuxkpi/common/src/linux_firmware.c @@ -85,9 +85,10 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware * fwimg = fw_name; fbdfw = firmware_get_flags(fwimg, flags); } - /* (3) Flatten '/' and then '.' to '_' and try with adjusted name. */ + /* (3) Flatten '/', '.' and '-' to '_' and try with adjusted name. */ if (fbdfw == NULL && - (strchr(fw_name, '/') != NULL || strchr(fw_name, '.') != NULL)) { + (strchr(fw_name, '/') != NULL || strchr(fw_name, '.') != NULL || + strchr(fw_name, '-'))) { fwimg = strdup(fw_name, M_LKPI_FW); if (fwimg != NULL) { while ((p = strchr(fwimg, '/')) != NULL) @@ -98,6 +99,11 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware * *p = '_'; fbdfw = firmware_get_flags(fwimg, flags); } + if (fbdfw == NULL) { + while ((p = strchr(fwimg, '-')) != NULL) + *p = '_'; + fbdfw = firmware_get_flags(fwimg, flags); + } free(__DECONST(void *, fwimg), M_LKPI_FW); } } From owner-dev-commits-src-all@freebsd.org Fri Apr 2 10:45:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B99C55CB713; Fri, 2 Apr 2021 10:45:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBcCj4rRsz4jBd; Fri, 2 Apr 2021 10:45:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9914E1EA20; Fri, 2 Apr 2021 10:45:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132Ajrt4091519; Fri, 2 Apr 2021 10:45:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132AjrcK091518; Fri, 2 Apr 2021 10:45:53 GMT (envelope-from git) Date: Fri, 2 Apr 2021 10:45:53 GMT Message-Id: <202104021045.132AjrcK091518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 9bad2638cc18 - main - netmap: restore commit a56e6334d1b7ed6e6faaa8b4612d948005ba74f5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9bad2638cc1882b44adb29a1cb1234f79e5c29f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 10:45:53 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=9bad2638cc1882b44adb29a1cb1234f79e5c29f1 commit 9bad2638cc1882b44adb29a1cb1234f79e5c29f1 Author: Vincenzo Maffione AuthorDate: 2021-04-02 10:43:19 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-02 10:45:47 +0000 netmap: restore commit a56e6334d1b7ed6e6faaa8b4612d948005ba74f5 The fix in a56e6334d1b7ed6e6faaa8b4612d948005ba74f5 was accidentally reverted by commit 45c67e8f6b56b9744f01142747fadf291fe3fad2. --- sys/net/netmap_user.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h index 27f8592eed85..06b159d9bfe7 100644 --- a/sys/net/netmap_user.h +++ b/sys/net/netmap_user.h @@ -995,7 +995,8 @@ nm_close(struct nm_desc *d) static int nm_mmap(struct nm_desc *d, const struct nm_desc *parent) { - //XXX TODO: check if mmap is already done + if (d->done_mmap) + return 0; if (IS_NETMAP_DESC(parent) && parent->mem && parent->req.nr_arg2 == d->req.nr_arg2) { From owner-dev-commits-src-all@freebsd.org Fri Apr 2 12:40:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BEED5CE462; Fri, 2 Apr 2021 12:40:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBfmP2glMz4qBx; Fri, 2 Apr 2021 12:40:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 441B31FDE8; Fri, 2 Apr 2021 12:40:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132Cerbb055354; Fri, 2 Apr 2021 12:40:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132CerGr055353; Fri, 2 Apr 2021 12:40:53 GMT (envelope-from git) Date: Fri, 2 Apr 2021 12:40:53 GMT Message-Id: <202104021240.132CerGr055353@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 76b1b5ce6d81 - main - nullfs: protect against user creating inconsistent state MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76b1b5ce6d81f66b09be8a20aecd064b65fd6b50 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 12:40:53 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=76b1b5ce6d81f66b09be8a20aecd064b65fd6b50 commit 76b1b5ce6d81f66b09be8a20aecd064b65fd6b50 Author: Konstantin Belousov AuthorDate: 2021-04-01 17:42:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-02 12:40:25 +0000 nullfs: protect against user creating inconsistent state The VFS conventions is that VOP_LOOKUP() methods do not need to handle ISDOTDOT lookups for VV_ROOT vnodes (since they cannot, after all). Nullfs bypasses VOP_LOOKUP() to lower filesystem, and there, due to user actions, it is possible to get into situation where - upper vnode does not have VV_ROOT set - lower vnode is root - ISDOTDOT is requested User just needs to nullfs-mount non-root of some filesystem, and then move some directory under mount, out of mount, using lower filesystem. In this case, nullfs cannot do much, but we still should and can ensure internal kernel structures are consistent. Avoid ISDOTDOT lookup forwarding when VV_ROOT is set on lower dvp, return somewhat arbitrary ENOENT. PR: 253593 Reported by: Gregor Koscak Test by: Patrick Sullivan Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/fs/nullfs/null_vnops.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index bc0f5cdb7801..5bf470897c08 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -389,10 +389,21 @@ null_lookup(struct vop_lookup_args *ap) */ ldvp = NULLVPTOLOWERVP(dvp); vp = lvp = NULL; - KASSERT((ldvp->v_vflag & VV_ROOT) == 0 || - ((dvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) == 0), - ("ldvp %p fl %#x dvp %p fl %#x flags %#x", ldvp, ldvp->v_vflag, - dvp, dvp->v_vflag, flags)); + + /* + * Renames in the lower mounts might create an inconsistent + * configuration where lower vnode is moved out of the + * directory tree remounted by our null mount. Do not try to + * handle it fancy, just avoid VOP_LOOKUP() with DOTDOT name + * which cannot be handled by VOP, at least passing over lower + * root. + */ + if ((ldvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) != 0) { + KASSERT((dvp->v_vflag & VV_ROOT) == 0, + ("ldvp %p fl %#x dvp %p fl %#x flags %#x", + ldvp, ldvp->v_vflag, dvp, dvp->v_vflag, flags)); + return (ENOENT); + } /* * Hold ldvp. The reference on it, owned by dvp, is lost in From owner-dev-commits-src-all@freebsd.org Fri Apr 2 12:49:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC7E75CE67D; Fri, 2 Apr 2021 12:49:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBfyk5vvDz4qhd; Fri, 2 Apr 2021 12:49:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8F93201B0; Fri, 2 Apr 2021 12:49:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132CnoR2061380; Fri, 2 Apr 2021 12:49:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132CnoXQ061379; Fri, 2 Apr 2021 12:49:50 GMT (envelope-from git) Date: Fri, 2 Apr 2021 12:49:50 GMT Message-Id: <202104021249.132CnoXQ061379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: aa3ea612be36 - main - x86: remove gcov kernel support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa3ea612be3659881392251e91912682b038ce78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 12:49:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=aa3ea612be3659881392251e91912682b038ce78 commit aa3ea612be3659881392251e91912682b038ce78 Author: Konstantin Belousov AuthorDate: 2021-03-31 21:04:55 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-02 12:41:51 +0000 x86: remove gcov kernel support Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D29529 --- sys/amd64/amd64/apic_vector.S | 14 -- sys/amd64/amd64/atpic_vector.S | 2 - sys/amd64/amd64/exception.S | 25 +- sys/amd64/amd64/locore.S | 10 +- sys/amd64/amd64/prof_machdep.c | 323 ------------------------ sys/amd64/amd64/sigtramp.S | 2 +- sys/amd64/amd64/support.S | 1 - sys/amd64/amd64/xen-locore.S | 6 +- sys/amd64/conf/NOTES | 4 - sys/amd64/ia32/ia32_exception.S | 2 - sys/amd64/include/asmacros.h | 82 +----- sys/amd64/include/profile.h | 81 +----- sys/amd64/linux/linux_locore.asm | 10 +- sys/amd64/linux32/linux32_locore.asm | 6 +- sys/cddl/dev/dtrace/amd64/dtrace_asm.S | 3 +- sys/conf/Makefile.arm | 2 +- sys/conf/files | 27 +- sys/conf/files.amd64 | 1 - sys/conf/files.arm | 2 +- sys/conf/files.arm64 | 18 +- sys/conf/files.i386 | 1 - sys/conf/files.x86 | 10 +- sys/conf/kern.post.mk | 3 - sys/conf/kern.pre.mk | 42 +--- sys/conf/options.i386 | 1 - sys/dev/hyperv/vmbus/amd64/vmbus_vector.S | 2 - sys/dev/hyperv/vmbus/i386/vmbus_vector.S | 2 - sys/i386/conf/NOTES | 5 - sys/i386/i386/apic_vector.s | 14 -- sys/i386/i386/atpic_vector.s | 2 - sys/i386/i386/exception.s | 30 +-- sys/i386/i386/locore.s | 4 +- sys/i386/i386/mpboot.s | 4 +- sys/i386/i386/prof_machdep.c | 404 ------------------------------ sys/i386/i386/sigtramp.s | 2 +- sys/i386/i386/support.s | 2 - sys/i386/i386/vm86bios.s | 1 - sys/i386/include/asmacros.h | 82 +----- sys/i386/include/profile.h | 94 +------ sys/i386/linux/linux_locore.asm | 6 +- sys/kern/subr_prof.c | 345 ------------------------- sys/libkern/mcount.c | 316 ----------------------- 42 files changed, 79 insertions(+), 1914 deletions(-) diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S index 4de39283f92f..21696a93fc5f 100644 --- a/sys/amd64/amd64/apic_vector.S +++ b/sys/amd64/amd64/apic_vector.S @@ -81,7 +81,6 @@ as_lapic_eoi: */ .macro ISR_VEC index, vec_name INTR_HANDLER \vec_name - FAKE_MCOUNT(TF_RIP(%rsp)) cmpl $0,x2apic_mode je 1f movl $(MSR_APIC_ISR0 + \index),%ecx @@ -98,7 +97,6 @@ as_lapic_eoi: movl %eax, %edi /* pass the IRQ */ call lapic_handle_intr 3: - MEXITCOUNT jmp doreti .endm @@ -127,28 +125,22 @@ IDTVEC(spuriousint) * Local APIC periodic timer handler. */ INTR_HANDLER timerint - FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rdi call lapic_handle_timer - MEXITCOUNT jmp doreti /* * Local APIC CMCI handler. */ INTR_HANDLER cmcint - FAKE_MCOUNT(TF_RIP(%rsp)) call lapic_handle_cmc - MEXITCOUNT jmp doreti /* * Local APIC error interrupt handler. */ INTR_HANDLER errorint - FAKE_MCOUNT(TF_RIP(%rsp)) call lapic_handle_error - MEXITCOUNT jmp doreti #ifdef XENHVM @@ -157,10 +149,8 @@ IDTVEC(spuriousint) * Only used when the hypervisor supports direct vector callbacks. */ INTR_HANDLER xen_intr_upcall - FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rdi call xen_intr_handle_upcall - MEXITCOUNT jmp doreti #endif @@ -184,9 +174,7 @@ IDTVEC(spuriousint) */ INTR_HANDLER ipi_intr_bitmap_handler call as_lapic_eoi - FAKE_MCOUNT(TF_RIP(%rsp)) call ipi_bitmap_handler - MEXITCOUNT jmp doreti /* @@ -210,9 +198,7 @@ IDTVEC(spuriousint) */ INTR_HANDLER ipi_swi call as_lapic_eoi - FAKE_MCOUNT(TF_RIP(%rsp)) call ipi_swi_handler - MEXITCOUNT jmp doreti /* diff --git a/sys/amd64/amd64/atpic_vector.S b/sys/amd64/amd64/atpic_vector.S index d82ffd30e1c9..d76331a887ad 100644 --- a/sys/amd64/amd64/atpic_vector.S +++ b/sys/amd64/amd64/atpic_vector.S @@ -44,11 +44,9 @@ */ .macro INTR irq_num, vec_name INTR_HANDLER \vec_name - FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rsi movl $\irq_num, %edi /* pass the IRQ */ call atpic_handle_intr - MEXITCOUNT jmp doreti .endm diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S index 3fb518179406..4716ca8cd7c2 100644 --- a/sys/amd64/amd64/exception.S +++ b/sys/amd64/amd64/exception.S @@ -101,9 +101,6 @@ dtrace_invop_calltrap_addr: * registers are reloaded on return to the usermode. */ -MCOUNT_LABEL(user) -MCOUNT_LABEL(btrap) - /* Traps that we leave interrupts disabled for. */ .macro TRAP_NOEN l, trapno PTI_ENTRY \l,\l\()_pti_k,\l\()_pti_u @@ -257,7 +254,6 @@ alltraps_pushregs_no_rax: pushfq andq $~(PSL_D | PSL_AC),(%rsp) popfq - FAKE_MCOUNT(TF_RIP(%rsp)) #ifdef KDTRACE_HOOKS /* * DTrace Function Boundary Trace (fbt) probes are triggered @@ -288,7 +284,6 @@ alltraps_pushregs_no_rax: calltrap: movq %rsp,%rdi call trap_check - MEXITCOUNT jmp doreti /* Handle any pending ASTs */ /* @@ -576,7 +571,6 @@ fast_syscall_common: movq %r14,TF_R14(%rsp) /* C preserved */ movq %r15,TF_R15(%rsp) /* C preserved */ movl $TF_HASSEGS,TF_FLAGS(%rsp) - FAKE_MCOUNT(TF_RIP(%rsp)) movq PCPU(CURTHREAD),%rdi movq %rsp,TD_FRAME(%rdi) movl TF_RFLAGS(%rsp),%esi @@ -594,7 +588,6 @@ fast_syscall_common: call handle_ibrs_exit callq *mds_handler /* Restore preserved registers. */ - MEXITCOUNT movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ movq TF_RSI(%rsp),%rsi /* bonus: preserve arg 2 */ movq TF_RDX(%rsp),%rdx /* return value 2 */ @@ -621,7 +614,6 @@ fast_syscall_common: jmp 1b 4: /* Requested full context restore, use doreti for that. */ - MEXITCOUNT jmp doreti /* @@ -692,10 +684,8 @@ IDTVEC(dbg) rdmsr movl %eax,%r14d call handle_ibrs_entry -2: FAKE_MCOUNT(TF_RIP(%rsp)) - movq %rsp,%rdi +2: movq %rsp,%rdi call trap - MEXITCOUNT testl $CPUID_STDEXT3_IBPB,cpu_stdext_feature3(%rip) je 3f movl %r14d,%eax @@ -866,10 +856,8 @@ nmi_fromuserspace: 3: /* Note: this label is also used by ddb and gdb: */ nmi_calltrap: - FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp,%rdi call trap - MEXITCOUNT #ifdef HWPMC_HOOKS /* * Capture a userspace callchain if needed. @@ -1055,10 +1043,8 @@ mchk_fromuserspace: 1: call handle_ibrs_entry /* Note: this label is also used by ddb and gdb: */ mchk_calltrap: - FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp,%rdi call mca_intr - MEXITCOUNT testl %ebx,%ebx /* %ebx != 0 => return to userland */ jnz doreti_exit /* @@ -1089,7 +1075,6 @@ ENTRY(fork_trampoline) movq %rbx,%rsi /* arg1 */ movq %rsp,%rdx /* trapframe pointer */ call fork_exit - MEXITCOUNT jmp doreti /* Handle any ASTs */ /* @@ -1115,8 +1100,6 @@ ENTRY(fork_trampoline) .p2align 4 .text SUPERALIGN_TEXT -MCOUNT_LABEL(bintr) - #include #ifdef DEV_ATPIC @@ -1128,9 +1111,6 @@ MCOUNT_LABEL(bintr) #include #endif - .text -MCOUNT_LABEL(eintr) - /* * void doreti(struct trapframe) * @@ -1141,7 +1121,6 @@ MCOUNT_LABEL(eintr) .type doreti,@function .globl doreti doreti: - FAKE_MCOUNT($bintr) /* init "from" bintr -> doreti */ /* * Check if ASTs can be handled now. */ @@ -1171,7 +1150,6 @@ doreti_ast: * registers. The fault is handled in trap.c. */ doreti_exit: - MEXITCOUNT movq PCPU(CURPCB),%r8 /* @@ -1332,7 +1310,6 @@ doreti_iret_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) movq $0,TF_ERR(%rsp) /* XXX should be the error code */ movq $0,TF_ADDR(%rsp) - FAKE_MCOUNT(TF_RIP(%rsp)) jmp calltrap ALIGN_TEXT diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 3addc3fb10cd..4f6283b88bd2 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -54,7 +54,7 @@ * * We are already in long mode, on a 64 bit %cs and running at KERNBASE. */ -NON_GPROF_ENTRY(btext) +ENTRY(btext) /* Tell the bios to warmboot next time */ movw $0x1234,0x472 @@ -79,7 +79,7 @@ NON_GPROF_ENTRY(btext) jmp 0b /* la57_trampoline(%rdi pml5) */ -NON_GPROF_ENTRY(la57_trampoline) +ENTRY(la57_trampoline) movq %rsp,%r11 movq %rbx,%r10 leaq la57_trampoline_end(%rip),%rsp @@ -118,11 +118,11 @@ l2: movq %r11,%rsp movq %r10,%rbx retq .p2align 4,0 -NON_GPROF_ENTRY(la57_trampoline_gdt_desc) +ENTRY(la57_trampoline_gdt_desc) .word la57_trampoline_end - la57_trampoline_gdt .long 0 /* filled by pmap_bootstrap_la57 */ .p2align 4,0 -NON_GPROF_ENTRY(la57_trampoline_gdt) +ENTRY(la57_trampoline_gdt) .long 0x00000000 /* null desc */ .long 0x00000000 .long 0x00000000 /* 64bit code */ @@ -132,7 +132,7 @@ NON_GPROF_ENTRY(la57_trampoline_gdt) .long 0x0000ffff /* universal data */ .long 0x00cf9300 .dcb.l 16,0 -NON_GPROF_ENTRY(la57_trampoline_end) +ENTRY(la57_trampoline_end) .bss ALIGN_DATA /* just to be sure */ diff --git a/sys/amd64/amd64/prof_machdep.c b/sys/amd64/amd64/prof_machdep.c deleted file mode 100644 index 72b18faef028..000000000000 --- a/sys/amd64/amd64/prof_machdep.c +++ /dev/null @@ -1,323 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1996 Bruce D. Evans. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#ifdef GUPROF - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define CPUTIME_CLOCK_UNINITIALIZED 0 -#define CPUTIME_CLOCK_I8254 1 -#define CPUTIME_CLOCK_TSC 2 -#define CPUTIME_CLOCK_I8254_SHIFT 7 - -int cputime_bias = 1; /* initialize for locality of reference */ - -static int cputime_clock = CPUTIME_CLOCK_UNINITIALIZED; -static int cputime_prof_active; -#endif /* GUPROF */ - -#ifdef __GNUCLIKE_ASM -#if defined(SMP) && defined(GUPROF) -#define MPLOCK " \n\ - movl $1,%edx \n\ -9: \n\ - xorl %eax,%eax \n\ - lock \n\ - cmpxchgl %edx,mcount_lock \n\ - jne 9b \n" -#define MPUNLOCK "movl $0,mcount_lock \n" -#else /* !(SMP && GUPROF) */ -#define MPLOCK -#define MPUNLOCK -#endif /* SMP && GUPROF */ - -__asm(" \n\ -GM_STATE = 0 \n\ -GMON_PROF_OFF = 3 \n\ - \n\ - .text \n\ - .p2align 4,0x90 \n\ - .globl __mcount \n\ - .type __mcount,@function \n\ -__mcount: \n\ - # \n\ - # Check that we are profiling. Do it early for speed. \n\ - # \n\ - cmpl $GMON_PROF_OFF,_gmonparam+GM_STATE \n\ - je .mcount_exit \n\ - # \n\ - # __mcount is the same as [.]mcount except the caller \n\ - # hasn't changed the stack except to call here, so the \n\ - # caller's raddr is above our raddr. \n\ - # \n\ - pushq %rax \n\ - pushq %rdx \n\ - pushq %rcx \n\ - pushq %rsi \n\ - pushq %rdi \n\ - pushq %r8 \n\ - pushq %r9 \n\ - movq 7*8+8(%rsp),%rdi \n\ - jmp .got_frompc \n\ - \n\ - .p2align 4,0x90 \n\ - .globl .mcount \n\ -.mcount: \n\ - cmpl $GMON_PROF_OFF,_gmonparam+GM_STATE \n\ - je .mcount_exit \n\ - # \n\ - # The caller's stack frame has already been built, so \n\ - # %rbp is the caller's frame pointer. The caller's \n\ - # raddr is in the caller's frame following the caller's \n\ - # caller's frame pointer. \n\ - # \n\ - pushq %rax \n\ - pushq %rdx \n\ - pushq %rcx \n\ - pushq %rsi \n\ - pushq %rdi \n\ - pushq %r8 \n\ - pushq %r9 \n\ - movq 8(%rbp),%rdi \n\ -.got_frompc: \n\ - # \n\ - # Our raddr is the caller's pc. \n\ - # \n\ - movq 7*8(%rsp),%rsi \n\ - \n\ - pushfq \n\ - cli \n" - MPLOCK " \n\ - call mcount \n" - MPUNLOCK " \n\ - popfq \n\ - popq %r9 \n\ - popq %r8 \n\ - popq %rdi \n\ - popq %rsi \n\ - popq %rcx \n\ - popq %rdx \n\ - popq %rax \n\ -.mcount_exit: \n\ - ret $0 \n\ -"); -#else /* !__GNUCLIKE_ASM */ -#error "this file needs to be ported to your compiler" -#endif /* __GNUCLIKE_ASM */ - -#ifdef GUPROF -/* - * [.]mexitcount saves the return register(s), loads selfpc and calls - * mexitcount(selfpc) to do the work. Someday it should be in a machine - * dependent file together with cputime(), __mcount and [.]mcount. cputime() - * can't just be put in machdep.c because it has to be compiled without -pg. - */ -#ifdef __GNUCLIKE_ASM -__asm(" \n\ - .text \n\ -# \n\ -# Dummy label to be seen when gprof -u hides [.]mexitcount. \n\ -# \n\ - .p2align 4,0x90 \n\ - .globl __mexitcount \n\ - .type __mexitcount,@function \n\ -__mexitcount: \n\ - nop \n\ - \n\ -GMON_PROF_HIRES = 4 \n\ - \n\ - .p2align 4,0x90 \n\ - .globl .mexitcount \n\ -.mexitcount: \n\ - cmpl $GMON_PROF_HIRES,_gmonparam+GM_STATE \n\ - jne .mexitcount_exit \n\ - pushq %rax \n\ - pushq %rdx \n\ - pushq %rcx \n\ - pushq %rsi \n\ - pushq %rdi \n\ - pushq %r8 \n\ - pushq %r9 \n\ - movq 7*8(%rsp),%rdi \n\ - pushfq \n\ - cli \n" - MPLOCK " \n\ - call mexitcount \n" - MPUNLOCK " \n\ - popfq \n\ - popq %r9 \n\ - popq %r8 \n\ - popq %rdi \n\ - popq %rsi \n\ - popq %rcx \n\ - popq %rdx \n\ - popq %rax \n\ -.mexitcount_exit: \n\ - ret $0 \n\ -"); -#endif /* __GNUCLIKE_ASM */ - -/* - * Return the time elapsed since the last call. The units are machine- - * dependent. - */ -int -cputime() -{ - u_int count; - int delta; - u_char high, low; - static u_int prev_count; - - if (cputime_clock == CPUTIME_CLOCK_TSC) { - /* - * Scale the TSC a little to make cputime()'s frequency - * fit in an int, assuming that the TSC frequency fits - * in a u_int. Use a fixed scale since dynamic scaling - * would be slower and we can't really use the low bit - * of precision. - */ - count = (u_int)rdtsc() & ~1u; - delta = (int)(count - prev_count) >> 1; - prev_count = count; - return (delta); - } - - /* - * Read the current value of the 8254 timer counter 0. - */ - outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); - low = inb(TIMER_CNTR0); - high = inb(TIMER_CNTR0); - count = ((high << 8) | low) << CPUTIME_CLOCK_I8254_SHIFT; - - /* - * The timer counts down from TIMER_CNTR0_MAX to 0 and then resets. - * While profiling is enabled, this routine is called at least twice - * per timer reset (for mcounting and mexitcounting hardclock()), - * so at most one reset has occurred since the last call, and one - * has occurred iff the current count is larger than the previous - * count. This allows counter underflow to be detected faster - * than in microtime(). - */ - delta = prev_count - count; - prev_count = count; - if ((int) delta <= 0) - return (delta + (i8254_max_count << CPUTIME_CLOCK_I8254_SHIFT)); - return (delta); -} - -static int -sysctl_machdep_cputime_clock(SYSCTL_HANDLER_ARGS) -{ - int clock; - int error; - - clock = cputime_clock; - error = sysctl_handle_opaque(oidp, &clock, sizeof clock, req); - if (error == 0 && req->newptr != NULL) { - if (clock < 0 || clock > CPUTIME_CLOCK_TSC) - return (EINVAL); - cputime_clock = clock; - } - return (error); -} - -SYSCTL_PROC(_machdep, OID_AUTO, cputime_clock, - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 0, sizeof(u_int), - sysctl_machdep_cputime_clock, "I", - ""); - -/* - * The start and stop routines need not be here since we turn off profiling - * before calling them. They are here for convenience. - */ - -void -startguprof(gp) - struct gmonparam *gp; -{ - uint64_t freq; - - freq = atomic_load_acq_64(&tsc_freq); - if (cputime_clock == CPUTIME_CLOCK_UNINITIALIZED) { - if (freq != 0 && mp_ncpus == 1) - cputime_clock = CPUTIME_CLOCK_TSC; - else - cputime_clock = CPUTIME_CLOCK_I8254; - } - if (cputime_clock == CPUTIME_CLOCK_TSC) { - gp->profrate = freq >> 1; - cputime_prof_active = 1; - } else - gp->profrate = i8254_freq << CPUTIME_CLOCK_I8254_SHIFT; - cputime_bias = 0; - cputime(); -} - -void -stopguprof(gp) - struct gmonparam *gp; -{ - if (cputime_clock == CPUTIME_CLOCK_TSC) - cputime_prof_active = 0; -} - -/* If the cpu frequency changed while profiling, report a warning. */ -static void -tsc_freq_changed(void *arg, const struct cf_level *level, int status) -{ - - /* - * If there was an error during the transition or - * TSC is P-state invariant, don't do anything. - */ - if (status != 0 || tsc_is_invariant) - return; - if (cputime_prof_active && cputime_clock == CPUTIME_CLOCK_TSC) - printf("warning: cpu freq changed while profiling active\n"); -} - -EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL, - EVENTHANDLER_PRI_ANY); - -#endif /* GUPROF */ diff --git a/sys/amd64/amd64/sigtramp.S b/sys/amd64/amd64/sigtramp.S index a249a1a646f2..9983edf229a3 100644 --- a/sys/amd64/amd64/sigtramp.S +++ b/sys/amd64/amd64/sigtramp.S @@ -38,7 +38,7 @@ * Signal trampoline, copied to top of user stack * */ -NON_GPROF_ENTRY(sigcode) +ENTRY(sigcode) call *SIGF_HANDLER(%rsp) /* call signal handler */ lea SIGF_UC(%rsp),%rdi /* get ucontext_t */ pushq $0 /* junk to fake return addr. */ diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 4c0f7da87ef8..0db6f2f04099 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -1490,7 +1490,6 @@ ENTRY(lgdt) popq %rax pushq $KCSEL pushq %rax - MEXITCOUNT lretq END(lgdt) diff --git a/sys/amd64/amd64/xen-locore.S b/sys/amd64/amd64/xen-locore.S index 7c7707a3864e..97d81711a051 100644 --- a/sys/amd64/amd64/xen-locore.S +++ b/sys/amd64/amd64/xen-locore.S @@ -69,11 +69,11 @@ .text .p2align PAGE_SHIFT, 0x90 /* Hypercall_page needs to be PAGE aligned */ -NON_GPROF_ENTRY(hypercall_page) +ENTRY(hypercall_page) .skip 0x1000, 0x90 /* Fill with "nop"s */ /* Legacy PVH entry point, to be removed. */ -NON_GPROF_ENTRY(xen_start) +ENTRY(xen_start) /* Don't trust what the loader gives for rflags. */ pushq $PSL_KERNEL popfq @@ -97,7 +97,7 @@ NON_GPROF_ENTRY(xen_start) /* PVH entry point. */ .code32 -NON_GPROF_ENTRY(xen_start32) +ENTRY(xen_start32) /* Load flat GDT */ movl $VTOP(gdtdesc32), %eax diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index 60d171721cf1..5627ce5377d3 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -7,10 +7,6 @@ # $FreeBSD$ # -# -# We want LINT to cover profiling as well. -profile 2 - # # Enable the kernel DTrace hooks which are required to load the DTrace # kernel modules. diff --git a/sys/amd64/ia32/ia32_exception.S b/sys/amd64/ia32/ia32_exception.S index c7bfb02f0281..a1c40ced168f 100644 --- a/sys/amd64/ia32/ia32_exception.S +++ b/sys/amd64/ia32/ia32_exception.S @@ -73,8 +73,6 @@ int0x80_syscall_common: pushfq andq $~(PSL_D | PSL_AC),(%rsp) popfq - FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rdi call ia32_syscall - MEXITCOUNT jmp doreti diff --git a/sys/amd64/include/asmacros.h b/sys/amd64/include/asmacros.h index b8541bed310c..438f4ec26f61 100644 --- a/sys/amd64/include/asmacros.h +++ b/sys/amd64/include/asmacros.h @@ -55,92 +55,14 @@ #define CNAME(csym) csym #define ALIGN_DATA .p2align 3 /* 8 byte alignment, zero filled */ -#ifdef GPROF #define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ -#else -#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ -#endif #define SUPERALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ #define GEN_ENTRY(name) ALIGN_TEXT; .globl CNAME(name); \ .type CNAME(name),@function; CNAME(name): -#define NON_GPROF_ENTRY(name) GEN_ENTRY(name) -#define NON_GPROF_RET .byte 0xc3 /* opcode for `ret' */ - -#define END(name) .size name, . - name - -#ifdef GPROF -/* - * __mcount is like [.]mcount except that doesn't require its caller to set - * up a frame pointer. It must be called before pushing anything onto the - * stack. gcc should eventually generate code to call __mcount in most - * cases. This would make -pg in combination with -fomit-frame-pointer - * useful. gcc has a configuration variable PROFILE_BEFORE_PROLOGUE to - * allow profiling before setting up the frame pointer, but this is - * inadequate for good handling of special cases, e.g., -fpic works best - * with profiling after the prologue. - * - * [.]mexitcount is a new function to support non-statistical profiling if an - * accurate clock is available. For C sources, calls to it are generated - * by the FreeBSD extension `-mprofiler-epilogue' to gcc. It is best to - * call [.]mexitcount at the end of a function like the MEXITCOUNT macro does, - * but gcc currently generates calls to it at the start of the epilogue to - * avoid problems with -fpic. - * - * [.]mcount and __mcount may clobber the call-used registers and %ef. - * [.]mexitcount may clobber %ecx and %ef. - * - * Cross-jumping makes non-statistical profiling timing more complicated. - * It is handled in many cases by calling [.]mexitcount before jumping. It - * is handled for conditional jumps using CROSSJUMP() and CROSSJUMP_LABEL(). - * It is handled for some fault-handling jumps by not sharing the exit - * routine. - * - * ALTENTRY() must be before a corresponding ENTRY() so that it can jump to - * the main entry point. Note that alt entries are counted twice. They - * have to be counted as ordinary entries for gprof to get the call times - * right for the ordinary entries. - * - * High local labels are used in macros to avoid clashes with local labels - * in functions. - * - * Ordinary `ret' is used instead of a macro `RET' because there are a lot - * of `ret's. 0xc3 is the opcode for `ret' (`#define ret ... ret' can't - * be used because this file is sometimes preprocessed in traditional mode). - * `ret' clobbers eflags but this doesn't matter. - */ -#define ALTENTRY(name) GEN_ENTRY(name) ; MCOUNT ; MEXITCOUNT ; jmp 9f -#define CROSSJUMP(jtrue, label, jfalse) \ - jfalse 8f; MEXITCOUNT; jmp __CONCAT(to,label); 8: -#define CROSSJUMPTARGET(label) \ - ALIGN_TEXT; __CONCAT(to,label): ; MCOUNT; jmp label -#define ENTRY(name) GEN_ENTRY(name) ; 9: ; MCOUNT -#define FAKE_MCOUNT(caller) pushq caller ; call __mcount ; popq %rcx -#define MCOUNT call __mcount -#define MCOUNT_LABEL(name) GEN_ENTRY(name) ; nop ; ALIGN_TEXT -#ifdef GUPROF -#define MEXITCOUNT call .mexitcount -#define ret MEXITCOUNT ; NON_GPROF_RET -#else -#define MEXITCOUNT -#endif - -#else /* !GPROF */ -/* - * ALTENTRY() has to align because it is before a corresponding ENTRY(). - * ENTRY() has to align to because there may be no ALTENTRY() before it. - * If there is a previous ALTENTRY() then the alignment code for ENTRY() - * is empty. - */ -#define ALTENTRY(name) GEN_ENTRY(name) -#define CROSSJUMP(jtrue, label, jfalse) jtrue label -#define CROSSJUMPTARGET(label) #define ENTRY(name) GEN_ENTRY(name) -#define FAKE_MCOUNT(caller) -#define MCOUNT -#define MCOUNT_LABEL(name) -#define MEXITCOUNT -#endif /* GPROF */ +#define ALTENTRY(name) GEN_ENTRY(name) +#define END(name) .size name, . - name /* * Convenience for adding frame pointers to hand-coded ASM. Useful for diff --git a/sys/amd64/include/profile.h b/sys/amd64/include/profile.h index 2e19918cfb76..b0fb469f5354 100644 --- a/sys/amd64/include/profile.h +++ b/sys/amd64/include/profile.h @@ -35,74 +35,9 @@ #ifndef _MACHINE_PROFILE_H_ #define _MACHINE_PROFILE_H_ -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -#ifdef _KERNEL - -/* - * Config generates something to tell the compiler to align functions on 16 - * byte boundaries. A strict alignment is good for keeping the tables small. - */ -#define FUNCTION_ALIGNMENT 16 - -/* - * The kernel uses assembler stubs instead of unportable inlines. - * This is mainly to save a little time when profiling is not enabled, - * which is the usual case for the kernel. - */ -#define _MCOUNT_DECL void mcount -#define MCOUNT - -#ifdef GUPROF -#define MCOUNT_DECL(s) -#define MCOUNT_ENTER(s) -#define MCOUNT_EXIT(s) -#ifdef __GNUCLIKE_ASM -#define MCOUNT_OVERHEAD(label) \ - __asm __volatile("pushq %0; call __mcount; popq %%rcx" \ - : \ - : "i" (label) \ - : "cx", "r10", "r11", "memory") -#define MEXITCOUNT_OVERHEAD() \ - __asm __volatile("call .mexitcount; 1:" \ - : : \ - : "r10", "r11", "memory") -#define MEXITCOUNT_OVERHEAD_GETLABEL(labelp) \ - __asm __volatile("movq $1b,%0" : "=rm" (labelp)) -#else -#error this file needs to be ported to your compiler -#endif /* !__GNUCLIKE_ASM */ -#else /* !GUPROF */ -#define MCOUNT_DECL(s) register_t s; -#ifdef SMP -extern int mcount_lock; -#define MCOUNT_ENTER(s) { s = intr_disable(); \ - while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1)) \ - /* nothing */ ; } -#define MCOUNT_EXIT(s) { atomic_store_rel_int(&mcount_lock, 0); \ - intr_restore(s); } -#else -#define MCOUNT_ENTER(s) { s = intr_disable(); } -#define MCOUNT_EXIT(s) (intr_restore(s)) -#endif -#endif /* GUPROF */ - -void bintr(void); -void btrap(void); -void eintr(void); -void user(void); - -#define MCOUNT_FROMPC_USER(pc) \ - ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc) +#ifndef _KERNEL -#define MCOUNT_FROMPC_INTR(pc) \ - ((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ? \ - ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr : \ - (uintfptr_t)btrap) : ~0UL) - -#else /* !_KERNEL */ +#include #define FUNCTION_ALIGNMENT 4 @@ -172,28 +107,18 @@ mcount() \ typedef u_long uintfptr_t; -#endif /* _KERNEL */ - /* * An unsigned integral type that can hold non-negative difference between * function pointers. */ typedef u_long fptrdiff_t; -#ifdef _KERNEL - -void mcount(uintfptr_t frompc, uintfptr_t selfpc); - -#else /* !_KERNEL */ - -#include - __BEGIN_DECLS #ifdef __GNUCLIKE_ASM void mcount(void) __asm(".mcount"); #endif __END_DECLS -#endif /* _KERNEL */ +#endif /* !_KERNEL */ #endif /* !_MACHINE_PROFILE_H_ */ diff --git a/sys/amd64/linux/linux_locore.asm b/sys/amd64/linux/linux_locore.asm index 1bcf05bc57dd..4e358f583a45 100644 --- a/sys/amd64/linux/linux_locore.asm +++ b/sys/amd64/linux/linux_locore.asm @@ -17,7 +17,7 @@ linux_platform: * To avoid excess stack frame the signal trampoline code emulates * the 'call' instruction. */ -NON_GPROF_ENTRY(linux_rt_sigcode) +ENTRY(linux_rt_sigcode) movq %rsp, %rbx /* preserve sigframe */ call .getip .getip: @@ -32,28 +32,28 @@ NON_GPROF_ENTRY(linux_rt_sigcode) .endrtsigcode: 0: jmp 0b -NON_GPROF_ENTRY(__vdso_clock_gettime) +ENTRY(__vdso_clock_gettime) movq $LINUX_SYS_linux_clock_gettime,%rax syscall ret .weak clock_gettime .set clock_gettime, __vdso_clock_gettime -NON_GPROF_ENTRY(__vdso_time) +ENTRY(__vdso_time) movq $LINUX_SYS_linux_time,%rax *** 2138 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Apr 2 12:49:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEFCB5CEBD8; Fri, 2 Apr 2021 12:49:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBfyl6QLzz4qbB; Fri, 2 Apr 2021 12:49:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4B9F1FF7C; Fri, 2 Apr 2021 12:49:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132CnpU0061402; Fri, 2 Apr 2021 12:49:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132CnpdH061401; Fri, 2 Apr 2021 12:49:51 GMT (envelope-from git) Date: Fri, 2 Apr 2021 12:49:51 GMT Message-Id: <202104021249.132CnpdH061401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 69efe3695d75 - main - config(8): remove support for -p MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69efe3695d75d716e6066a0b1225df00ec98952b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 12:49:52 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=69efe3695d75d716e6066a0b1225df00ec98952b commit 69efe3695d75d716e6066a0b1225df00ec98952b Author: Konstantin Belousov AuthorDate: 2021-04-01 01:16:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-02 12:41:51 +0000 config(8): remove support for -p and other equivalent ways to request mcount-based profiling, like 'profile N' in kernel config. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D29529 --- usr.sbin/config/config.5 | 14 -------------- usr.sbin/config/config.8 | 10 ---------- usr.sbin/config/config.h | 2 -- usr.sbin/config/config.y | 2 -- usr.sbin/config/lang.l | 1 - usr.sbin/config/main.c | 4 ---- usr.sbin/config/mkmakefile.c | 15 +-------------- 7 files changed, 1 insertion(+), 47 deletions(-) diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5 index 9b26326ea862..dd3ee8baffee 100644 --- a/usr.sbin/config/config.5 +++ b/usr.sbin/config/config.5 @@ -401,20 +401,6 @@ Options specific to architecture .Ar arch are specified in the file .Pa sys/conf/options . Ns Aq Ar arch . -.\" -------- PROFILE -------- -.Pp -.It Ic profile Ar number -Enables kernel profiling if -.Ar number -is non-zero. -If -.Ar number -is 2 or greater, the kernel is configured for -high-resolution profiling. -Kernels can also be built for profiling using the -.Fl p -option to -.Xr config 8 . .El .Ss Obsolete Directives The following kernel configuration directives are obsolete. diff --git a/usr.sbin/config/config.8 b/usr.sbin/config/config.8 index c8c92b5eddab..b33c972c8efa 100644 --- a/usr.sbin/config/config.8 +++ b/usr.sbin/config/config.8 @@ -102,16 +102,6 @@ file. This option makes sense only if .Cd "options INCLUDE_CONFIG_FILE" entry was present in your configuration file. -.It Fl p -Configure a system for profiling; for example, -.Xr kgmon 8 -and -.Xr gprof 1 . -If two or more -.Fl p -options are supplied, -.Nm -configures a system for high resolution profiling. .It Ar SYSTEM_NAME Specify the name of the system configuration file containing device specifications, configuration options diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index a1591486b390..79d0a788bae7 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -69,7 +69,6 @@ struct files_name { * Types. */ #define NORMAL 1 -#define PROFILING 3 #define NODEPEND 4 #define LOCAL 5 #define DEVDONE 0x80000000 @@ -210,7 +209,6 @@ extern STAILQ_HEAD(file_list_head, file_list) ftab; extern STAILQ_HEAD(files_name_head, files_name) fntab; -extern int profiling; extern int debugging; extern int found_defaults; diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index 6fcd93aa19f9..3d517c2b789e 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -18,7 +18,6 @@ %token HINTS %token IDENT %token MAXUSERS -%token PROFILE %token OPTIONS %token NOOPTION %token MAKEOPTIONS @@ -192,7 +191,6 @@ Config_spec: System_spec | MAXUSERS NUMBER { maxusers = $2; } | - PROFILE NUMBER { profiling = $2; } | ENV ID { newenvvar($2, true); } | ENVVAR ENVLINE { newenvvar($2, false); } | HINTS ID { diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l index 308c38393916..f83af3b5d9cc 100644 --- a/usr.sbin/config/lang.l +++ b/usr.sbin/config/lang.l @@ -79,7 +79,6 @@ struct kt { { "nomakeoption", NOMAKEOPTION }, { "nomakeoptions", NOMAKEOPTION }, { "maxusers", MAXUSERS }, - { "profile", PROFILE }, { "option", OPTIONS }, { "options", OPTIONS }, { "nooption", NOOPTION }, diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index e52db432bf65..60bafb0b46ba 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -88,7 +88,6 @@ char destdir[MAXPATHLEN]; char srcdir[MAXPATHLEN]; int debugging; -int profiling; int found_defaults; int incignore; @@ -170,9 +169,6 @@ main(int argc, char **argv) case 'm': printmachine = 1; break; - case 'p': - profiling++; - break; case 's': if (*srcdir == '\0') strlcpy(srcdir, optarg, sizeof(srcdir)); diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 0a1f2f129aab..00eb3422d1d0 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -155,8 +155,6 @@ makefile(void) } if (debugging) fprintf(ofp, "DEBUG=-g\n"); - if (profiling) - fprintf(ofp, "PROFLEVEL=%d\n", profiling); if (*srcdir != '\0') fprintf(ofp,"S=%s\n", srcdir); while (fgets(line, BUFSIZ, ifp) != NULL) { @@ -406,7 +404,7 @@ next: /* * include "filename" * filename [ standard | optional ] - * [ dev* [ | dev* ... ] | profiling-routine ] [ no-obj ] + * [ dev* [ | dev* ... ] | [ no-obj ] * [ compile-with "compile rule" [no-implicit-rule] ] * [ dependency "dependency-list"] [ before-depend ] * [ clean "file-list"] [ warning "text warning" ] @@ -554,10 +552,6 @@ next: continue; } nreqs++; - if (eq(wd, "profiling-routine")) { - filetype = PROFILING; - continue; - } if (std) errout("standard entry %s has optional inclusion specifier %s!\n", this, wd); @@ -585,8 +579,6 @@ nextparam:; if (std == 0 && nreqs == 0) errout("%s: what is %s optional on?\n", fname, this); - if (filetype == PROFILING && profiling == 0) - goto next; tp = new_fent(); tp->f_fn = this; tp->f_type = filetype; @@ -789,11 +781,6 @@ do_rules(FILE *f) case NORMAL: ftype = "NORMAL"; break; - case PROFILING: - if (!profiling) - continue; - ftype = "PROFILE"; - break; default: fprintf(stderr, "config: don't know rules for %s\n", np); From owner-dev-commits-src-all@freebsd.org Fri Apr 2 14:37:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C485E57946F; Fri, 2 Apr 2021 14:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBjMD58ZDz3Dw2; Fri, 2 Apr 2021 14:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A43F216B7; Fri, 2 Apr 2021 14:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132Ebi6m014999; Fri, 2 Apr 2021 14:37:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132Ebi7W014998; Fri, 2 Apr 2021 14:37:44 GMT (envelope-from git) Date: Fri, 2 Apr 2021 14:37:44 GMT Message-Id: <202104021437.132Ebi7W014998@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: ab639bb28730 - main - libnetmap: reset errno in nmreq_register_decode() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab639bb2873034786cd2ec4d2d9c4489fbf6f424 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 14:37:44 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=ab639bb2873034786cd2ec4d2d9c4489fbf6f424 commit ab639bb2873034786cd2ec4d2d9c4489fbf6f424 Author: Vincenzo Maffione AuthorDate: 2021-04-02 14:31:57 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-02 14:31:57 +0000 libnetmap: reset errno in nmreq_register_decode() The reset is necessary at the beginning of the function, because of the errno logic in the error path (set errno to EINVAL if not set). If errno is already set when calling the function, and the function fails, the previous errno value will be inherited. --- lib/libnetmap/nmreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libnetmap/nmreq.c b/lib/libnetmap/nmreq.c index 390f791cb4dd..2c35b3a30089 100644 --- a/lib/libnetmap/nmreq.c +++ b/lib/libnetmap/nmreq.c @@ -257,6 +257,8 @@ nmreq_register_decode(const char **pifname, struct nmreq_register *r, struct nmc uint16_t nr_ringid; uint64_t nr_flags; + errno = 0; + /* fill the request */ p_state = P_START; From owner-dev-commits-src-all@freebsd.org Fri Apr 2 14:39:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB761579550; Fri, 2 Apr 2021 14:39:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBjPX4QWBz3FC3; Fri, 2 Apr 2021 14:39:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8586D2199D; Fri, 2 Apr 2021 14:39:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132EdiAN015407; Fri, 2 Apr 2021 14:39:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132Ediu9015406; Fri, 2 Apr 2021 14:39:44 GMT (envelope-from git) Date: Fri, 2 Apr 2021 14:39:44 GMT Message-Id: <202104021439.132Ediu9015406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 36d6e65722ea - main - netmap: update unit tests with libnetmap tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36d6e65722ea515bf2d122d6e69096a5ff620a92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 14:39:44 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=36d6e65722ea515bf2d122d6e69096a5ff620a92 commit 36d6e65722ea515bf2d122d6e69096a5ff620a92 Author: Vincenzo Maffione AuthorDate: 2021-04-02 14:39:30 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-02 14:39:30 +0000 netmap: update unit tests with libnetmap tests --- tests/sys/netmap/Makefile | 1 + tests/sys/netmap/ctrl-api-test.c | 321 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 309 insertions(+), 13 deletions(-) diff --git a/tests/sys/netmap/Makefile b/tests/sys/netmap/Makefile index 0228271dd668..a7891f583b3b 100644 --- a/tests/sys/netmap/Makefile +++ b/tests/sys/netmap/Makefile @@ -10,5 +10,6 @@ PLAIN_TESTS_C+= ctrl-api-test CFLAGS+= -I${SRCTOP}/tests LIBADD+= pthread +LIBADD+= netmap .include diff --git a/tests/sys/netmap/ctrl-api-test.c b/tests/sys/netmap/ctrl-api-test.c index cea78141fbe4..7cd4d6ac6d9b 100644 --- a/tests/sys/netmap/ctrl-api-test.c +++ b/tests/sys/netmap/ctrl-api-test.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,7 @@ #include #include #include +#include #ifdef __FreeBSD__ #include "freebsd_test_suite/macros.h" @@ -71,6 +73,8 @@ eventfd(int x __unused, int y __unused) #include #endif +#define NM_IFNAMSZ 64 + static int exec_command(int argc, const char *const argv[]) { @@ -143,9 +147,9 @@ exec_command(int argc, const char *const argv[]) #define THRET_FAILURE ((void *)0) struct TestContext { - char ifname[64]; - char ifname_ext[128]; - char bdgname[64]; + char ifname[NM_IFNAMSZ]; + char ifname_ext[NM_IFNAMSZ]; + char bdgname[NM_IFNAMSZ]; uint32_t nr_tx_slots; /* slots in tx rings */ uint32_t nr_rx_slots; /* slots in rx rings */ uint16_t nr_tx_rings; /* number of tx rings */ @@ -166,6 +170,10 @@ struct TestContext { void *csb; /* CSB entries (atok and ktoa) */ struct nmreq_option *nr_opt; /* list of options */ sem_t *sem; /* for thread synchronization */ + + struct nmctx *nmctx; + const char *ifparse; + struct nmport_d *nmport; /* nmport descriptor from libnetmap */ }; static struct TestContext ctx_; @@ -177,7 +185,8 @@ nmreq_hdr_init(struct nmreq_header *hdr, const char *ifname) { memset(hdr, 0, sizeof(*hdr)); hdr->nr_version = NETMAP_API; - strncpy(hdr->nr_name, ifname, sizeof(hdr->nr_name) - 1); + assert(strlen(ifname) < NM_IFNAMSZ); + strncpy(hdr->nr_name, ifname, sizeof(hdr->nr_name)); } /* Single NETMAP_REQ_PORT_INFO_GET. */ @@ -522,16 +531,30 @@ port_register_hwall_rx(struct TestContext *ctx) return port_register(ctx); } + +static int +vale_mkname(char *vpname, struct TestContext *ctx) +{ + if (snprintf(vpname, NM_IFNAMSZ, "%s:%s", ctx->bdgname, ctx->ifname_ext) >= NM_IFNAMSZ) { + fprintf(stderr, "%s:%s too long (max %d chars)\n", ctx->bdgname, ctx->ifname_ext, + NM_IFNAMSZ - 1); + return -1; + } + return 0; +} + + /* NETMAP_REQ_VALE_ATTACH */ static int vale_attach(struct TestContext *ctx) { struct nmreq_vale_attach req; struct nmreq_header hdr; - char vpname[sizeof(ctx->bdgname) + 1 + sizeof(ctx->ifname_ext)]; + char vpname[NM_IFNAMSZ]; int ret; - snprintf(vpname, sizeof(vpname), "%s:%s", ctx->bdgname, ctx->ifname_ext); + if (vale_mkname(vpname, ctx) < 0) + return -1; printf("Testing NETMAP_REQ_VALE_ATTACH on '%s'\n", vpname); nmreq_hdr_init(&hdr, vpname); @@ -563,10 +586,11 @@ vale_detach(struct TestContext *ctx) { struct nmreq_header hdr; struct nmreq_vale_detach req; - char vpname[256]; + char vpname[NM_IFNAMSZ]; int ret; - snprintf(vpname, sizeof(vpname), "%s:%s", ctx->bdgname, ctx->ifname_ext); + if (vale_mkname(vpname, ctx) < 0) + return -1; printf("Testing NETMAP_REQ_VALE_DETACH on '%s'\n", vpname); nmreq_hdr_init(&hdr, vpname); @@ -818,7 +842,7 @@ pipe_slave(struct TestContext *ctx) } /* Test PORT_INFO_GET and POOLS_INFO_GET on a pipe. This is useful to test the - * registration request used internall by netmap. */ + * registration request used internally by netmap. */ static int pipe_port_info_get(struct TestContext *ctx) { @@ -841,10 +865,12 @@ vale_polling_enable(struct TestContext *ctx) { struct nmreq_vale_polling req; struct nmreq_header hdr; - char vpname[256]; + char vpname[NM_IFNAMSZ]; int ret; - snprintf(vpname, sizeof(vpname), "%s:%s", ctx->bdgname, ctx->ifname_ext); + if (vale_mkname(vpname, ctx) < 0) + return -1; + printf("Testing NETMAP_REQ_VALE_POLLING_ENABLE on '%s'\n", vpname); nmreq_hdr_init(&hdr, vpname); @@ -873,10 +899,12 @@ vale_polling_disable(struct TestContext *ctx) { struct nmreq_vale_polling req; struct nmreq_header hdr; - char vpname[256]; + char vpname[NM_IFNAMSZ]; int ret; - snprintf(vpname, sizeof(vpname), "%s:%s", ctx->bdgname, ctx->ifname_ext); + if (vale_mkname(vpname, ctx) < 0) + return -1; + printf("Testing NETMAP_REQ_VALE_POLLING_DISABLE on '%s'\n", vpname); nmreq_hdr_init(&hdr, vpname); @@ -1715,6 +1743,271 @@ null_port_sync(struct TestContext *ctx) return 0; } +struct nmreq_parse_test { + const char *ifname; + const char *exp_port; + const char *exp_suff; + int exp_error; + uint32_t exp_mode; + uint16_t exp_ringid; + uint64_t exp_flags; +}; + +static struct nmreq_parse_test nmreq_parse_tests[] = { + /* port spec is the input. The expected results are as follows: + * - port: what should go into hdr.nr_name + * - suff: the trailing part of the input after parsing (NULL means equal to port spec) + * - err: the expected return value, interpreted as follows + * err > 0 => nmreq_header_parse should fail with the given error + * err < 0 => nrmeq_header_parse should succeed, but nmreq_register_decode should + * fail with error |err| + * err = 0 => should succeed + * - mode, ringid flags: what should go into the corresponding nr_* fields in the + * nmreq_register struct in case of success + */ + + /*port spec*/ /*port*/ /*suff*/ /*err*/ /*mode*/ /*ringid*/ /*flags*/ + { "netmap:eth0", "eth0", "", 0, NR_REG_ALL_NIC, 0, 0 }, + { "netmap:eth0-1", "eth0", "", 0, NR_REG_ONE_NIC, 1, 0 }, + { "netmap:eth0-", "eth0", "-", -EINVAL,0, 0, 0 }, + { "netmap:eth0/x", "eth0", "", 0, NR_REG_ALL_NIC, 0, NR_EXCLUSIVE }, + { "netmap:eth0/z", "eth0", "", 0, NR_REG_ALL_NIC, 0, NR_ZCOPY_MON }, + { "netmap:eth0/r", "eth0", "", 0, NR_REG_ALL_NIC, 0, NR_MONITOR_RX }, + { "netmap:eth0/t", "eth0", "", 0, NR_REG_ALL_NIC, 0, NR_MONITOR_TX }, + { "netmap:eth0-2/Tx", "eth0", "", 0, NR_REG_ONE_NIC, 2, NR_TX_RINGS_ONLY|NR_EXCLUSIVE }, + { "netmap:eth0*", "eth0", "", 0, NR_REG_NIC_SW, 0, 0 }, + { "netmap:eth0^", "eth0", "", 0, NR_REG_SW, 0, 0 }, + { "netmap:eth0@2", "eth0", "", 0, NR_REG_ALL_NIC, 0, 0 }, + { "netmap:eth0@2/R", "eth0", "", 0, NR_REG_ALL_NIC, 0, NR_RX_RINGS_ONLY }, + { "netmap:eth0@netmap:lo/R", "eth0", "@netmap:lo/R", 0, NR_REG_ALL_NIC, 0, 0 }, + { "netmap:eth0/R@xxx", "eth0", "@xxx", 0, NR_REG_ALL_NIC, 0, NR_RX_RINGS_ONLY }, + { "netmap:eth0@2/R@2", "eth0", "", 0, NR_REG_ALL_NIC, 0, NR_RX_RINGS_ONLY }, + { "netmap:eth0@2/R@3", "eth0", "@2/R@3", -EINVAL,0, 0, 0 }, + { "netmap:eth0@", "eth0", "@", -EINVAL,0, 0, 0 }, + { "netmap:", "", NULL, EINVAL, 0, 0, 0 }, + { "netmap:^", "", NULL, EINVAL, 0, 0, 0 }, + { "netmap:{", "", NULL, EINVAL, 0, 0, 0 }, + { "netmap:vale0:0", NULL, NULL, EINVAL, 0, 0, 0 }, + { "eth0", NULL, NULL, EINVAL, 0, 0, 0 }, + { "vale0:0", "vale0:0", "", 0, NR_REG_ALL_NIC, 0, 0 }, + { "vale:0", "vale:0", "", 0, NR_REG_ALL_NIC, 0, 0 }, + { "valeXXX:YYY", "valeXXX:YYY", "", 0, NR_REG_ALL_NIC, 0, 0 }, + { "valeXXX:YYY-4", "valeXXX:YYY", "", 0, NR_REG_ONE_NIC, 4, 0 }, + { "netmapXXX:eth0", NULL, NULL, EINVAL, 0, 0, 0 }, + { "netmap:14", "14", "", 0, NR_REG_ALL_NIC, 0, 0 }, + { "netmap:eth0&", NULL, NULL, EINVAL, 0, 0, 0 }, + { "netmap:pipe{0", "pipe{0", "", 0, NR_REG_ALL_NIC, 0, 0 }, + { "netmap:pipe{in", "pipe{in", "", 0, NR_REG_ALL_NIC, 0, 0 }, + { "netmap:pipe{in-7", "pipe{in", "", 0, NR_REG_ONE_NIC, 7, 0 }, + { "vale0:0{0", "vale0:0{0", "", 0, NR_REG_ALL_NIC, 0, 0 }, + { "netmap:pipe{1}2", NULL, NULL, EINVAL, 0, 0, 0 }, + { "vale0:0@opt", "vale0:0", "@opt", 0, NR_REG_ALL_NIC, 0, 0 }, + { "vale0:0/Tx@opt", "vale0:0", "@opt", 0, NR_REG_ALL_NIC, 0, NR_TX_RINGS_ONLY|NR_EXCLUSIVE }, + { "vale0:0-3@opt", "vale0:0", "@opt", 0, NR_REG_ONE_NIC, 3, 0 }, + { "vale0:0@", "vale0:0", "@", -EINVAL,0, 0, 0 }, + { "", NULL, NULL, EINVAL, 0, 0, 0 }, + { NULL, NULL, NULL, 0, 0, 0, 0 }, +}; + +static void +randomize(void *dst, size_t n) +{ + size_t i; + char *dst_ = dst; + + for (i = 0; i < n; i++) + dst_[i] = (char)random(); +} + +static int +nmreq_hdr_parsing(struct TestContext *ctx, + struct nmreq_parse_test *t, + struct nmreq_header *hdr) +{ + const char *save; + struct nmreq_header orig_hdr; + + save = ctx->ifparse = t->ifname; + orig_hdr = *hdr; + + printf("nmreq_header: \"%s\"\n", ctx->ifparse); + if (nmreq_header_decode(&ctx->ifparse, hdr, ctx->nmctx) < 0) { + if (t->exp_error > 0) { + if (errno != t->exp_error) { + printf("!!! got errno=%d, want %d\n", + errno, t->exp_error); + return -1; + } + if (ctx->ifparse != save) { + printf("!!! parse error, but first arg changed\n"); + return -1; + } + if (memcmp(&orig_hdr, hdr, sizeof(*hdr))) { + printf("!!! parse error, but header changed\n"); + return -1; + } + return 0; + } + printf ("!!! nmreq_header_decode was expected to succeed, but it failed with error %d\n", errno); + return -1; + } + if (t->exp_error > 0) { + printf("!!! nmreq_header_decode returns 0, but error %d was expected\n", t->exp_error); + return -1; + } + if (strcmp(t->exp_port, hdr->nr_name) != 0) { + printf("!!! got '%s', want '%s'\n", hdr->nr_name, t->exp_port); + return -1; + } + if (hdr->nr_reqtype != orig_hdr.nr_reqtype || + hdr->nr_options != orig_hdr.nr_options || + hdr->nr_body != orig_hdr.nr_body) { + printf("!!! some fields of the nmreq_header where changed unexpectedly\n"); + return -1; + } + return 0; +} + +static int +nmreq_reg_parsing(struct TestContext *ctx, + struct nmreq_parse_test *t, + struct nmreq_register *reg) +{ + const char *save; + struct nmreq_register orig_reg; + + + save = ctx->ifparse; + orig_reg = *reg; + + printf("nmreq_register: \"%s\"\n", ctx->ifparse); + if (nmreq_register_decode(&ctx->ifparse, reg, ctx->nmctx) < 0) { + if (t->exp_error < 0) { + if (errno != -t->exp_error) { + printf("!!! got errno=%d, want %d\n", + errno, -t->exp_error); + return -1; + } + if (ctx->ifparse != save) { + printf("!!! parse error, but first arg changed\n"); + return -1; + } + if (memcmp(&orig_reg, reg, sizeof(*reg))) { + printf("!!! parse error, but nmreq_register changed\n"); + return -1; + } + return 0; + } + printf ("!!! parse failed but it should have succeeded\n"); + return -1; + } + if (t->exp_error < 0) { + printf("!!! nmreq_register_decode returns 0, but error %d was expected\n", -t->exp_error); + return -1; + } + if (reg->nr_mode != t->exp_mode) { + printf("!!! got nr_mode '%d', want '%d'\n", reg->nr_mode, t->exp_mode); + return -1; + } + if (reg->nr_ringid != t->exp_ringid) { + printf("!!! got nr_ringid '%d', want '%d'\n", reg->nr_ringid, t->exp_ringid); + return -1; + } + if (reg->nr_flags != t->exp_flags) { + printf("!!! got nm_flags '%llx', want '%llx\n", (unsigned long long)reg->nr_flags, + (unsigned long long)t->exp_flags); + return -1; + } + if (reg->nr_offset != orig_reg.nr_offset || + reg->nr_memsize != orig_reg.nr_memsize || + reg->nr_tx_slots != orig_reg.nr_tx_slots || + reg->nr_rx_slots != orig_reg.nr_rx_slots || + reg->nr_tx_rings != orig_reg.nr_tx_rings || + reg->nr_rx_rings != orig_reg.nr_rx_rings || + reg->nr_extra_bufs != orig_reg.nr_extra_bufs) + { + printf("!!! some fields of the nmreq_register where changed unexpectedly\n"); + return -1; + } + return 0; +} + +static void +nmctx_parsing_error(struct nmctx *ctx, const char *msg) +{ + (void)ctx; + printf(" got message: %s\n", msg); +} + +static int +nmreq_parsing(struct TestContext *ctx) +{ + struct nmreq_parse_test *t; + struct nmreq_header hdr; + struct nmreq_register reg; + struct nmctx test_nmctx, *nmctx; + int ret = 0; + + nmctx = nmctx_get(); + if (nmctx == NULL) { + printf("Failed to acquire nmctx: %s", strerror(errno)); + return -1; + } + test_nmctx = *nmctx; + test_nmctx.error = nmctx_parsing_error; + ctx->nmctx = &test_nmctx; + for (t = nmreq_parse_tests; t->ifname != NULL; t++) { + const char *exp_suff = t->exp_suff != NULL ? + t->exp_suff : t->ifname; + + randomize(&hdr, sizeof(hdr)); + randomize(®, sizeof(reg)); + reg.nr_mem_id = 0; + if (nmreq_hdr_parsing(ctx, t, &hdr) < 0) { + ret = -1; + } else if (t->exp_error <= 0 && nmreq_reg_parsing(ctx, t, ®) < 0) { + ret = -1; + } + if (strcmp(ctx->ifparse, exp_suff) != 0) { + printf("!!! string suffix after parse is '%s', but it should be '%s'\n", + ctx->ifparse, exp_suff); + ret = -1; + } + } + return ret; +} + +static int +binarycomp(struct TestContext *ctx) +{ +#define ckroff(f, o) do {\ + if (offsetof(struct netmap_ring, f) != (o)) {\ + printf("offset of netmap_ring.%s is %zd, but it should be %d",\ + #f, offsetof(struct netmap_ring, f), (o));\ + return -1;\ + }\ +} while (0) + + (void)ctx; + + ckroff(buf_ofs, 0); + ckroff(num_slots, 8); + ckroff(nr_buf_size, 12); + ckroff(ringid, 16); + ckroff(dir, 18); + ckroff(head, 20); + ckroff(cur, 24); + ckroff(tail, 28); + ckroff(flags, 32); + ckroff(ts, 40); + ckroff(offset_mask, 56); + ckroff(buf_align, 64); + ckroff(sem, 128); + ckroff(slot, 256); + + return 0; +} + static void usage(const char *prog) { @@ -1783,6 +2076,8 @@ static struct mytest tests[] = { decltest(legacy_regif_extra_bufs), decltest(legacy_regif_extra_bufs_pipe), decltest(legacy_regif_extra_bufs_pipe_vale), + decltest(nmreq_parsing), + decltest(binarycomp), }; static void From owner-dev-commits-src-all@freebsd.org Fri Apr 2 17:23:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E57AD57CC51; Fri, 2 Apr 2021 17:23:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBn2b60H1z3QFG; Fri, 2 Apr 2021 17:23:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C05F4235E0; Fri, 2 Apr 2021 17:23:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132HNZes052201; Fri, 2 Apr 2021 17:23:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132HNZLk052200; Fri, 2 Apr 2021 17:23:35 GMT (envelope-from git) Date: Fri, 2 Apr 2021 17:23:35 GMT Message-Id: <202104021723.132HNZLk052200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Neel Chauhan Subject: git: ea96dcc6e233 - stable/13 - ichsmb: Add PCI IDs for Intel Comet Lake and Tiger Lake MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ea96dcc6e2333a33509ee318be7882fcbdb88ed4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 17:23:36 -0000 The branch stable/13 has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ea96dcc6e2333a33509ee318be7882fcbdb88ed4 commit ea96dcc6e2333a33509ee318be7882fcbdb88ed4 Author: Neel Chauhan AuthorDate: 2021-03-27 21:08:34 +0000 Commit: Neel Chauhan CommitDate: 2021-04-02 17:22:46 +0000 ichsmb: Add PCI IDs for Intel Comet Lake and Tiger Lake Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D27859 MFC after: 2 weeks (cherry picked from commit a94d15af26b51cea480030b26c751c3550b1b4bb) --- sys/dev/ichsmb/ichsmb_pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/dev/ichsmb/ichsmb_pci.c b/sys/dev/ichsmb/ichsmb_pci.c index e0aa3bfdb383..ff4b287dd020 100644 --- a/sys/dev/ichsmb/ichsmb_pci.c +++ b/sys/dev/ichsmb/ichsmb_pci.c @@ -105,6 +105,10 @@ __FBSDID("$FreeBSD$"); #define ID_LEWISBURG2 0xa223 #define ID_KABYLAKE 0xa2a3 #define ID_CANNONLAKE 0xa323 +#define ID_COMETLAKE 0x02a3 +#define ID_COMETLAKE2 0x06a3 +#define ID_TIGERLAKE 0xa0a3 +#define ID_TIGERLAKE2 0x43a3 static const struct pci_device_table ichsmb_devices[] = { { PCI_DEV(PCI_VENDOR_INTEL, ID_82801AA), @@ -187,6 +191,14 @@ static const struct pci_device_table ichsmb_devices[] = { PCI_DESCR("Intel Kaby Lake SMBus controller") }, { PCI_DEV(PCI_VENDOR_INTEL, ID_CANNONLAKE), PCI_DESCR("Intel Cannon Lake SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_COMETLAKE), + PCI_DESCR("Intel Comet Lake SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_COMETLAKE2), + PCI_DESCR("Intel Comet Lake SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_TIGERLAKE), + PCI_DESCR("Intel Tiger Lake SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_TIGERLAKE2), + PCI_DESCR("Intel Tiger Lake SMBus controller") }, }; /* Internal functions */ From owner-dev-commits-src-all@freebsd.org Fri Apr 2 18:25:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C68257DEFF; Fri, 2 Apr 2021 18:25:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBpPj2Qlcz3jlZ; Fri, 2 Apr 2021 18:25:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DEAF24659; Fri, 2 Apr 2021 18:25:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132IPDnt036012; Fri, 2 Apr 2021 18:25:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132IPDlh036011; Fri, 2 Apr 2021 18:25:13 GMT (envelope-from git) Date: Fri, 2 Apr 2021 18:25:13 GMT Message-Id: <202104021825.132IPDlh036011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: cad4fd0365a5 - main - Make sbuf_drain safe for external use MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cad4fd0365a5e3235e715e072e6ee9dffaa7a3ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 18:25:13 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=cad4fd0365a5e3235e715e072e6ee9dffaa7a3ab commit cad4fd0365a5e3235e715e072e6ee9dffaa7a3ab Author: Richard Scheffenegger AuthorDate: 2021-04-02 18:11:45 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-02 18:12:11 +0000 Make sbuf_drain safe for external use While sbuf_drain was an internal function, two KASSERTS checked the sanity of it being called. However, an external caller may be ignorant if there is any data to drain, or if an error has already accumulated. Be nice and return immediately with the accumulated error. MFC after: 2 weeks Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29544 --- sys/kern/subr_sbuf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index 66822115dbcb..cdeaf690208f 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -388,8 +388,12 @@ sbuf_drain(struct sbuf *s) { int len; - KASSERT(s->s_len > 0, ("Shouldn't drain empty sbuf %p", s)); - KASSERT(s->s_error == 0, ("Called %s with error on %p", __func__, s)); + /* + * Immediately return when no work to do, + * or an error has already been accumulated. + */ + if ((s->s_len == 0) || (s->s_error != 0)) + return(s->s_error); if (SBUF_DODRAINTOEOR(s) && s->s_rec_off == 0) return (s->s_error = EDEADLK); From owner-dev-commits-src-all@freebsd.org Fri Apr 2 18:28:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83F8657E13B; Fri, 2 Apr 2021 18:28:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBpTh3Dg1z3k3n; Fri, 2 Apr 2021 18:28:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6195D2483D; Fri, 2 Apr 2021 18:28:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132ISeMe036634; Fri, 2 Apr 2021 18:28:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132ISe7r036633; Fri, 2 Apr 2021 18:28:40 GMT (envelope-from git) Date: Fri, 2 Apr 2021 18:28:40 GMT Message-Id: <202104021828.132ISe7r036633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 38ea2bd0698e - main - Use sbuf_drain unconditionally MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38ea2bd0698e434ec531b97fa94b24db24e16629 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 18:28:40 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=38ea2bd0698e434ec531b97fa94b24db24e16629 commit 38ea2bd0698e434ec531b97fa94b24db24e16629 Author: Richard Scheffenegger AuthorDate: 2021-04-02 18:26:48 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-02 18:27:46 +0000 Use sbuf_drain unconditionally After making sbuf_drain safe for external use, there is no need to protect the call. MFC after: 2 weeks Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29545 --- sys/netinet/tcp_hostcache.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index a8c4b2b178cd..f8f01afb07d7 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -644,7 +644,6 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) const int linesize = 128; struct sbuf sb; int i, error, len; - bool do_drain = false; struct hc_metrics *hc_entry; char ip4buf[INET_ADDRSTRLEN]; #ifdef INET6 @@ -702,15 +701,9 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) hc_entry->rmx_hits, hc_entry->rmx_updates, hc_entry->rmx_expire); - do_drain = true; } THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); - /* Need to track if sbuf has data, to avoid - * a KASSERT when calling sbuf_drain. - */ - if (do_drain) { - sbuf_drain(&sb); - do_drain = false; + sbuf_drain(&sb); } } #undef msec From owner-dev-commits-src-all@freebsd.org Fri Apr 2 18:35:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5548157E579; Fri, 2 Apr 2021 18:35:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBpdL1tcRz3kW6; Fri, 2 Apr 2021 18:35:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3290D244FF; Fri, 2 Apr 2021 18:35:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132IZI5D050429; Fri, 2 Apr 2021 18:35:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132IZI7M050428; Fri, 2 Apr 2021 18:35:18 GMT (envelope-from git) Date: Fri, 2 Apr 2021 18:35:18 GMT Message-Id: <202104021835.132IZI7M050428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: a04906f0273f - main - fix typo in 38ea2bd0698e MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a04906f0273fa6d80eb3ebf22b9b84e53e6b21e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 18:35:18 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=a04906f0273fa6d80eb3ebf22b9b84e53e6b21e0 commit a04906f0273fa6d80eb3ebf22b9b84e53e6b21e0 Author: Richard Scheffenegger AuthorDate: 2021-04-02 18:34:33 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-02 18:34:33 +0000 fix typo in 38ea2bd0698e --- sys/netinet/tcp_hostcache.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index f8f01afb07d7..a873558621d1 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -704,7 +704,6 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) } THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); sbuf_drain(&sb); - } } #undef msec error = sbuf_finish(&sb); From owner-dev-commits-src-all@freebsd.org Fri Apr 2 18:55:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B829457ED53; Fri, 2 Apr 2021 18:55:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBq4p4nSWz3m5w; Fri, 2 Apr 2021 18:55:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9458824C4C; Fri, 2 Apr 2021 18:55:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132Itc1S077938; Fri, 2 Apr 2021 18:55:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132ItcaP077937; Fri, 2 Apr 2021 18:55:38 GMT (envelope-from git) Date: Fri, 2 Apr 2021 18:55:38 GMT Message-Id: <202104021855.132ItcaP077937@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: fc56fd262d0b - main - Ensure that all allocated data structures in fsck_ffs are freed. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc56fd262d0bc8ee523f6c8e6a65c0ff5417af6e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 18:55:38 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=fc56fd262d0bc8ee523f6c8e6a65c0ff5417af6e commit fc56fd262d0bc8ee523f6c8e6a65c0ff5417af6e Author: Kirk McKusick AuthorDate: 2021-04-02 18:57:34 +0000 Commit: Kirk McKusick CommitDate: 2021-04-02 18:58:49 +0000 Ensure that all allocated data structures in fsck_ffs are freed. Several large data structures are allocated by fsck_ffs to track resource usage. Most but not all were deallocated at the end of checking each filesystem. This commit consolidates the freeing of all data structures in one place and adds one that had previously been missing. It is important to clean up these data structures as they can be large. If the previous allocations have not been freed, fsck_ffs can run out of address space when many large filesystems are being checked. An alternative would be to fork a new instance of fsck_ffs for each filesystem to be checked, but we choose to free the small set of large structures to save the fork overhead. Reported by: Chuck Silvers Tested by: Chuck Silvers MFC after: 7 days Sponsored by: Netflix --- sbin/fsck_ffs/fsck.h | 4 +++- sbin/fsck_ffs/fsutil.c | 47 +++++++++++++++++++++++++++++++++++++---------- sbin/fsck_ffs/globs.c | 2 -- sbin/fsck_ffs/main.c | 6 ------ 4 files changed, 40 insertions(+), 19 deletions(-) diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h index 676350b75767..9ecc5793e644 100644 --- a/sbin/fsck_ffs/fsck.h +++ b/sbin/fsck_ffs/fsck.h @@ -236,10 +236,12 @@ extern int sujrecovery; /* 1 => doing check using the journal */ } while (0) #define initbarea(bp, type) do { \ (bp)->b_bno = (ufs2_daddr_t)-1; \ + (bp)->b_size = 0; \ + (bp)->b_errs = 0; \ (bp)->b_flags = 0; \ + (bp)->b_type = type; \ (bp)->b_refcnt = 0; \ (bp)->b_index = 0; \ - (bp)->b_type = type; \ } while (0) #define sbdirty() dirty(&sblk) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 127884400651..ca19f6726af5 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -84,7 +84,6 @@ static LIST_HEAD(bufhash, bufarea) bufhashhd[HASHSIZE]; /* buffer hash list */ static int numbufs; /* size of buffer cache */ static int cachelookups; /* number of cache lookups */ static int cachereads; /* number of cache reads */ -static struct bufarea *cgbufs; /* header for cylinder group cache */ static int flushtries; /* number of tries to reclaim memory */ char *buftype[BT_NUMBUFTYPES] = BT_NAMES; @@ -187,13 +186,9 @@ bufinit(void) { int i; - pdirbp = (struct bufarea *)0; - bzero(&cgblk, sizeof(struct bufarea)); - cgblk.b_un.b_buf = Malloc((unsigned int)sblock.fs_bsize); - if (cgblk.b_un.b_buf == NULL) + if ((cgblk.b_un.b_buf = Malloc((unsigned int)sblock.fs_bsize)) == NULL) errx(EEXIT, "Initial malloc(%d) failed", sblock.fs_bsize); initbarea(&cgblk, BT_CYLGRP); - cgbufs = NULL; numbufs = cachelookups = cachereads = 0; TAILQ_INIT(&bufqueuehd); for (i = 0; i < HASHSIZE; i++) @@ -559,7 +554,8 @@ void ckfini(int markclean) { struct bufarea *bp, *nbp; - int ofsmodified, cnt; + struct inoinfo *inp, *ninp; + int ofsmodified, cnt, cg, i; if (bkgrdflag) { unlink(snapname); @@ -609,16 +605,20 @@ ckfini(int markclean) free(cgbufs[cnt].b_un.b_cg); } free(cgbufs); + cgbufs = NULL; } flush(fswritefd, &cgblk); free(cgblk.b_un.b_buf); + cgblk.b_un.b_buf = NULL; cnt = 0; /* Step 2: indirect, directory, external attribute, and data blocks */ if (debug) printf("Flush indirect, directory, external attribute, " "and data blocks\n"); - if (pdirbp != NULL) + if (pdirbp != NULL) { brelse(pdirbp); + pdirbp = NULL; + } TAILQ_FOREACH_REVERSE_SAFE(bp, &bufqueuehd, bufqueue, b_list, nbp) { switch (bp->b_type) { /* These should not be in the buffer cache list */ @@ -658,8 +658,10 @@ ckfini(int markclean) /* Step 3: inode blocks */ if (debug) printf("Flush inode blocks\n"); - if (icachebp != NULL) + if (icachebp != NULL) { brelse(icachebp); + icachebp = NULL; + } TAILQ_FOREACH_REVERSE_SAFE(bp, &bufqueuehd, bufqueue, b_list, nbp) { if (debug && bp->b_refcnt != 0) { prtbuf("ckfini: clearing in-use buffer", bp); @@ -686,7 +688,6 @@ ckfini(int markclean) sbdirty(); flush(fswritefd, &sblk); } - pdirbp = (struct bufarea *)0; if (cursnapshot == 0 && sblock.fs_clean != markclean) { if ((sblock.fs_clean = markclean) != 0) { sblock.fs_flags &= ~(FS_UNCLEAN | FS_NEEDSFSCK); @@ -711,6 +712,32 @@ ckfini(int markclean) rerun = 1; } } + /* + * Free allocated tracking structures. + */ + if (blockmap != NULL) + free(blockmap); + blockmap = NULL; + if (inostathead != NULL) { + for (cg = 0; cg < sblock.fs_ncg; cg++) + if (inostathead[cg].il_stat != NULL) + free((char *)inostathead[cg].il_stat); + free(inostathead); + } + inostathead = NULL; + if (inpsort != NULL) + free(inpsort); + inpsort = NULL; + if (inphead != NULL) { + for (i = 0; i < dirhash; i++) { + for (inp = inphead[i]; inp != NULL; inp = ninp) { + ninp = inp->i_nexthash; + free(inp); + } + } + free(inphead); + } + inphead = NULL; finalIOstats(); (void)close(fsreadfd); (void)close(fswritefd); diff --git a/sbin/fsck_ffs/globs.c b/sbin/fsck_ffs/globs.c index 45d6b80d8fe8..be4434ce38ca 100644 --- a/sbin/fsck_ffs/globs.c +++ b/sbin/fsck_ffs/globs.c @@ -128,7 +128,6 @@ fsckinit(void) bzero(totalreadtime, sizeof(struct timespec) * BT_NUMBUFTYPES); bzero(&startprog, sizeof(struct timespec)); bzero(&sblk, sizeof(struct bufarea)); - pdirbp = NULL; cursnapshot = 0; listmax = numdirs = dirhash = inplast = 0; countdirs = 0; @@ -159,7 +158,6 @@ fsckinit(void) fsreadfd = 0; fswritefd = 0; maxfsblock = 0; - blockmap = NULL; maxino = 0; lfdir = 0; lfname = "lost+found"; diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 65cee9b7b8c6..401ee10f9be3 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -243,7 +243,6 @@ checkfilesys(char *filesys) char errmsg[255]; int ofsmodified; int iovlen; - int cylno; intmax_t blks, files; size_t size; @@ -627,11 +626,6 @@ checkfilesys(char *filesys) resolved = 0; ckfini(resolved); - for (cylno = 0; cylno < sblock.fs_ncg; cylno++) - if (inostathead[cylno].il_stat != NULL) - free((char *)inostathead[cylno].il_stat); - free((char *)inostathead); - inostathead = NULL; if (fsmodified && !preen) printf("\n***** FILE SYSTEM WAS MODIFIED *****\n"); if (rerun) { From owner-dev-commits-src-all@freebsd.org Fri Apr 2 21:49:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1D7B5B34D3; Fri, 2 Apr 2021 21:49:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBtxd5zK6z4S0g; Fri, 2 Apr 2021 21:49:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0483272C4; Fri, 2 Apr 2021 21:49:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132Lnfxn017736; Fri, 2 Apr 2021 21:49:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132Lnf4S017735; Fri, 2 Apr 2021 21:49:41 GMT (envelope-from git) Date: Fri, 2 Apr 2021 21:49:41 GMT Message-Id: <202104022149.132Lnf4S017735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: fab7c18ce322 - stable/13 - Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode". MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fab7c18ce3229d53b732fdfdbb6e9a1a1c72739a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 21:49:42 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=fab7c18ce3229d53b732fdfdbb6e9a1a1c72739a commit fab7c18ce3229d53b732fdfdbb6e9a1a1c72739a Author: Kirk McKusick AuthorDate: 2021-03-24 23:50:24 +0000 Commit: Kirk McKusick CommitDate: 2021-04-02 21:52:49 +0000 Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode". (cherry picked from commit bc444e2ec6e6cc9d96d35ab7ce3c02c0da952fad) --- sbin/fsck_ffs/pass1b.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/pass1b.c b/sbin/fsck_ffs/pass1b.c index 8c09ef36acad..b44e0107c982 100644 --- a/sbin/fsck_ffs/pass1b.c +++ b/sbin/fsck_ffs/pass1b.c @@ -78,8 +78,10 @@ pass1b(void) continue; setinodebuf(c, inosused); for (i = 0; i < inosused; i++, inumber++) { - if (inumber < UFS_ROOTINO) + if (inumber < UFS_ROOTINO) { + (void)getnextinode(inumber, 0); continue; + } dp = getnextinode(inumber, 0); idesc.id_number = inumber; idesc.id_type = inoinfo(inumber)->ino_idtype; From owner-dev-commits-src-all@freebsd.org Fri Apr 2 21:51:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 066765B3C8C; Fri, 2 Apr 2021 21:51:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBtzt6nh5z4SGS; Fri, 2 Apr 2021 21:51:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAE0C270C8; Fri, 2 Apr 2021 21:51:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132LpcGH027184; Fri, 2 Apr 2021 21:51:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132Lpc8U027183; Fri, 2 Apr 2021 21:51:38 GMT (envelope-from git) Date: Fri, 2 Apr 2021 21:51:38 GMT Message-Id: <202104022151.132Lpc8U027183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 52a99c72b5e1 - main - sendfile: Fix error initialization in sendfile_getobj() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 52a99c72b5e1e58a8297d1e62854a5b765dc7d33 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 21:51:39 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=52a99c72b5e1e58a8297d1e62854a5b765dc7d33 commit 52a99c72b5e1e58a8297d1e62854a5b765dc7d33 Author: Mark Johnston AuthorDate: 2021-04-02 21:12:56 +0000 Commit: Mark Johnston CommitDate: 2021-04-02 21:42:38 +0000 sendfile: Fix error initialization in sendfile_getobj() Reviewed by: chs, kib Reported by: jhb Fixes: faa998f6ff695 MFC after: 1 day Differential Revision: https://reviews.freebsd.org/D29540 --- sys/kern/kern_sendfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 95bfba0538dc..520b7c9c62d0 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -571,6 +571,7 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, struct shmfd *shmfd; int error; + error = 0; vp = *vp_res = NULL; obj = NULL; shmfd = *shmfd_res = NULL; @@ -610,7 +611,6 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, VM_OBJECT_RLOCK(obj); } } else if (fp->f_type == DTYPE_SHM) { - error = 0; shmfd = fp->f_data; obj = shmfd->shm_object; VM_OBJECT_RLOCK(obj); From owner-dev-commits-src-all@freebsd.org Fri Apr 2 21:51:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30A865B3B56; Fri, 2 Apr 2021 21:51:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBtzw0jYhz4SX1; Fri, 2 Apr 2021 21:51:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09D0827266; Fri, 2 Apr 2021 21:51:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132LpdHF027210; Fri, 2 Apr 2021 21:51:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132Lpdus027209; Fri, 2 Apr 2021 21:51:39 GMT (envelope-from git) Date: Fri, 2 Apr 2021 21:51:39 GMT Message-Id: <202104022151.132Lpdus027209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7653f9317bc3 - main - dtrace: Document the libdir, nolibs and syslibdir options MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7653f9317bc3fb3b945cb1485123a80050cfd4e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 21:51:40 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7653f9317bc3fb3b945cb1485123a80050cfd4e8 commit 7653f9317bc3fb3b945cb1485123a80050cfd4e8 Author: Domagoj Stolfa AuthorDate: 2021-04-02 21:19:47 +0000 Commit: Mark Johnston CommitDate: 2021-04-02 21:42:38 +0000 dtrace: Document the libdir, nolibs and syslibdir options MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29541 --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index b236fd49c260..c91dfc8270bb 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2020 +.Dd April 2, 2021 .Dt DTRACE 1 .Os .Sh NAME @@ -602,8 +602,12 @@ Number of default stack frames for .It Sy jstackstrsize Ns = Ns Ar scalar Default string space size for .Fn jstack . +.It Sy libdir Ns = Ns Ar path +Add a directory to the system library path. .It Sy nspec Ns = Ns Ar scalar Number of speculations. +.It Sy nolibs +Do not load D system libraries. .It Sy quiet Set quiet mode. Same as the @@ -627,6 +631,10 @@ output. Rate of status checking. .It Sy switchrate Ns = Ns Ar time Rate of buffer switching. +.It Sy syslibdir Ns = Ns Ar path +Path to system libraries. +Defaults to +.Pa /usr/lib/dtrace . .It Sy ustackframes Ns = Ns Ar scalar Maximum number of userspace stack frames to unwind when executing the .Fn ustack From owner-dev-commits-src-all@freebsd.org Fri Apr 2 21:51:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 635815B3F00; Fri, 2 Apr 2021 21:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBtzx2Bhtz4SJZ; Fri, 2 Apr 2021 21:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3633C26CF6; Fri, 2 Apr 2021 21:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132Lpfjq027231; Fri, 2 Apr 2021 21:51:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132Lpft3027230; Fri, 2 Apr 2021 21:51:41 GMT (envelope-from git) Date: Fri, 2 Apr 2021 21:51:41 GMT Message-Id: <202104022151.132Lpft3027230@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4d221f59b851 - main - fbt: Remove some handling for multiple CTF containers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d221f59b851a9c844c84701bab7f4edb7026bd4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 21:51:41 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4d221f59b851a9c844c84701bab7f4edb7026bd4 commit 4d221f59b851a9c844c84701bab7f4edb7026bd4 Author: Mark Johnston AuthorDate: 2021-04-02 21:42:26 +0000 Commit: Mark Johnston CommitDate: 2021-04-02 21:49:13 +0000 fbt: Remove some handling for multiple CTF containers This was ported from illumos but not completely done. Currently we do not perform type deduplication between KLDs and the kernel, i.e., kernel modules have a complete type graph. So, remove it for now since it's not functional and complicates the task of modifying various CTF type definitions, and we are hitting some limits in the current format which necessitate an update. No functional change intended. MFC after: 2 weeks --- sys/cddl/dev/fbt/fbt.c | 44 +++++++++----------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/sys/cddl/dev/fbt/fbt.c b/sys/cddl/dev/fbt/fbt.c index a378ae0eb317..3bad4243c040 100644 --- a/sys/cddl/dev/fbt/fbt.c +++ b/sys/cddl/dev/fbt/fbt.c @@ -474,17 +474,18 @@ fbt_typoff_init(linker_ctf_t *lc) int ctf_typemax = 0; uint32_t *xp; ulong_t pop[CTF_K_MAX + 1] = { 0 }; + uint8_t version; /* Sanity check. */ if (hp->cth_magic != CTF_MAGIC) return (EINVAL); + version = hp->cth_version; + tbuf = (const ctf_type_t *) (ctfdata + hp->cth_typeoff); tend = (const ctf_type_t *) (ctfdata + hp->cth_stroff); - int child = hp->cth_parname != 0; - /* * We make two passes through the entire type section. In this first * pass, we count the number of each type and the total number of types. @@ -495,9 +496,8 @@ fbt_typoff_init(linker_ctf_t *lc) ssize_t size, increment; size_t vbytes; - uint_t n; - (void) fbt_get_ctt_size(hp->cth_version, tp, &size, &increment); + (void) fbt_get_ctt_size(version, tp, &size, &increment); switch (kind) { case CTF_K_INTEGER: @@ -512,22 +512,10 @@ fbt_typoff_init(linker_ctf_t *lc) break; case CTF_K_STRUCT: case CTF_K_UNION: - if (size < CTF_LSTRUCT_THRESH) { - ctf_member_t *mp = (ctf_member_t *) - ((uintptr_t)tp + increment); - + if (size < CTF_LSTRUCT_THRESH) vbytes = sizeof (ctf_member_t) * vlen; - for (n = vlen; n != 0; n--, mp++) - child |= CTF_TYPE_ISCHILD(mp->ctm_type); - } else { - ctf_lmember_t *lmp = (ctf_lmember_t *) - ((uintptr_t)tp + increment); - + else vbytes = sizeof (ctf_lmember_t) * vlen; - for (n = vlen; n != 0; n--, lmp++) - child |= - CTF_TYPE_ISCHILD(lmp->ctlm_type); - } break; case CTF_K_ENUM: vbytes = sizeof (ctf_enum_t) * vlen; @@ -552,7 +540,6 @@ fbt_typoff_init(linker_ctf_t *lc) case CTF_K_VOLATILE: case CTF_K_CONST: case CTF_K_RESTRICT: - child |= CTF_TYPE_ISCHILD(tp->ctt_type); vbytes = 0; break; default: @@ -584,9 +571,8 @@ fbt_typoff_init(linker_ctf_t *lc) ssize_t size, increment; size_t vbytes; - uint_t n; - (void) fbt_get_ctt_size(hp->cth_version, tp, &size, &increment); + (void) fbt_get_ctt_size(version, tp, &size, &increment); switch (kind) { case CTF_K_INTEGER: @@ -601,22 +587,10 @@ fbt_typoff_init(linker_ctf_t *lc) break; case CTF_K_STRUCT: case CTF_K_UNION: - if (size < CTF_LSTRUCT_THRESH) { - ctf_member_t *mp = (ctf_member_t *) - ((uintptr_t)tp + increment); - + if (size < CTF_LSTRUCT_THRESH) vbytes = sizeof (ctf_member_t) * vlen; - for (n = vlen; n != 0; n--, mp++) - child |= CTF_TYPE_ISCHILD(mp->ctm_type); - } else { - ctf_lmember_t *lmp = (ctf_lmember_t *) - ((uintptr_t)tp + increment); - + else vbytes = sizeof (ctf_lmember_t) * vlen; - for (n = vlen; n != 0; n--, lmp++) - child |= - CTF_TYPE_ISCHILD(lmp->ctlm_type); - } break; case CTF_K_ENUM: vbytes = sizeof (ctf_enum_t) * vlen; From owner-dev-commits-src-all@freebsd.org Fri Apr 2 21:52:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B42725B3CC6; Fri, 2 Apr 2021 21:52:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBv0d1hyjz4ShX; Fri, 2 Apr 2021 21:52:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A2E127454; Fri, 2 Apr 2021 21:52:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 132LqAej030444; Fri, 2 Apr 2021 21:52:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132LqARj030438; Fri, 2 Apr 2021 21:52:10 GMT (envelope-from git) Date: Fri, 2 Apr 2021 21:52:10 GMT Message-Id: <202104022152.132LqARj030438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 343b9e6219e1 - stable/13 - Fix fsck_ffs -R finds unfixed duplicate block errors when rerunning. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 343b9e6219e1579efe8980612655ec52d61b0d57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 21:52:19 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=343b9e6219e1579efe8980612655ec52d61b0d57 commit 343b9e6219e1579efe8980612655ec52d61b0d57 Author: Kirk McKusick AuthorDate: 2021-03-25 00:23:33 +0000 Commit: Kirk McKusick CommitDate: 2021-04-02 21:55:58 +0000 Fix fsck_ffs -R finds unfixed duplicate block errors when rerunning. (cherry picked from commit 7848b25edd2a513f115de6d91f0a5a8d8fa1aa58) --- sbin/fsck_ffs/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 60019425c825..020a69dd72f8 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -600,6 +600,9 @@ setinodebuf(int cg, ino_t inosused) nextino = inum; lastinum = inum; readcount = 0; + /* Flush old contents in case they have been updated */ + flush(fswritefd, &inobuf); + inobuf.b_bno = 0; if (inobuf.b_un.b_buf == NULL) { inobufsize = blkroundup(&sblock, MAX(INOBUFSIZE, sblock.fs_bsize)); From owner-dev-commits-src-all@freebsd.org Sat Apr 3 00:53:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BEAE5B8A41; Sat, 3 Apr 2021 00:53:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBz1Z3rnZz4dtp; Sat, 3 Apr 2021 00:53:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 753B3164A; Sat, 3 Apr 2021 00:53:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1330rMDC082459; Sat, 3 Apr 2021 00:53:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1330rMsW082458; Sat, 3 Apr 2021 00:53:22 GMT (envelope-from git) Date: Sat, 3 Apr 2021 00:53:22 GMT Message-Id: <202104030053.1330rMsW082458@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b2ebf64aaef5 - stable/13 - vm_fault: handle KERN_PROTECTION_FAILURE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b2ebf64aaef53802a1be25fbc6adcd9ad76085a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 00:53:22 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b2ebf64aaef53802a1be25fbc6adcd9ad76085a8 commit b2ebf64aaef53802a1be25fbc6adcd9ad76085a8 Author: Konstantin Belousov AuthorDate: 2021-03-27 11:08:52 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-03 00:39:06 +0000 vm_fault: handle KERN_PROTECTION_FAILURE (cherry picked from commit c7b913aa47bac8b35b6a0679497ad28e561318c2) --- sys/vm/vm_fault.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index da7b1f1d2d8e..585e1544415d 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -506,6 +506,8 @@ vm_fault_populate(struct faultstate *fs) PMAP_ENTER_LARGEPAGE, bdry_idx); VM_OBJECT_WLOCK(fs->first_object); vm_page_xunbusy(m); + if (rv != KERN_SUCCESS) + goto out; if ((fs->fault_flags & VM_FAULT_WIRE) != 0) { for (i = 0; i < atop(pagesizes[bdry_idx]); i++) vm_page_wire(m + i); @@ -586,7 +588,7 @@ vm_fault_populate(struct faultstate *fs) } out: curthread->td_ru.ru_majflt++; - return (KERN_SUCCESS); + return (rv); } static int prot_fault_translation; @@ -1073,6 +1075,7 @@ vm_fault_allocate(struct faultstate *fs) switch (rv) { case KERN_SUCCESS: case KERN_FAILURE: + case KERN_PROTECTION_FAILURE: case KERN_RESTART: return (rv); case KERN_NOT_RECEIVER: @@ -1343,6 +1346,7 @@ RetryFault: goto RetryFault; case KERN_SUCCESS: case KERN_FAILURE: + case KERN_PROTECTION_FAILURE: case KERN_OUT_OF_BOUNDS: unlock_and_deallocate(&fs); return (rv); @@ -1410,6 +1414,7 @@ RetryFault: goto RetryFault; case KERN_SUCCESS: case KERN_FAILURE: + case KERN_PROTECTION_FAILURE: case KERN_OUT_OF_BOUNDS: unlock_and_deallocate(&fs); return (rv); From owner-dev-commits-src-all@freebsd.org Sat Apr 3 06:20:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D7015C11BB; Sat, 3 Apr 2021 06:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FC6GR6gHRz3GRw; Sat, 3 Apr 2021 06:19:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D77815E33; Sat, 3 Apr 2021 06:19:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1336JxNF033028; Sat, 3 Apr 2021 06:19:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1336JxKs033027; Sat, 3 Apr 2021 06:19:59 GMT (envelope-from git) Date: Sat, 3 Apr 2021 06:19:59 GMT Message-Id: <202104030619.1336JxKs033027@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: 98740ead97c6 - stable/13 - virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 98740ead97c60caca1d7cb3e996108c75f499beb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 06:20:00 -0000 The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=98740ead97c60caca1d7cb3e996108c75f499beb commit 98740ead97c60caca1d7cb3e996108c75f499beb Author: Ka Ho Ng AuthorDate: 2021-03-20 07:40:52 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-03 06:09:31 +0000 virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap The MSI-X resource shouldn't be assumed to be always on BAR1. The Virtio v1.1 Spec did not specify that MSI-X table and PBA BAR has to be BAR1 either. Reported by: Yuan Rui Reviewed by: bryanv, jhb Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D28817 (cherry picked from commit faf9a4e9142a02c289ee543a6091bd4b925c6a63) --- sys/dev/virtio/pci/virtio_pci_legacy.c | 74 +++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 14 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c index 22e369097e2e..d74983099110 100644 --- a/sys/dev/virtio/pci/virtio_pci_legacy.c +++ b/sys/dev/virtio/pci/virtio_pci_legacy.c @@ -60,7 +60,8 @@ struct vtpci_legacy_softc { device_t vtpci_dev; struct vtpci_common vtpci_common; struct resource *vtpci_res; - struct resource *vtpci_msix_res; + struct resource *vtpci_msix_table_res; + struct resource *vtpci_msix_pba_res; }; static int vtpci_legacy_probe(device_t); @@ -97,6 +98,8 @@ static void vtpci_legacy_notify_vq(device_t, uint16_t, bus_size_t); static void vtpci_legacy_read_dev_config(device_t, bus_size_t, void *, int); static void vtpci_legacy_write_dev_config(device_t, bus_size_t, void *, int); +static bool vtpci_legacy_setup_msix(struct vtpci_legacy_softc *sc); +static void vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc); static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *); static void vtpci_legacy_free_resources(struct vtpci_legacy_softc *); @@ -232,6 +235,13 @@ vtpci_legacy_attach(device_t dev) return (error); } + if (vtpci_is_msix_available(&sc->vtpci_common) && + !vtpci_legacy_setup_msix(sc)) { + device_printf(dev, "cannot setup MSI-x resources\n"); + error = ENXIO; + goto fail; + } + vtpci_legacy_reset(sc); /* Tell the host we've noticed this device. */ @@ -265,6 +275,7 @@ vtpci_legacy_detach(device_t dev) return (error); vtpci_legacy_reset(sc); + vtpci_legacy_teardown_msix(sc); vtpci_legacy_free_resources(sc); return (0); @@ -539,6 +550,54 @@ vtpci_legacy_write_dev_config(device_t dev, bus_size_t offset, } } +static bool +vtpci_legacy_setup_msix(struct vtpci_legacy_softc *sc) +{ + device_t dev; + int rid, table_rid; + + dev = sc->vtpci_dev; + + rid = table_rid = pci_msix_table_bar(dev); + if (rid != PCIR_BAR(0)) { + sc->vtpci_msix_table_res = bus_alloc_resource_any( + dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->vtpci_msix_table_res == NULL) + return (false); + } + + rid = pci_msix_pba_bar(dev); + if (rid != table_rid && rid != PCIR_BAR(0)) { + sc->vtpci_msix_pba_res = bus_alloc_resource_any( + dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->vtpci_msix_pba_res == NULL) + return (false); + } + + return (true); +} + +static void +vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc) +{ + device_t dev; + + dev = sc->vtpci_dev; + + if (sc->vtpci_msix_pba_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->vtpci_msix_pba_res), + sc->vtpci_msix_pba_res); + sc->vtpci_msix_pba_res = NULL; + } + if (sc->vtpci_msix_table_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->vtpci_msix_table_res), + sc->vtpci_msix_table_res); + sc->vtpci_msix_table_res = NULL; + } +} + static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) { @@ -552,13 +611,6 @@ vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) &rid, RF_ACTIVE)) == NULL) return (ENXIO); - if (vtpci_is_msix_available(&sc->vtpci_common)) { - rid = PCIR_BAR(1); - if ((sc->vtpci_msix_res = bus_alloc_resource_any(dev, - SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) - return (ENXIO); - } - return (0); } @@ -569,12 +621,6 @@ vtpci_legacy_free_resources(struct vtpci_legacy_softc *sc) dev = sc->vtpci_dev; - if (sc->vtpci_msix_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(1), - sc->vtpci_msix_res); - sc->vtpci_msix_res = NULL; - } - if (sc->vtpci_res != NULL) { bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), sc->vtpci_res); From owner-dev-commits-src-all@freebsd.org Sat Apr 3 06:20:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 364755C1313; Sat, 3 Apr 2021 06:20:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FC6GT0nY9z3GPV; Sat, 3 Apr 2021 06:20:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02D2B5EF1; Sat, 3 Apr 2021 06:20:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1336K0nK034058; Sat, 3 Apr 2021 06:20:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1336K0sn034047; Sat, 3 Apr 2021 06:20:00 GMT (envelope-from git) Date: Sat, 3 Apr 2021 06:20:00 GMT Message-Id: <202104030620.1336K0sn034047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: 2e107638eac2 - stable/13 - virtio_pci_legacy: Allow memory space for configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e107638eac2a721bc024314ae79d4688edfc130 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 06:20:01 -0000 The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=2e107638eac2a721bc024314ae79d4688edfc130 commit 2e107638eac2a721bc024314ae79d4688edfc130 Author: Ka Ho Ng AuthorDate: 2021-03-20 07:40:55 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-03 06:09:50 +0000 virtio_pci_legacy: Allow memory space for configuration For guests running under some kind of VMMs, configuration structure is available in memory space but not I/O space. Reported by: Yuan Rui Reviewed by: rpokala, bryanv, jhb Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D28818 (cherry picked from commit cf5d1112408ddef3fdff8212599727c49ba90fa4) --- sys/dev/virtio/pci/virtio_pci_legacy.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c index d74983099110..a17dd22aa953 100644 --- a/sys/dev/virtio/pci/virtio_pci_legacy.c +++ b/sys/dev/virtio/pci/virtio_pci_legacy.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); struct vtpci_legacy_softc { device_t vtpci_dev; struct vtpci_common vtpci_common; + int vtpci_res_type; struct resource *vtpci_res; struct resource *vtpci_msix_table_res; struct resource *vtpci_msix_pba_res; @@ -231,7 +232,7 @@ vtpci_legacy_attach(device_t dev) error = vtpci_legacy_alloc_resources(sc); if (error) { - device_printf(dev, "cannot map I/O space\n"); + device_printf(dev, "cannot map I/O space nor memory space\n"); return (error); } @@ -601,14 +602,25 @@ vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc) static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) { + const int res_types[] = { SYS_RES_IOPORT, SYS_RES_MEMORY }; device_t dev; - int rid; + int rid, i; dev = sc->vtpci_dev; - rid = PCIR_BAR(0); - if ((sc->vtpci_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &rid, RF_ACTIVE)) == NULL) + /* + * Most hypervisors export the common configuration structure in IO + * space, but some use memory space; try both. + */ + for (i = 0; nitems(res_types); i++) { + rid = PCIR_BAR(0); + sc->vtpci_res_type = res_types[i]; + sc->vtpci_res = bus_alloc_resource_any(dev, res_types[i], &rid, + RF_ACTIVE); + if (sc->vtpci_res != NULL) + break; + } + if (sc->vtpci_res == NULL) return (ENXIO); return (0); @@ -622,7 +634,7 @@ vtpci_legacy_free_resources(struct vtpci_legacy_softc *sc) dev = sc->vtpci_dev; if (sc->vtpci_res != NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), + bus_release_resource(dev, sc->vtpci_res_type, PCIR_BAR(0), sc->vtpci_res); sc->vtpci_res = NULL; } From owner-dev-commits-src-all@freebsd.org Sat Apr 3 06:40:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFDB95C15CD; Sat, 3 Apr 2021 06:40:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FC6jv6Qk5z3HKJ; Sat, 3 Apr 2021 06:40:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA0886600; Sat, 3 Apr 2021 06:40:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1336eJHP068605; Sat, 3 Apr 2021 06:40:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1336eJGI068597; Sat, 3 Apr 2021 06:40:19 GMT (envelope-from git) Date: Sat, 3 Apr 2021 06:40:19 GMT Message-Id: <202104030640.1336eJGI068597@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Grehan Subject: git: ab899f8937c1 - main - Fix typo in xhci nvlist node name, and also increment device counter. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab899f8937c1c7c79197baf7192b727ddc9cfe54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 06:40:20 -0000 The branch main has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=ab899f8937c1c7c79197baf7192b727ddc9cfe54 commit ab899f8937c1c7c79197baf7192b727ddc9cfe54 Author: Peter Grehan AuthorDate: 2021-04-03 04:32:54 +0000 Commit: Peter Grehan CommitDate: 2021-04-03 04:32:54 +0000 Fix typo in xhci nvlist node name, and also increment device counter. This allows the xhci tablet device to be recognized and a PCI device instantiated. Reviewed by: jhb Fixes: 621b5090487d Refactor configuration management in bhyve. MFC after: 3 months. --- usr.sbin/bhyve/pci_xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_xhci.c b/usr.sbin/bhyve/pci_xhci.c index dd6dfc39d014..b71d66337048 100644 --- a/usr.sbin/bhyve/pci_xhci.c +++ b/usr.sbin/bhyve/pci_xhci.c @@ -2720,7 +2720,7 @@ pci_xhci_parse_devices(struct pci_xhci_softc *sc, nvlist_t *nvl) ndevices = 0; - slots_nvl = find_relative_config_node(nvl, "slots"); + slots_nvl = find_relative_config_node(nvl, "slot"); if (slots_nvl == NULL) goto portsfinal; @@ -2806,6 +2806,7 @@ pci_xhci_parse_devices(struct pci_xhci_softc *sc, nvlist_t *nvl) dev->dev_sc = devsc; XHCI_SLOTDEV_PTR(sc, slot) = dev; + ndevices++; } portsfinal: From owner-dev-commits-src-all@freebsd.org Sat Apr 3 11:29:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25CE45B12C4; Sat, 3 Apr 2021 11:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCF7p0WSkz3r1J; Sat, 3 Apr 2021 11:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0486412175; Sat, 3 Apr 2021 11:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133BTfpQ068096; Sat, 3 Apr 2021 11:29:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133BTfvY068095; Sat, 3 Apr 2021 11:29:41 GMT (envelope-from git) Date: Sat, 3 Apr 2021 11:29:41 GMT Message-Id: <202104031129.133BTfvY068095@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 7f8acc8d3d3a - stable/13 - zfs: Cherry-pick upstream commit ef977fce6636 to fix macOS/arm64 bootstrap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7f8acc8d3d3a5094cd4055f39ad05fc753a90707 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 11:29:42 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=7f8acc8d3d3a5094cd4055f39ad05fc753a90707 commit 7f8acc8d3d3a5094cd4055f39ad05fc753a90707 Author: Jessica Clarke AuthorDate: 2021-03-27 02:23:59 +0000 Commit: Jessica Clarke CommitDate: 2021-04-03 11:29:31 +0000 zfs: Cherry-pick upstream commit ef977fce6636 to fix macOS/arm64 bootstrap Upstream commit message: Support running FreeBSD buildworld on Arm-based macOS hosts Arm-based Macs are like FreeBSD and provide a full 64-bit stat from the start, so have no stat64 variants. Thus, define stat64 and fstat64 as aliases for the normal versions. Reviewed-by: Ryan Moeller Signed-off-by: Jessica Clarke Closes #11771 (cherry picked from commit 3a314eb5bb444ec019457e5aefaabb656fcb3d54) --- sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h index 07f9762f09ee..38c684d62a1b 100644 --- a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h +++ b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h @@ -29,6 +29,7 @@ #include_next /* Note: this file can be used on linux/macOS when bootstrapping tools. */ + #if defined(__FreeBSD__) #include /* for BLKGETSIZE64 */ @@ -71,4 +72,14 @@ fstat64_blk(int fd, struct stat64 *st) return (0); } #endif /* defined(__FreeBSD__) */ + +/* + * Only Intel-based Macs have a separate stat64; Arm-based Macs are like + * FreeBSD and have a full 64-bit stat from the start. + */ +#if defined(__APPLE__) && !(defined(__i386__) || defined(__x86_64__)) +#define stat64 stat +#define fstat64 fstat +#endif + #endif /* _LIBSPL_SYS_STAT_H */ From owner-dev-commits-src-all@freebsd.org Sat Apr 3 12:06:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 399785B315B; Sat, 3 Apr 2021 12:06:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCFyJ1B6Pz3v8f; Sat, 3 Apr 2021 12:06:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AC5512CDC; Sat, 3 Apr 2021 12:06:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133C6WF1024512; Sat, 3 Apr 2021 12:06:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133C6VBK024511; Sat, 3 Apr 2021 12:06:31 GMT (envelope-from git) Date: Sat, 3 Apr 2021 12:06:31 GMT Message-Id: <202104031206.133C6VBK024511@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: bfd8b9b826cb - main - pam: add option to not prompt for password if it's set to empty MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bfd8b9b826cb302759ef48e7a5adfd0c260c82d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 12:06:32 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=bfd8b9b826cb302759ef48e7a5adfd0c260c82d8 commit bfd8b9b826cb302759ef48e7a5adfd0c260c82d8 Author: Edward Tomasz Napierala AuthorDate: 2021-04-03 12:01:45 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-03 12:05:50 +0000 pam: add option to not prompt for password if it's set to empty Add a new option to pam_unix(8), "emptyok", which makes it not prompt for password, if it's set to an empty one. It is similar to "nullok", which makes it not prompt for password if the hash itself is empty. Reviewed By: markj Sponsored By: NetApp, Inc. Sponsored By: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27569 --- lib/libpam/libpam/security/pam_mod_misc.h | 1 + lib/libpam/modules/pam_unix/pam_unix.8 | 12 +++++++++++- lib/libpam/modules/pam_unix/pam_unix.c | 10 ++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/libpam/libpam/security/pam_mod_misc.h b/lib/libpam/libpam/security/pam_mod_misc.h index 08c9c1ab8f56..ff0cdc2dc8ea 100644 --- a/lib/libpam/libpam/security/pam_mod_misc.h +++ b/lib/libpam/libpam/security/pam_mod_misc.h @@ -37,6 +37,7 @@ * Common option names */ #define PAM_OPT_NULLOK "nullok" +#define PAM_OPT_EMPTYOK "emptyok" #define PAM_OPT_AUTH_AS_SELF "auth_as_self" #define PAM_OPT_ECHO_PASS "echo_pass" #define PAM_OPT_DEBUG "debug" diff --git a/lib/libpam/modules/pam_unix/pam_unix.8 b/lib/libpam/modules/pam_unix/pam_unix.8 index 1345e82296c0..03f8feaf4ba9 100644 --- a/lib/libpam/modules/pam_unix/pam_unix.8 +++ b/lib/libpam/modules/pam_unix/pam_unix.8 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 20, 2009 +.Dd April 3, 2020 .Dt PAM_UNIX 8 .Os .Sh NAME @@ -116,6 +116,16 @@ privileges), the option may cause .Nm to allow any user to log in with any password. +.It Cm emptyok +If the password database contains the password for the entity being +authenticated, but the password matches an empty string, +then this option will forgo password prompting, and +silently allow authentication to succeed. +.Pp +The difference between this and +.Cm nullok +is that it avoids prompting for password when the password is set +to an empty string, as opposed to not being set. .It Cm local_pass Use only the local password database, even if NIS is in use. This will cause an authentication failure if the system is configured diff --git a/lib/libpam/modules/pam_unix/pam_unix.c b/lib/libpam/modules/pam_unix/pam_unix.c index ecdd10772155..29588f0af1ea 100644 --- a/lib/libpam/modules/pam_unix/pam_unix.c +++ b/lib/libpam/modules/pam_unix/pam_unix.c @@ -94,6 +94,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, struct passwd *pwd; int retval; const char *pass, *user, *realpw, *prompt; + const char *emptypasswd = ""; if (openpam_get_option(pamh, PAM_OPT_AUTH_AS_SELF)) { user = getlogin(); @@ -116,6 +117,15 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, PAM_LOG("Password is empty, using fake password"); realpw = "*"; } + /* + * Check whether the saved password hash matches the one + * generated from an empty password - as opposed to empty + * saved password hash, which is handled above. + */ + if (!(flags & PAM_DISALLOW_NULL_AUTHTOK) && + openpam_get_option(pamh, PAM_OPT_EMPTYOK) && + strcmp(crypt(emptypasswd, realpw), realpw) == 0) + return (PAM_SUCCESS); lc = login_getpwclass(pwd); } else { PAM_LOG("Doing dummy authentication"); From owner-dev-commits-src-all@freebsd.org Sat Apr 3 12:27:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FC495B3CE4; Sat, 3 Apr 2021 12:27:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCGQZ36pDz3w8D; Sat, 3 Apr 2021 12:27:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5912D130C1; Sat, 3 Apr 2021 12:27:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133CRYtq052031; Sat, 3 Apr 2021 12:27:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133CRYbN052030; Sat, 3 Apr 2021 12:27:34 GMT (envelope-from git) Date: Sat, 3 Apr 2021 12:27:34 GMT Message-Id: <202104031227.133CRYbN052030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 7f6157f7fd12 - main - lock_delay(9): improve interaction with restrict_starvation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7f6157f7fd12608ccb96c8a571b9352bf9968d8f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 12:27:34 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=7f6157f7fd12608ccb96c8a571b9352bf9968d8f commit 7f6157f7fd12608ccb96c8a571b9352bf9968d8f Author: Edward Tomasz Napierala AuthorDate: 2021-04-03 12:08:45 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-03 12:08:53 +0000 lock_delay(9): improve interaction with restrict_starvation After e7a5b3bd058, the la->delay value was adjusted after being set by the starvation_limit code block, which is wrong. Reported By: avg Reviewed By: avg Fixes: e7a5b3bd058 Sponsored By: NetApp, Inc. Sponsored By: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D29513 --- sys/kern/subr_lock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index 8b08c61715b3..1afaa19302ed 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -130,17 +130,17 @@ lock_delay(struct lock_delay_arg *la) for (i = la->delay; i > 0; i--) cpu_spinwait(); - la->spin_cnt += la->delay; + + la->delay <<= 1; + if (__predict_false(la->delay > lc->max)) + la->delay = lc->max; + if (__predict_false(la->spin_cnt > starvation_limit)) { SDT_PROBE1(lock, , , starvation, la->delay); if (restrict_starvation) la->delay = lc->base; } - - la->delay <<= 1; - if (__predict_false(la->delay > lc->max)) - la->delay = lc->max; } static u_int From owner-dev-commits-src-all@freebsd.org Sat Apr 3 15:14:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D2705B6AD5; Sat, 3 Apr 2021 15:14:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCL6s2bnRz4Yxs; Sat, 3 Apr 2021 15:14:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AB6B149E3; Sat, 3 Apr 2021 15:14:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133FEDe6089276; Sat, 3 Apr 2021 15:14:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133FED2n089275; Sat, 3 Apr 2021 15:14:13 GMT (envelope-from git) Date: Sat, 3 Apr 2021 15:14:13 GMT Message-Id: <202104031514.133FED2n089275@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 69f4805c3698 - stable/13 - sendfile: Fix error initialization in sendfile_getobj() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 69f4805c3698407a7cb3e107e37823c08419915d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 15:14:13 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=69f4805c3698407a7cb3e107e37823c08419915d commit 69f4805c3698407a7cb3e107e37823c08419915d Author: Mark Johnston AuthorDate: 2021-04-02 21:12:56 +0000 Commit: Mark Johnston CommitDate: 2021-04-03 15:11:39 +0000 sendfile: Fix error initialization in sendfile_getobj() Reviewed by: chs, kib Reported by: jhb Fixes: faa998f6ff695 Differential Revision: https://reviews.freebsd.org/D29540 (cherry picked from commit 52a99c72b5e1e58a8297d1e62854a5b765dc7d33) --- sys/kern/kern_sendfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 95bfba0538dc..520b7c9c62d0 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -571,6 +571,7 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, struct shmfd *shmfd; int error; + error = 0; vp = *vp_res = NULL; obj = NULL; shmfd = *shmfd_res = NULL; @@ -610,7 +611,6 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, VM_OBJECT_RLOCK(obj); } } else if (fp->f_type == DTYPE_SHM) { - error = 0; shmfd = fp->f_data; obj = shmfd->shm_object; VM_OBJECT_RLOCK(obj); From owner-dev-commits-src-all@freebsd.org Sat Apr 3 15:14:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8ABB45B65FE; Sat, 3 Apr 2021 15:14:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCL6t3XwQz4YvN; Sat, 3 Apr 2021 15:14:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C6A114DF7; Sat, 3 Apr 2021 15:14:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133FEEJD089301; Sat, 3 Apr 2021 15:14:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133FEE62089300; Sat, 3 Apr 2021 15:14:14 GMT (envelope-from git) Date: Sat, 3 Apr 2021 15:14:14 GMT Message-Id: <202104031514.133FEE62089300@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: cbadf77834e1 - stable/13 - libctf: Fix an out-of-bounds read in ctf_lookup_by_name() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cbadf77834e145d42ff9805694c4fccd44df7f8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 15:14:14 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cbadf77834e145d42ff9805694c4fccd44df7f8b commit cbadf77834e145d42ff9805694c4fccd44df7f8b Author: Domagoj Stolfa AuthorDate: 2021-03-27 18:04:12 +0000 Commit: Mark Johnston CommitDate: 2021-04-03 15:11:55 +0000 libctf: Fix an out-of-bounds read in ctf_lookup_by_name() When prefixes such as struct, union, etc. are compared with the current type (e.g. struct foo), a comparison is made with the prefix. The code currently assumes that every type is a valid C type with a prefix, however at times, garbage ends up in this function causing an unpredictable crash with DTrace due to the isspace(*p) call or subsequent calls. An example that I've seen of this is the letter 's' being passed in, comparing true with struct as the comparison size was (q - p) == 1, but then we increment p with the length of "struct", resulting in an out of bounds read. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D29435 (cherry picked from commit 410556f1f10fd35b350102725fd8504c3cb0afc8) --- cddl/contrib/opensolaris/common/ctf/ctf_lookup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c b/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c index aa58663309b6..5912cc1a36e8 100644 --- a/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c +++ b/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c @@ -132,8 +132,9 @@ ctf_lookup_by_name(ctf_file_t *fp, const char *name) continue; /* skip qualifier keyword */ for (lp = fp->ctf_lookups; lp->ctl_prefix != NULL; lp++) { - if (lp->ctl_prefix[0] == '\0' || - strncmp(p, lp->ctl_prefix, (size_t)(q - p)) == 0) { + if ((size_t)(q - p) >= lp->ctl_len && + (lp->ctl_prefix[0] == '\0' || + strncmp(p, lp->ctl_prefix, (size_t)(q - p)) == 0)) { for (p += lp->ctl_len; isspace(*p); p++) continue; /* skip prefix and next ws */ From owner-dev-commits-src-all@freebsd.org Sat Apr 3 15:14:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 070E45B6E8A; Sat, 3 Apr 2021 15:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCL6v5f8dz4ZBT; Sat, 3 Apr 2021 15:14:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1CEC149E4; Sat, 3 Apr 2021 15:14:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133FEF8W089323; Sat, 3 Apr 2021 15:14:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133FEF6U089322; Sat, 3 Apr 2021 15:14:15 GMT (envelope-from git) Date: Sat, 3 Apr 2021 15:14:15 GMT Message-Id: <202104031514.133FEF6U089322@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e3b1b9d625ca - stable/13 - libctf: Adjust logic to match upstream after 410556f1f MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e3b1b9d625ca6e816b91e0e58142cfc7743cacb8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 15:14:16 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e3b1b9d625ca6e816b91e0e58142cfc7743cacb8 commit e3b1b9d625ca6e816b91e0e58142cfc7743cacb8 Author: Mark Johnston AuthorDate: 2021-03-28 00:36:44 +0000 Commit: Mark Johnston CommitDate: 2021-04-03 15:12:09 +0000 libctf: Adjust logic to match upstream after 410556f1f No functional change intended. Suggested by: jrtc27 (cherry picked from commit 3c065eeaa7a5ebb56991f5c8123e343a83bf0f0d) --- cddl/contrib/opensolaris/common/ctf/ctf_lookup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c b/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c index 5912cc1a36e8..cd9c71436938 100644 --- a/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c +++ b/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c @@ -132,9 +132,9 @@ ctf_lookup_by_name(ctf_file_t *fp, const char *name) continue; /* skip qualifier keyword */ for (lp = fp->ctf_lookups; lp->ctl_prefix != NULL; lp++) { - if ((size_t)(q - p) >= lp->ctl_len && - (lp->ctl_prefix[0] == '\0' || - strncmp(p, lp->ctl_prefix, (size_t)(q - p)) == 0)) { + if (lp->ctl_prefix[0] == '\0' || + ((size_t)(q - p) >= lp->ctl_len && strncmp(p, + lp->ctl_prefix, (size_t)(q - p)) == 0)) { for (p += lp->ctl_len; isspace(*p); p++) continue; /* skip prefix and next ws */ From owner-dev-commits-src-all@freebsd.org Sat Apr 3 15:14:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AD565B6C70; Sat, 3 Apr 2021 15:14:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCL6w73Kdz4ZH9; Sat, 3 Apr 2021 15:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABA8F1528C; Sat, 3 Apr 2021 15:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133FEGev089348; Sat, 3 Apr 2021 15:14:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133FEGKH089347; Sat, 3 Apr 2021 15:14:16 GMT (envelope-from git) Date: Sat, 3 Apr 2021 15:14:16 GMT Message-Id: <202104031514.133FEGKH089347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: ca20444e2ad6 - stable/13 - vfs: Add an assertion around name length limits MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ca20444e2ad664c34bb12f1a24f4ca6dc407a5bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 15:14:22 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ca20444e2ad664c34bb12f1a24f4ca6dc407a5bc commit ca20444e2ad664c34bb12f1a24f4ca6dc407a5bc Author: Mark Johnston AuthorDate: 2021-03-27 17:42:48 +0000 Commit: Mark Johnston CommitDate: 2021-04-03 15:12:21 +0000 vfs: Add an assertion around name length limits Some filesystems assume that they can copy a name component, with length bounded by NAME_MAX, into a dirent buffer of size MAXNAMLEN. These constants have the same value; add a compile-time assertion to that effect. Reported by: Alexey Kulaev Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29431 (cherry picked from commit 71c160a8f614fa4812838002ba9d266af3cf988c) --- sys/kern/vfs_lookup.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index e881e8f909a4..07c89e634de4 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -747,6 +748,14 @@ needs_exclusive_leaf(struct mount *mp, int flags) return (0); } +/* + * Various filesystems expect to be able to copy a name component with length + * bounded by NAME_MAX into a directory entry buffer of size MAXNAMLEN. Make + * sure that these are the same size. + */ +_Static_assert(MAXNAMLEN == NAME_MAX, + "MAXNAMLEN and NAME_MAX have different values"); + /* * Search a pathname. * This is a very central and rather complicated routine. From owner-dev-commits-src-all@freebsd.org Sat Apr 3 20:22:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 750505BE432; Sat, 3 Apr 2021 20:22:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCSyz2fcrz4tJd; Sat, 3 Apr 2021 20:22:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B90B19144; Sat, 3 Apr 2021 20:22:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133KMpZe023440; Sat, 3 Apr 2021 20:22:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133KMpoF023439; Sat, 3 Apr 2021 20:22:51 GMT (envelope-from git) Date: Sat, 3 Apr 2021 20:22:51 GMT Message-Id: <202104032022.133KMpoF023439@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 29e54af43ee0 - main - libc: use standard LF line endings, not CRLF MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29e54af43ee06ed5636b9f567795cd271efc1ef7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 20:22:51 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=29e54af43ee06ed5636b9f567795cd271efc1ef7 commit 29e54af43ee06ed5636b9f567795cd271efc1ef7 Author: Ed Maste AuthorDate: 2021-03-31 17:04:36 +0000 Commit: Ed Maste CommitDate: 2021-04-03 20:20:07 +0000 libc: use standard LF line endings, not CRLF --- lib/libc/softfloat/templates/milieu.h | 98 +-- lib/libc/softfloat/templates/softfloat-specialize | 930 +++++++++++----------- lib/libc/softfloat/templates/softfloat.h | 582 +++++++------- 3 files changed, 805 insertions(+), 805 deletions(-) diff --git a/lib/libc/softfloat/templates/milieu.h b/lib/libc/softfloat/templates/milieu.h index b7bd8e5f5f41..914efdf4fe7b 100644 --- a/lib/libc/softfloat/templates/milieu.h +++ b/lib/libc/softfloat/templates/milieu.h @@ -1,49 +1,49 @@ -/* $FreeBSD$ */ - -/* -=============================================================================== - -This C header file is part of the SoftFloat IEC/IEEE Floating-point -Arithmetic Package, Release 2a. - -Written by John R. Hauser. This work was made possible in part by the -International Computer Science Institute, located at Suite 600, 1947 Center -Street, Berkeley, California 94704. Funding was partially provided by the -National Science Foundation under grant MIP-9311980. The original version -of this code was written as part of a project to build a fixed-point vector -processor in collaboration with the University of California at Berkeley, -overseen by Profs. Nelson Morgan and John Wawrzynek. More information -is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/ -arithmetic/SoftFloat.html'. - -THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort -has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT -TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO -PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY -AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. - -Derivative works are acceptable, even for commercial purposes, so long as -(1) they include prominent notice that the work is derivative, and (2) they -include prominent notice akin to these four paragraphs for those parts of -this code that are retained. - -=============================================================================== -*/ - -/* -------------------------------------------------------------------------------- -Include common integer types and flags. -------------------------------------------------------------------------------- -*/ -#include "../../../processors/!!!processor.h" - -/* -------------------------------------------------------------------------------- -Symbolic Boolean literals. -------------------------------------------------------------------------------- -*/ -enum { - FALSE = 0, - TRUE = 1 -}; - +/* $FreeBSD$ */ + +/* +=============================================================================== + +This C header file is part of the SoftFloat IEC/IEEE Floating-point +Arithmetic Package, Release 2a. + +Written by John R. Hauser. This work was made possible in part by the +International Computer Science Institute, located at Suite 600, 1947 Center +Street, Berkeley, California 94704. Funding was partially provided by the +National Science Foundation under grant MIP-9311980. The original version +of this code was written as part of a project to build a fixed-point vector +processor in collaboration with the University of California at Berkeley, +overseen by Profs. Nelson Morgan and John Wawrzynek. More information +is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/ +arithmetic/SoftFloat.html'. + +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. + +Derivative works are acceptable, even for commercial purposes, so long as +(1) they include prominent notice that the work is derivative, and (2) they +include prominent notice akin to these four paragraphs for those parts of +this code that are retained. + +=============================================================================== +*/ + +/* +------------------------------------------------------------------------------- +Include common integer types and flags. +------------------------------------------------------------------------------- +*/ +#include "../../../processors/!!!processor.h" + +/* +------------------------------------------------------------------------------- +Symbolic Boolean literals. +------------------------------------------------------------------------------- +*/ +enum { + FALSE = 0, + TRUE = 1 +}; + diff --git a/lib/libc/softfloat/templates/softfloat-specialize b/lib/libc/softfloat/templates/softfloat-specialize index a1dc4de86a53..b1a39021734f 100644 --- a/lib/libc/softfloat/templates/softfloat-specialize +++ b/lib/libc/softfloat/templates/softfloat-specialize @@ -1,465 +1,465 @@ -/* $FreeBSD$ */ - -/* -=============================================================================== - -This C source fragment is part of the SoftFloat IEC/IEEE Floating-point -Arithmetic Package, Release 2a. - -Written by John R. Hauser. This work was made possible in part by the -International Computer Science Institute, located at Suite 600, 1947 Center -Street, Berkeley, California 94704. Funding was partially provided by the -National Science Foundation under grant MIP-9311980. The original version -of this code was written as part of a project to build a fixed-point vector -processor in collaboration with the University of California at Berkeley, -overseen by Profs. Nelson Morgan and John Wawrzynek. More information -is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/ -arithmetic/SoftFloat.html'. - -THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort -has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT -TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO -PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY -AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. - -Derivative works are acceptable, even for commercial purposes, so long as -(1) they include prominent notice that the work is derivative, and (2) they -include prominent notice akin to these four paragraphs for those parts of -this code that are retained. - -=============================================================================== -*/ - -/* -------------------------------------------------------------------------------- -Underflow tininess-detection mode, statically initialized to default value. -(The declaration in `softfloat.h' must match the `int8' type here.) -------------------------------------------------------------------------------- -*/ -int8 float_detect_tininess = float_tininess_after_rounding; - -/* -------------------------------------------------------------------------------- -Raises the exceptions specified by `flags'. Floating-point traps can be -defined here if desired. It is currently not possible for such a trap to -substitute a result value. If traps are not implemented, this routine -should be simply `float_exception_flags |= flags;'. -------------------------------------------------------------------------------- -*/ -void float_raise( int8 flags ) -{ - - float_exception_flags |= flags; - -} - -/* -------------------------------------------------------------------------------- -Internal canonical NaN format. -------------------------------------------------------------------------------- -*/ -typedef struct { - flag sign; - bits64 high, low; -} commonNaNT; - -/* -------------------------------------------------------------------------------- -The pattern for a default generated single-precision NaN. -------------------------------------------------------------------------------- -*/ -#define float32_default_nan 0xFFFFFFFF - -/* -------------------------------------------------------------------------------- -Returns 1 if the single-precision floating-point value `a' is a NaN; -otherwise returns 0. -------------------------------------------------------------------------------- -*/ -flag float32_is_nan( float32 a ) -{ - - return ( 0xFF000000 < (bits32) ( a<<1 ) ); - -} - -/* -------------------------------------------------------------------------------- -Returns 1 if the single-precision floating-point value `a' is a signaling -NaN; otherwise returns 0. -------------------------------------------------------------------------------- -*/ -flag float32_is_signaling_nan( float32 a ) -{ - - return ( ( ( a>>22 ) & 0x1FF ) == 0x1FE ) && ( a & 0x003FFFFF ); - -} - -/* -------------------------------------------------------------------------------- -Returns the result of converting the single-precision floating-point NaN -`a' to the canonical NaN format. If `a' is a signaling NaN, the invalid -exception is raised. -------------------------------------------------------------------------------- -*/ -static commonNaNT float32ToCommonNaN( float32 a ) -{ - commonNaNT z; - - if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); - z.sign = a>>31; - z.low = 0; - z.high = ( (bits64) a )<<41; - return z; - -} - -/* -------------------------------------------------------------------------------- -Returns the result of converting the canonical NaN `a' to the single- -precision floating-point format. -------------------------------------------------------------------------------- -*/ -static float32 commonNaNToFloat32( commonNaNT a ) -{ - - return ( ( (bits32) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>41 ); - -} - -/* -------------------------------------------------------------------------------- -Takes two single-precision floating-point values `a' and `b', one of which -is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a -signaling NaN, the invalid exception is raised. -------------------------------------------------------------------------------- -*/ -static float32 propagateFloat32NaN( float32 a, float32 b ) -{ - flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; - - aIsNaN = float32_is_nan( a ); - aIsSignalingNaN = float32_is_signaling_nan( a ); - bIsNaN = float32_is_nan( b ); - bIsSignalingNaN = float32_is_signaling_nan( b ); - a |= 0x00400000; - b |= 0x00400000; - if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); - if ( aIsNaN ) { - return ( aIsSignalingNaN & bIsNaN ) ? b : a; - } - else { - return b; - } - -} - -/* -------------------------------------------------------------------------------- -The pattern for a default generated double-precision NaN. -------------------------------------------------------------------------------- -*/ -#define float64_default_nan LIT64( 0xFFFFFFFFFFFFFFFF ) - -/* -------------------------------------------------------------------------------- -Returns 1 if the double-precision floating-point value `a' is a NaN; -otherwise returns 0. -------------------------------------------------------------------------------- -*/ -flag float64_is_nan( float64 a ) -{ - - return ( LIT64( 0xFFE0000000000000 ) < (bits64) ( a<<1 ) ); - -} - -/* -------------------------------------------------------------------------------- -Returns 1 if the double-precision floating-point value `a' is a signaling -NaN; otherwise returns 0. -------------------------------------------------------------------------------- -*/ -flag float64_is_signaling_nan( float64 a ) -{ - - return - ( ( ( a>>51 ) & 0xFFF ) == 0xFFE ) - && ( a & LIT64( 0x0007FFFFFFFFFFFF ) ); - -} - -/* -------------------------------------------------------------------------------- -Returns the result of converting the double-precision floating-point NaN -`a' to the canonical NaN format. If `a' is a signaling NaN, the invalid -exception is raised. -------------------------------------------------------------------------------- -*/ -static commonNaNT float64ToCommonNaN( float64 a ) -{ - commonNaNT z; - - if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); - z.sign = a>>63; - z.low = 0; - z.high = a<<12; - return z; - -} - -/* -------------------------------------------------------------------------------- -Returns the result of converting the canonical NaN `a' to the double- -precision floating-point format. -------------------------------------------------------------------------------- -*/ -static float64 commonNaNToFloat64( commonNaNT a ) -{ - - return - ( ( (bits64) a.sign )<<63 ) - | LIT64( 0x7FF8000000000000 ) - | ( a.high>>12 ); - -} - -/* -------------------------------------------------------------------------------- -Takes two double-precision floating-point values `a' and `b', one of which -is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a -signaling NaN, the invalid exception is raised. -------------------------------------------------------------------------------- -*/ -static float64 propagateFloat64NaN( float64 a, float64 b ) -{ - flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; - - aIsNaN = float64_is_nan( a ); - aIsSignalingNaN = float64_is_signaling_nan( a ); - bIsNaN = float64_is_nan( b ); - bIsSignalingNaN = float64_is_signaling_nan( b ); - a |= LIT64( 0x0008000000000000 ); - b |= LIT64( 0x0008000000000000 ); - if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); - if ( aIsNaN ) { - return ( aIsSignalingNaN & bIsNaN ) ? b : a; - } - else { - return b; - } - -} - -#ifdef FLOATX80 - -/* -------------------------------------------------------------------------------- -The pattern for a default generated extended double-precision NaN. The -`high' and `low' values hold the most- and least-significant bits, -respectively. -------------------------------------------------------------------------------- -*/ -#define floatx80_default_nan_high 0xFFFF -#define floatx80_default_nan_low LIT64( 0xFFFFFFFFFFFFFFFF ) - -/* -------------------------------------------------------------------------------- -Returns 1 if the extended double-precision floating-point value `a' is a -NaN; otherwise returns 0. -------------------------------------------------------------------------------- -*/ -flag floatx80_is_nan( floatx80 a ) -{ - - return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 ); - -} - -/* -------------------------------------------------------------------------------- -Returns 1 if the extended double-precision floating-point value `a' is a -signaling NaN; otherwise returns 0. -------------------------------------------------------------------------------- -*/ -flag floatx80_is_signaling_nan( floatx80 a ) -{ - bits64 aLow; - - aLow = a.low & ~ LIT64( 0x4000000000000000 ); - return - ( ( a.high & 0x7FFF ) == 0x7FFF ) - && (bits64) ( aLow<<1 ) - && ( a.low == aLow ); - -} - -/* -------------------------------------------------------------------------------- -Returns the result of converting the extended double-precision floating- -point NaN `a' to the canonical NaN format. If `a' is a signaling NaN, the -invalid exception is raised. -------------------------------------------------------------------------------- -*/ -static commonNaNT floatx80ToCommonNaN( floatx80 a ) -{ - commonNaNT z; - - if ( floatx80_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); - z.sign = a.high>>15; - z.low = 0; - z.high = a.low<<1; - return z; - -} - -/* -------------------------------------------------------------------------------- -Returns the result of converting the canonical NaN `a' to the extended -double-precision floating-point format. -------------------------------------------------------------------------------- -*/ -static floatx80 commonNaNToFloatx80( commonNaNT a ) -{ - floatx80 z; - - z.low = LIT64( 0xC000000000000000 ) | ( a.high>>1 ); - z.high = ( ( (bits16) a.sign )<<15 ) | 0x7FFF; - return z; - -} - -/* -------------------------------------------------------------------------------- -Takes two extended double-precision floating-point values `a' and `b', one -of which is a NaN, and returns the appropriate NaN result. If either `a' or -`b' is a signaling NaN, the invalid exception is raised. -------------------------------------------------------------------------------- -*/ -static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b ) -{ - flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; - - aIsNaN = floatx80_is_nan( a ); - aIsSignalingNaN = floatx80_is_signaling_nan( a ); - bIsNaN = floatx80_is_nan( b ); - bIsSignalingNaN = floatx80_is_signaling_nan( b ); - a.low |= LIT64( 0xC000000000000000 ); - b.low |= LIT64( 0xC000000000000000 ); - if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); - if ( aIsNaN ) { - return ( aIsSignalingNaN & bIsNaN ) ? b : a; - } - else { - return b; - } - -} - -#endif - -#ifdef FLOAT128 - -/* -------------------------------------------------------------------------------- -The pattern for a default generated quadruple-precision NaN. The `high' and -`low' values hold the most- and least-significant bits, respectively. -------------------------------------------------------------------------------- -*/ -#define float128_default_nan_high LIT64( 0xFFFFFFFFFFFFFFFF ) -#define float128_default_nan_low LIT64( 0xFFFFFFFFFFFFFFFF ) - -/* -------------------------------------------------------------------------------- -Returns 1 if the quadruple-precision floating-point value `a' is a NaN; -otherwise returns 0. -------------------------------------------------------------------------------- -*/ -flag float128_is_nan( float128 a ) -{ - - return - ( LIT64( 0xFFFE000000000000 ) <= (bits64) ( a.high<<1 ) ) - && ( a.low || ( a.high & LIT64( 0x0000FFFFFFFFFFFF ) ) ); - -} - -/* -------------------------------------------------------------------------------- -Returns 1 if the quadruple-precision floating-point value `a' is a -signaling NaN; otherwise returns 0. -------------------------------------------------------------------------------- -*/ -flag float128_is_signaling_nan( float128 a ) -{ - - return - ( ( ( a.high>>47 ) & 0xFFFF ) == 0xFFFE ) - && ( a.low || ( a.high & LIT64( 0x00007FFFFFFFFFFF ) ) ); - -} - -/* -------------------------------------------------------------------------------- -Returns the result of converting the quadruple-precision floating-point NaN -`a' to the canonical NaN format. If `a' is a signaling NaN, the invalid -exception is raised. -------------------------------------------------------------------------------- -*/ -static commonNaNT float128ToCommonNaN( float128 a ) -{ - commonNaNT z; - - if ( float128_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); - z.sign = a.high>>63; - shortShift128Left( a.high, a.low, 16, &z.high, &z.low ); - return z; - -} - -/* -------------------------------------------------------------------------------- -Returns the result of converting the canonical NaN `a' to the quadruple- -precision floating-point format. -------------------------------------------------------------------------------- -*/ -static float128 commonNaNToFloat128( commonNaNT a ) -{ - float128 z; - - shift128Right( a.high, a.low, 16, &z.high, &z.low ); - z.high |= ( ( (bits64) a.sign )<<63 ) | LIT64( 0x7FFF800000000000 ); - return z; - -} - -/* -------------------------------------------------------------------------------- -Takes two quadruple-precision floating-point values `a' and `b', one of -which is a NaN, and returns the appropriate NaN result. If either `a' or -`b' is a signaling NaN, the invalid exception is raised. -------------------------------------------------------------------------------- -*/ -static float128 propagateFloat128NaN( float128 a, float128 b ) -{ - flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; - - aIsNaN = float128_is_nan( a ); - aIsSignalingNaN = float128_is_signaling_nan( a ); - bIsNaN = float128_is_nan( b ); - bIsSignalingNaN = float128_is_signaling_nan( b ); - a.high |= LIT64( 0x0000800000000000 ); - b.high |= LIT64( 0x0000800000000000 ); - if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); - if ( aIsNaN ) { - return ( aIsSignalingNaN & bIsNaN ) ? b : a; - } - else { - return b; - } - -} - -#endif - +/* $FreeBSD$ */ + +/* +=============================================================================== + +This C source fragment is part of the SoftFloat IEC/IEEE Floating-point +Arithmetic Package, Release 2a. + +Written by John R. Hauser. This work was made possible in part by the +International Computer Science Institute, located at Suite 600, 1947 Center +Street, Berkeley, California 94704. Funding was partially provided by the +National Science Foundation under grant MIP-9311980. The original version +of this code was written as part of a project to build a fixed-point vector +processor in collaboration with the University of California at Berkeley, +overseen by Profs. Nelson Morgan and John Wawrzynek. More information +is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/ +arithmetic/SoftFloat.html'. + +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. + +Derivative works are acceptable, even for commercial purposes, so long as +(1) they include prominent notice that the work is derivative, and (2) they +include prominent notice akin to these four paragraphs for those parts of +this code that are retained. + +=============================================================================== +*/ + +/* +------------------------------------------------------------------------------- +Underflow tininess-detection mode, statically initialized to default value. +(The declaration in `softfloat.h' must match the `int8' type here.) +------------------------------------------------------------------------------- +*/ +int8 float_detect_tininess = float_tininess_after_rounding; + +/* +------------------------------------------------------------------------------- +Raises the exceptions specified by `flags'. Floating-point traps can be +defined here if desired. It is currently not possible for such a trap to +substitute a result value. If traps are not implemented, this routine +should be simply `float_exception_flags |= flags;'. +------------------------------------------------------------------------------- +*/ +void float_raise( int8 flags ) +{ + + float_exception_flags |= flags; + +} + +/* +------------------------------------------------------------------------------- +Internal canonical NaN format. +------------------------------------------------------------------------------- +*/ +typedef struct { + flag sign; + bits64 high, low; +} commonNaNT; + +/* +------------------------------------------------------------------------------- +The pattern for a default generated single-precision NaN. +------------------------------------------------------------------------------- +*/ +#define float32_default_nan 0xFFFFFFFF + +/* +------------------------------------------------------------------------------- +Returns 1 if the single-precision floating-point value `a' is a NaN; +otherwise returns 0. +------------------------------------------------------------------------------- +*/ +flag float32_is_nan( float32 a ) +{ + + return ( 0xFF000000 < (bits32) ( a<<1 ) ); + +} + +/* +------------------------------------------------------------------------------- +Returns 1 if the single-precision floating-point value `a' is a signaling +NaN; otherwise returns 0. +------------------------------------------------------------------------------- +*/ +flag float32_is_signaling_nan( float32 a ) +{ + + return ( ( ( a>>22 ) & 0x1FF ) == 0x1FE ) && ( a & 0x003FFFFF ); + +} + +/* +------------------------------------------------------------------------------- +Returns the result of converting the single-precision floating-point NaN +`a' to the canonical NaN format. If `a' is a signaling NaN, the invalid +exception is raised. +------------------------------------------------------------------------------- +*/ +static commonNaNT float32ToCommonNaN( float32 a ) +{ + commonNaNT z; + + if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); + z.sign = a>>31; + z.low = 0; + z.high = ( (bits64) a )<<41; + return z; + +} + +/* +------------------------------------------------------------------------------- +Returns the result of converting the canonical NaN `a' to the single- +precision floating-point format. +------------------------------------------------------------------------------- +*/ +static float32 commonNaNToFloat32( commonNaNT a ) +{ + + return ( ( (bits32) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>41 ); + +} + +/* +------------------------------------------------------------------------------- +Takes two single-precision floating-point values `a' and `b', one of which +is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a +signaling NaN, the invalid exception is raised. +------------------------------------------------------------------------------- +*/ +static float32 propagateFloat32NaN( float32 a, float32 b ) +{ + flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; + + aIsNaN = float32_is_nan( a ); + aIsSignalingNaN = float32_is_signaling_nan( a ); + bIsNaN = float32_is_nan( b ); + bIsSignalingNaN = float32_is_signaling_nan( b ); + a |= 0x00400000; + b |= 0x00400000; + if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); + if ( aIsNaN ) { + return ( aIsSignalingNaN & bIsNaN ) ? b : a; + } + else { + return b; + } + +} + +/* +------------------------------------------------------------------------------- +The pattern for a default generated double-precision NaN. +------------------------------------------------------------------------------- +*/ +#define float64_default_nan LIT64( 0xFFFFFFFFFFFFFFFF ) + +/* +------------------------------------------------------------------------------- +Returns 1 if the double-precision floating-point value `a' is a NaN; +otherwise returns 0. +------------------------------------------------------------------------------- +*/ +flag float64_is_nan( float64 a ) +{ + + return ( LIT64( 0xFFE0000000000000 ) < (bits64) ( a<<1 ) ); + +} + +/* +------------------------------------------------------------------------------- +Returns 1 if the double-precision floating-point value `a' is a signaling +NaN; otherwise returns 0. +------------------------------------------------------------------------------- +*/ +flag float64_is_signaling_nan( float64 a ) +{ + + return + ( ( ( a>>51 ) & 0xFFF ) == 0xFFE ) + && ( a & LIT64( 0x0007FFFFFFFFFFFF ) ); + +} + +/* +------------------------------------------------------------------------------- +Returns the result of converting the double-precision floating-point NaN +`a' to the canonical NaN format. If `a' is a signaling NaN, the invalid +exception is raised. +------------------------------------------------------------------------------- +*/ +static commonNaNT float64ToCommonNaN( float64 a ) +{ + commonNaNT z; + + if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); + z.sign = a>>63; + z.low = 0; + z.high = a<<12; + return z; + +} + +/* +------------------------------------------------------------------------------- +Returns the result of converting the canonical NaN `a' to the double- +precision floating-point format. +------------------------------------------------------------------------------- +*/ +static float64 commonNaNToFloat64( commonNaNT a ) +{ + + return + ( ( (bits64) a.sign )<<63 ) + | LIT64( 0x7FF8000000000000 ) + | ( a.high>>12 ); + +} + +/* +------------------------------------------------------------------------------- +Takes two double-precision floating-point values `a' and `b', one of which +is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a +signaling NaN, the invalid exception is raised. +------------------------------------------------------------------------------- +*/ +static float64 propagateFloat64NaN( float64 a, float64 b ) +{ + flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; + + aIsNaN = float64_is_nan( a ); + aIsSignalingNaN = float64_is_signaling_nan( a ); + bIsNaN = float64_is_nan( b ); + bIsSignalingNaN = float64_is_signaling_nan( b ); + a |= LIT64( 0x0008000000000000 ); + b |= LIT64( 0x0008000000000000 ); + if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); + if ( aIsNaN ) { + return ( aIsSignalingNaN & bIsNaN ) ? b : a; + } + else { + return b; + } + +} + +#ifdef FLOATX80 + +/* +------------------------------------------------------------------------------- +The pattern for a default generated extended double-precision NaN. The +`high' and `low' values hold the most- and least-significant bits, +respectively. +------------------------------------------------------------------------------- +*/ +#define floatx80_default_nan_high 0xFFFF +#define floatx80_default_nan_low LIT64( 0xFFFFFFFFFFFFFFFF ) + +/* +------------------------------------------------------------------------------- +Returns 1 if the extended double-precision floating-point value `a' is a +NaN; otherwise returns 0. +------------------------------------------------------------------------------- +*/ +flag floatx80_is_nan( floatx80 a ) +{ + + return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 ); + +} + +/* +------------------------------------------------------------------------------- +Returns 1 if the extended double-precision floating-point value `a' is a +signaling NaN; otherwise returns 0. +------------------------------------------------------------------------------- +*/ +flag floatx80_is_signaling_nan( floatx80 a ) +{ + bits64 aLow; + + aLow = a.low & ~ LIT64( 0x4000000000000000 ); + return + ( ( a.high & 0x7FFF ) == 0x7FFF ) + && (bits64) ( aLow<<1 ) + && ( a.low == aLow ); + +} + +/* +------------------------------------------------------------------------------- +Returns the result of converting the extended double-precision floating- +point NaN `a' to the canonical NaN format. If `a' is a signaling NaN, the +invalid exception is raised. +------------------------------------------------------------------------------- +*/ +static commonNaNT floatx80ToCommonNaN( floatx80 a ) +{ + commonNaNT z; + + if ( floatx80_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); + z.sign = a.high>>15; + z.low = 0; + z.high = a.low<<1; + return z; + +} + +/* +------------------------------------------------------------------------------- +Returns the result of converting the canonical NaN `a' to the extended +double-precision floating-point format. +------------------------------------------------------------------------------- +*/ +static floatx80 commonNaNToFloatx80( commonNaNT a ) +{ + floatx80 z; + + z.low = LIT64( 0xC000000000000000 ) | ( a.high>>1 ); + z.high = ( ( (bits16) a.sign )<<15 ) | 0x7FFF; + return z; + +} + +/* +------------------------------------------------------------------------------- +Takes two extended double-precision floating-point values `a' and `b', one +of which is a NaN, and returns the appropriate NaN result. If either `a' or +`b' is a signaling NaN, the invalid exception is raised. +------------------------------------------------------------------------------- +*/ +static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b ) +{ + flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; + + aIsNaN = floatx80_is_nan( a ); + aIsSignalingNaN = floatx80_is_signaling_nan( a ); + bIsNaN = floatx80_is_nan( b ); + bIsSignalingNaN = floatx80_is_signaling_nan( b ); + a.low |= LIT64( 0xC000000000000000 ); + b.low |= LIT64( 0xC000000000000000 ); + if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); + if ( aIsNaN ) { + return ( aIsSignalingNaN & bIsNaN ) ? b : a; + } + else { + return b; + } + +} + +#endif + +#ifdef FLOAT128 + +/* +------------------------------------------------------------------------------- +The pattern for a default generated quadruple-precision NaN. The `high' and +`low' values hold the most- and least-significant bits, respectively. +------------------------------------------------------------------------------- +*/ +#define float128_default_nan_high LIT64( 0xFFFFFFFFFFFFFFFF ) +#define float128_default_nan_low LIT64( 0xFFFFFFFFFFFFFFFF ) + +/* +------------------------------------------------------------------------------- +Returns 1 if the quadruple-precision floating-point value `a' is a NaN; +otherwise returns 0. +------------------------------------------------------------------------------- +*/ +flag float128_is_nan( float128 a ) +{ + + return + ( LIT64( 0xFFFE000000000000 ) <= (bits64) ( a.high<<1 ) ) + && ( a.low || ( a.high & LIT64( 0x0000FFFFFFFFFFFF ) ) ); + +} + +/* +------------------------------------------------------------------------------- +Returns 1 if the quadruple-precision floating-point value `a' is a +signaling NaN; otherwise returns 0. +------------------------------------------------------------------------------- +*/ +flag float128_is_signaling_nan( float128 a ) +{ + + return *** 655 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Apr 3 20:30:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 588C85BE644; Sat, 3 Apr 2021 20:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCT7k20cdz4tS0; Sat, 3 Apr 2021 20:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31F60193BB; Sat, 3 Apr 2021 20:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133KUQPQ032869; Sat, 3 Apr 2021 20:30:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133KUQ5Q032868; Sat, 3 Apr 2021 20:30:26 GMT (envelope-from git) Date: Sat, 3 Apr 2021 20:30:26 GMT Message-Id: <202104032030.133KUQ5Q032868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: a64096aa63ea - main - ffsinfo: Update example to avoid to-be-deprecated vinum MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a64096aa63ea1303ae8d20d4147b3b097071072f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 20:30:26 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a64096aa63ea1303ae8d20d4147b3b097071072f commit a64096aa63ea1303ae8d20d4147b3b097071072f Author: Ed Maste AuthorDate: 2021-03-29 00:04:29 +0000 Commit: Ed Maste CommitDate: 2021-04-03 20:29:14 +0000 ffsinfo: Update example to avoid to-be-deprecated vinum Reviewed by: mckusick MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29478 --- sbin/ffsinfo/ffsinfo.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/ffsinfo/ffsinfo.8 b/sbin/ffsinfo/ffsinfo.8 index 4bf5cdd1cb18..90580f5767d5 100644 --- a/sbin/ffsinfo/ffsinfo.8 +++ b/sbin/ffsinfo/ffsinfo.8 @@ -113,10 +113,10 @@ If is provided, output will be sent to stdout. .El .Sh EXAMPLES -.Dl ffsinfo -o /var/tmp/ffsinfo -l 1023 /dev/vinum/testvol +.Dl ffsinfo -o /var/tmp/ffsinfo -l 1023 /dev/md0 .Pp will dump -.Pa /dev/vinum/testvol +.Pa /dev/md0 to .Pa /var/tmp/ffsinfo with all available information. From owner-dev-commits-src-all@freebsd.org Sat Apr 3 21:50:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 881B65C04D9; Sat, 3 Apr 2021 21:50:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCVwB3Jp7z3Fhd; Sat, 3 Apr 2021 21:50:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62C191A22A; Sat, 3 Apr 2021 21:50:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133LoYfW044573; Sat, 3 Apr 2021 21:50:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133LoYvt044572; Sat, 3 Apr 2021 21:50:34 GMT (envelope-from git) Date: Sat, 3 Apr 2021 21:50:34 GMT Message-Id: <202104032150.133LoYvt044572@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2d223ccdaed6 - main - Remove kgmon(8) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d223ccdaed67ad336474f023a661c300bd0ef38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 21:50:34 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2d223ccdaed67ad336474f023a661c300bd0ef38 commit 2d223ccdaed67ad336474f023a661c300bd0ef38 Author: Konstantin Belousov AuthorDate: 2021-04-02 22:00:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-03 21:50:28 +0000 Remove kgmon(8) Follow-up to the removal of the mcov from kernel. Noted by: mckusick Reviewed by: mckusick Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D29563 --- ObsoleteFiles.inc | 4 + share/man/man4/hwpmc.4 | 10 +- share/man/man7/clocks.7 | 3 +- targets/pseudo/userland/Makefile.depend | 5 +- usr.sbin/Makefile.amd64 | 1 - usr.sbin/Makefile.arm | 1 - usr.sbin/Makefile.i386 | 1 - usr.sbin/kgmon/Makefile | 16 - usr.sbin/kgmon/Makefile.depend | 19 -- usr.sbin/kgmon/kgmon.8 | 130 -------- usr.sbin/kgmon/kgmon.c | 531 -------------------------------- 11 files changed, 7 insertions(+), 714 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index de5808958c69..3b251eee1457 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20210403: remove kgmon(8) +OLD_FILES+=usr/sbin/kgmon +OLD_FILES+=usr/share/man/man8/kgmon.8.gz + # 20210401: remove bt(4) man page OLD_FILES+=usr/share/man/man4/bt.4.gz diff --git a/share/man/man4/hwpmc.4 b/share/man/man4/hwpmc.4 index 5777cdd4264d..a5b4bcb94707 100644 --- a/share/man/man4/hwpmc.4 +++ b/share/man/man4/hwpmc.4 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 2, 2012 +.Dd Apryl 3, 2021 .Dt HWPMC 4 .Os .Sh NAME @@ -198,13 +198,6 @@ This modifier is valid only for a PMC being allocated in process-private mode. It signifies that the PMC will track hardware events for its target process and the target's current and future descendants. -.It Dv PMC_F_KGMON -This modifier is valid only for a PMC being allocated in system-wide -sampling mode. -It signifies that the PMC's sampling interrupt is to be used to drive -kernel profiling via -.Xr kgmon 8 . -This functionality is currently unimplemented. .It Dv PMC_F_LOG_PROCCSW This modifier is valid only for a PMC being allocated in process-private mode. @@ -764,7 +757,6 @@ operation is not being monitored by .Xr kenv 1 , .Xr pmc 3 , .Xr pmclog 3 , -.Xr kgmon 8 , .Xr kldload 8 , .Xr pmccontrol 8 , .Xr pmcstat 8 , diff --git a/share/man/man7/clocks.7 b/share/man/man7/clocks.7 index 692796842ed4..06b41ed551ca 100644 --- a/share/man/man7/clocks.7 +++ b/share/man/man7/clocks.7 @@ -104,8 +104,7 @@ and throwing away information and resolution. The profiling clock. This is a real clock with frequency 1024. It is used mainly by -.Xr moncontrol 3 , -.Xr kgmon 8 +.Xr moncontrol 3 and .Xr gprof 1 . Applications should determine its actual frequency using diff --git a/targets/pseudo/userland/Makefile.depend b/targets/pseudo/userland/Makefile.depend index cde4eadd6eee..6891e9eb32cb 100644 --- a/targets/pseudo/userland/Makefile.depend +++ b/targets/pseudo/userland/Makefile.depend @@ -784,7 +784,6 @@ DIRDEPS.amd64= \ usr.sbin/hyperv/tools \ usr.sbin/hyperv/tools/kvp \ usr.sbin/hyperv/tools/vss \ - usr.sbin/kgmon \ usr.sbin/lptcontrol \ usr.sbin/mptable \ usr.sbin/spkrtest \ @@ -794,8 +793,7 @@ DIRDEPS.amd64= \ DIRDEPS.arm= \ sbin/bsdlabel \ sbin/fdisk \ - usr.sbin/ofwdump \ - usr.sbin/kgmon + usr.sbin/ofwdump DIRDEPS.i386= \ sbin/bsdlabel \ @@ -809,7 +807,6 @@ DIRDEPS.i386= \ usr.sbin/hyperv/tools \ usr.sbin/hyperv/tools/kvp \ usr.sbin/hyperv/tools/vss \ - usr.sbin/kgmon \ usr.sbin/lptcontrol \ usr.sbin/mptable \ usr.sbin/pnpinfo \ diff --git a/usr.sbin/Makefile.amd64 b/usr.sbin/Makefile.amd64 index 64e5d8678c41..d4d185414f41 100644 --- a/usr.sbin/Makefile.amd64 +++ b/usr.sbin/Makefile.amd64 @@ -21,7 +21,6 @@ SUBDIR+= cpucontrol .if ${MK_HYPERV} != "no" SUBDIR+= hyperv .endif -SUBDIR+= kgmon SUBDIR+= lptcontrol SUBDIR+= mptable SUBDIR+= spkrtest diff --git a/usr.sbin/Makefile.arm b/usr.sbin/Makefile.arm index 84cff4ab3314..8987110dba31 100644 --- a/usr.sbin/Makefile.arm +++ b/usr.sbin/Makefile.arm @@ -1,4 +1,3 @@ # $FreeBSD$ -SUBDIR+= kgmon SUBDIR+= ofwdump diff --git a/usr.sbin/Makefile.i386 b/usr.sbin/Makefile.i386 index 90a74e05e061..4705fcadb36f 100644 --- a/usr.sbin/Makefile.i386 +++ b/usr.sbin/Makefile.i386 @@ -15,7 +15,6 @@ SUBDIR+= cpucontrol .if ${MK_HYPERV} != "no" SUBDIR+= hyperv .endif -SUBDIR+= kgmon SUBDIR+= lptcontrol SUBDIR+= mptable SUBDIR+= pnpinfo diff --git a/usr.sbin/kgmon/Makefile b/usr.sbin/kgmon/Makefile deleted file mode 100644 index 5f6a2a37950a..000000000000 --- a/usr.sbin/kgmon/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 6/6/93 -# $FreeBSD$ - -PROG= kgmon -MAN= kgmon.8 -WARNS?= 2 - -# This program may safely be run setuid-root to allow non-root -# users to start, stop, and reset profiling buffers. -# -#BINOWN=root -#BINMODE=4555 - -LIBADD= kvm - -.include diff --git a/usr.sbin/kgmon/Makefile.depend b/usr.sbin/kgmon/Makefile.depend deleted file mode 100644 index 4a0ebeceed6f..000000000000 --- a/usr.sbin/kgmon/Makefile.depend +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/libelf \ - lib/libkvm \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.sbin/kgmon/kgmon.8 b/usr.sbin/kgmon/kgmon.8 deleted file mode 100644 index 3a2ff5836f9c..000000000000 --- a/usr.sbin/kgmon/kgmon.8 +++ /dev/null @@ -1,130 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)kgmon.8 8.1 (Berkeley) 6/6/93 -.\" $FreeBSD$ -.\" -.Dd November 27, 2017 -.Dt KGMON 8 -.Os -.Sh NAME -.Nm kgmon -.Nd generate a dump of the operating system's profile buffers -.Sh SYNOPSIS -.Nm -.Op Fl Bbhpr -.Op Fl M Ar core -.Op Fl N Ar system -.Sh DESCRIPTION -The -.Nm -utility is used when profiling the operating system. -When no arguments are supplied, -.Nm -indicates the state of operating system profiling as running, -off, or not configured. -(see -.Xr config 8 ) -If the -.Fl p -flag is specified, -.Nm -extracts profile data from the operating system and produces a -.Pa gmon.out -file suitable for later analysis by -.Xr gprof 1 . -.Pp -The options are as follows: -.Bl -tag -width Ds -.It Fl B -Resume the collection of high resolution profile data. -.It Fl b -Resume the collection of low resolution profile data. -.It Fl h -Stop the collection of profile data. -.It Fl p -Dump the contents of the profile buffers into a -.Pa gmon.out -file. -.It Fl r -Reset all the profile buffers. -If the -.Fl p -flag is also specified, the -.Pa gmon.out -file is generated before the buffers are reset. -.It Fl M -Extract values associated with the name list from the specified core -instead of the default -.Pa /dev/kmem . -.It Fl N -Extract the name list from the specified system instead of the -default -.Pa /boot/kernel/kernel . -.El -.Pp -If neither -.Fl B -nor -.Fl b -nor -.Fl h -is specified, the state of profiling collection remains unchanged. -For example, if the -.Fl p -flag is specified and profile data is being collected, -profiling will be momentarily suspended, -the operating system profile buffers will be dumped, -and profiling will be immediately resumed. -.Pp -The profile buffers should be reset when the resolution -of the profile data is changed. -.Sh FILES -.Bl -tag -width /boot/kernel/kernel -compact -.It Pa /boot/kernel/kernel -the default system -.It Pa /dev/kmem -the default memory -.El -.Sh DIAGNOSTICS -Users with only read permission on -.Pa /dev/kmem -cannot change the state -of profiling collection. -They can get a -.Pa gmon.out -file with the warning that the data may be -inconsistent if profiling is in progress. -.Sh SEE ALSO -.Xr gprof 1 , -.Xr config 8 , -.Xr pmcstat 8 -.Sh HISTORY -The -.Nm -utility appeared in -.Bx 4.2 . diff --git a/usr.sbin/kgmon/kgmon.c b/usr.sbin/kgmon/kgmon.c deleted file mode 100644 index 17f59cdd9ee2..000000000000 --- a/usr.sbin/kgmon/kgmon.c +++ /dev/null @@ -1,531 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1983, 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1983, 1992, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)kgmon.c 8.1 (Berkeley) 6/6/93"; -#endif -#endif /* not lint */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct nlist nl[] = { -#define N_GMONPARAM 0 - { "__gmonparam" }, -#define N_PROFHZ 1 - { "_profhz" }, - { NULL }, -}; - -struct kvmvars { - kvm_t *kd; - struct gmonparam gpm; -}; - -int Bflag, bflag, hflag, kflag, rflag, pflag; -int debug = 0; -int getprof(struct kvmvars *); -int getprofhz(struct kvmvars *); -void kern_readonly(int); -int openfiles(const char *, char *, struct kvmvars *); -void setprof(struct kvmvars *kvp, int state); -void dumpstate(struct kvmvars *kvp); -void reset(struct kvmvars *kvp); -static void usage(void); - -int -main(int argc, char **argv) -{ - int ch, mode, disp, accessmode; - struct kvmvars kvmvars; - const char *systemname; - char *kmemf; - - if (seteuid(getuid()) != 0) { - err(1, "seteuid failed\n"); - } - kmemf = NULL; - systemname = NULL; - while ((ch = getopt(argc, argv, "M:N:Bbhpr")) != -1) { - switch((char)ch) { - - case 'M': - kmemf = optarg; - kflag = 1; - break; - - case 'N': - systemname = optarg; - break; - - case 'B': - Bflag = 1; - break; - - case 'b': - bflag = 1; - break; - - case 'h': - hflag = 1; - break; - - case 'p': - pflag = 1; - break; - - case 'r': - rflag = 1; - break; - - default: - usage(); - } - } - argc -= optind; - argv += optind; - -#define BACKWARD_COMPATIBILITY -#ifdef BACKWARD_COMPATIBILITY - if (*argv) { - systemname = *argv; - if (*++argv) { - kmemf = *argv; - ++kflag; - } - } -#endif - if (systemname == NULL) - systemname = getbootfile(); - accessmode = openfiles(systemname, kmemf, &kvmvars); - mode = getprof(&kvmvars); - if (hflag) - disp = GMON_PROF_OFF; - else if (Bflag) - disp = GMON_PROF_HIRES; - else if (bflag) - disp = GMON_PROF_ON; - else - disp = mode; - if (pflag) - dumpstate(&kvmvars); - if (rflag) - reset(&kvmvars); - if (accessmode == O_RDWR) - setprof(&kvmvars, disp); - (void)fprintf(stdout, "kgmon: kernel profiling is %s.\n", - disp == GMON_PROF_OFF ? "off" : - disp == GMON_PROF_HIRES ? "running (high resolution)" : - disp == GMON_PROF_ON ? "running" : - disp == GMON_PROF_BUSY ? "busy" : - disp == GMON_PROF_ERROR ? "off (error)" : - "in an unknown state"); - return (0); -} - -static void -usage(void) -{ - fprintf(stderr, "usage: kgmon [-Bbhrp] [-M core] [-N system]\n"); - exit(1); -} - -/* - * Check that profiling is enabled and open any necessary files. - */ -int -openfiles(const char *systemname, char *kmemf, struct kvmvars *kvp) -{ - size_t size; - int mib[3], state, openmode; - char errbuf[_POSIX2_LINE_MAX]; - - if (!kflag) { - mib[0] = CTL_KERN; - mib[1] = KERN_PROF; - mib[2] = GPROF_STATE; - size = sizeof state; - if (sysctl(mib, 3, &state, &size, NULL, 0) < 0) - errx(20, "profiling not defined in kernel"); - if (!(Bflag || bflag || hflag || rflag || - (pflag && - (state == GMON_PROF_HIRES || state == GMON_PROF_ON)))) - return (O_RDONLY); - (void)seteuid(0); - if (sysctl(mib, 3, NULL, NULL, &state, size) >= 0) - return (O_RDWR); - (void)seteuid(getuid()); - kern_readonly(state); - return (O_RDONLY); - } - openmode = (Bflag || bflag || hflag || pflag || rflag) - ? O_RDWR : O_RDONLY; - kvp->kd = kvm_openfiles(systemname, kmemf, NULL, openmode, errbuf); - if (kvp->kd == NULL) { - if (openmode == O_RDWR) { - openmode = O_RDONLY; - kvp->kd = kvm_openfiles(systemname, kmemf, NULL, O_RDONLY, - errbuf); - } - if (kvp->kd == NULL) - errx(2, "kvm_openfiles: %s", errbuf); - kern_readonly(GMON_PROF_ON); - } - if (kvm_nlist(kvp->kd, nl) < 0) - errx(3, "%s: no namelist", systemname); - if (!nl[N_GMONPARAM].n_value) - errx(20, "profiling not defined in kernel"); - return (openmode); -} - -/* - * Suppress options that require a writable kernel. - */ -void -kern_readonly(int mode) -{ - - (void)fprintf(stderr, "kgmon: kernel read-only: "); - if (pflag && (mode == GMON_PROF_HIRES || mode == GMON_PROF_ON)) - (void)fprintf(stderr, "data may be inconsistent\n"); - if (rflag) - (void)fprintf(stderr, "-r suppressed\n"); - if (Bflag) - (void)fprintf(stderr, "-B suppressed\n"); - if (bflag) - (void)fprintf(stderr, "-b suppressed\n"); - if (hflag) - (void)fprintf(stderr, "-h suppressed\n"); - rflag = Bflag = bflag = hflag = 0; -} - -/* - * Get the state of kernel profiling. - */ -int -getprof(struct kvmvars *kvp) -{ - size_t size; - int mib[3]; - - if (kflag) { - size = kvm_read(kvp->kd, nl[N_GMONPARAM].n_value, &kvp->gpm, - sizeof kvp->gpm); - } else { - mib[0] = CTL_KERN; - mib[1] = KERN_PROF; - mib[2] = GPROF_GMONPARAM; - size = sizeof kvp->gpm; - if (sysctl(mib, 3, &kvp->gpm, &size, NULL, 0) < 0) - size = 0; - } - - /* - * Accept certain undersized "structs" from old kernels. We need - * everything up to hashfraction, and want profrate and - * histcounter_type. Assume that the kernel doesn't put garbage - * in any padding that is returned instead of profrate and - * histcounter_type. This is a bad assumption for dead kernels, - * since kvm_read() will normally return garbage for bytes beyond - * the end of the actual kernel struct, if any. - */ - if (size < offsetof(struct gmonparam, hashfraction) + - sizeof(kvp->gpm.hashfraction) || size > sizeof(kvp->gpm)) - errx(4, "cannot get gmonparam: %s", - kflag ? kvm_geterr(kvp->kd) : strerror(errno)); - bzero((char *)&kvp->gpm + size, sizeof(kvp->gpm) - size); - if (kvp->gpm.profrate == 0) - kvp->gpm.profrate = getprofhz(kvp); -#ifdef __i386__ - if (kvp->gpm.histcounter_type == 0) { - /* - * This fixup only works for not-so-old i386 kernels. The - * magic 16 is the kernel FUNCTION_ALIGNMENT. 64-bit - * counters are signed; smaller counters are unsigned. - */ - kvp->gpm.histcounter_type = 16 / - (kvp->gpm.textsize / kvp->gpm.kcountsize) * CHAR_BIT; - if (kvp->gpm.histcounter_type == 64) - kvp->gpm.histcounter_type = -64; - } -#endif - - return (kvp->gpm.state); -} - -/* - * Enable or disable kernel profiling according to the state variable. - */ -void -setprof(struct kvmvars *kvp, int state) -{ - struct gmonparam *p = (struct gmonparam *)nl[N_GMONPARAM].n_value; - size_t sz; - int mib[3], oldstate; - - sz = sizeof(state); - if (!kflag) { - mib[0] = CTL_KERN; - mib[1] = KERN_PROF; - mib[2] = GPROF_STATE; - if (sysctl(mib, 3, &oldstate, &sz, NULL, 0) < 0) - goto bad; - if (oldstate == state) - return; - (void)seteuid(0); - if (sysctl(mib, 3, NULL, NULL, &state, sz) >= 0) { - (void)seteuid(getuid()); - return; - } - (void)seteuid(getuid()); - } else if (kvm_write(kvp->kd, (u_long)&p->state, (void *)&state, sz) - == (ssize_t)sz) - return; -bad: - warnx("warning: cannot turn profiling %s", - state == GMON_PROF_OFF ? "off" : "on"); -} - -/* - * Build the gmon.out file. - */ -void -dumpstate(struct kvmvars *kvp) -{ - register FILE *fp; - struct rawarc rawarc; - struct tostruct *tos; - u_long frompc; - u_short *froms, *tickbuf; - size_t i; - int mib[3]; - struct gmonhdr h; - int fromindex, endfrom, toindex; - - setprof(kvp, GMON_PROF_OFF); - fp = fopen("gmon.out", "w"); - if (fp == NULL) { - warn("gmon.out"); - return; - } - - /* - * Build the gmon header and write it to a file. - */ - bzero(&h, sizeof(h)); - h.lpc = kvp->gpm.lowpc; - h.hpc = kvp->gpm.highpc; - h.ncnt = kvp->gpm.kcountsize + sizeof(h); - h.version = GMONVERSION; - h.profrate = kvp->gpm.profrate; - h.histcounter_type = kvp->gpm.histcounter_type; - fwrite((char *)&h, sizeof(h), 1, fp); - - /* - * Write out the tick buffer. - */ - mib[0] = CTL_KERN; - mib[1] = KERN_PROF; - if ((tickbuf = (u_short *)malloc(kvp->gpm.kcountsize)) == NULL) - errx(5, "cannot allocate kcount space"); - if (kflag) { - i = kvm_read(kvp->kd, (u_long)kvp->gpm.kcount, (void *)tickbuf, - kvp->gpm.kcountsize); - } else { - mib[2] = GPROF_COUNT; - i = kvp->gpm.kcountsize; - if (sysctl(mib, 3, tickbuf, &i, NULL, 0) < 0) - i = 0; - } - if (i != kvp->gpm.kcountsize) - errx(6, "read ticks: read %lu, got %ld: %s", - kvp->gpm.kcountsize, (long)i, - kflag ? kvm_geterr(kvp->kd) : strerror(errno)); - if ((fwrite(tickbuf, kvp->gpm.kcountsize, 1, fp)) != 1) - err(7, "writing tocks to gmon.out"); - free(tickbuf); - - /* - * Write out the arc info. - */ - if ((froms = (u_short *)malloc(kvp->gpm.fromssize)) == NULL) - errx(8, "cannot allocate froms space"); - if (kflag) { - i = kvm_read(kvp->kd, (u_long)kvp->gpm.froms, (void *)froms, - kvp->gpm.fromssize); - } else { - mib[2] = GPROF_FROMS; - i = kvp->gpm.fromssize; - if (sysctl(mib, 3, froms, &i, NULL, 0) < 0) - i = 0; - } - if (i != kvp->gpm.fromssize) - errx(9, "read froms: read %lu, got %ld: %s", - kvp->gpm.fromssize, (long)i, - kflag ? kvm_geterr(kvp->kd) : strerror(errno)); - if ((tos = (struct tostruct *)malloc(kvp->gpm.tossize)) == NULL) - errx(10, "cannot allocate tos space"); - if (kflag) { - i = kvm_read(kvp->kd, (u_long)kvp->gpm.tos, (void *)tos, - kvp->gpm.tossize); - } else { - mib[2] = GPROF_TOS; - i = kvp->gpm.tossize; - if (sysctl(mib, 3, tos, &i, NULL, 0) < 0) - i = 0; - } - if (i != kvp->gpm.tossize) - errx(11, "read tos: read %lu, got %ld: %s", - kvp->gpm.tossize, (long)i, - kflag ? kvm_geterr(kvp->kd) : strerror(errno)); - if (debug) - warnx("lowpc 0x%lx, textsize 0x%lx", - (unsigned long)kvp->gpm.lowpc, kvp->gpm.textsize); - endfrom = kvp->gpm.fromssize / sizeof(*froms); - for (fromindex = 0; fromindex < endfrom; ++fromindex) { - if (froms[fromindex] == 0) - continue; - frompc = (u_long)kvp->gpm.lowpc + - (fromindex * kvp->gpm.hashfraction * sizeof(*froms)); - for (toindex = froms[fromindex]; toindex != 0; - toindex = tos[toindex].link) { - if (debug) - warnx("[mcleanup] frompc 0x%lx selfpc 0x%lx " - "count %ld", frompc, tos[toindex].selfpc, - tos[toindex].count); - rawarc.raw_frompc = frompc; - rawarc.raw_selfpc = (u_long)tos[toindex].selfpc; - rawarc.raw_count = tos[toindex].count; - fwrite((char *)&rawarc, sizeof(rawarc), 1, fp); - } - } - fclose(fp); -} - -/* - * Get the profiling rate. - */ -int -getprofhz(struct kvmvars *kvp) -{ - size_t size; - int mib[2], profrate; - struct clockinfo clockrate; - - if (kflag) { - profrate = 1; - if (kvm_read(kvp->kd, nl[N_PROFHZ].n_value, &profrate, - sizeof profrate) != sizeof profrate) - warnx("get clockrate: %s", kvm_geterr(kvp->kd)); - return (profrate); - } - mib[0] = CTL_KERN; - mib[1] = KERN_CLOCKRATE; - clockrate.profhz = 1; - size = sizeof clockrate; - if (sysctl(mib, 2, &clockrate, &size, NULL, 0) < 0) - warn("get clockrate"); - return (clockrate.profhz); -} - -/* - * Reset the kernel profiling date structures. - */ -void -reset(struct kvmvars *kvp) -{ - char *zbuf; - u_long biggest; - int mib[3]; - - setprof(kvp, GMON_PROF_OFF); - - biggest = kvp->gpm.kcountsize; - if (kvp->gpm.fromssize > biggest) - biggest = kvp->gpm.fromssize; - if (kvp->gpm.tossize > biggest) - biggest = kvp->gpm.tossize; - if ((zbuf = (char *)malloc(biggest)) == NULL) - errx(12, "cannot allocate zbuf space"); - bzero(zbuf, biggest); - if (kflag) { - if (kvm_write(kvp->kd, (u_long)kvp->gpm.kcount, zbuf, - kvp->gpm.kcountsize) != (ssize_t)kvp->gpm.kcountsize) - errx(13, "tickbuf zero: %s", kvm_geterr(kvp->kd)); - if (kvm_write(kvp->kd, (u_long)kvp->gpm.froms, zbuf, - kvp->gpm.fromssize) != (ssize_t)kvp->gpm.fromssize) - errx(14, "froms zero: %s", kvm_geterr(kvp->kd)); - if (kvm_write(kvp->kd, (u_long)kvp->gpm.tos, zbuf, - kvp->gpm.tossize) != (ssize_t)kvp->gpm.tossize) - errx(15, "tos zero: %s", kvm_geterr(kvp->kd)); - free(zbuf); - return; - } - (void)seteuid(0); - mib[0] = CTL_KERN; - mib[1] = KERN_PROF; - mib[2] = GPROF_COUNT; - if (sysctl(mib, 3, NULL, NULL, zbuf, kvp->gpm.kcountsize) < 0) - err(13, "tickbuf zero"); - mib[2] = GPROF_FROMS; - if (sysctl(mib, 3, NULL, NULL, zbuf, kvp->gpm.fromssize) < 0) - err(14, "froms zero"); - mib[2] = GPROF_TOS; - if (sysctl(mib, 3, NULL, NULL, zbuf, kvp->gpm.tossize) < 0) - err(15, "tos zero"); - (void)seteuid(getuid()); - free(zbuf); -} From owner-dev-commits-src-all@freebsd.org Sat Apr 3 22:01:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 390C35C07DA; Sat, 3 Apr 2021 22:01:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCW8n0Mbrz3GXy; Sat, 3 Apr 2021 22:01:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC7351A256; Sat, 3 Apr 2021 22:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133M1SEh063164; Sat, 3 Apr 2021 22:01:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133M1Sqc063163; Sat, 3 Apr 2021 22:01:28 GMT (envelope-from git) Date: Sat, 3 Apr 2021 22:01:28 GMT Message-Id: <202104032201.133M1Sqc063163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f548033818b8 - main - amd64 fabs(3): move signbit to .text MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f548033818b8bbcee17ad3926103f2a9b2c975df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 22:01:29 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f548033818b8bbcee17ad3926103f2a9b2c975df commit f548033818b8bbcee17ad3926103f2a9b2c975df Author: Konstantin Belousov AuthorDate: 2021-04-03 01:32:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-03 22:00:57 +0000 amd64 fabs(3): move signbit to .text There is no reason for signbit quad to be writeable. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/libc/amd64/gen/fabs.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/amd64/gen/fabs.S b/lib/libc/amd64/gen/fabs.S index 2ace0f9fb926..bb1ac3a81b96 100644 --- a/lib/libc/amd64/gen/fabs.S +++ b/lib/libc/amd64/gen/fabs.S @@ -39,7 +39,7 @@ ENTRY(fabs) ret END(fabs) - .data + .p2align 3 signbit: .quad 0x8000000000000000 From owner-dev-commits-src-all@freebsd.org Sat Apr 3 22:01:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 343475C0B24; Sat, 3 Apr 2021 22:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCW8p0wxMz3GP7; Sat, 3 Apr 2021 22:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 079C91A2C8; Sat, 3 Apr 2021 22:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133M1TGJ063189; Sat, 3 Apr 2021 22:01:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133M1ThI063188; Sat, 3 Apr 2021 22:01:29 GMT (envelope-from git) Date: Sat, 3 Apr 2021 22:01:29 GMT Message-Id: <202104032201.133M1ThI063188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 4c2e9c35fb19 - main - libc//sys/cerror.S: fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c2e9c35fb1958544040493e4fd8d8b8a0927677 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 22:01:30 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4c2e9c35fb1958544040493e4fd8d8b8a0927677 commit 4c2e9c35fb1958544040493e4fd8d8b8a0927677 Author: Konstantin Belousov AuthorDate: 2021-04-03 01:36:41 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-03 22:00:57 +0000 libc//sys/cerror.S: fix typo Sponsored by: The FreeBSD Foundation MFC after: 3 days --- lib/libc/amd64/sys/cerror.S | 2 +- lib/libc/i386/sys/cerror.S | 2 +- lib/libc/powerpc/sys/cerror.S | 2 +- lib/libc/powerpc64/sys/cerror.S | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/amd64/sys/cerror.S b/lib/libc/amd64/sys/cerror.S index ffce9d561993..1928acd0b7a9 100644 --- a/lib/libc/amd64/sys/cerror.S +++ b/lib/libc/amd64/sys/cerror.S @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); /* * The __error() function is thread aware. For non-threaded - * programs and the initial threaded in threaded programs, + * programs and the initial thread in threaded programs, * it returns a pointer to the global errno variable. */ .globl CNAME(__error) diff --git a/lib/libc/i386/sys/cerror.S b/lib/libc/i386/sys/cerror.S index 423d716cb651..47bd0fade000 100644 --- a/lib/libc/i386/sys/cerror.S +++ b/lib/libc/i386/sys/cerror.S @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); /* * The __error() function is thread aware. For non-threaded - * programs and the initial threaded in threaded programs, + * programs and the initial thread in threaded programs, * it returns a pointer to the global errno variable. */ .globl CNAME(__error) diff --git a/lib/libc/powerpc/sys/cerror.S b/lib/libc/powerpc/sys/cerror.S index c2bc994b9c33..9ec3cbaf63a2 100644 --- a/lib/libc/powerpc/sys/cerror.S +++ b/lib/libc/powerpc/sys/cerror.S @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); /* * The __error() function is thread aware. For non-threaded - * programs and the initial threaded in threaded programs, + * programs and the initial thread in threaded programs, * it returns a pointer to the global errno variable. */ HIDENAME(cerror): diff --git a/lib/libc/powerpc64/sys/cerror.S b/lib/libc/powerpc64/sys/cerror.S index 3362c9fdf046..93172fdb822e 100644 --- a/lib/libc/powerpc64/sys/cerror.S +++ b/lib/libc/powerpc64/sys/cerror.S @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); /* * The __error() function is thread aware. For non-threaded - * programs and the initial threaded in threaded programs, + * programs and the initial thread in threaded programs, * it returns a pointer to the global errno variable. */ ENTRY_NOPROF(HIDENAME(cerror)) From owner-dev-commits-src-all@freebsd.org Sun Apr 4 00:57:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF0D55C472F for ; Sun, 4 Apr 2021 00:57:56 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCb4N4m0jz3RKS for ; Sun, 4 Apr 2021 00:57:56 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f41.google.com with SMTP id u5-20020a7bcb050000b029010e9316b9d5so3993032wmj.2 for ; Sat, 03 Apr 2021 17:57:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=FkZrpjGo7V1oK4f0m84wWIpV++DuwqlW/pLGdZ5mIAY=; b=jS6jgaITUrMi1kd1l7MFP4eJtOEWvIaUS9u6tr24zlbUJ/ztt2G408TzIZwYDKZwQ+ Z2pkLxpjB8X5JHR1DltdZCv6Z73sOTPp0G3TPtv56vOib/DcC0CBZM5IRWXauYCEoAo8 983r5jgwB5zSH+Rgby225+E5N6vh+8kKyunJ/W6siiVJtSYwIv38KTtfUIgKG+vg1zhy tHUICnz6h5aUhk+Cx8S4ZyJ2mZwV63boH5qqDbHZtKhFchJNfrppcliSX2gkw60yy4p/ ADUTGbTC3rD7XMIYLTytXAU1h+vyoICD8t/yxvGvUqF1T94MBjxf2rW/u8o47K5kbjDr 2qiQ== X-Gm-Message-State: AOAM530yeZSJhwINMHvfnH2PoEAXLdv2ORyf8E15rC5q0IWQJivtt8KT R58AdynUaZy+f3/UQPCJSoTw/g== X-Google-Smtp-Source: ABdhPJwuARtNlyeYreC0ZPZGW68EcaYOgopPajpcIOHUUdd6jRJegkh6S+obI229vxDC2BOSuuBr/A== X-Received: by 2002:a05:600c:3643:: with SMTP id y3mr18618647wmq.159.1617497874535; Sat, 03 Apr 2021 17:57:54 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id f4sm22217042wrz.4.2021.04.03.17.57.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Apr 2021 17:57:54 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: f548033818b8 - main - amd64 fabs(3): move signbit to .text From: Jessica Clarke In-Reply-To: <202104032201.133M1Sqc063163@gitrepo.freebsd.org> Date: Sun, 4 Apr 2021 01:57:53 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <9DE102DB-5445-4D6B-BBB5-DE310F6850DB@freebsd.org> References: <202104032201.133M1Sqc063163@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FCb4N4m0jz3RKS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 00:57:56 -0000 On 3 Apr 2021, at 23:01, Konstantin Belousov wrote: >=20 > The branch main has been updated by kib: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df548033818b8bbcee17ad3926103f2a9= b2c975df >=20 > commit f548033818b8bbcee17ad3926103f2a9b2c975df > Author: Konstantin Belousov > AuthorDate: 2021-04-03 01:32:10 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-04-03 22:00:57 +0000 >=20 > amd64 fabs(3): move signbit to .text Why not .rodata then? That=E2=80=99s where constant pools typically end = up. Jess From owner-dev-commits-src-all@freebsd.org Sun Apr 4 01:50:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 861ED5C6885; Sun, 4 Apr 2021 01:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCcDS3LlSz3kx5; Sun, 4 Apr 2021 01:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60C7B1D1BB; Sun, 4 Apr 2021 01:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1341o0Ik072201; Sun, 4 Apr 2021 01:50:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1341o01x072186; Sun, 4 Apr 2021 01:50:00 GMT (envelope-from git) Date: Sun, 4 Apr 2021 01:50:00 GMT Message-Id: <202104040150.1341o01x072186@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 6d3f54fd0901 - main - amd64 fabs.S: put signbit into rodata instead of text MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d3f54fd090162ab14e2ec66f46bb1335a127a30 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 01:50:00 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6d3f54fd090162ab14e2ec66f46bb1335a127a30 commit 6d3f54fd090162ab14e2ec66f46bb1335a127a30 Author: Konstantin Belousov AuthorDate: 2021-04-04 01:36:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-04 01:49:22 +0000 amd64 fabs.S: put signbit into rodata instead of text Noted by: jrtc27 MFC after: 1 week Sponsored by: The FreeBSD Foundation --- lib/libc/amd64/gen/fabs.S | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libc/amd64/gen/fabs.S b/lib/libc/amd64/gen/fabs.S index bb1ac3a81b96..1da21d03f506 100644 --- a/lib/libc/amd64/gen/fabs.S +++ b/lib/libc/amd64/gen/fabs.S @@ -39,6 +39,7 @@ ENTRY(fabs) ret END(fabs) + .rodata .p2align 3 signbit: .quad 0x8000000000000000 From owner-dev-commits-src-all@freebsd.org Sun Apr 4 08:16:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B2525CE866; Sun, 4 Apr 2021 08:16:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCmpM2TRzz4bpY; Sun, 4 Apr 2021 08:16:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46D1522259; Sun, 4 Apr 2021 08:16:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1348GRTO017223; Sun, 4 Apr 2021 08:16:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1348GRHn017222; Sun, 4 Apr 2021 08:16:27 GMT (envelope-from git) Date: Sun, 4 Apr 2021 08:16:27 GMT Message-Id: <202104040816.1348GRHn017222@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: d36341f7b8dd - main - loader: we should support pools without features MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d36341f7b8ddc2457a1e9e4a721d27d2e66cb39a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 08:16:27 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=d36341f7b8ddc2457a1e9e4a721d27d2e66cb39a commit d36341f7b8ddc2457a1e9e4a721d27d2e66cb39a Author: Toomas Soome AuthorDate: 2021-04-02 23:40:51 +0000 Commit: Toomas Soome CommitDate: 2021-04-03 23:01:03 +0000 loader: we should support pools without features nvlist_check_features_for_read() does return error when there are no features for read. MFC after: 5 days --- stand/libsa/zfs/zfsimpl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c index bc577f168459..7036b508fa3c 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -191,8 +191,16 @@ nvlist_check_features_for_read(nvlist_t *nvl) rc = nvlist_find(nvl, ZPOOL_CONFIG_FEATURES_FOR_READ, DATA_TYPE_NVLIST, NULL, &features, NULL); - if (rc != 0) - return (rc); + switch (rc) { + case 0: + break; /* Continue with checks */ + + case ENOENT: + return (0); /* All features are disabled */ + + default: + return (rc); /* Error while reading nvlist */ + } data = (nvs_data_t *)features->nv_data; nvp = &data->nvl_pair; /* first pair in nvlist */ From owner-dev-commits-src-all@freebsd.org Sun Apr 4 08:18:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 463A45CEBE7; Sun, 4 Apr 2021 08:18:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCmsG17hnz4bqc; Sun, 4 Apr 2021 08:18:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18EB9225A0; Sun, 4 Apr 2021 08:18:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1348IvHv017707; Sun, 4 Apr 2021 08:18:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1348Iv7k017706; Sun, 4 Apr 2021 08:18:57 GMT (envelope-from git) Date: Sun, 4 Apr 2021 08:18:57 GMT Message-Id: <202104040818.1348Iv7k017706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: d019c774e906 - stable/13 - loader: insert spaces around menu title MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d019c774e9063e36c0a80e75df02df8b4b202f47 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 08:18:58 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=d019c774e9063e36c0a80e75df02df8b4b202f47 commit d019c774e9063e36c0a80e75df02df8b4b202f47 Author: Toomas Soome AuthorDate: 2021-03-23 05:04:48 +0000 Commit: Toomas Soome CommitDate: 2021-04-03 23:03:33 +0000 loader: insert spaces around menu title Small visual nit, make menu title more clean (cherry picked from 62ffcaab8f3ccba6053d4a5622c5ef2de9f636b5) --- stand/forth/menu.4th | 3 ++- stand/lua/drawer.lua | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stand/forth/menu.4th b/stand/forth/menu.4th index 6b0869cfe3b9..a336b9f9e7aa 100644 --- a/stand/forth/menu.4th +++ b/stand/forth/menu.4th @@ -489,7 +489,8 @@ also menu-infrastructure definitions if ( use default center alignement? ) menuX @ 19 + over 2 / - menuY @ 1- then - at-xy type + swap 1- swap + at-xy space type space \ If $menu_init is set, evaluate it (allowing for whole menus to be \ constructed dynamically -- as this function could conceivably set diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index eb9b18117cd3..523735a75d06 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -285,8 +285,8 @@ local function drawbox() if menu_header_x == nil then menu_header_x = x + (w // 2) - (#menu_header // 2) end - screen.setcursor(menu_header_x, y) - printc(menu_header) + screen.setcursor(menu_header_x - 1, y) + printc(" " .. menu_header .. " ") end local function drawbrand() From owner-dev-commits-src-all@freebsd.org Sun Apr 4 08:36:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E8CE5CF95D; Sun, 4 Apr 2021 08:36:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCnFY40GVz4dKS; Sun, 4 Apr 2021 08:36:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53EAA228F3; Sun, 4 Apr 2021 08:36:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1348aX7P045492; Sun, 4 Apr 2021 08:36:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1348aXLZ045491; Sun, 4 Apr 2021 08:36:33 GMT (envelope-from git) Date: Sun, 4 Apr 2021 08:36:33 GMT Message-Id: <202104040836.1348aXLZ045491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 332a6001389f - main - stress2: Add note about problems found. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 332a6001389f2b7e547fe24f02568a32f993bfa2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 08:36:33 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=332a6001389f2b7e547fe24f02568a32f993bfa2 commit 332a6001389f2b7e547fe24f02568a32f993bfa2 Author: Peter Holm AuthorDate: 2021-04-04 08:27:53 +0000 Commit: Peter Holm CommitDate: 2021-04-04 08:27:53 +0000 stress2: Add note about problems found. --- tools/test/stress2/misc/maxvnodes.sh | 9 ++++++--- tools/test/stress2/misc/maxvnodes2.sh | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/test/stress2/misc/maxvnodes.sh b/tools/test/stress2/misc/maxvnodes.sh index b962310cbb0e..e53c378fa762 100755 --- a/tools/test/stress2/misc/maxvnodes.sh +++ b/tools/test/stress2/misc/maxvnodes.sh @@ -33,9 +33,12 @@ # "panic: vm_fault_hold: fault on nofault entry, addr: 0xfffffe00b1b3c000" # seen: https://people.freebsd.org/~pho/stress/log/kostik1175.txt +# https://people.freebsd.org/~pho/stress/log/log0084.txt +# Fixed by: dc532884d582 + . ../default.cfg -kldstat | grep -q tmpfs.ko || notloaded=1 +kldstat | grep -q tmpfs && loaded=1 mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint mount -o size=2g -t tmpfs tmpfs $mntpoint || exit 1 chmod 777 $mntpoint @@ -59,12 +62,12 @@ min=1000 max=$((oldmx * 4)) while kill -0 $! 2>/dev/null; do sysctl kern.maxvnodes=`jot -r 1 $min $max` > /dev/null - sleep `jot -r 1 1 3` + sleep .2 done wait while mount | grep $mntpoint | grep -q tmpfs; do umount $mntpoint || sleep 1 done -[ $notloaded ] && kldunload tmpfs.ko +[ $loaded ] && kldunload tmpfs.ko exit 0 diff --git a/tools/test/stress2/misc/maxvnodes2.sh b/tools/test/stress2/misc/maxvnodes2.sh index 798eff1bffd6..b0923f55d0a6 100755 --- a/tools/test/stress2/misc/maxvnodes2.sh +++ b/tools/test/stress2/misc/maxvnodes2.sh @@ -32,6 +32,9 @@ # https://people.freebsd.org/~pho/stress/log/mjguzik005.txt # Fixed by r309067. +# Watchdog fired: +# https://people.freebsd.org/~pho/stress/log/log0083.txt + oldmx=`sysctl -n kern.maxvnodes` trap "sysctl kern.maxvnodes=$oldmx > /dev/null" EXIT SIGINT From owner-dev-commits-src-all@freebsd.org Sun Apr 4 08:36:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C8775CF857; Sun, 4 Apr 2021 08:36:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCnFZ3W91z4dWq; Sun, 4 Apr 2021 08:36:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6910A224FB; Sun, 4 Apr 2021 08:36:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1348aYDC045517; Sun, 4 Apr 2021 08:36:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1348aY0K045516; Sun, 4 Apr 2021 08:36:34 GMT (envelope-from git) Date: Sun, 4 Apr 2021 08:36:34 GMT Message-Id: <202104040836.1348aY0K045516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: a17a9c931a65 - main - stress2: update the list of test not to run MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a17a9c931a6582460c4369624f7b62c35fa8dfd7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 08:36:34 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=a17a9c931a6582460c4369624f7b62c35fa8dfd7 commit a17a9c931a6582460c4369624f7b62c35fa8dfd7 Author: Peter Holm AuthorDate: 2021-04-04 08:31:52 +0000 Commit: Peter Holm CommitDate: 2021-04-04 08:31:52 +0000 stress2: update the list of test not to run --- tools/test/stress2/misc/all.exclude | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index decd2e233a46..1c5926ac9447 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -4,9 +4,9 @@ backingstore.sh g_vfs_done():md6a[WRITE(offset=...)]error = 28 20111220 backingstore2.sh panic: 43 vncache entries remaining 20111220 backingstore3.sh g_vfs_done():md6a[WRITE(offset=...)]error = 28 20111230 -collapse.sh panic: freeing mapped page 0xfffffe0028ed1d50 20200106 dd.sh CAM stuck in vmwait 20200116 devfs4.sh Hang seen 20210210 +force4.sh https://people.freebsd.org/~pho/stress/log/log0082.txt 20210328 fsync.sh panic: Journal overflow 20190208 fuse.sh Memory corruption seen in log file kostik734.txt 20141114 fuse2.sh Deadlock seen 20121129 @@ -26,17 +26,14 @@ graid1_9.sh panic: Bad effnlink 20180212 lockf5.sh Spinning threads seen 20160718 ifconfig.sh Bug 253824 20210322 ifconfig2.sh https://people.freebsd.org/~pho/stress/log/log0051.txt 20210210 -maxvnodes.sh Only supposed to work in single user mode 20190412 -maxvnodes2.sh Only supposed to work in single user mode 20190412 -memguard.sh Waiting for fix commit +maxvnodes2.sh https://people.freebsd.org/~pho/stress/log/log0083.txt 20210329 +memguard.sh https://people.freebsd.org/~pho/stress/log/log0088.txt 20210402 memguard2.sh Waiting for fix commit memguard3.sh Waiting for fix commit memsetdomain.sh May change policy for random threads to to domainset_fixed 20210104 mlockall2.sh Unrecoverable OOM killing seen 20190203 mlockall7.sh Needs further investigation 20210123 nfs15lockd.sh panic: Assertion td->td_realucred == td->td_ucred failed ... 20210211 -Xnfs15lockd2.sh WiP 20200805 -Xnfs15lockd3.sh WiP 20200805 newfs4.sh watchdog fired. newbuf 20190225 nfs10.sh Double fault 20151013 nfs13.sh mount_nfs hangs in mntref 20191007 @@ -51,7 +48,6 @@ quota10.sh people.freebsd.org/~pho/stress/log/quota10-2.txt 20200525 quota2.sh panic: dqflush: stray dquot 20120221 quota3.sh panic: softdep_deallocate_dependencies: unrecovered ... 20111222 quota7.sh panic: dqflush: stray dquot 20120221 -Xrename14.sh mark136.txt 20200525 sctp.sh panic: Queues are not empty when handling ... i386 20201104 sctp2.sh panic: soclose: SS_NOFDREF on enter 20200307 sctp3.sh panic: Queues are not empty when handling SHUTDOWN-COMPLETE 20210211 @@ -60,10 +56,6 @@ signal.sh Timing issues. Needs fixing 20171116 snap8.sh https://people.freebsd.org/~pho/stress/log/log0049.txt 20210216 snap9.sh panic: handle_written_filepage: not started 20170722 snap11.sh panic: handle_written_filepage: not started 20200928 -suj13.sh Stuck with suspfs 20210105 -suj31.sh Stuck with suspfs 20210105 -suj34.sh Various hangs and panics (SUJ + NULLFS issue) 20131210 -Xswap4.sh WiP 20171208 swapoff2.sh swap_pager_force_pagein: read from swap failed 20171223 swapoff5.sh log0005.txt, known issue 20210111 systrace.sh WiP 20200227 From owner-dev-commits-src-all@freebsd.org Sun Apr 4 08:36:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B63D5CF96C; Sun, 4 Apr 2021 08:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCnFc1bTjz4dKY; Sun, 4 Apr 2021 08:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B3AF22568; Sun, 4 Apr 2021 08:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1348aZpV045539; Sun, 4 Apr 2021 08:36:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1348aZDZ045538; Sun, 4 Apr 2021 08:36:35 GMT (envelope-from git) Date: Sun, 4 Apr 2021 08:36:35 GMT Message-Id: <202104040836.1348aZDZ045538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 6f646494e1a8 - main - stress2: Added a new regression test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f646494e1a8a554dcbc4f19e3918cd13b8a33e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 08:36:36 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=6f646494e1a8a554dcbc4f19e3918cd13b8a33e8 commit 6f646494e1a8a554dcbc4f19e3918cd13b8a33e8 Author: Peter Holm AuthorDate: 2021-04-04 08:36:09 +0000 Commit: Peter Holm CommitDate: 2021-04-04 08:36:09 +0000 stress2: Added a new regression test --- tools/test/stress2/misc/chroot.sh | 83 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/tools/test/stress2/misc/chroot.sh b/tools/test/stress2/misc/chroot.sh new file mode 100755 index 000000000000..176b249312f0 --- /dev/null +++ b/tools/test/stress2/misc/chroot.sh @@ -0,0 +1,83 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Peter Holm +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +# Test scenario input by: "Patrick Sullivan" sulli00777@gmail.com + +# Bug 253593 +# "panic: ldvp 0xffff... fl 0x1 dvp 0xffff... fl 0 flags 0x34048144" seen. +# https://people.freebsd.org/~pho/stress/log/log0087.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/$0 > chroot.c +rm -f /tmp/chroot +mycc -o chroot -Wall -Wextra -O0 -g chroot.c -static || exit 1 +rm -f chroot.c + +mdconfig -a -t swap -s 10m -u $mdstart || exit 1 +newfs -n $newfs_flags md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint +mkdir -p $mntpoint/root/dir $mntpoint/jail $mntpoint/dev +mount -t nullfs $mntpoint/root $mntpoint/jail +mount -t devfs null $mntpoint/dev +mv /tmp/chroot $mntpoint/root + +chroot $mntpoint/jail ./chroot & +sleep .5 +mv $mntpoint/root/dir $mntpoint +wait + +umount $mntpoint/dev +umount $mntpoint/jail +while mount | grep "on $mntpoint " | grep -q /dev/md; do + umount $mntpoint || sleep 1 +done +mdconfig -d -u $mdstart +exit +EOF +#include +#include +#include +#include + +int +main(void) +{ + if (chdir("dir") == -1) + err(1, "chdir() #1"); + sleep(2); + fprintf(stderr, "cwd is %s\n", getwd(NULL)); +} From owner-dev-commits-src-all@freebsd.org Sun Apr 4 08:44:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DC8E5CFDD8; Sun, 4 Apr 2021 08:44:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCnQh3bJ7z4f5d; Sun, 4 Apr 2021 08:44:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69DEA22D08; Sun, 4 Apr 2021 08:44:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1348iSwU058930; Sun, 4 Apr 2021 08:44:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1348iSQB058929; Sun, 4 Apr 2021 08:44:28 GMT (envelope-from git) Date: Sun, 4 Apr 2021 08:44:28 GMT Message-Id: <202104040844.1348iSQB058929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 1260724822b5 - stable/13 - Fix `netstat -rs` reporting. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1260724822b5830411cbf56d48e997be1628e53b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 08:44:28 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=1260724822b5830411cbf56d48e997be1628e53b commit 1260724822b5830411cbf56d48e997be1628e53b Author: Alexander V. Chernikov AuthorDate: 2021-03-31 20:56:26 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-04 08:44:01 +0000 Fix `netstat -rs` reporting. rttrash (unused but not yet delete entries) were eliminated during routing rework. Remove reading these symbols from the kernel. PR: 254681 Reported by: rashey@superbox.pl (cherry picked from commit 4084b1ab0413d15dab496b1c24c3875601c71438) --- usr.bin/netstat/nlist_symbols | 1 - usr.bin/netstat/route.c | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/usr.bin/netstat/nlist_symbols b/usr.bin/netstat/nlist_symbols index afad45d353bd..1c09d81c0b98 100644 --- a/usr.bin/netstat/nlist_symbols +++ b/usr.bin/netstat/nlist_symbols @@ -39,7 +39,6 @@ all _rip6stat all _ripcbinfo all _rtree all _rtstat -all _rttrash all _sctpstat all _sfstat all _tcbinfo diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index ba47a4b56ac5..317e3ffb9607 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -699,19 +699,13 @@ void rt_stats(void) { struct rtstat rtstat; - u_long rtsaddr, rttaddr; - int rttrash; + u_long rtsaddr; if ((rtsaddr = nl[N_RTSTAT].n_value) == 0) { xo_emit("{W:rtstat: symbol not in namelist}\n"); return; } - if ((rttaddr = nl[N_RTTRASH].n_value) == 0) { - xo_emit("{W:rttrash: symbol not in namelist}\n"); - return; - } kread_counters(rtsaddr, (char *)&rtstat, sizeof (rtstat)); - kread(rttaddr, (char *)&rttrash, sizeof (rttrash)); xo_emit("{T:routing}:\n"); #define p(f, m) if (rtstat.f || sflag <= 1) \ @@ -728,9 +722,4 @@ rt_stats(void) p(rts_wildcard, "\t{:wildcard-uses/%ju} " "{N:/use%s of a wildcard route}\n"); #undef p - - if (rttrash || sflag <= 1) - xo_emit("\t{:unused-but-not-freed/%u} " - "{N:/route%s not in table but not freed}\n", - rttrash, plural(rttrash)); } From owner-dev-commits-src-all@freebsd.org Sun Apr 4 13:19:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEA545D6F47; Sun, 4 Apr 2021 13:19:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCvWT4cMdz3C5j; Sun, 4 Apr 2021 13:19:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88C55263A0; Sun, 4 Apr 2021 13:19:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 134DJ15N036900; Sun, 4 Apr 2021 13:19:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 134DJ1Ul036899; Sun, 4 Apr 2021 13:19:01 GMT (envelope-from git) Date: Sun, 4 Apr 2021 13:19:01 GMT Message-Id: <202104041319.134DJ1Ul036899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: cf2a72643460 - stable/13 - zfs: merge OpenZFS master-9305ff2ed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cf2a72643460a2bb50fcdf78fb8721a692315793 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 13:19:01 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=cf2a72643460a2bb50fcdf78fb8721a692315793 commit cf2a72643460a2bb50fcdf78fb8721a692315793 Author: Martin Matuska AuthorDate: 2021-03-14 01:23:51 +0000 Commit: Martin Matuska CommitDate: 2021-04-04 13:18:45 +0000 zfs: merge OpenZFS master-9305ff2ed Notable upstream pull request merges: #11153 Scalable teardown lock for FreeBSD #11651 Don't bomb out when using keylocation=file:// #11667 zvol: call zil_replaying() during replay #11683 abd_get_offset_struct() may allocate new abd #11693 Intentionally allow ZFS_READONLY in zfs_write #11716 zpool import cachefile improvements #11720 FreeBSD: Clean up zfsdev_close to match Linux #11730 FreeBSD: bring back possibility to rewind the checkpoint from bootloader Obtained from: OpenZFS (cherry picked from commit 9db44a8e5da9bf1ce6dd1c0f1468ddafed6d6c91) --- .../openzfs/.github/workflows/checkstyle.yaml | 2 +- sys/contrib/openzfs/cmd/vdev_id/vdev_id | 9 +- sys/contrib/openzfs/cmd/zpool/zpool_main.c | 307 +++++++++++++-------- sys/contrib/openzfs/cmd/zstream/zstream_redup.c | 1 + sys/contrib/openzfs/config/zfs-build.m4 | 36 +++ sys/contrib/openzfs/configure.ac | 1 + .../openzfs/include/os/freebsd/spl/sys/Makefile.am | 3 + .../openzfs/include/os/freebsd/spl/sys/debug.h | 80 +++--- .../include/os/freebsd/zfs/sys/zfs_vfsops_os.h | 2 +- .../openzfs/include/os/linux/spl/sys/debug.h | 78 +++--- .../include/os/linux/zfs/sys/zfs_vfsops_os.h | 33 +++ .../include/os/linux/zfs/sys/zfs_znode_impl.h | 4 +- sys/contrib/openzfs/include/sys/dmu_redact.h | 2 + sys/contrib/openzfs/include/sys/zfs_ioctl.h | 1 - sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c | 10 +- sys/contrib/openzfs/lib/libzfs/libzfs_mount.c | 25 +- .../openzfs/lib/libzfs/os/freebsd/libzfs_zmount.c | 5 +- .../openzfs/lib/libzfs/os/linux/libzfs_mount_os.c | 6 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 177 +++++++++--- sys/contrib/openzfs/man/man8/zfs-receive.8 | 10 + sys/contrib/openzfs/man/man8/zfs-send.8 | 7 +- sys/contrib/openzfs/module/Makefile.in | 5 + .../openzfs/module/os/freebsd/zfs/kmod_core.c | 18 +- .../openzfs/module/os/freebsd/zfs/zfs_dir.c | 2 - .../openzfs/module/os/freebsd/zfs/zvol_os.c | 9 +- sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c | 26 +- .../openzfs/module/os/linux/zfs/zio_crypt.c | 1 + sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c | 102 +++++-- sys/contrib/openzfs/module/zcommon/zfs_prop.c | 2 +- sys/contrib/openzfs/module/zfs/abd.c | 6 +- sys/contrib/openzfs/module/zfs/spa_misc.c | 4 +- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 6 +- sys/contrib/openzfs/module/zfs/zvol.c | 15 +- sys/contrib/openzfs/tests/runfiles/common.run | 1 + .../openzfs/tests/zfs-tests/include/commands.cfg | 2 +- .../openzfs/tests/zfs-tests/include/libtest.shlib | 19 +- .../openzfs/tests/zfs-tests/include/tunables.cfg | 8 +- .../functional/cli_root/zpool/zpool_002_pos.ksh | 37 ++- .../functional/cli_root/zpool/zpool_003_pos.ksh | 39 ++- .../functional/cli_root/zpool_import/Makefile.am | 1 + .../import_cachefile_paths_changed.ksh | 117 ++++++++ .../tests/functional/events/events_002_pos.ksh | 7 +- .../tests/functional/xattr/xattr_003_neg.ksh | 44 +-- sys/modules/zfs/zfs_config.h | 4 +- 44 files changed, 896 insertions(+), 378 deletions(-) diff --git a/sys/contrib/openzfs/.github/workflows/checkstyle.yaml b/sys/contrib/openzfs/.github/workflows/checkstyle.yaml index 1707f5bb21db..8dcd5047a748 100644 --- a/sys/contrib/openzfs/.github/workflows/checkstyle.yaml +++ b/sys/contrib/openzfs/.github/workflows/checkstyle.yaml @@ -6,7 +6,7 @@ on: jobs: checkstyle: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 with: diff --git a/sys/contrib/openzfs/cmd/vdev_id/vdev_id b/sys/contrib/openzfs/cmd/vdev_id/vdev_id index 8a379a72690e..d8918da1078c 100755 --- a/sys/contrib/openzfs/cmd/vdev_id/vdev_id +++ b/sys/contrib/openzfs/cmd/vdev_id/vdev_id @@ -298,8 +298,15 @@ sas_handler() { # Utilize DM device name to gather subordinate block devices # using sysfs to avoid userspace utilities - DMDEV=$(ls -l --full-time /dev/mapper | grep $DM_NAME | + + # If our DEVNAME is something like /dev/dm-177, then we may be + # able to get our DMDEV from it. + DMDEV=$(echo $DEVNAME | sed 's;/dev/;;g') + if [ ! -e /sys/block/$DMDEV/slaves/* ] ; then + # It's not there, try looking in /dev/mapper + DMDEV=$(ls -l --full-time /dev/mapper | grep $DM_NAME | awk '{gsub("../", " "); print $NF}') + fi # Use sysfs pointers in /sys/block/dm-X/slaves because using # userspace tools creates lots of overhead and should be avoided diff --git a/sys/contrib/openzfs/cmd/zpool/zpool_main.c b/sys/contrib/openzfs/cmd/zpool/zpool_main.c index e89eb3bea770..e23604b3d81c 100644 --- a/sys/contrib/openzfs/cmd/zpool/zpool_main.c +++ b/sys/contrib/openzfs/cmd/zpool/zpool_main.c @@ -2623,8 +2623,8 @@ print_class_vdevs(zpool_handle_t *zhp, status_cbdata_t *cb, nvlist_t *nv, /* * Display the status for the given pool. */ -static void -show_import(nvlist_t *config) +static int +show_import(nvlist_t *config, boolean_t report_error) { uint64_t pool_state; vdev_stat_t *vs; @@ -2656,6 +2656,13 @@ show_import(nvlist_t *config) reason = zpool_import_status(config, &msgid, &errata); + /* + * If we're importing using a cachefile, then we won't report any + * errors unless we are in the scan phase of the import. + */ + if (reason != ZPOOL_STATUS_OK && !report_error) + return (reason); + (void) printf(gettext(" pool: %s\n"), name); (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); (void) printf(gettext(" state: %s"), health); @@ -2983,6 +2990,7 @@ show_import(nvlist_t *config) "be part of this pool, though their\n\texact " "configuration cannot be determined.\n")); } + return (0); } static boolean_t @@ -3121,6 +3129,121 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts, return (ret); } +static int +import_pools(nvlist_t *pools, nvlist_t *props, char *mntopts, int flags, + char *orig_name, char *new_name, + boolean_t do_destroyed, boolean_t pool_specified, boolean_t do_all, + importargs_t *import) +{ + nvlist_t *config = NULL; + nvlist_t *found_config = NULL; + uint64_t pool_state; + + /* + * At this point we have a list of import candidate configs. Even if + * we were searching by pool name or guid, we still need to + * post-process the list to deal with pool state and possible + * duplicate names. + */ + int err = 0; + nvpair_t *elem = NULL; + boolean_t first = B_TRUE; + while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { + + verify(nvpair_value_nvlist(elem, &config) == 0); + + verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, + &pool_state) == 0); + if (!do_destroyed && pool_state == POOL_STATE_DESTROYED) + continue; + if (do_destroyed && pool_state != POOL_STATE_DESTROYED) + continue; + + verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY, + import->policy) == 0); + + if (!pool_specified) { + if (first) + first = B_FALSE; + else if (!do_all) + (void) printf("\n"); + + if (do_all) { + err |= do_import(config, NULL, mntopts, + props, flags); + } else { + /* + * If we're importing from cachefile, then + * we don't want to report errors until we + * are in the scan phase of the import. If + * we get an error, then we return that error + * to invoke the scan phase. + */ + if (import->cachefile && !import->scan) + err = show_import(config, B_FALSE); + else + (void) show_import(config, B_TRUE); + } + } else if (import->poolname != NULL) { + char *name; + + /* + * We are searching for a pool based on name. + */ + verify(nvlist_lookup_string(config, + ZPOOL_CONFIG_POOL_NAME, &name) == 0); + + if (strcmp(name, import->poolname) == 0) { + if (found_config != NULL) { + (void) fprintf(stderr, gettext( + "cannot import '%s': more than " + "one matching pool\n"), + import->poolname); + (void) fprintf(stderr, gettext( + "import by numeric ID instead\n")); + err = B_TRUE; + } + found_config = config; + } + } else { + uint64_t guid; + + /* + * Search for a pool by guid. + */ + verify(nvlist_lookup_uint64(config, + ZPOOL_CONFIG_POOL_GUID, &guid) == 0); + + if (guid == import->guid) + found_config = config; + } + } + + /* + * If we were searching for a specific pool, verify that we found a + * pool, and then do the import. + */ + if (pool_specified && err == 0) { + if (found_config == NULL) { + (void) fprintf(stderr, gettext("cannot import '%s': " + "no such pool available\n"), orig_name); + err = B_TRUE; + } else { + err |= do_import(found_config, new_name, + mntopts, props, flags); + } + } + + /* + * If we were just looking for pools, report an error if none were + * found. + */ + if (!pool_specified && first) + (void) fprintf(stderr, + gettext("no pools available to import\n")); + return (err); +} + typedef struct target_exists_args { const char *poolname; uint64_t poolguid; @@ -3248,51 +3371,54 @@ zpool_do_checkpoint(int argc, char **argv) /* * zpool import [-d dir] [-D] * import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l] - * [-d dir | -c cachefile] [-f] -a + * [-d dir | -c cachefile | -s] [-f] -a * import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l] - * [-d dir | -c cachefile] [-f] [-n] [-F] [newpool] + * [-d dir | -c cachefile | -s] [-f] [-n] [-F] + * [newpool] * - * -c Read pool information from a cachefile instead of searching - * devices. + * -c Read pool information from a cachefile instead of searching + * devices. If importing from a cachefile config fails, then + * fallback to searching for devices only in the directories that + * exist in the cachefile. * - * -d Scan in a specific directory, other than /dev/. More than + * -d Scan in a specific directory, other than /dev/. More than * one directory can be specified using multiple '-d' options. * - * -D Scan for previously destroyed pools or import all or only - * specified destroyed pools. + * -D Scan for previously destroyed pools or import all or only + * specified destroyed pools. * - * -R Temporarily import the pool, with all mountpoints relative to + * -R Temporarily import the pool, with all mountpoints relative to * the given root. The pool will remain exported when the machine * is rebooted. * - * -V Import even in the presence of faulted vdevs. This is an - * intentionally undocumented option for testing purposes, and - * treats the pool configuration as complete, leaving any bad + * -V Import even in the presence of faulted vdevs. This is an + * intentionally undocumented option for testing purposes, and + * treats the pool configuration as complete, leaving any bad * vdevs in the FAULTED state. In other words, it does verbatim * import. * - * -f Force import, even if it appears that the pool is active. + * -f Force import, even if it appears that the pool is active. * - * -F Attempt rewind if necessary. + * -F Attempt rewind if necessary. * - * -n See if rewind would work, but don't actually rewind. + * -n See if rewind would work, but don't actually rewind. * - * -N Import the pool but don't mount datasets. + * -N Import the pool but don't mount datasets. * - * -T Specify a starting txg to use for import. This option is - * intentionally undocumented option for testing purposes. + * -T Specify a starting txg to use for import. This option is + * intentionally undocumented option for testing purposes. * - * -a Import all pools found. + * -a Import all pools found. * - * -l Load encryption keys while importing. + * -l Load encryption keys while importing. * - * -o Set property=value and/or temporary mount options (without '='). + * -o Set property=value and/or temporary mount options (without '='). * - * -s Scan using the default search path, the libblkid cache will - * not be consulted. + * -s Scan using the default search path, the libblkid cache will + * not be consulted. * - * --rewind-to-checkpoint - * Import the pool and revert back to the checkpoint. + * --rewind-to-checkpoint + * Import the pool and revert back to the checkpoint. * * The import command scans for pools to import, and import pools based on pool * name and GUID. The pool can also be renamed as part of the import process. @@ -3309,15 +3435,11 @@ zpool_do_import(int argc, char **argv) boolean_t do_all = B_FALSE; boolean_t do_destroyed = B_FALSE; char *mntopts = NULL; - nvpair_t *elem; - nvlist_t *config; uint64_t searchguid = 0; char *searchname = NULL; char *propval; - nvlist_t *found_config; nvlist_t *policy = NULL; nvlist_t *props = NULL; - boolean_t first; int flags = ZFS_IMPORT_NORMAL; uint32_t rewind_policy = ZPOOL_NO_REWIND; boolean_t dryrun = B_FALSE; @@ -3325,7 +3447,8 @@ zpool_do_import(int argc, char **argv) boolean_t xtreme_rewind = B_FALSE; boolean_t do_scan = B_FALSE; boolean_t pool_exists = B_FALSE; - uint64_t pool_state, txg = -1ULL; + boolean_t pool_specified = B_FALSE; + uint64_t txg = -1ULL; char *cachefile = NULL; importargs_t idata = { 0 }; char *endptr; @@ -3447,6 +3570,11 @@ zpool_do_import(int argc, char **argv) usage(B_FALSE); } + if (cachefile && do_scan) { + (void) fprintf(stderr, gettext("-c is incompatible with -s\n")); + usage(B_FALSE); + } + if ((flags & ZFS_IMPORT_LOAD_KEYS) && (flags & ZFS_IMPORT_ONLY)) { (void) fprintf(stderr, gettext("-l is incompatible with -N\n")); usage(B_FALSE); @@ -3527,7 +3655,7 @@ zpool_do_import(int argc, char **argv) searchname = argv[0]; searchguid = 0; } - found_config = NULL; + pool_specified = B_TRUE; /* * User specified a name or guid. Ensure it's unique. @@ -3606,98 +3734,33 @@ zpool_do_import(int argc, char **argv) return (1); } + err = import_pools(pools, props, mntopts, flags, argv[0], + argc == 1 ? NULL : argv[1], do_destroyed, pool_specified, + do_all, &idata); + /* - * At this point we have a list of import candidate configs. Even if - * we were searching by pool name or guid, we still need to - * post-process the list to deal with pool state and possible - * duplicate names. + * If we're using the cachefile and we failed to import, then + * fallback to scanning the directory for pools that match + * those in the cachefile. */ - err = 0; - elem = NULL; - first = B_TRUE; - while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { - - verify(nvpair_value_nvlist(elem, &config) == 0); - - verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, - &pool_state) == 0); - if (!do_destroyed && pool_state == POOL_STATE_DESTROYED) - continue; - if (do_destroyed && pool_state != POOL_STATE_DESTROYED) - continue; - - verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY, - policy) == 0); - - if (argc == 0) { - if (first) - first = B_FALSE; - else if (!do_all) - (void) printf("\n"); - - if (do_all) { - err |= do_import(config, NULL, mntopts, - props, flags); - } else { - show_import(config); - } - } else if (searchname != NULL) { - char *name; - - /* - * We are searching for a pool based on name. - */ - verify(nvlist_lookup_string(config, - ZPOOL_CONFIG_POOL_NAME, &name) == 0); + if (err != 0 && cachefile != NULL) { + (void) printf(gettext("cachefile import failed, retrying\n")); - if (strcmp(name, searchname) == 0) { - if (found_config != NULL) { - (void) fprintf(stderr, gettext( - "cannot import '%s': more than " - "one matching pool\n"), searchname); - (void) fprintf(stderr, gettext( - "import by numeric ID instead\n")); - err = B_TRUE; - } - found_config = config; - } - } else { - uint64_t guid; - - /* - * Search for a pool by guid. - */ - verify(nvlist_lookup_uint64(config, - ZPOOL_CONFIG_POOL_GUID, &guid) == 0); - - if (guid == searchguid) - found_config = config; - } - } + /* + * We use the scan flag to gather the directories that exist + * in the cachefile. If we need to fallback to searching for + * the pool config, we will only search devices in these + * directories. + */ + idata.scan = B_TRUE; + nvlist_free(pools); + pools = zpool_search_import(g_zfs, &idata, &libzfs_config_ops); - /* - * If we were searching for a specific pool, verify that we found a - * pool, and then do the import. - */ - if (argc != 0 && err == 0) { - if (found_config == NULL) { - (void) fprintf(stderr, gettext("cannot import '%s': " - "no such pool available\n"), argv[0]); - err = B_TRUE; - } else { - err |= do_import(found_config, argc == 1 ? NULL : - argv[1], mntopts, props, flags); - } + err = import_pools(pools, props, mntopts, flags, argv[0], + argc == 1 ? NULL : argv[1], do_destroyed, pool_specified, + do_all, &idata); } - /* - * If we were just looking for pools, report an error if none were - * found. - */ - if (argc == 0 && first) - (void) fprintf(stderr, - gettext("no pools available to import\n")); - error: nvlist_free(props); nvlist_free(pools); @@ -7785,8 +7848,8 @@ print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs) * do not print estimated time if hours_left is more than * 30 days */ - (void) printf(gettext(" %s copied out of %s at %s/s, " - "%.2f%% done"), + (void) printf(gettext( + "\t%s copied out of %s at %s/s, %.2f%% done"), examined_buf, total_buf, rate_buf, 100 * fraction_done); if (hours_left < (30 * 24)) { (void) printf(gettext(", %lluh%um to go\n"), @@ -7801,8 +7864,8 @@ print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs) if (prs->prs_mapping_memory > 0) { char mem_buf[7]; zfs_nicenum(prs->prs_mapping_memory, mem_buf, sizeof (mem_buf)); - (void) printf(gettext(" %s memory used for " - "removed device mappings\n"), + (void) printf(gettext( + "\t%s memory used for removed device mappings\n"), mem_buf); } } diff --git a/sys/contrib/openzfs/cmd/zstream/zstream_redup.c b/sys/contrib/openzfs/cmd/zstream/zstream_redup.c index 41f1068e3dfc..15dd8a1ed126 100644 --- a/sys/contrib/openzfs/cmd/zstream/zstream_redup.c +++ b/sys/contrib/openzfs/cmd/zstream/zstream_redup.c @@ -248,6 +248,7 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose) fflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); fflags &= ~(DMU_BACKUP_FEATURE_DEDUP | DMU_BACKUP_FEATURE_DEDUPPROPS); + /* cppcheck-suppress syntaxError */ DMU_SET_FEATUREFLAGS(drrb->drr_versioninfo, fflags); int sz = drr->drr_payloadlen; diff --git a/sys/contrib/openzfs/config/zfs-build.m4 b/sys/contrib/openzfs/config/zfs-build.m4 index 305d0c6936b2..cd5996c0424c 100644 --- a/sys/contrib/openzfs/config/zfs-build.m4 +++ b/sys/contrib/openzfs/config/zfs-build.m4 @@ -11,6 +11,7 @@ AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [ DEBUG_CPPFLAGS="-DDEBUG -UNDEBUG" DEBUG_LDFLAGS="" DEBUG_ZFS="_with_debug" + WITH_DEBUG="true" AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled]) KERNEL_DEBUG_CFLAGS="-Werror" @@ -22,6 +23,7 @@ AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [ DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" DEBUG_LDFLAGS="" DEBUG_ZFS="_without_debug" + WITH_DEBUG="" KERNEL_DEBUG_CFLAGS="" KERNEL_DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" @@ -51,6 +53,7 @@ AC_DEFUN([ZFS_AC_DEBUG], [ AC_SUBST(DEBUG_CPPFLAGS) AC_SUBST(DEBUG_LDFLAGS) AC_SUBST(DEBUG_ZFS) + AC_SUBST(WITH_DEBUG) AC_SUBST(KERNEL_DEBUG_CFLAGS) AC_SUBST(KERNEL_DEBUG_CPPFLAGS) @@ -152,6 +155,39 @@ AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [ AC_MSG_RESULT([$enable_debug_kmem_tracking]) ]) +AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], [ + AS_IF([sysctl -n kern.conftxt | fgrep -qx $'options\tINVARIANTS'], + [enable_invariants="yes"], + [enable_invariants="no"]) +]) + +AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT], [ + AM_COND_IF([BUILD_FREEBSD], + [ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], + [enable_invariants="no"]) +]) + +dnl # +dnl # Detected for the running kernel by default, enables INVARIANTS features +dnl # in the FreeBSD kernel module. This feature must be used when building +dnl # for a FreeBSD kernel with "options INVARIANTS" in the KERNCONF and must +dnl # not be used when the INVARIANTS option is absent. +dnl # +AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS], [ + AC_MSG_CHECKING([whether FreeBSD kernel INVARIANTS checks are enabled]) + AC_ARG_ENABLE([invariants], + [AS_HELP_STRING([--enable-invariants], + [Enable FreeBSD kernel INVARIANTS checks [[default: detect]]])], + [], [ZFS_AC_DEBUG_INVARIANTS_DETECT]) + + AS_IF([test "x$enable_invariants" = xyes], + [WITH_INVARIANTS="true"], + [WITH_INVARIANTS=""]) + AC_SUBST(WITH_INVARIANTS) + + AC_MSG_RESULT([$enable_invariants]) +]) + AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ AX_COUNT_CPUS([]) AC_SUBST(CPU_COUNT) diff --git a/sys/contrib/openzfs/configure.ac b/sys/contrib/openzfs/configure.ac index b2d88554ed7d..07f590b390bd 100644 --- a/sys/contrib/openzfs/configure.ac +++ b/sys/contrib/openzfs/configure.ac @@ -61,6 +61,7 @@ ZFS_AC_DEBUG ZFS_AC_DEBUGINFO ZFS_AC_DEBUG_KMEM ZFS_AC_DEBUG_KMEM_TRACKING +ZFS_AC_DEBUG_INVARIANTS AC_CONFIG_FILES([ Makefile diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am index ca45b42b6b8d..6bee47830d9c 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am @@ -4,6 +4,7 @@ KERNEL_H = \ atomic.h \ byteorder.h \ callb.h \ + ccompat.h \ ccompile.h \ cmn_err.h \ condvar.h \ @@ -18,9 +19,11 @@ KERNEL_H = \ fcntl.h \ file.h \ freebsd_rwlock.h \ + idmap.h \ inttypes.h \ isa_defs.h \ kmem_cache.h \ + kidmap.h \ kmem.h \ kstat.h \ list_impl.h \ diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h index 2751f57801f7..1f820bc3345f 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h @@ -68,65 +68,65 @@ void spl_dumpstack(void); #define PANIC(fmt, a...) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) -#define VERIFY(cond) \ - (void) (unlikely(!(cond)) && \ +#define VERIFY(cond) \ + (void) (unlikely(!(cond)) && \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "%s", "VERIFY(" #cond ") failed\n")) -#define VERIFY3B(LEFT, OP, RIGHT) do { \ - boolean_t _verify3_left = (boolean_t)(LEFT); \ - boolean_t _verify3_right = (boolean_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3B(LEFT, OP, RIGHT) do { \ + const boolean_t _verify3_left = (boolean_t)(LEFT); \ + const boolean_t _verify3_right = (boolean_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%d " #OP " %d)\n", \ - (boolean_t) (_verify3_left), \ - (boolean_t) (_verify3_right)); \ + "failed (%d " #OP " %d)\n", \ + (boolean_t) (_verify3_left), \ + (boolean_t) (_verify3_right)); \ } while (0) -#define VERIFY3S(LEFT, OP, RIGHT) do { \ - int64_t _verify3_left = (int64_t)(LEFT); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3S(LEFT, OP, RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(LEFT); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%lld " #OP " %lld)\n", \ - (long long) (_verify3_left), \ - (long long) (_verify3_right)); \ + "failed (%lld " #OP " %lld)\n", \ + (long long) (_verify3_left), \ + (long long) (_verify3_right)); \ } while (0) -#define VERIFY3U(LEFT, OP, RIGHT) do { \ - uint64_t _verify3_left = (uint64_t)(LEFT); \ - uint64_t _verify3_right = (uint64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3U(LEFT, OP, RIGHT) do { \ + const uint64_t _verify3_left = (uint64_t)(LEFT); \ + const uint64_t _verify3_right = (uint64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%llu " #OP " %llu)\n", \ - (unsigned long long) (_verify3_left), \ - (unsigned long long) (_verify3_right)); \ + "failed (%llu " #OP " %llu)\n", \ + (unsigned long long) (_verify3_left), \ + (unsigned long long) (_verify3_right)); \ } while (0) -#define VERIFY3P(LEFT, OP, RIGHT) do { \ - uintptr_t _verify3_left = (uintptr_t)(LEFT); \ - uintptr_t _verify3_right = (uintptr_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3P(LEFT, OP, RIGHT) do { \ + const uintptr_t _verify3_left = (uintptr_t)(LEFT); \ + const uintptr_t _verify3_right = (uintptr_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%px " #OP " %px)\n", \ - (void *) (_verify3_left), \ - (void *) (_verify3_right)); \ + "failed (%px " #OP " %px)\n", \ + (void *) (_verify3_left), \ + (void *) (_verify3_right)); \ } while (0) -#define VERIFY0(RIGHT) do { \ - int64_t _verify3_left = (int64_t)(0); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left == _verify3_right)) \ +#define VERIFY0(RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(0); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left == _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(0 == " #RIGHT ") " \ - "failed (0 == %lld)\n", \ - (long long) (_verify3_right)); \ + "VERIFY3(0 == " #RIGHT ") " \ + "failed (0 == %lld)\n", \ + (long long) (_verify3_right)); \ } while (0) -#define CTASSERT_GLOBAL(x) CTASSERT(x) +#define CTASSERT_GLOBAL(x) CTASSERT(x) /* * Debugging disabled (--disable-debug) @@ -154,11 +154,11 @@ void spl_dumpstack(void); #define ASSERT0 VERIFY0 #define ASSERT VERIFY #define IMPLY(A, B) \ - ((void)(((!(A)) || (B)) || \ + ((void)(likely((!(A)) || (B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") implies (" #B ")"))) #define EQUIV(A, B) \ - ((void)((!!(A) == !!(B)) || \ + ((void)(likely(!!(A) == !!(B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") is equivalent to (" #B ")"))) /* END CSTYLED */ diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h index 5d8e5978a3cb..a263b48f7517 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h @@ -27,7 +27,7 @@ #ifndef _SYS_FS_ZFS_VFSOPS_H #define _SYS_FS_ZFS_VFSOPS_H -#if __FreeBSD_version >= 1300109 +#if __FreeBSD_version >= 1300125 #define TEARDOWN_RMS #endif diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h b/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h index 46da5c783397..dc6b85eebff7 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h @@ -62,63 +62,63 @@ void spl_dumpstack(void); #define PANIC(fmt, a...) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) -#define VERIFY(cond) \ - (void) (unlikely(!(cond)) && \ +#define VERIFY(cond) \ + (void) (unlikely(!(cond)) && \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "%s", "VERIFY(" #cond ") failed\n")) -#define VERIFY3B(LEFT, OP, RIGHT) do { \ - boolean_t _verify3_left = (boolean_t)(LEFT); \ - boolean_t _verify3_right = (boolean_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3B(LEFT, OP, RIGHT) do { \ + const boolean_t _verify3_left = (boolean_t)(LEFT); \ + const boolean_t _verify3_right = (boolean_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%d " #OP " %d)\n", \ - (boolean_t) (_verify3_left), \ - (boolean_t) (_verify3_right)); \ + "failed (%d " #OP " %d)\n", \ + (boolean_t) (_verify3_left), \ + (boolean_t) (_verify3_right)); \ } while (0) -#define VERIFY3S(LEFT, OP, RIGHT) do { \ - int64_t _verify3_left = (int64_t)(LEFT); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3S(LEFT, OP, RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(LEFT); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%lld " #OP " %lld)\n", \ - (long long) (_verify3_left), \ - (long long) (_verify3_right)); \ + "failed (%lld " #OP " %lld)\n", \ + (long long) (_verify3_left), \ + (long long) (_verify3_right)); \ } while (0) -#define VERIFY3U(LEFT, OP, RIGHT) do { \ - uint64_t _verify3_left = (uint64_t)(LEFT); \ - uint64_t _verify3_right = (uint64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3U(LEFT, OP, RIGHT) do { \ + const uint64_t _verify3_left = (uint64_t)(LEFT); \ + const uint64_t _verify3_right = (uint64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%llu " #OP " %llu)\n", \ - (unsigned long long) (_verify3_left), \ - (unsigned long long) (_verify3_right)); \ + "failed (%llu " #OP " %llu)\n", \ + (unsigned long long) (_verify3_left), \ + (unsigned long long) (_verify3_right)); \ } while (0) -#define VERIFY3P(LEFT, OP, RIGHT) do { \ - uintptr_t _verify3_left = (uintptr_t)(LEFT); \ - uintptr_t _verify3_right = (uintptr_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3P(LEFT, OP, RIGHT) do { \ + const uintptr_t _verify3_left = (uintptr_t)(LEFT); \ + const uintptr_t _verify3_right = (uintptr_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%px " #OP " %px)\n", \ - (void *) (_verify3_left), \ - (void *) (_verify3_right)); \ + "failed (%px " #OP " %px)\n", \ + (void *) (_verify3_left), \ + (void *) (_verify3_right)); \ } while (0) -#define VERIFY0(RIGHT) do { \ - int64_t _verify3_left = (int64_t)(0); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left == _verify3_right)) \ +#define VERIFY0(RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(0); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left == _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(0 == " #RIGHT ") " \ - "failed (0 == %lld)\n", \ - (long long) (_verify3_right)); \ + "VERIFY3(0 == " #RIGHT ") " \ + "failed (0 == %lld)\n", \ + (long long) (_verify3_right)); \ } while (0) #define CTASSERT_GLOBAL(x) _CTASSERT(x, __LINE__) @@ -154,11 +154,11 @@ void spl_dumpstack(void); #define ASSERT0 VERIFY0 #define ASSERT VERIFY #define IMPLY(A, B) \ - ((void)(((!(A)) || (B)) || \ + ((void)(likely((!(A)) || (B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") implies (" #B ")"))) #define EQUIV(A, B) \ - ((void)((!!(A) == !!(B)) || \ + ((void)(likely(!!(A) == !!(B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") is equivalent to (" #B ")"))) /* END CSTYLED */ diff --git a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vfsops_os.h b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vfsops_os.h index 24a0a2e6a05f..7b4a1aac9aad 100644 --- a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vfsops_os.h +++ b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vfsops_os.h @@ -138,6 +138,39 @@ struct zfsvfs { taskqid_t z_drain_task; /* task id for the unlink drain task */ }; +#define ZFS_TEARDOWN_INIT(zfsvfs) \ + rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE) + +#define ZFS_TEARDOWN_DESTROY(zfsvfs) \ + rrm_destroy(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \ + rw_tryenter(&(zfsvfs)->z_teardown_lock, RW_READER) + +#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \ + rrm_enter_read(&(zfsvfs)->z_teardown_lock, tag); + +#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \ + rrm_enter(&(zfsvfs)->z_teardown_lock, RW_WRITER, tag) + +#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \ + RRM_READ_HELD(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \ + RRM_WRITE_HELD(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_HELD(zfsvfs) \ + RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock) + #define ZSB_XATTR 0x0001 /* Enable user xattrs */ /* diff --git a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h index 41bdf932511d..b1b3aec4c70f 100644 --- a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h +++ b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h @@ -81,7 +81,7 @@ extern "C" { do { \ ZFS_TEARDOWN_ENTER_READ(zfsvfs, FTAG); \ if (unlikely((zfsvfs)->z_unmounted)) { \ - ZFS_EXIT_READ(zfsvfs, FTAG); \ + ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \ return (error); \ } \ } while (0) @@ -92,7 +92,7 @@ do { \ #define ZFS_EXIT(zfsvfs) \ do { \ zfs_exit_fs(zfsvfs); \ - ZFS_EXIT_READ(zfsvfs, FTAG); \ + ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \ } while (0) #define ZPL_EXIT(zfsvfs) \ diff --git a/sys/contrib/openzfs/include/sys/dmu_redact.h b/sys/contrib/openzfs/include/sys/dmu_redact.h index 207fdbb5cfda..85f4b0522891 100644 --- a/sys/contrib/openzfs/include/sys/dmu_redact.h +++ b/sys/contrib/openzfs/include/sys/dmu_redact.h @@ -39,6 +39,7 @@ redact_block_get_size(redact_block_phys_t *rbp) static inline void redact_block_set_size(redact_block_phys_t *rbp, uint64_t size) { + /* cppcheck-suppress syntaxError */ BF64_SET_SB((rbp)->rbp_size_count, 48, 16, SPA_MINBLOCKSHIFT, 0, size); } @@ -51,6 +52,7 @@ redact_block_get_count(redact_block_phys_t *rbp) static inline void redact_block_set_count(redact_block_phys_t *rbp, uint64_t count) { + /* cppcheck-suppress syntaxError */ *** 1423 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Apr 4 13:19:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 321F55D710E; Sun, 4 Apr 2021 13:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCvWw0j9Xz3CWC; Sun, 4 Apr 2021 13:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0978B25EEA; Sun, 4 Apr 2021 13:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 134DJNZm037067; Sun, 4 Apr 2021 13:19:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 134DJN9t037065; Sun, 4 Apr 2021 13:19:23 GMT (envelope-from git) Date: Sun, 4 Apr 2021 13:19:23 GMT Message-Id: <202104041319.134DJN9t037065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 93d1c189bc36 - stable/13 - zfs: merge OpenZFS master-891568c99 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 93d1c189bc368bf1e9a661673cbc44142780be75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 13:19:24 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=93d1c189bc368bf1e9a661673cbc44142780be75 commit 93d1c189bc368bf1e9a661673cbc44142780be75 Author: Martin Matuska AuthorDate: 2021-03-21 00:46:08 +0000 Commit: Martin Matuska CommitDate: 2021-04-04 13:19:09 +0000 zfs: merge OpenZFS master-891568c99 Notable upstream pull request merges: #11652 Split dmu_zfetch() speculation and execution parts #11682 Fix zfs_get_data access to files with wrong generation #11735 Clean up RAIDZ/DRAID ereport code #11737 Initialize metaslab range trees in metaslab_init #11739 FreeBSD: make seqc asserts conditional on replay #11763 Allow setting bootfs property on pools with indirect vdevs #11767 FreeBSD: Fix memory leaks in kstats Obtained from: OpenZFS (cherry picked from commit f9693bef8dc83284e7ac905adc346f7d866b5245) --- sys/contrib/openzfs/README.md | 2 +- sys/contrib/openzfs/cmd/raidz_test/raidz_test.c | 2 - sys/contrib/openzfs/cmd/ztest/ztest.c | 4 +- sys/contrib/openzfs/config/kernel-bio_max_segs.m4 | 23 ++ .../openzfs/config/kernel-generic_fillattr.m4 | 28 +++ sys/contrib/openzfs/config/kernel-inode-create.m4 | 43 +++- sys/contrib/openzfs/config/kernel-inode-getattr.m4 | 63 ++++- .../openzfs/config/kernel-is_owner_or_cap.m4 | 23 +- sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 | 32 --- sys/contrib/openzfs/config/kernel-mkdir.m4 | 65 +++++ sys/contrib/openzfs/config/kernel-mknod.m4 | 30 +++ sys/contrib/openzfs/config/kernel-rename.m4 | 50 +++- .../openzfs/config/kernel-setattr-prepare.m4 | 45 +++- sys/contrib/openzfs/config/kernel-symlink.m4 | 30 +++ sys/contrib/openzfs/config/kernel-xattr-handler.m4 | 78 ++++-- sys/contrib/openzfs/config/kernel.m4 | 20 +- sys/contrib/openzfs/configure.ac | 1 + .../include/os/linux/kernel/linux/kmap_compat.h | 4 +- .../include/os/linux/kernel/linux/vfs_compat.h | 24 +- .../include/os/linux/kernel/linux/xattr_compat.h | 17 +- .../include/os/linux/zfs/sys/zfs_vnops_os.h | 3 +- .../include/os/linux/zfs/sys/zfs_znode_impl.h | 8 +- sys/contrib/openzfs/include/os/linux/zfs/sys/zpl.h | 18 ++ sys/contrib/openzfs/include/sys/dmu_zfetch.h | 23 +- sys/contrib/openzfs/include/sys/vdev_raidz.h | 2 + sys/contrib/openzfs/include/sys/vdev_raidz_impl.h | 7 +- sys/contrib/openzfs/include/sys/zil.h | 3 +- sys/contrib/openzfs/include/sys/zio.h | 10 +- sys/contrib/openzfs/include/sys/zvol_impl.h | 4 +- .../openzfs/man/man5/zfs-module-parameters.5 | 25 +- sys/contrib/openzfs/man/man8/zfs-allow.8 | 3 + sys/contrib/openzfs/man/man8/zgenhostid.8 | 4 +- sys/contrib/openzfs/man/man8/zpoolconcepts.8 | 17 ++ .../openzfs/module/os/freebsd/spl/spl_kstat.c | 11 +- .../openzfs/module/os/freebsd/zfs/sysctl_os.c | 6 - sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 10 +- sys/contrib/openzfs/module/os/linux/zfs/policy.c | 2 +- .../openzfs/module/os/linux/zfs/vdev_disk.c | 5 + .../openzfs/module/os/linux/zfs/zfs_ctldir.c | 3 +- sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c | 4 +- .../openzfs/module/os/linux/zfs/zfs_vfsops.c | 6 +- .../openzfs/module/os/linux/zfs/zfs_vnops_os.c | 5 +- .../openzfs/module/os/linux/zfs/zpl_ctldir.c | 51 +++- sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c | 2 +- .../openzfs/module/os/linux/zfs/zpl_inode.c | 52 +++- .../openzfs/module/os/linux/zfs/zpl_xattr.c | 4 +- sys/contrib/openzfs/module/zfs/dbuf.c | 5 +- sys/contrib/openzfs/module/zfs/dmu.c | 35 ++- sys/contrib/openzfs/module/zfs/dmu_zfetch.c | 250 +++++++++++-------- sys/contrib/openzfs/module/zfs/metaslab.c | 149 +++++------- sys/contrib/openzfs/module/zfs/refcount.c | 10 +- sys/contrib/openzfs/module/zfs/vdev.c | 4 +- sys/contrib/openzfs/module/zfs/vdev_draid.c | 240 +------------------ sys/contrib/openzfs/module/zfs/vdev_indirect.c | 1 - sys/contrib/openzfs/module/zfs/vdev_mirror.c | 5 +- sys/contrib/openzfs/module/zfs/vdev_raidz.c | 266 +++------------------ sys/contrib/openzfs/module/zfs/zfs_fm.c | 8 +- sys/contrib/openzfs/module/zfs/zfs_fuid.c | 4 - sys/contrib/openzfs/module/zfs/zfs_log.c | 5 + sys/contrib/openzfs/module/zfs/zfs_vnops.c | 14 +- sys/contrib/openzfs/module/zfs/zil.c | 3 +- sys/contrib/openzfs/module/zfs/zio.c | 4 +- sys/contrib/openzfs/module/zfs/zvol.c | 3 +- sys/contrib/openzfs/tests/runfiles/common.run | 8 +- sys/contrib/openzfs/tests/runfiles/freebsd.run | 4 + sys/contrib/openzfs/tests/runfiles/sanity.run | 4 + .../zfs-tests/tests/functional/acl/Makefile.am | 2 +- .../zfs-tests/tests/functional/acl/off/.gitignore | 1 + .../zfs-tests/tests/functional/acl/off/Makefile.am | 16 ++ .../zfs-tests/tests/functional/acl/off/cleanup.ksh | 33 +++ .../zfs-tests/tests/functional/acl/off/dosmode.ksh | 199 +++++++++++++++ .../functional/acl/off/dosmode_readonly_write.c | 61 +++++ .../tests/functional/acl/off/posixmode.ksh | 145 +++++++++++ .../zfs-tests/tests/functional/acl/off/setup.ksh | 44 ++++ .../tests/functional/redacted_send/Makefile.am | 1 + .../functional/redacted_send/redacted_panic.ksh | 44 ++++ sys/modules/zfs/zfs_config.h | 4 +- 77 files changed, 1561 insertions(+), 883 deletions(-) diff --git a/sys/contrib/openzfs/README.md b/sys/contrib/openzfs/README.md index 31d99386e90e..d666df7af309 100644 --- a/sys/contrib/openzfs/README.md +++ b/sys/contrib/openzfs/README.md @@ -32,4 +32,4 @@ For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197` # Supported Kernels * The `META` file contains the officially recognized supported Linux kernel versions. - * Supported FreeBSD versions are 12-STABLE and 13-CURRENT. + * Supported FreeBSD versions are any supported branches and releases starting from 12.2-RELEASE. diff --git a/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c b/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c index e3eb4f4ce44a..9a8be549c5cb 100644 --- a/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c +++ b/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c @@ -448,7 +448,6 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset, rr->rr_missingdata = 0; rr->rr_missingparity = 0; rr->rr_firstdatacol = nparity; - rr->rr_abd_copy = NULL; rr->rr_abd_empty = NULL; rr->rr_nempty = 0; @@ -459,7 +458,6 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset, } rr->rr_col[c].rc_devidx = child_id; rr->rr_col[c].rc_offset = child_offset; - rr->rr_col[c].rc_gdata = NULL; rr->rr_col[c].rc_orig_data = NULL; rr->rr_col[c].rc_error = 0; rr->rr_col[c].rc_tried = 0; diff --git a/sys/contrib/openzfs/cmd/ztest/ztest.c b/sys/contrib/openzfs/cmd/ztest/ztest.c index 1a030280704a..7193eafe3d21 100644 --- a/sys/contrib/openzfs/cmd/ztest/ztest.c +++ b/sys/contrib/openzfs/cmd/ztest/ztest.c @@ -2287,8 +2287,8 @@ ztest_get_done(zgd_t *zgd, int error) } static int -ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, - zio_t *zio) +ztest_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf, + struct lwb *lwb, zio_t *zio) { ztest_ds_t *zd = arg; objset_t *os = zd->zd_os; diff --git a/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 b/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 new file mode 100644 index 000000000000..a90d75455c13 --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 @@ -0,0 +1,23 @@ +dnl # +dnl # 5.12 API change removes BIO_MAX_PAGES in favor of bio_max_segs() +dnl # which will handle the logic of setting the upper-bound to a +dnl # BIO_MAX_PAGES, internally. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS], [ + ZFS_LINUX_TEST_SRC([bio_max_segs], [ + #include + ],[ + bio_max_segs(1); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_MAX_SEGS], [ + AC_MSG_CHECKING([whether bio_max_segs() exists]) + ZFS_LINUX_TEST_RESULT([bio_max_segs], [ + AC_MSG_RESULT(yes) + + AC_DEFINE([HAVE_BIO_MAX_SEGS], 1, [bio_max_segs() is implemented]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 b/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 new file mode 100644 index 000000000000..50c8031305b3 --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 @@ -0,0 +1,28 @@ +dnl # +dnl # 5.12 API +dnl # +dnl # generic_fillattr in linux/fs.h now requires a struct user_namespace* +dnl # as the first arg, to support idmapped mounts. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS], [ + ZFS_LINUX_TEST_SRC([generic_fillattr_userns], [ + #include + ],[ + struct user_namespace *userns = NULL; + struct inode *in = NULL; + struct kstat *k = NULL; + generic_fillattr(userns, in, k); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS], [ + AC_MSG_CHECKING([whether generic_fillattr requres struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([generic_fillattr_userns], [ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GENERIC_FILLATTR_USERNS, 1, + [generic_fillattr requires struct user_namespace*]) + ],[ + AC_MSG_RESULT([no]) + ]) +]) + diff --git a/sys/contrib/openzfs/config/kernel-inode-create.m4 b/sys/contrib/openzfs/config/kernel-inode-create.m4 index 9f28bcbd4f7f..a6ea11fb61b2 100644 --- a/sys/contrib/openzfs/config/kernel-inode-create.m4 +++ b/sys/contrib/openzfs/config/kernel-inode-create.m4 @@ -1,7 +1,25 @@ -dnl # -dnl # 3.6 API change -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [ +AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [ + dnl # + dnl # 5.12 API change that added the struct user_namespace* arg + dnl # to the front of this function type's arg list. + dnl # + ZFS_LINUX_TEST_SRC([create_userns], [ + #include + #include + + int inode_create(struct user_namespace *userns, + struct inode *inode ,struct dentry *dentry, + umode_t umode, bool flag) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .create = inode_create, + }; + ],[]) + + dnl # + dnl # 3.6 API change + dnl # ZFS_LINUX_TEST_SRC([create_flags], [ #include #include @@ -16,11 +34,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [ ],[]) ]) -AC_DEFUN([ZFS_AC_KERNEL_CREATE_FLAGS], [ - AC_MSG_CHECKING([whether iops->create() passes flags]) - ZFS_LINUX_TEST_RESULT([create_flags], [ +AC_DEFUN([ZFS_AC_KERNEL_CREATE], [ + AC_MSG_CHECKING([whether iops->create() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([create_userns], [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_CREATE_USERNS, 1, + [iops->create() takes struct user_namespace*]) ],[ - ZFS_LINUX_TEST_ERROR([iops->create()]) + AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether iops->create() passes flags]) + ZFS_LINUX_TEST_RESULT([create_flags], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([iops->create()]) + ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-inode-getattr.m4 b/sys/contrib/openzfs/config/kernel-inode-getattr.m4 index 48391d66f8bd..f62e82f5230a 100644 --- a/sys/contrib/openzfs/config/kernel-inode-getattr.m4 +++ b/sys/contrib/openzfs/config/kernel-inode-getattr.m4 @@ -1,8 +1,29 @@ -dnl # -dnl # Linux 4.11 API -dnl # See torvalds/linux@a528d35 -dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [ + dnl # + dnl # Linux 5.12 API + dnl # The getattr I/O operations handler type was extended to require + dnl # a struct user_namespace* as its first arg, to support idmapped + dnl # mounts. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_getattr_userns], [ + #include + + int test_getattr( + struct user_namespace *userns, + const struct path *p, struct kstat *k, + u32 request_mask, unsigned int query_flags) + { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .getattr = test_getattr, + }; + ],[]) + + dnl # + dnl # Linux 4.11 API + dnl # See torvalds/linux@a528d35 + dnl # ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [ #include @@ -33,21 +54,39 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [ ]) AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [ - AC_MSG_CHECKING([whether iops->getattr() takes a path]) - ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [ + dnl # + dnl # Kernel 5.12 test + dnl # + AC_MSG_CHECKING([whether iops->getattr() takes user_namespace]) + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_userns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1, - [iops->getattr() takes a path]) + AC_DEFINE(HAVE_USERNS_IOPS_GETATTR, 1, + [iops->getattr() takes struct user_namespace*]) ],[ AC_MSG_RESULT(no) - AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount]) - ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [ + dnl # + dnl # Kernel 4.11 test + dnl # + AC_MSG_CHECKING([whether iops->getattr() takes a path]) + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1, - [iops->getattr() takes a vfsmount]) + AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1, + [iops->getattr() takes a path]) ],[ AC_MSG_RESULT(no) + + dnl # + dnl # Kernel < 4.11 test + dnl # + AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount]) + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1, + [iops->getattr() takes a vfsmount]) + ],[ + AC_MSG_RESULT(no) + ]) ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4 b/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4 index 3df6163da270..3c3c6ad2240f 100644 --- a/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4 +++ b/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4 @@ -11,13 +11,32 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [ struct inode *ip = NULL; (void) inode_owner_or_capable(ip); ]) + + ZFS_LINUX_TEST_SRC([inode_owner_or_capable_idmapped], [ + #include + ],[ + struct inode *ip = NULL; + (void) inode_owner_or_capable(&init_user_ns, ip); + ]) ]) AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [ AC_MSG_CHECKING([whether inode_owner_or_capable() exists]) ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [ AC_MSG_RESULT(yes) - ],[ - ZFS_LINUX_TEST_ERROR([capability]) + AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1, + [inode_owner_or_capable() exists]) + ], [ + AC_MSG_RESULT(no) + + AC_MSG_CHECKING( + [whether inode_owner_or_capable() takes user_ns]) + ZFS_LINUX_TEST_RESULT([inode_owner_or_capable_idmapped], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED, 1, + [inode_owner_or_capable() takes user_ns]) + ],[ + ZFS_LINUX_TEST_ERROR([capability]) + ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 b/sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 deleted file mode 100644 index 19599670df3b..000000000000 --- a/sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 +++ /dev/null @@ -1,32 +0,0 @@ -dnl # -dnl # 3.3 API change -dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a -dnl # umode_t type rather than an int. The expectation is that any backport -dnl # would also change all three prototypes. However, if it turns out that -dnl # some distribution doesn't backport the whole thing this could be -dnl # broken apart into three separate checks. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T], [ - ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [ - #include - - int mkdir(struct inode *inode, struct dentry *dentry, - umode_t umode) { return 0; } - - static const struct inode_operations - iops __attribute__ ((unused)) = { - .mkdir = mkdir, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [ - AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t]) - ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, - [iops->create()/mkdir()/mknod() take umode_t]) - ],[ - ZFS_LINUX_TEST_ERROR([mkdir()]) - ]) -]) diff --git a/sys/contrib/openzfs/config/kernel-mkdir.m4 b/sys/contrib/openzfs/config/kernel-mkdir.m4 new file mode 100644 index 000000000000..a162bcd880ff --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-mkdir.m4 @@ -0,0 +1,65 @@ +dnl # +dnl # Supported mkdir() interfaces checked newest to oldest. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [ + dnl # + dnl # 5.12 API change + dnl # The struct user_namespace arg was added as the first argument to + dnl # mkdir() + dnl # + ZFS_LINUX_TEST_SRC([mkdir_user_namespace], [ + #include + + int mkdir(struct user_namespace *userns, + struct inode *inode, struct dentry *dentry, + umode_t umode) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .mkdir = mkdir, + }; + ],[]) + + dnl # + dnl # 3.3 API change + dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a + dnl # umode_t type rather than an int. The expectation is that any backport + dnl # would also change all three prototypes. However, if it turns out that + dnl # some distribution doesn't backport the whole thing this could be + dnl # broken apart into three separate checks. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [ + #include + + int mkdir(struct inode *inode, struct dentry *dentry, + umode_t umode) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .mkdir = mkdir, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_MKDIR], [ + dnl # + dnl # 5.12 API change + dnl # The struct user_namespace arg was added as the first argument to + dnl # mkdir() of the iops structure. + dnl # + AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1, + [iops->mkdir() takes struct user_namespace*]) + ],[ + AC_MSG_CHECKING([whether iops->mkdir() takes umode_t]) + ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, + [iops->mkdir() takes umode_t]) + ],[ + ZFS_LINUX_TEST_ERROR([mkdir()]) + ]) + ]) +]) diff --git a/sys/contrib/openzfs/config/kernel-mknod.m4 b/sys/contrib/openzfs/config/kernel-mknod.m4 new file mode 100644 index 000000000000..ffe45106003a --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-mknod.m4 @@ -0,0 +1,30 @@ +AC_DEFUN([ZFS_AC_KERNEL_SRC_MKNOD], [ + dnl # + dnl # 5.12 API change that added the struct user_namespace* arg + dnl # to the front of this function type's arg list. + dnl # + ZFS_LINUX_TEST_SRC([mknod_userns], [ + #include + #include + + int tmp_mknod(struct user_namespace *userns, + struct inode *inode ,struct dentry *dentry, + umode_t u, dev_t d) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .mknod = tmp_mknod, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_MKNOD], [ + AC_MSG_CHECKING([whether iops->mknod() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([mknod_userns], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_MKNOD_USERNS, 1, + [iops->mknod() takes struct user_namespace*]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/sys/contrib/openzfs/config/kernel-rename.m4 b/sys/contrib/openzfs/config/kernel-rename.m4 index f707391539d8..31d199f33bba 100644 --- a/sys/contrib/openzfs/config/kernel-rename.m4 +++ b/sys/contrib/openzfs/config/kernel-rename.m4 @@ -1,10 +1,10 @@ -dnl # -dnl # 4.9 API change, -dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants -dnl # flags. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [ - ZFS_LINUX_TEST_SRC([inode_operations_rename], [ +AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [ + dnl # + dnl # 4.9 API change, + dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants + dnl # flags. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [ #include int rename_fn(struct inode *sip, struct dentry *sdp, struct inode *tip, struct dentry *tdp, @@ -15,15 +15,41 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [ .rename = rename_fn, }; ],[]) + + dnl # + dnl # 5.12 API change, + dnl # + dnl # Linux 5.12 introduced passing struct user_namespace* as the first argument + dnl # of the rename() and other inode_operations members. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [ + #include + int rename_fn(struct user_namespace *user_ns, struct inode *sip, + struct dentry *sdp, struct inode *tip, struct dentry *tdp, + unsigned int flags) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .rename = rename_fn, + }; + ],[]) ]) -AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [ - AC_MSG_CHECKING([whether iops->rename() wants flags]) - ZFS_LINUX_TEST_RESULT([inode_operations_rename], [ +AC_DEFUN([ZFS_AC_KERNEL_RENAME], [ + AC_MSG_CHECKING([whether iops->rename() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([inode_operations_rename_userns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, - [iops->rename() wants flags]) + AC_DEFINE(HAVE_IOPS_RENAME_USERNS, 1, + [iops->rename() takes struct user_namespace*]) ],[ AC_MSG_RESULT(no) + + ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, + [iops->rename() wants flags]) + ],[ + AC_MSG_RESULT(no) + ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-setattr-prepare.m4 b/sys/contrib/openzfs/config/kernel-setattr-prepare.m4 index 45408c45c69b..24245aa53448 100644 --- a/sys/contrib/openzfs/config/kernel-setattr-prepare.m4 +++ b/sys/contrib/openzfs/config/kernel-setattr-prepare.m4 @@ -1,27 +1,52 @@ -dnl # -dnl # 4.9 API change -dnl # The inode_change_ok() function has been renamed setattr_prepare() -dnl # and updated to take a dentry rather than an inode. -dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_SETATTR_PREPARE], [ + dnl # + dnl # 4.9 API change + dnl # The inode_change_ok() function has been renamed setattr_prepare() + dnl # and updated to take a dentry rather than an inode. + dnl # ZFS_LINUX_TEST_SRC([setattr_prepare], [ #include ], [ struct dentry *dentry = NULL; struct iattr *attr = NULL; int error __attribute__ ((unused)) = - setattr_prepare(dentry, attr); + setattr_prepare(dentry, attr); + ]) + + dnl # + dnl # 5.12 API change + dnl # The setattr_prepare() function has been changed to accept a new argument + dnl # for struct user_namespace* + dnl # + ZFS_LINUX_TEST_SRC([setattr_prepare_userns], [ + #include + ], [ + struct dentry *dentry = NULL; + struct iattr *attr = NULL; + struct user_namespace *userns = NULL; + int error __attribute__ ((unused)) = + setattr_prepare(userns, dentry, attr); ]) ]) AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], [ - AC_MSG_CHECKING([whether setattr_prepare() is available]) - ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare], + AC_MSG_CHECKING([whether setattr_prepare() is available and accepts struct user_namespace*]) + ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare_userns], [setattr_prepare], [fs/attr.c], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SETATTR_PREPARE, 1, - [setattr_prepare() is available]) + AC_DEFINE(HAVE_SETATTR_PREPARE_USERNS, 1, + [setattr_prepare() accepts user_namespace]) ], [ AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether setattr_prepare() is available, doesn't accept user_namespace]) + ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare], + [setattr_prepare], [fs/attr.c], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SETATTR_PREPARE_NO_USERNS, 1, + [setattr_prepare() is available, doesn't accept user_namespace]) + ], [ + AC_MSG_RESULT(no) + ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-symlink.m4 b/sys/contrib/openzfs/config/kernel-symlink.m4 new file mode 100644 index 000000000000..d90366d04b72 --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-symlink.m4 @@ -0,0 +1,30 @@ +AC_DEFUN([ZFS_AC_KERNEL_SRC_SYMLINK], [ + dnl # + dnl # 5.12 API change that added the struct user_namespace* arg + dnl # to the front of this function type's arg list. + dnl # + ZFS_LINUX_TEST_SRC([symlink_userns], [ + #include + #include + + int tmp_symlink(struct user_namespace *userns, + struct inode *inode ,struct dentry *dentry, + const char *path) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .symlink = tmp_symlink, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SYMLINK], [ + AC_MSG_CHECKING([whether iops->symlink() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([symlink_userns], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_SYMLINK_USERNS, 1, + [iops->symlink() takes struct user_namespace*]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/sys/contrib/openzfs/config/kernel-xattr-handler.m4 b/sys/contrib/openzfs/config/kernel-xattr-handler.m4 index 137bf4a8aff0..00b1e74a9ccb 100644 --- a/sys/contrib/openzfs/config/kernel-xattr-handler.m4 +++ b/sys/contrib/openzfs/config/kernel-xattr-handler.m4 @@ -152,6 +152,21 @@ dnl # dnl # Supported xattr handler set() interfaces checked newest to oldest. dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ + ZFS_LINUX_TEST_SRC([xattr_handler_set_userns], [ + #include + + int set(const struct xattr_handler *handler, + struct user_namespace *mnt_userns, + struct dentry *dentry, struct inode *inode, + const char *name, const void *buffer, + size_t size, int flags) + { return 0; } + static const struct xattr_handler + xops __attribute__ ((unused)) = { + .set = set, + }; + ],[]) + ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [ #include @@ -194,45 +209,58 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ dnl # - dnl # 4.7 API change, - dnl # The xattr_handler->set() callback was changed to take both - dnl # dentry and inode. + dnl # 5.12 API change, + dnl # The xattr_handler->set() callback was changed to 8 arguments, and + dnl # struct user_namespace* was inserted as arg #2 dnl # - AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [ + AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, - [xattr_handler->set() wants both dentry and inode]) + AC_DEFINE(HAVE_XATTR_SET_USERNS, 1, + [xattr_handler->set() takes user_namespace]) ],[ dnl # - dnl # 4.4 API change, - dnl # The xattr_handler->set() callback was changed to take a - dnl # xattr_handler, and handler_flags argument was removed and - dnl # should be accessed by handler->flags. + dnl # 4.7 API change, + dnl # The xattr_handler->set() callback was changed to take both + dnl # dentry and inode. dnl # AC_MSG_RESULT(no) - AC_MSG_CHECKING( - [whether xattr_handler->set() wants xattr_handler]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [ + AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, - [xattr_handler->set() wants xattr_handler]) + AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, + [xattr_handler->set() wants both dentry and inode]) ],[ dnl # - dnl # 2.6.33 API change, - dnl # The xattr_handler->set() callback was changed - dnl # to take a dentry instead of an inode, and a - dnl # handler_flags argument was added. + dnl # 4.4 API change, + dnl # The xattr_handler->set() callback was changed to take a + dnl # xattr_handler, and handler_flags argument was removed and + dnl # should be accessed by handler->flags. dnl # AC_MSG_RESULT(no) AC_MSG_CHECKING( - [whether xattr_handler->set() wants dentry]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ + [whether xattr_handler->set() wants xattr_handler]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, - [xattr_handler->set() wants dentry]) + AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, + [xattr_handler->set() wants xattr_handler]) ],[ - ZFS_LINUX_TEST_ERROR([xattr set()]) + dnl # + dnl # 2.6.33 API change, + dnl # The xattr_handler->set() callback was changed + dnl # to take a dentry instead of an inode, and a + dnl # handler_flags argument was added. + dnl # + AC_MSG_RESULT(no) + AC_MSG_CHECKING( + [whether xattr_handler->set() wants dentry]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, + [xattr_handler->set() wants dentry]) + ],[ + ZFS_LINUX_TEST_ERROR([xattr set()]) + ]) ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel.m4 b/sys/contrib/openzfs/config/kernel.m4 index f31be845f5d9..dfb6165d879d 100644 --- a/sys/contrib/openzfs/config/kernel.m4 +++ b/sys/contrib/openzfs/config/kernel.m4 @@ -79,9 +79,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_EVICT_INODE ZFS_AC_KERNEL_SRC_DIRTY_INODE ZFS_AC_KERNEL_SRC_SHRINKER - ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T + ZFS_AC_KERNEL_SRC_MKDIR ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS - ZFS_AC_KERNEL_SRC_CREATE_FLAGS + ZFS_AC_KERNEL_SRC_CREATE ZFS_AC_KERNEL_SRC_GET_LINK ZFS_AC_KERNEL_SRC_PUT_LINK ZFS_AC_KERNEL_SRC_TMPFILE @@ -115,7 +115,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_KUIDGID_T ZFS_AC_KERNEL_SRC_KUID_HELPERS ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST - ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS + ZFS_AC_KERNEL_SRC_RENAME ZFS_AC_KERNEL_SRC_CURRENT_TIME ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL @@ -125,6 +125,10 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_KSTRTOUL ZFS_AC_KERNEL_SRC_PERCPU ZFS_AC_KERNEL_SRC_CPU_HOTPLUG + ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS + ZFS_AC_KERNEL_SRC_MKNOD + ZFS_AC_KERNEL_SRC_SYMLINK + ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS AC_MSG_CHECKING([for available kernel interfaces]) ZFS_LINUX_TEST_COMPILE_ALL([kabi]) @@ -177,9 +181,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_EVICT_INODE ZFS_AC_KERNEL_DIRTY_INODE ZFS_AC_KERNEL_SHRINKER - ZFS_AC_KERNEL_MKDIR_UMODE_T + ZFS_AC_KERNEL_MKDIR ZFS_AC_KERNEL_LOOKUP_FLAGS - ZFS_AC_KERNEL_CREATE_FLAGS + ZFS_AC_KERNEL_CREATE ZFS_AC_KERNEL_GET_LINK ZFS_AC_KERNEL_PUT_LINK ZFS_AC_KERNEL_TMPFILE @@ -213,7 +217,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_KUIDGID_T ZFS_AC_KERNEL_KUID_HELPERS ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST - ZFS_AC_KERNEL_RENAME_WANTS_FLAGS + ZFS_AC_KERNEL_RENAME ZFS_AC_KERNEL_CURRENT_TIME ZFS_AC_KERNEL_USERNS_CAPABILITIES ZFS_AC_KERNEL_IN_COMPAT_SYSCALL @@ -223,6 +227,10 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_KSTRTOUL ZFS_AC_KERNEL_PERCPU ZFS_AC_KERNEL_CPU_HOTPLUG + ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS + ZFS_AC_KERNEL_MKNOD + ZFS_AC_KERNEL_SYMLINK + ZFS_AC_KERNEL_BIO_MAX_SEGS ]) dnl # diff --git a/sys/contrib/openzfs/configure.ac b/sys/contrib/openzfs/configure.ac index 07f590b390bd..e31d12271394 100644 --- a/sys/contrib/openzfs/configure.ac +++ b/sys/contrib/openzfs/configure.ac @@ -240,6 +240,7 @@ AC_CONFIG_FILES([ tests/zfs-tests/tests/Makefile tests/zfs-tests/tests/functional/Makefile tests/zfs-tests/tests/functional/acl/Makefile + tests/zfs-tests/tests/functional/acl/off/Makefile tests/zfs-tests/tests/functional/acl/posix/Makefile tests/zfs-tests/tests/functional/acl/posix-sa/Makefile tests/zfs-tests/tests/functional/alloc_class/Makefile diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h index a7e63944ea16..42f463ab9ae9 100644 --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h @@ -30,8 +30,8 @@ #include /* 2.6.37 API change */ -#define zfs_kmap_atomic(page, km_type) kmap_atomic(page) -#define zfs_kunmap_atomic(addr, km_type) kunmap_atomic(addr) +#define zfs_kmap_atomic(page) kmap_atomic(page) +#define zfs_kunmap_atomic(addr) kunmap_atomic(addr) /* 5.0 API change - no more 'type' argument for access_ok() */ #ifdef HAVE_ACCESS_OK_TYPE diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h index c35e80d31cd7..91e908598fbb 100644 --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h @@ -343,7 +343,8 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid) /* * 4.9 API change */ -#ifndef HAVE_SETATTR_PREPARE +#if !(defined(HAVE_SETATTR_PREPARE_NO_USERNS) || \ + defined(HAVE_SETATTR_PREPARE_USERNS)) static inline int setattr_prepare(struct dentry *dentry, struct iattr *ia) { @@ -389,6 +390,15 @@ func(const struct path *path, struct kstat *stat, u32 request_mask, \ { \ return (func##_impl(path, stat, request_mask, query_flags)); \ } +#elif defined(HAVE_USERNS_IOPS_GETATTR) +#define ZPL_GETATTR_WRAPPER(func) \ +static int \ +func(struct user_namespace *user_ns, const struct path *path, \ + struct kstat *stat, u32 request_mask, unsigned int query_flags) \ +{ \ + return (func##_impl(user_ns, path, stat, request_mask, \ + query_flags)); \ +} #else #error #endif @@ -436,4 +446,16 @@ zpl_is_32bit_api(void) #endif } +/* + * 5.12 API change + * To support id-mapped mounts, generic_fillattr() was modified to + * accept a new struct user_namespace* as its first arg. + */ +#ifdef HAVE_GENERIC_FILLATTR_USERNS +#define zpl_generic_fillattr(user_ns, ip, sp) \ + generic_fillattr(user_ns, ip, sp) +#else +#define zpl_generic_fillattr(user_ns, ip, sp) generic_fillattr(ip, sp) +#endif + #endif /* _ZFS_VFS_H */ diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h index 8348e99198af..54690727eab9 100644 --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h @@ -119,12 +119,27 @@ fn(struct dentry *dentry, const char *name, void *buffer, size_t size, \ #error "Unsupported kernel" #endif +/* + * 5.12 API change, + * The xattr_handler->set() callback was changed to take the + * struct user_namespace* as the first arg, to support idmapped + * mounts. + */ +#if defined(HAVE_XATTR_SET_USERNS) +#define ZPL_XATTR_SET_WRAPPER(fn) \ +static int \ +fn(const struct xattr_handler *handler, struct user_namespace *user_ns, \ + struct dentry *dentry, struct inode *inode, const char *name, \ + const void *buffer, size_t size, int flags) \ +{ \ + return (__ ## fn(inode, name, buffer, size, flags)); \ *** 3309 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Apr 4 17:39:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BDD55ADA5D; Sun, 4 Apr 2021 17:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD1J218zBz3jYY; Sun, 4 Apr 2021 17:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19586156C; Sun, 4 Apr 2021 17:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 134HdTLH000601; Sun, 4 Apr 2021 17:39:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 134HdTO0000600; Sun, 4 Apr 2021 17:39:29 GMT (envelope-from git) Date: Sun, 4 Apr 2021 17:39:29 GMT Message-Id: <202104041739.134HdTO0000600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 51a7be5f6036 - main - Style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51a7be5f6036ebd47c8b3f704d52e7ec3f837114 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 17:39:30 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=51a7be5f6036ebd47c8b3f704d52e7ec3f837114 commit 51a7be5f6036ebd47c8b3f704d52e7ec3f837114 Author: Konstantin Belousov AuthorDate: 2021-04-04 16:27:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-04 17:39:06 +0000 Style Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/vm/vm_kern.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 637298eb2caa..f767f01acaa5 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -891,7 +891,7 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) i = 0; error = sysctl_handle_int(oidp, &i, 0, req); - if (error) + if (error != 0) return (error); if ((i & ~(VM_LOW_KMEM | VM_LOW_PAGES)) != 0) return (EINVAL); @@ -900,5 +900,6 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) return (0); } -SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, - debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags"); +SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, debug_vm_lowmem, "I", + "set to trigger vm_lowmem event with given flags"); From owner-dev-commits-src-all@freebsd.org Sun Apr 4 17:39:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E28E5ADA7B; Sun, 4 Apr 2021 17:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD1J31gFLz3jc0; Sun, 4 Apr 2021 17:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2AE2B156D; Sun, 4 Apr 2021 17:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 134HdVY0000622; Sun, 4 Apr 2021 17:39:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 134HdVYt000621; Sun, 4 Apr 2021 17:39:31 GMT (envelope-from git) Date: Sun, 4 Apr 2021 17:39:31 GMT Message-Id: <202104041739.134HdVYt000621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 89619b747bcf - main - Add sysctl debug.uma_reclaim MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 89619b747bcff379dca98e975a98865a45366417 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 17:39:31 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=89619b747bcff379dca98e975a98865a45366417 commit 89619b747bcff379dca98e975a98865a45366417 Author: Konstantin Belousov AuthorDate: 2021-04-04 16:28:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-04 17:39:06 +0000 Add sysctl debug.uma_reclaim Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/vm/vm_kern.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index f767f01acaa5..77d9a4105862 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -903,3 +903,23 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags"); + +static int +debug_uma_reclaim(SYSCTL_HANDLER_ARGS) +{ + int error, i; + + i = 0; + error = sysctl_handle_int(oidp, &i, 0, req); + if (error != 0) + return (error); + if (i != UMA_RECLAIM_TRIM && i != UMA_RECLAIM_DRAIN && + i != UMA_RECLAIM_DRAIN_CPU) + return (EINVAL); + uma_reclaim(i); + return (0); +} + +SYSCTL_PROC(_debug, OID_AUTO, uma_reclaim, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, debug_uma_reclaim, "I", + "set to generate request to reclaim uma caches"); From owner-dev-commits-src-all@freebsd.org Sun Apr 4 17:52:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C18465AE93C; Sun, 4 Apr 2021 17:52:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD1bN4xH8z3ktY; Sun, 4 Apr 2021 17:52:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A27D1CA9; Sun, 4 Apr 2021 17:52:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 134Hqm9n026923; Sun, 4 Apr 2021 17:52:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 134Hqmq6026922; Sun, 4 Apr 2021 17:52:48 GMT (envelope-from git) Date: Sun, 4 Apr 2021 17:52:48 GMT Message-Id: <202104041752.134Hqmq6026922@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 8c1d956ffa03 - main - jail: fix jail(8) synposis and usage message to match reality. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c1d956ffa0355ece3b63ea8587938176f87f072 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 17:52:48 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=8c1d956ffa0355ece3b63ea8587938176f87f072 commit 8c1d956ffa0355ece3b63ea8587938176f87f072 Author: Jamie Gritton AuthorDate: 2021-04-04 17:49:38 +0000 Commit: Jamie Gritton CommitDate: 2021-04-04 17:49:38 +0000 jail: fix jail(8) synposis and usage message to match reality. Reported by: yuri PR: 254741 MFC after: 5 days --- usr.sbin/jail/jail.8 | 4 ++-- usr.sbin/jail/jail.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/jail/jail.8 b/usr.sbin/jail/jail.8 index cc3561f03f6a..61fe91cf973e 100644 --- a/usr.sbin/jail/jail.8 +++ b/usr.sbin/jail/jail.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 18, 2020 +.Dd April 4, 2021 .Dt JAIL 8 .Os .Sh NAME @@ -58,7 +58,7 @@ .Op Fl U Ar username .Op Fl n Ar jailname .Op Fl s Ar securelevel -.Op Ar path hostname [ Ar ip Ns [ Ns Ar ,... Ns ]] Ar command ... +.Ar path hostname ip Ns [ Ns Ar ,... Ns ] Ar command ... .Nm .Op Fl f Ar conf_file .Fl e diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c index 920e573b9149..eb3b19f2cb82 100644 --- a/usr.sbin/jail/jail.c +++ b/usr.sbin/jail/jail.c @@ -1046,7 +1046,7 @@ usage(void) " jail [-qv] [-f file] -[rR] ['*' | jail ...]\n" " jail [-dhilqv] [-J jid_file] [-u username] [-U username]\n" " [-n jailname] [-s securelevel]\n" - " path hostname [ip[,...]] command ...\n" + " path hostname ip[,...] command ...\n" " jail [-f file] -e separator\n"); exit(1); } From owner-dev-commits-src-all@freebsd.org Sun Apr 4 19:33:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A26B5B2134; Sun, 4 Apr 2021 19:33:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD3qx04BNz3rvK; Sun, 4 Apr 2021 19:33:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E82EC2E76; Sun, 4 Apr 2021 19:33:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 134JXm7q067271; Sun, 4 Apr 2021 19:33:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 134JXmHh067270; Sun, 4 Apr 2021 19:33:48 GMT (envelope-from git) Date: Sun, 4 Apr 2021 19:33:48 GMT Message-Id: <202104041933.134JXmHh067270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d218c6f6af33 - main - amd64 fabs.S: use '.section .rodata' instead of '.rodata' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d218c6f6af336135ea88342d472b0e66c21239c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 19:33:49 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d218c6f6af336135ea88342d472b0e66c21239c9 commit d218c6f6af336135ea88342d472b0e66c21239c9 Author: Konstantin Belousov AuthorDate: 2021-04-04 19:25:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-04 19:33:22 +0000 amd64 fabs.S: use '.section .rodata' instead of '.rodata' Seems to be an issue with older gnu as Reported by: rscheff Sponsored by: The FreeBSD Foundation MFC after: 6 days --- lib/libc/amd64/gen/fabs.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/amd64/gen/fabs.S b/lib/libc/amd64/gen/fabs.S index 1da21d03f506..38e67ab03873 100644 --- a/lib/libc/amd64/gen/fabs.S +++ b/lib/libc/amd64/gen/fabs.S @@ -39,7 +39,7 @@ ENTRY(fabs) ret END(fabs) - .rodata + .section .rodata .p2align 3 signbit: .quad 0x8000000000000000 From owner-dev-commits-src-all@freebsd.org Sun Apr 4 19:59:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 263995B2C36 for ; Sun, 4 Apr 2021 19:59:57 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD4Q50Gsyz3tZw for ; Sun, 4 Apr 2021 19:59:56 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f47.google.com with SMTP id a6so3220418wrw.8 for ; Sun, 04 Apr 2021 12:59:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=CuhjgShwtkWEokTH4zTmghyta/4n9gOlfL2mTx2DGcE=; b=Ba5AzN8IJ704+n7U64U08eSb9on2548qEMEtOTxAbEjZSeIYt82awZVQo13CeMP1hv eOoicxqbFl5Mr+agaGsB+63OaL2oezXYfdwdcYZTxjZeZpxe9s089aYaFuaO6mC1B3AD RT8RJtauu1AQ3XduL0f2pKIWI94N7RMSOY7QKJ+SzR5B7719QTm0PtqIjj4wZfLJ4h0a zlRat5gQtxl5iMR7HoOMaxpcnpArchv1+opX9aoXiRzwdGrpx62/kd1ZdBmbxy7znw60 kP230NP4eiHGx2gUHwgnr4DxjQuR226oPl61Yix9Xow7Mxb60lN+2LcAaxmfk9Ws2xS2 QhhA== X-Gm-Message-State: AOAM531AlAtPRAnZDu67CBjlKKgjVnLMdXZ9puGE3yGFrs9A00c5B2pL tuJV8sKbv8nqmIpP8aYV92yRnQ== X-Google-Smtp-Source: ABdhPJxUu7Y9lnIcVVXdy6QSfgVgPyrYscx1bnrmr/QTEC6+dLUsoKF+JgCo2zgmWW5YhD58Mey4IA== X-Received: by 2002:a5d:6a86:: with SMTP id s6mr26625543wru.307.1617566395550; Sun, 04 Apr 2021 12:59:55 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id 64sm20407118wmz.7.2021.04.04.12.59.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Apr 2021 12:59:55 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 6d3f54fd0901 - main - amd64 fabs.S: put signbit into rodata instead of text From: Jessica Clarke In-Reply-To: <202104040150.1341o01x072186@gitrepo.freebsd.org> Date: Sun, 4 Apr 2021 20:59:54 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <5E9FB294-48BC-4805-82AF-F3ED76276550@freebsd.org> References: <202104040150.1341o01x072186@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FD4Q50Gsyz3tZw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 19:59:57 -0000 On 4 Apr 2021, at 02:50, Konstantin Belousov wrote: >=20 > The branch main has been updated by kib: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D6d3f54fd090162ab14e2ec66f46bb133= 5a127a30 >=20 > commit 6d3f54fd090162ab14e2ec66f46bb1335a127a30 > Author: Konstantin Belousov > AuthorDate: 2021-04-04 01:36:32 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-04-04 01:49:22 +0000 >=20 > amd64 fabs.S: put signbit into rodata instead of text Thanks! Jess > Noted by: jrtc27 > MFC after: 1 week > Sponsored by: The FreeBSD Foundation > --- > lib/libc/amd64/gen/fabs.S | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/lib/libc/amd64/gen/fabs.S b/lib/libc/amd64/gen/fabs.S > index bb1ac3a81b96..1da21d03f506 100644 > --- a/lib/libc/amd64/gen/fabs.S > +++ b/lib/libc/amd64/gen/fabs.S > @@ -39,6 +39,7 @@ ENTRY(fabs) > ret > END(fabs) >=20 > + .rodata > .p2align 3 > signbit: > .quad 0x8000000000000000 From owner-dev-commits-src-all@freebsd.org Sun Apr 4 22:08:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCCAB5B7A24; Sun, 4 Apr 2021 22:08:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD7Gs2MwGz4Y9t; Sun, 4 Apr 2021 22:08:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42B7555A3; Sun, 4 Apr 2021 22:08:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 134M8rUf078091; Sun, 4 Apr 2021 22:08:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 134M8rYM078090; Sun, 4 Apr 2021 22:08:53 GMT (envelope-from git) Date: Sun, 4 Apr 2021 22:08:53 GMT Message-Id: <202104042208.134M8rYM078090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 6f2addd83881 - main - nfsd: fix BindConnectionToSession so that it clears "cb path down" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f2addd838810ce33c7e9ad9543827d45e0b491c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 22:08:54 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=6f2addd838810ce33c7e9ad9543827d45e0b491c commit 6f2addd838810ce33c7e9ad9543827d45e0b491c Author: Rick Macklem AuthorDate: 2021-04-04 22:05:39 +0000 Commit: Rick Macklem CommitDate: 2021-04-04 22:05:39 +0000 nfsd: fix BindConnectionToSession so that it clears "cb path down" Commit 01ae8969a9ee stopped the NFSv4.1/4.2 server from implicitly binding the back channel to a new TCP connection so that it conforms to RFC5661, for NFSv4.1/4.2. An effect of this for the Linux NFS client is that it will do a BindConnectionToSession when it sees NFSV4SEQ_CBPATHDOWN set in a sequence reply. It will do this for every RPC reply until it no longer sees the flag. Without that patch, this will happen until the client does an Open, which will clear LCL_CBDOWN. This patch clears LCL_CBDOWN right away, so that NFSV4SEQ_CBPATHDOWN will no longer be sent to the client in Sequence replies and the Linux client will not repeat the BindConnectionToSession RPCs. This is not critical for correct behaviour, but reduces RPC overheads for cases where the Open will not be done for a while. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 5ac37ed07cae..1cf0dcee99e9 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -6440,6 +6440,7 @@ nfsrv_bindconnsess(struct nfsrv_descript *nd, uint8_t *sessionid, int *foreaftp) sep->sess_crflags |= NFSV4CRSESS_CONNBACKCHAN; clp->lc_flags |= LCL_DONEBINDCONN | LCL_NEEDSCBNULL; + clp->lc_flags &= ~LCL_CBDOWN; if (*foreaftp == NFSCDFS4_BACK) *foreaftp = NFSCDFS4_BACK; else