From owner-dev-commits-src-main@freebsd.org Mon Mar 29 08:06:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 08:57:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 09:22:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 09:59:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 14:39:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 15:02:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 15:05:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 15:06:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 15:06:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 15:06:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 15:06:21 -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-main@freebsd.org Mon Mar 29 15:06:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 16:29:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 16:36:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 16:41:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 17:28:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 20:10:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 20:41:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 22:16:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 23:07:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 23:07:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 23:15:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 23:24:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 23:32:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 23:43:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 23:45:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Mon Mar 29 23:49:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 06:19:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 06:29:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 08:47:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 09:42:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 09:53:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 14:19:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 14:19:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 14:20:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 14:20:01 -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-main@freebsd.org Tue Mar 30 14:37:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 14:37:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 14:52:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 15:05:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 15:48:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 17:38:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 17:38:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 17:38:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Mar 2021 17:38:32 -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-main@freebsd.org Tue Mar 30 17:52:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 18:08:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F9FA57FAEC for ; Tue, 30 Mar 2021 18:08:24 +0000 (UTC) (envelope-from 0100017884527dea-3cdb0c79-18e2-4a99-9287-fba6900a5614-000000@amazonses.com) Received: from a8-237.smtp-out.amazonses.com (a8-237.smtp-out.amazonses.com [54.240.8.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8y9g2bjWz54rX for ; Tue, 30 Mar 2021 18:08:22 +0000 (UTC) (envelope-from 0100017884527dea-3cdb0c79-18e2-4a99-9287-fba6900a5614-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=JkUDVrfkhX0JGES90MfahVAPM3BD7yEZ1S89IMr7HibEJ8sTLJrOkcZGA/6GEHur blTWS0GCE6whIQi8KR2g4ICbsaE5oahIGdPNu5zTkCV21bHFFsbhwHJl7axNhGi6K40 5Hq5JGNw43Td2umBd4bvIFAaPxcJeuff8Gxpq3ps= 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=RPUi9xFv9kK/ztyZdBTTaUzjlksGk+Zuo2sCPAAW9Wo9WTuwGVnI5/L1sF8kXLfd cw3V0PxK1/aJ3th+64vzipYDG7JhtxzP+kRpOw6hF57FuFAtcUKS7WwJ6hiCD901dqA c3zc2gPGViJZr6lQjjERn3+uFZBuJMASTl2XnxG4= 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: <0100017884527dea-3cdb0c79-18e2-4a99-9287-fba6900a5614-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.237 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-Rspamd-Queue-Id: 4F8y9g2bjWz54rX X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tarsnap.com header.s=dqtolf56kk3wpt62c3jnwboqvr7iedax header.b=JkUDVrfk; dkim=pass header.d=amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=RPUi9xFv; dmarc=pass (policy=none) header.from=tarsnap.com; spf=pass (mx1.freebsd.org: domain of 0100017884527dea-3cdb0c79-18e2-4a99-9287-fba6900a5614-000000@amazonses.com designates 54.240.8.237 as permitted sender) smtp.mailfrom=0100017884527dea-3cdb0c79-18e2-4a99-9287-fba6900a5614-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:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RWL_MAILSPIKE_GOOD(0.00)[54.240.8.237:from]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[54.240.8.237: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.237:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[cperciva@tarsnap.com,0100017884527dea-3cdb0c79-18e2-4a99-9287-fba6900a5614-000000@amazonses.com]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[54.240.8.237: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,0100017884527dea-3cdb0c79-18e2-4a99-9287-fba6900a5614-000000@amazonses.com]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 18:23:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 18:34:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 19:13:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 21:39:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 21:49:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 22:22:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 22:32:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 22:44:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Tue Mar 30 23:27:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 01:10:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 01:17:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 01:23:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 01:28:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 01:45:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 02:22:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 04:05:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 11:19:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 11:38:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 11:38:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 17:18:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 17:25:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 18:19:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 18:24:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 18:34:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 18:34:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 19:41:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Wed Mar 31 20:59:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 04:04:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 04:37:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 05:33:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 07:31:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 08:03:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 08:20:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 09:11:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 09:35:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 12:51:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 14:01:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 14:32:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 15:20:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 21:07:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 21:25:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 22:12:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 22:39:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 22:49:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 22:49:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Thu Apr 1 23:37:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 01:20:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 02:10:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 02:18:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 03:13:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 03:13:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 03:13:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 03:13:39 -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-main@freebsd.org Fri Apr 2 06:47:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 07:01:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 08:44:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 10:12:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 10:15:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 10:45:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 12:40:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 12:49:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 12:49:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 14:37:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 14:39:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 18:25:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 18:28:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 18:35:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 18:55:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 21:51:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 21:51:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Fri Apr 2 21:51:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sat Apr 3 06:40:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sat Apr 3 12:06:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sat Apr 3 12:27:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sat Apr 3 20:22:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sat Apr 3 20:30:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sat Apr 3 21:50:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sat Apr 3 22:01:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sat Apr 3 22:01:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 00:57:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC1B65C483A for ; Sun, 4 Apr 2021 00:57:56 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 4FCb4N55SVz3R34 for ; Sun, 4 Apr 2021 00:57:56 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f45.google.com with SMTP id w203-20020a1c49d40000b029010c706d0642so6262896wma.0 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=KhPA/GQxtHmwGtTfiRpKnazK87B24z6QMlXwaNXIxoEvEbHQO5CnCKFh1Xi5Z6hPKj RxycjuNkanCPicvFV8OnqF7kcWnEpEwECHsV74oFvj66fKheH29WbYa1q8hieyjCJV8L 0ZXPnHP+TrwgMvylspTJqoDVBVR57tPh8gzmOo9Sz9k31DS8SVkQWsECEMqO5vVv8F7n WXHUFw06yuk1Ha7WcCCxfIp4EtbIirMhuhXUuFOpksvNVJGSnwkSybS+JPB5RfLBTZ9X Zdq3IBbp2vyXIWSL3b/C8hdfvFTL7g2XxmMlDA5eSTTvBLO7Tf1EV3v9KqUdT8Ro8tHf ET/w== X-Gm-Message-State: AOAM531TqdIl4salQE1jG9G5dWrojKWbQbc5VU+W9SVZsltaakqSH11O Vygb4rzecT+dSvxSPRkxP4Rvhw== 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: 4FCb4N55SVz3R34 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 01:50:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 08:16:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 08:36:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 08:36:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 08:36:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 08:36:37 -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-main@freebsd.org Sun Apr 4 17:39:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 17:39:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 17:52:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2021 17:52:49 -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-main@freebsd.org Sun Apr 4 19:33:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 19:59:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 262735B2D18 for ; Sun, 4 Apr 2021 19:59:57 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD4Q46lXXz3tgr for ; Sun, 4 Apr 2021 19:59:56 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f48.google.com with SMTP id b9so1349163wrs.1 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=Bju7ecNiQKxQ9mhxZm8/PF+vUcyEQ7NJ/BFJ+OKVsm9r7tm8j10jjO3MmXAMve3As3 cLPnqz+BR6a7bIo6nnILGVHre18AhAUOPqC+aVA+kOKFK2KPME2wM9SxMdFdX1j969pN UyM6h2gXfJAqfTsKFYgLuPpi+liyLVaZOZ2bk1C3EjoFVUHTHr8q8aKHnuRC3Aeapa4T DcrJft1jCiAoFs0nTELVVRb7P6Md+qyrz+gCs0cPEksihUdLuKb7ST4t7b+4W/rV65hl XfCiygBpBW9jJoq7/B0UmcWK8XM2LYGnRj5IPIZu32DY1IW0e2h6BL9G6WJYRuErtoDV 6mog== X-Gm-Message-State: AOAM5315G9gC/i+5nMdpcrrIXhHptK4pZbJe6WSAingmejNEaE6vU6UJ f4RYJc4qLP+FTq3ytlz8c4lVqR+nnX3ELEyI 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: 4FD4Q46lXXz3tgr 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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-main@freebsd.org Sun Apr 4 22:08:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch 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