From owner-dev-commits-src-main@freebsd.org Mon Jun 21 01:15: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 E302965D04C; Mon, 21 Jun 2021 01:15: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 4G7Wmk5pffz3Nlg; Mon, 21 Jun 2021 01:15: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 AF54F13D6D; Mon, 21 Jun 2021 01:15: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 15L1FYpx002266; Mon, 21 Jun 2021 01:15:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L1FYbM002265; Mon, 21 Jun 2021 01:15:34 GMT (envelope-from git) Date: Mon, 21 Jun 2021 01:15:34 GMT Message-Id: <202106210115.15L1FYbM002265@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: 4afa62be7167 - main - cam: Set the CAM_QOS_VALID when valid 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: 4afa62be71674b76c31ea513d6c470089a6c1848 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, 21 Jun 2021 01:15:35 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4afa62be71674b76c31ea513d6c470089a6c1848 commit 4afa62be71674b76c31ea513d6c470089a6c1848 Author: Warner Losh AuthorDate: 2021-06-18 17:57:57 +0000 Commit: Warner Losh CommitDate: 2021-06-21 01:14:13 +0000 cam: Set the CAM_QOS_VALID when valid When the elapsed time of the operation is complete and stored in the QOS field, set the CAM_QOS_VALID bit. In iosched, test to make sure it's set before using it. Sponsored by: Netflix --- sys/cam/cam_iosched.c | 3 ++- sys/cam/cam_xpt.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c index ba1bc4843163..d30eb34747e1 100644 --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -1685,7 +1685,8 @@ cam_iosched_bio_complete(struct cam_iosched_softc *isc, struct bio *bp, printf("Completing command with bio_cmd == %#x\n", bp->bio_cmd); } - if (!(bp->bio_flags & BIO_ERROR) && done_ccb != NULL) { + if ((bp->bio_flags & BIO_ERROR) == 0 && done_ccb != NULL && + (done_ccb->ccb_h.status & CAM_QOS_VALID) != 0) { sbintime_t sim_latency; sim_latency = cam_iosched_sbintime_t(done_ccb->ccb_h.qos.periph_data); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 762feaf5dd49..b0e112868383 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4617,6 +4617,7 @@ xpt_done(union ccb *done_ccb) /* Store the time the ccb was in the sim */ done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data); + done_ccb->ccb_h.status |= CAM_QOS_VALID; hash = (u_int)(done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id + done_ccb->ccb_h.target_lun) % cam_num_doneqs; queue = &cam_doneqs[hash]; From owner-dev-commits-src-main@freebsd.org Mon Jun 21 03:29: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 EE84665E8C6; Mon, 21 Jun 2021 03:29: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 4G7Zkp6C8Hz3n9t; Mon, 21 Jun 2021 03:29: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 B294215EA2; Mon, 21 Jun 2021 03:29: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 15L3T6pa076221; Mon, 21 Jun 2021 03:29:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L3T6vX076220; Mon, 21 Jun 2021 03:29:06 GMT (envelope-from git) Date: Mon, 21 Jun 2021 03:29:06 GMT Message-Id: <202106210329.15L3T6vX076220@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 60a978bec912 - main - stand/common: Add file_addbuf() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 60a978bec9123fcb9c74bd925e06dd3f4faddac6 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, 21 Jun 2021 03:29:07 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=60a978bec9123fcb9c74bd925e06dd3f4faddac6 commit 60a978bec9123fcb9c74bd925e06dd3f4faddac6 Author: Colin Percival AuthorDate: 2021-05-30 20:17:11 +0000 Commit: Colin Percival CommitDate: 2021-06-21 03:09:41 +0000 stand/common: Add file_addbuf() This provides an interface for a memory buffer to be passed from the loader to the kernel as a "preloaded module". Reviewed by: kevans --- stand/common/bootstrap.h | 1 + stand/common/module.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index f671dba96e63..d94d35b555e4 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -260,6 +260,7 @@ void file_addmetadata(struct preloaded_file *, int, size_t, void *); int file_addmodule(struct preloaded_file *, char *, int, struct kernel_module **); void file_removemetadata(struct preloaded_file *fp); +int file_addbuf(const char *name, const char *type, size_t len, void *buf); vm_offset_t build_font_module(vm_offset_t); diff --git a/stand/common/module.c b/stand/common/module.c index 34ffc10cded3..8bddd9f56f52 100644 --- a/stand/common/module.c +++ b/stand/common/module.c @@ -1042,6 +1042,57 @@ file_removemetadata(struct preloaded_file *fp) fp->f_metadata = NULL; } +/* + * Add a buffer to the list of preloaded "files". + */ +int +file_addbuf(const char *name, const char *type, size_t len, void *buf) +{ + struct preloaded_file *fp; + vm_offset_t dest; + + /* We can't load first */ + if ((file_findfile(NULL, NULL)) == NULL) { + command_errmsg = "can't load file before kernel"; + return (-1); + } + + /* Figure out where to load the data. */ + dest = loadaddr; + if (archsw.arch_loadaddr != NULL) + dest = archsw.arch_loadaddr(LOAD_RAW, (void *)name, dest); + + /* Create & populate control structure */ + fp = file_alloc(); + if (fp == NULL) { + snprintf(command_errbuf, sizeof (command_errbuf), + "no memory to load %s", name); + return (-1); + } + fp->f_name = strdup(name); + fp->f_type = strdup(type); + fp->f_args = NULL; + fp->f_metadata = NULL; + fp->f_loader = -1; + fp->f_addr = dest; + fp->f_size = len; + if ((fp->f_name == NULL) || (fp->f_type == NULL)) { + snprintf(command_errbuf, sizeof (command_errbuf), + "no memory to load %s", name); + free(fp->f_name); + free(fp->f_type); + return (-1); + } + + /* Copy the data in. */ + archsw.arch_copyin(buf, fp->f_addr, len); + loadaddr = fp->f_addr + len; + + /* Add to the list of loaded files */ + file_insert_tail(fp); + return(0); +} + struct file_metadata * metadata_next(struct file_metadata *md, int type) { From owner-dev-commits-src-main@freebsd.org Mon Jun 21 03:29:08 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 3F49B65DC74; Mon, 21 Jun 2021 03:29:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7Zkr0c8lz3msW; Mon, 21 Jun 2021 03:29:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E47CE1608D; Mon, 21 Jun 2021 03:29:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15L3T7L2076246; Mon, 21 Jun 2021 03:29:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L3T74m076245; Mon, 21 Jun 2021 03:29:07 GMT (envelope-from git) Date: Mon, 21 Jun 2021 03:29:07 GMT Message-Id: <202106210329.15L3T74m076245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: e193d3ba3377 - main - libsa: Add support for timestamp logging (tslog) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e193d3ba337757a27148a38494d3df106b826d1c 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, 21 Jun 2021 03:29:08 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=e193d3ba337757a27148a38494d3df106b826d1c commit e193d3ba337757a27148a38494d3df106b826d1c Author: Colin Percival AuthorDate: 2021-05-30 20:20:50 +0000 Commit: Colin Percival CommitDate: 2021-06-21 03:09:42 +0000 libsa: Add support for timestamp logging (tslog) At present this only supports x86, due to the use of the rdtsc instruction; and is inert unless a buffer is allocated and passed to the tslog code (which will be done by a future commit). Reviewed by: kevans --- stand/libsa/Makefile | 2 +- stand/libsa/stand.h | 9 ++++++ stand/libsa/tslog.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index 838fefb260a8..815f479b5a0a 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -16,7 +16,7 @@ LIB?= sa SRCS+= gzguts.h zutil.h __main.c abort.c assert.c bcd.c environment.c \ getopt.c gets.c globals.c \ hexdump.c pager.c panic.c printf.c strdup.c strerror.c \ - random.c sbrk.c twiddle.c zalloc.c zalloc_malloc.c + random.c sbrk.c tslog.c twiddle.c zalloc.c zalloc_malloc.c # private (pruned) versions of libc string functions SRCS+= strcasecmp.c diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h index 6da4966738b4..eb95afe4b169 100644 --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -473,4 +473,13 @@ caddr_t ptov(uintptr_t); /* hexdump.c */ void hexdump(caddr_t region, size_t len); +/* tslog.c */ +#define TSRAW(a, b, c) tslog(a, b, c) +#define TSENTER() TSRAW("ENTER", __func__, NULL) +#define TSEXIT() TSRAW("EXIT", __func__, NULL) +#define TSLINE() TSRAW("EVENT", __FILE__, __XSTRING(__LINE__)) +void tslog(const char *, const char *, const char *); +void tslog_setbuf(void * buf, size_t len); +void tslog_getbuf(void ** buf, size_t * len); + #endif /* STAND_H */ diff --git a/stand/libsa/tslog.c b/stand/libsa/tslog.c new file mode 100644 index 000000000000..7ea18e0bb8f8 --- /dev/null +++ b/stand/libsa/tslog.c @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 2021 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include + +#include + +/* Buffer for holding tslog data in string format. */ +static char * tslog_buf = NULL; +static size_t tslog_buflen = 0; +static size_t tslog_bufpos = 0; + +void +tslog_setbuf(void * buf, size_t len) +{ + + tslog_buf = (char *)buf; + tslog_buflen = len; + tslog_bufpos = 0; +} + +void +tslog_getbuf(void ** buf, size_t * len) +{ + + *buf = (void *)tslog_buf; + *len = tslog_bufpos; +} + +void +tslog(const char * type, const char * f, const char * s) +{ +#if defined(__amd64__) || defined(__i386__) + uint64_t tsc = rdtsc(); +#else + uint64_t tsc = 0; +#endif + int len; + + /* If we have no buffer, do nothing. */ + if (tslog_buf == NULL) + return; + + /* Append to existing buffer, if we have enough space. */ + len = snprintf(&tslog_buf[tslog_bufpos], + tslog_buflen - tslog_bufpos, "0x0 %llu %s %s%s%s\n", + (unsigned long long)tsc, type, f, s ? " " : "", s ? s : ""); + if ((len > 0) && (tslog_bufpos + len <= tslog_buflen)) + tslog_bufpos += len; +} From owner-dev-commits-src-main@freebsd.org Mon Jun 21 03:29: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 4367465E63A; Mon, 21 Jun 2021 03:29: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 4G7Zks0bLQz3n9y; Mon, 21 Jun 2021 03:29: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 E44E315EA3; Mon, 21 Jun 2021 03:29:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15L3T8kN076270; Mon, 21 Jun 2021 03:29:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L3T8D5076269; Mon, 21 Jun 2021 03:29:08 GMT (envelope-from git) Date: Mon, 21 Jun 2021 03:29:08 GMT Message-Id: <202106210329.15L3T8D5076269@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: c8dfc327db23 - main - stand/common: Add support for timestamp logging (tslog) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8dfc327db2373c721a35efe857cf07262fd7dd0 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, 21 Jun 2021 03:29:09 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=c8dfc327db2373c721a35efe857cf07262fd7dd0 commit c8dfc327db2373c721a35efe857cf07262fd7dd0 Author: Colin Percival AuthorDate: 2021-05-30 20:30:28 +0000 Commit: Colin Percival CommitDate: 2021-06-21 03:09:43 +0000 stand/common: Add support for timestamp logging (tslog) This adds tslog_init, which allocates a 2MB buffer for recording timestamped events; and tslog_publish, which takes the buffer and passes it to the kernel as a "preloaded module". These functions will be used in a later commit. Reviewed by: kevans --- stand/common/bootstrap.h | 2 ++ stand/common/tslog.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ stand/loader.mk | 2 +- 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index d94d35b555e4..b7e1f8553f47 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -261,6 +261,8 @@ int file_addmodule(struct preloaded_file *, char *, int, struct kernel_module **); void file_removemetadata(struct preloaded_file *fp); int file_addbuf(const char *name, const char *type, size_t len, void *buf); +int tslog_init(void); +int tslog_publish(void); vm_offset_t build_font_module(vm_offset_t); diff --git a/stand/common/tslog.c b/stand/common/tslog.c new file mode 100644 index 000000000000..3851e760daf1 --- /dev/null +++ b/stand/common/tslog.c @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 2021 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include + +#include "bootstrap.h" + +/* Buffer for holding tslog data in string format. */ +#ifndef LOADER_TSLOGSIZE +#define LOADER_TSLOGSIZE (2 * 1024 * 1024) +#endif + +int +tslog_init(void) +{ + void * tslog_buf; + + /* Allocate buffer and pass to libsa tslog code. */ + if ((tslog_buf = malloc(LOADER_TSLOGSIZE)) == NULL) + return (-1); + tslog_setbuf(tslog_buf, LOADER_TSLOGSIZE); + + /* Record this as when we entered the loader. */ + TSRAW("ENTER", "loader", NULL); + + return (0); +} + +/* + * Pass our tslog buffer as a preloaded "module" to the kernel. This should + * be called as late as possible prior to the kernel being executed, since + * any timestamps logged after this is called will not be visible to the + * kernel. + */ +int +tslog_publish(void) +{ + void * tslog_buf; + size_t tslog_bufpos; + + /* Record a log entry for ending logging. */ + TSRAW("EXIT", "loader", NULL); + + /* Get the buffer and its current length. */ + tslog_getbuf(&tslog_buf, &tslog_bufpos); + + /* If we never allocated a buffer, return an error. */ + if (tslog_buf == NULL) + return (-1); + + /* Store the buffer where the kernel can read it. */ + return (file_addbuf("TSLOG", "TSLOG data", tslog_bufpos, tslog_buf)); +} diff --git a/stand/loader.mk b/stand/loader.mk index 9dda8c6535ea..359aee58657c 100644 --- a/stand/loader.mk +++ b/stand/loader.mk @@ -6,7 +6,7 @@ CFLAGS+=-I${LDRSRC} SRCS+= boot.c commands.c console.c devopen.c interp.c SRCS+= interp_backslash.c interp_parse.c ls.c misc.c -SRCS+= module.c nvstore.c pnglite.c +SRCS+= module.c nvstore.c pnglite.c tslog.c CFLAGS.module.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite From owner-dev-commits-src-main@freebsd.org Mon Jun 21 03:29: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 645B365E78F; Mon, 21 Jun 2021 03:29: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 4G7Zkv2FB9z3n6V; Mon, 21 Jun 2021 03:29: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 3505115EA4; Mon, 21 Jun 2021 03:29: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 15L3TBne076318; Mon, 21 Jun 2021 03:29:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L3TBIF076317; Mon, 21 Jun 2021 03:29:11 GMT (envelope-from git) Date: Mon, 21 Jun 2021 03:29:11 GMT Message-Id: <202106210329.15L3TBIF076317@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: f49381ccb6bc - main - efi/loader: Call tslog_init MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f49381ccb6bc8a5733f1aa505e716eddae299986 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, 21 Jun 2021 03:29:11 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=f49381ccb6bc8a5733f1aa505e716eddae299986 commit f49381ccb6bc8a5733f1aa505e716eddae299986 Author: Colin Percival AuthorDate: 2021-06-21 01:31:27 +0000 Commit: Colin Percival CommitDate: 2021-06-21 03:09:45 +0000 efi/loader: Call tslog_init This allows the EFI loader to start recording timestamps. --- stand/efi/loader/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index ae32960e4049..d46f3f4161b1 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -927,6 +927,8 @@ main(int argc, CHAR16 *argv[]) char buf[32]; bool uefi_boot_mgr; + tslog_init(); + archsw.arch_autoload = efi_autoload; archsw.arch_getdev = efi_getdev; archsw.arch_copyin = efi_copyin; From owner-dev-commits-src-main@freebsd.org Mon Jun 21 03:29: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 A589F65E6DA; Mon, 21 Jun 2021 03:29: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 4G7Zkt3429z3nB1; Mon, 21 Jun 2021 03:29: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 1E29315BFF; Mon, 21 Jun 2021 03:29: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 15L3TAQP076294; Mon, 21 Jun 2021 03:29:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L3TAC0076293; Mon, 21 Jun 2021 03:29:10 GMT (envelope-from git) Date: Mon, 21 Jun 2021 03:29:10 GMT Message-Id: <202106210329.15L3TAC0076293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: c4b65e954f0f - main - i386/loader: Call tslog_init MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4b65e954f0f4754941f5b37436231f611b76d67 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, 21 Jun 2021 03:29:10 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=c4b65e954f0f4754941f5b37436231f611b76d67 commit c4b65e954f0f4754941f5b37436231f611b76d67 Author: Colin Percival AuthorDate: 2021-05-30 23:21:31 +0000 Commit: Colin Percival CommitDate: 2021-06-21 03:09:44 +0000 i386/loader: Call tslog_init This allows the i386 loader to start recording timestamps. Reviewed by: kevans --- stand/i386/loader/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c index a595340d3a13..6b81ef411f7f 100644 --- a/stand/i386/loader/main.c +++ b/stand/i386/loader/main.c @@ -130,6 +130,12 @@ main(void) } setheap(heap_bottom, heap_top); + /* + * Now that malloc is usable, allocate a buffer for tslog and start + * logging timestamps during the boot process. + */ + tslog_init(); + /* * detect ACPI for future reference. This may set console to comconsole * if we do have ACPI SPCR table. From owner-dev-commits-src-main@freebsd.org Mon Jun 21 03:29: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 B93D765E6E5; Mon, 21 Jun 2021 03:29: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 4G7Zkw3NDgz3n6b; Mon, 21 Jun 2021 03:29: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 5490915878; Mon, 21 Jun 2021 03:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15L3TCwr076344; Mon, 21 Jun 2021 03:29:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L3TC29076343; Mon, 21 Jun 2021 03:29:12 GMT (envelope-from git) Date: Mon, 21 Jun 2021 03:29:12 GMT Message-Id: <202106210329.15L3TC29076343@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 537a44bf2815 - main - stand/common command_boot: Pass tslog to kernel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 537a44bf281559d304850b5e28b6f8b8e44fd593 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, 21 Jun 2021 03:29:12 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=537a44bf281559d304850b5e28b6f8b8e44fd593 commit 537a44bf281559d304850b5e28b6f8b8e44fd593 Author: Colin Percival AuthorDate: 2021-05-30 23:22:28 +0000 Commit: Colin Percival CommitDate: 2021-06-21 03:09:46 +0000 stand/common command_boot: Pass tslog to kernel Pass the recorded tslog buffer to the kernel as a "preloaded module". Reviewed by: kevans --- stand/common/boot.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stand/common/boot.c b/stand/common/boot.c index 2103f6dc240c..5ce6fe8a6760 100644 --- a/stand/common/boot.c +++ b/stand/common/boot.c @@ -113,6 +113,9 @@ command_boot(int argc, char *argv[]) #endif #endif + /* Pass the tslog buffer to the kernel as a preloaded module. */ + tslog_publish(); + /* Call the exec handler from the loader matching the kernel */ file_formats[fp->f_loader]->l_exec(fp); return(CMD_ERROR); From owner-dev-commits-src-main@freebsd.org Mon Jun 21 03:29: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 3405365E798; Mon, 21 Jun 2021 03:29: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 4G7Zkx4bmBz3nDX; Mon, 21 Jun 2021 03:29: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 7AE1215E5A; Mon, 21 Jun 2021 03:29: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 15L3TDBe076372; Mon, 21 Jun 2021 03:29:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L3TD10076371; Mon, 21 Jun 2021 03:29:13 GMT (envelope-from git) Date: Mon, 21 Jun 2021 03:29:13 GMT Message-Id: <202106210329.15L3TD10076371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: fe51b5a76de3 - main - kern_tslog: Include tslog data from loader MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fe51b5a76de38d20cddc05a4c6cb1103d1a0547e 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, 21 Jun 2021 03:29:14 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=fe51b5a76de38d20cddc05a4c6cb1103d1a0547e commit fe51b5a76de38d20cddc05a4c6cb1103d1a0547e Author: Colin Percival AuthorDate: 2021-05-30 23:25:01 +0000 Commit: Colin Percival CommitDate: 2021-06-21 03:09:47 +0000 kern_tslog: Include tslog data from loader The i386 loader (and hopefully others to come) now passes tslog data as a "preloaded module". Include this in the data returned by the debug.tslog sysctl. Reviewed by: kevans --- sys/kern/kern_tslog.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/kern/kern_tslog.c b/sys/kern/kern_tslog.c index a0cb230f191c..dd3b25158340 100644 --- a/sys/kern/kern_tslog.c +++ b/sys/kern/kern_tslog.c @@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include #include #include @@ -74,6 +76,9 @@ sysctl_debug_tslog(SYSCTL_HANDLER_ARGS) int error; struct sbuf *sb; size_t i, limit; + caddr_t loader_tslog; + void * loader_tslog_buf; + size_t loader_tslog_len; /* * This code can race against the code in tslog() which stores @@ -84,6 +89,16 @@ sysctl_debug_tslog(SYSCTL_HANDLER_ARGS) * anyone will ever experience this race. */ sb = sbuf_new_for_sysctl(NULL, NULL, 1024, req); + + /* Get data from the boot loader, if it provided any. */ + loader_tslog = preload_search_by_type("TSLOG data"); + if (loader_tslog != NULL) { + loader_tslog_buf = preload_fetch_addr(loader_tslog); + loader_tslog_len = preload_fetch_size(loader_tslog); + sbuf_bcat(sb, loader_tslog_buf, loader_tslog_len); + } + + /* Add data logged within the kernel. */ limit = MIN(nrecs, nitems(timestamps)); for (i = 0; i < limit; i++) { sbuf_printf(sb, "%p", timestamps[i].td); From owner-dev-commits-src-main@freebsd.org Mon Jun 21 03:29: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 624FE65E1FE; Mon, 21 Jun 2021 03:29: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 4G7Zky6Q6Hz3n8S; Mon, 21 Jun 2021 03:29: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 A4F3B1608E; Mon, 21 Jun 2021 03:29: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 15L3TEGw076396; Mon, 21 Jun 2021 03:29:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L3TEki076395; Mon, 21 Jun 2021 03:29:14 GMT (envelope-from git) Date: Mon, 21 Jun 2021 03:29:14 GMT Message-Id: <202106210329.15L3TEki076395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 313724bab940 - main - loader: Use tslog to instrument some functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 313724bab940c1844fda3d797cf88cd46780e62a 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, 21 Jun 2021 03:29:15 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=313724bab940c1844fda3d797cf88cd46780e62a commit 313724bab940c1844fda3d797cf88cd46780e62a Author: Colin Percival AuthorDate: 2021-05-31 00:01:25 +0000 Commit: Colin Percival CommitDate: 2021-06-21 03:09:48 +0000 loader: Use tslog to instrument some functions In my initial testing, these are the functions which showed up as being worth instrumenting. More may be added later. common/console.c: cons_probe common/gfx_fb.c: read_list, insert_font, autoload_font common/interp.c: interact common/interp_lua.c: interp_init, interp_run efi/libefi/efipart.c: efipart_readwrite i386/libi386/biosdisk.c: bd_init, bd_open, bd_edd_io, bd_chs_io, bd_io libsa/open.c: open libsa/read.c: read libsa/twiddle.c: twiddle Note that profiling interp_run may be of questionable utility as it may depend on user behaviour (e.g. pressing keys). Reviewed by: kevans (earlier version) --- stand/common/console.c | 4 ++++ stand/common/gfx_fb.c | 14 ++++++++++++++ stand/common/interp.c | 2 ++ stand/common/interp_lua.c | 6 ++++++ stand/efi/libefi/efipart.c | 3 +++ stand/i386/libi386/biosdisk.c | 17 +++++++++++++++++ stand/libsa/open.c | 5 +++++ stand/libsa/read.c | 12 ++++++++++-- stand/libsa/twiddle.c | 11 +++++++++-- 9 files changed, 70 insertions(+), 4 deletions(-) diff --git a/stand/common/console.c b/stand/common/console.c index 5b2ddfb10f69..7886f9386c14 100644 --- a/stand/common/console.c +++ b/stand/common/console.c @@ -53,6 +53,8 @@ cons_probe(void) int active; char *prefconsole; + TSENTER(); + /* We want a callback to install the new value when this var changes. */ env_setenv("twiddle_divisor", EV_VOLATILE, "1", twiddle_set, env_nounset); @@ -98,6 +100,8 @@ cons_probe(void) env_nounset); free(prefconsole); } + + TSEXIT(); } int diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 92af49913748..522c70327425 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -2430,6 +2430,8 @@ read_list(char *fonts) char buf[PATH_MAX]; int fd, len; + TSENTER(); + dir = strdup(fonts); if (dir == NULL) return (NULL); @@ -2477,6 +2479,7 @@ read_list(char *fonts) SLIST_INSERT_HEAD(nl, np, n_entry); } close(fd); + TSEXIT(); return (nl); } @@ -2494,6 +2497,8 @@ insert_font(char *name, FONT_FLAGS flags) int fd; char *font_name; + TSENTER(); + font_name = NULL; if (flags == FONT_BUILTIN) { /* @@ -2540,6 +2545,7 @@ insert_font(char *name, FONT_FLAGS flags) free(entry->font_name); entry->font_name = font_name; entry->font_flags = FONT_RELOAD; + TSEXIT(); return (true); } } @@ -2563,6 +2569,7 @@ insert_font(char *name, FONT_FLAGS flags) if (STAILQ_EMPTY(&fonts)) { STAILQ_INSERT_HEAD(&fonts, fp, font_next); + TSEXIT(); return (true); } @@ -2581,6 +2588,7 @@ insert_font(char *name, FONT_FLAGS flags) STAILQ_INSERT_AFTER(&fonts, previous, fp, font_next); } + TSEXIT(); return (true); } next = STAILQ_NEXT(entry, font_next); @@ -2588,10 +2596,12 @@ insert_font(char *name, FONT_FLAGS flags) size > next->font_data->vfbd_width * next->font_data->vfbd_height) { STAILQ_INSERT_AFTER(&fonts, entry, fp, font_next); + TSEXIT(); return (true); } previous = entry; } + TSEXIT(); return (true); } @@ -2650,6 +2660,8 @@ autoload_font(bool bios) struct name_list *nl; struct name_entry *np; + TSENTER(); + nl = read_list("/boot/fonts/INDEX.fonts"); if (nl == NULL) return; @@ -2671,6 +2683,8 @@ autoload_font(bool bios) } (void) cons_update_mode(gfx_state.tg_fb_type != FB_TEXT); + + TSEXIT(); } COMMAND_SET(load_font, "loadfont", "load console font from file", command_font); diff --git a/stand/common/interp.c b/stand/common/interp.c index a0a6bd486614..ab68694d61b7 100644 --- a/stand/common/interp.c +++ b/stand/common/interp.c @@ -48,6 +48,8 @@ interact(void) static char input[256]; /* big enough? */ const char * volatile interp_identifier; + TSENTER(); + /* * Because interp_identifier is volatile, it cannot be optimized out by * the compiler as it's considered an externally observable event. This diff --git a/stand/common/interp_lua.c b/stand/common/interp_lua.c index 94001918e151..8a420660683e 100644 --- a/stand/common/interp_lua.c +++ b/stand/common/interp_lua.c @@ -107,6 +107,8 @@ interp_init(void) const char *filename; const luaL_Reg *lib; + TSENTER(); + setenv("script.lang", "lua", 1); LDBG("creating context"); @@ -131,6 +133,8 @@ interp_init(void) lua_pop(luap, 1); setenv("autoboot_delay", "NO", 1); } + + TSEXIT(); } int @@ -142,6 +146,7 @@ interp_run(const char *line) struct interp_lua_softc *softc = &lua_softc; int status, ret; + TSENTER(); luap = softc->luap; LDBG("executing line..."); if ((status = luaL_dostring(luap, line)) != 0) { @@ -186,6 +191,7 @@ interp_run(const char *line) } } + TSEXIT(); return (status == 0 ? CMD_OK : CMD_ERROR); } diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c index 424df7d2e423..aede28ef40c3 100644 --- a/stand/efi/libefi/efipart.c +++ b/stand/efi/libefi/efipart.c @@ -1006,6 +1006,8 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, int rw, daddr_t blk, daddr_t nblks, { EFI_STATUS status; + TSENTER(); + if (blkio == NULL) return (ENXIO); if (blk < 0 || blk > blkio->Media->LastBlock) @@ -1032,6 +1034,7 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, int rw, daddr_t blk, daddr_t nblks, printf("%s: rw=%d, blk=%ju size=%ju status=%lu\n", __func__, rw, blk, nblks, EFI_ERROR_CODE(status)); } + TSEXIT(); return (efi_status_to_errno(status)); } diff --git a/stand/i386/libi386/biosdisk.c b/stand/i386/libi386/biosdisk.c index 00d2de5de418..2c52617f255d 100644 --- a/stand/i386/libi386/biosdisk.c +++ b/stand/i386/libi386/biosdisk.c @@ -339,6 +339,8 @@ bd_init(void) int base, unit; bdinfo_t *bd; + TSENTER(); + base = 0x80; for (unit = 0; unit < *(unsigned char *)PTOV(BIOS_NUMDRIVES); unit++) { /* @@ -358,6 +360,7 @@ bd_init(void) STAILQ_INSERT_TAIL(&hdinfo, bd, bd_link); } bcache_add_dev(unit); + TSEXIT(); return (0); } @@ -840,6 +843,8 @@ bd_open(struct open_file *f, ...) va_list ap; int rc; + TSENTER(); + va_start(ap, f); dev = va_arg(ap, struct disk_devdesc *); va_end(ap); @@ -873,6 +878,7 @@ bd_open(struct open_file *f, ...) } } } + TSEXIT(); return (rc); } @@ -1135,6 +1141,8 @@ bd_edd_io(bdinfo_t *bd, daddr_t dblk, int blks, caddr_t dest, { static struct edd_packet packet; + TSENTER(); + packet.len = sizeof(struct edd_packet); packet.count = blks; packet.off = VTOPOFF(dest); @@ -1152,6 +1160,8 @@ bd_edd_io(bdinfo_t *bd, daddr_t dblk, int blks, caddr_t dest, v86int(); if (V86_CY(v86.efl)) return (v86.eax >> 8); + + TSEXIT(); return (0); } @@ -1161,6 +1171,8 @@ bd_chs_io(bdinfo_t *bd, daddr_t dblk, int blks, caddr_t dest, { uint32_t x, bpc, cyl, hd, sec; + TSENTER(); + bpc = bd->bd_sec * bd->bd_hds; /* blocks per cylinder */ x = dblk; cyl = x / bpc; /* block # / blocks per cylinder */ @@ -1189,6 +1201,7 @@ bd_chs_io(bdinfo_t *bd, daddr_t dblk, int blks, caddr_t dest, v86int(); if (V86_CY(v86.efl)) return (v86.eax >> 8); + TSEXIT(); return (0); } @@ -1206,6 +1219,8 @@ bd_io(struct disk_devdesc *dev, bdinfo_t *bd, daddr_t dblk, int blks, { int result, retry; + TSENTER(); + /* Just in case some idiot actually tries to read/write -1 blocks... */ if (blks < 0) return (-1); @@ -1264,6 +1279,8 @@ bd_io(struct disk_devdesc *dev, bdinfo_t *bd, daddr_t dblk, int blks, } } + TSEXIT(); + return (result); } diff --git a/stand/libsa/open.c b/stand/libsa/open.c index d1f1fcf9bb4d..9590508b0015 100644 --- a/stand/libsa/open.c +++ b/stand/libsa/open.c @@ -96,6 +96,8 @@ open(const char *fname, int mode) int fd, i, error, besterror; const char *file; + TSENTER(); + if ((fd = o_gethandle()) == -1) { errno = EMFILE; return (-1); @@ -126,6 +128,7 @@ open(const char *fname, int mode) if (file == NULL || *file == '\0') { f->f_flags |= F_RAW; f->f_rabuf = NULL; + TSEXIT(); return (fd); } @@ -149,10 +152,12 @@ open(const char *fname, int mode) err: f->f_flags = 0; errno = error; + TSEXIT(); return (-1); ok: f->f_ops = fs; o_rainit(f); + TSEXIT(); return (fd); } diff --git a/stand/libsa/read.c b/stand/libsa/read.c index 021425371ee7..7ad75c387a5d 100644 --- a/stand/libsa/read.c +++ b/stand/libsa/read.c @@ -72,6 +72,8 @@ read(int fd, void *dest, size_t bcount) struct open_file *f = &files[fd]; size_t resid; + TSENTER(); + if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_READ)) { errno = EBADF; return (-1); @@ -83,6 +85,7 @@ read(int fd, void *dest, size_t bcount) if (errno) return (-1); f->f_offset += resid; + TSEXIT(); return (resid); } @@ -102,8 +105,10 @@ read(int fd, void *dest, size_t bcount) f->f_raoffset += ccount; f->f_ralen -= ccount; resid -= ccount; - if (resid == 0) + if (resid == 0) { + TSEXIT(); return (bcount); + } dest = (char *)dest + ccount; } @@ -116,6 +121,7 @@ read(int fd, void *dest, size_t bcount) errno = (f->f_ops->fo_read)(f, dest, resid, &cresid); if (errno != 0) return (-1); + TSEXIT(); return (bcount - cresid); } @@ -127,7 +133,9 @@ read(int fd, void *dest, size_t bcount) f->f_raoffset = 0; f->f_ralen = SOPEN_RASIZE - cresid; /* no more data, return what we had */ - if (f->f_ralen == 0) + if (f->f_ralen == 0) { + TSEXIT(); return (bcount - resid); + } } } diff --git a/stand/libsa/twiddle.c b/stand/libsa/twiddle.c index 31828542f7f3..7565295fa1a3 100644 --- a/stand/libsa/twiddle.c +++ b/stand/libsa/twiddle.c @@ -49,16 +49,23 @@ twiddle(u_int callerdiv) { static u_int callercnt, globalcnt, pos; + TSENTER(); + callercnt++; - if (callerdiv > 1 && (callercnt % callerdiv) != 0) + if (callerdiv > 1 && (callercnt % callerdiv) != 0) { + TSEXIT(); return; + } globalcnt++; - if (globaldiv > 1 && (globalcnt % globaldiv) != 0) + if (globaldiv > 1 && (globalcnt % globaldiv) != 0) { + TSEXIT(); return; + } putchar("|/-\\"[pos++ & 3]); putchar('\b'); + TSEXIT(); } void From owner-dev-commits-src-main@freebsd.org Mon Jun 21 08:06: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 92E8664275A; Mon, 21 Jun 2021 08:06: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 4G7hv11k3Pz4d1R; Mon, 21 Jun 2021 08:06: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 248A719AAD; Mon, 21 Jun 2021 08:06: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 15L86b9C049866; Mon, 21 Jun 2021 08:06:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15L86buZ049865; Mon, 21 Jun 2021 08:06:37 GMT (envelope-from git) Date: Mon, 21 Jun 2021 08:06:37 GMT Message-Id: <202106210806.15L86buZ049865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 7544c1d20d8b - main - rtwn: make sure to not write in upper bits of txdseq MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7544c1d20d8b7127ed3511edeb94e01d328daebb 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, 21 Jun 2021 08:06:37 -0000 The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=7544c1d20d8b7127ed3511edeb94e01d328daebb commit 7544c1d20d8b7127ed3511edeb94e01d328daebb Author: Andriy Gapon AuthorDate: 2021-06-21 08:05:04 +0000 Commit: Andriy Gapon CommitDate: 2021-06-21 08:05:04 +0000 rtwn: make sure to not write in upper bits of txdseq ni_txseqs is kept as 16-bit counter, but we need to trim the upper four bits as they may have special meanings for the firmware / hardware. For instance, bit 15 enables hardware / firmware generation of sequence numbers that overrides sequence numbers programmed by the driver. Reviewed by: adrian MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30814 --- sys/dev/rtwn/rtl8192c/r92c_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx.c b/sys/dev/rtwn/rtl8192c/r92c_tx.c index ab2d05635358..b01731ba29ed 100644 --- a/sys/dev/rtwn/rtl8192c/r92c_tx.c +++ b/sys/dev/rtwn/rtl8192c/r92c_tx.c @@ -335,7 +335,7 @@ r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, uint16_t seqno; if (m->m_flags & M_AMPDU_MPDU) { - seqno = ni->ni_txseqs[tid]; + seqno = ni->ni_txseqs[tid] % IEEE80211_SEQ_RANGE; ni->ni_txseqs[tid]++; } else seqno = M_SEQNO_GET(m) % IEEE80211_SEQ_RANGE; From owner-dev-commits-src-main@freebsd.org Mon Jun 21 13:07: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 0A1C9647925; Mon, 21 Jun 2021 13:07:24 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (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 4G7qZ34JF0z3MMR; Mon, 21 Jun 2021 13:07:23 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTP id uwHMl5Lv94bInvJe1lkQix; Mon, 21 Jun 2021 13:07:17 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id vJdzlrl7raZZOvJe0lnPU6; Mon, 21 Jun 2021 13:07:17 +0000 X-Authority-Analysis: v=2.4 cv=e4PD9Yl/ c=1 sm=1 tr=0 ts=60d08f05 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=r6YtysWOX24A:10 a=6I5d2MoRAAAA:8 a=iaTFZB6CAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=EOOEwpsu0-iJifp83OIA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=QWXrQ9iV8q7LKaLQ9lfw:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id EFEFD2AB2; Mon, 21 Jun 2021 06:07:14 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 15LD7E0I007880; Mon, 21 Jun 2021 06:07:14 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202106211307.15LD7E0I007880@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: "Hartmann, O." cc: Dimitry Andric , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 23408297fbf3 - main - Merge llvm-project 12.0.1 rc2 In-reply-to: <20210620225350.06d559a8@hermann.fritz.box> References: <202106191811.15JIB4nu002236@gitrepo.freebsd.org> <20210620155800.236bb4b8@hermann.fritz.box> <3960850F-E446-45F1-A79B-F31D832F20BA@FreeBSD.org> <20210620225350.06d559a8@hermann.fritz.box> Comments: In-reply-to "Hartmann, O." message dated "Sun, 20 Jun 2021 22:53:50 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 21 Jun 2021 06:07:14 -0700 X-CMAE-Envelope: MS4xfEYCYiRFh0tYCj35nZNSwtIiqyXOF6mu3hfyMkN1CMiM6v3/shvBA+UIKzKMQE+aBxA99+jBCiRPH/7fhvASpey4uVgGxksXwEQhTyrb0znmhmgfnH4J 5zIebAfCMtoO51z8Ziq7I9SWpfAK8K9pWa6jYBWdOI+I8PxoGZAWdudXWkAsNfbet+xwbgFQ+pw59xGASPMIwPRSavRGBRq0itbLcYVVlkNcaf59+hTdk+k0 xxdXrWoBr5waCf0dU+HV+ScQqhJf+jUfiStkpcpIUmd1KbrTksp2P8KkP0PDPuFc3cyB8JfWb04x6NRY2A2pw6YyqTveAJE5iwfB3sOpB5zo0aur/SgyYfUk aBtXmPrEWK1BcAAANRkiaMwAT0A2Fg== X-Rspamd-Queue-Id: 4G7qZ34JF0z3MMR 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, 21 Jun 2021 13:07:24 -0000 In message <20210620225350.06d559a8@hermann.fritz.box>, "Hartmann, O." writes: > --Sig_/T.8cBIoLbtVCh5/H4xqFwKF > On Sun, 20 Jun 2021 21:56:40 +0200 > Dimitry Andric wrote: > > > On 20 Jun 2021, at 15:58, Hartmann, O. wrote: > > >=20 > > > On Sat, 19 Jun 2021 18:11:04 GMT > > > Dimitry Andric wrote: > > > =20 > > >> The branch main has been updated by dim: > > >>=20 > > >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D23408297fbf3089f0388a88= > 73b02fa75ab3f5bb9 > > >>=20 > > >> commit 23408297fbf3089f0388a8873b02fa75ab3f5bb9 > > >> Merge: cac129e60300 e4bbddaec868 > > >> Author: Dimitry Andric > > >> AuthorDate: 2021-06-19 10:06:00 +0000 > > >> Commit: Dimitry Andric > > >> CommitDate: 2021-06-19 18:09:28 +0000 > > >>=20 > > >> Merge llvm-project 12.0.1 rc2 > > >>=20 > > >> This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb= > and > > >> openmp to llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2. =20 > > ... > > > running FreeBSD 14.0-CURRENT #13 main-n247423-7bd295750b1: Fri Jun 18 = > 17:32:58 CEST > > > 2021 amd64, buildworld fails with the error > > >=20 > > > /usr/src/contrib/llvm-project/clang/lib/Basic/SourceManager.cpp:1256:10= > : fatal error: > > > 'emmintrin.h' file not found > > >=20 > > > How can I fix this? =20 > >=20 > > I have never been able to figure out why some people encounter this, > > except that they seem to have manually deleted files from their base > > system, thereby effectively destroying their toolchain. > > I think in my case it is very simple - first of all: thanks for the explana= > tion, the > folder "/usr/lib/clang/" is empty and that is the result of "make delete-ol= > d". > > The running system as shown above has llvm 12.0.0 and I forgot to run "make= > delete-old" > days ago when FreeBSD 14-CURRENT moved towards 12.0.0. Obviously, there was= > anlther move > towards 12.0.1 today or yesterday, I pulled the sources and did a rebuild o= > f the whole > system - and issued then make delete-old. That renders the system unusabel.= > Desperate and > not with the full understanding what happened before your mail, I also made= > a "make > cleanworld" to "rebuild/rescue" the system - with the result reported here.= > Havoc. Your email suggests you ran make delete-old before running make installworld. -- 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 Jun 21 14:42:08 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 CD32A649C1C; Mon, 21 Jun 2021 14:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7sgN5NJYz3l0C; Mon, 21 Jun 2021 14:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A01251EDC1; Mon, 21 Jun 2021 14:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15LEg8MW085738; Mon, 21 Jun 2021 14:42:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LEg8Vw085737; Mon, 21 Jun 2021 14:42:08 GMT (envelope-from git) Date: Mon, 21 Jun 2021 14:42:08 GMT Message-Id: <202106211442.15LEg8Vw085737@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: f394c73666ba - main - basename: fix history 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: f394c73666ba375cbd6114950b1b1ea5943185a8 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, 21 Jun 2021 14:42:08 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f394c73666ba375cbd6114950b1b1ea5943185a8 commit f394c73666ba375cbd6114950b1b1ea5943185a8 Author: Warner Losh AuthorDate: 2021-06-21 14:23:34 +0000 Commit: Warner Losh CommitDate: 2021-06-21 14:40:54 +0000 basename: fix history Basename(1) first appeared in the 7th edition. It was not in the 6th edition, or PWB releases. It's on all the subsequent descendants. Dirname(1) first appeared in System III, and was later picked up in 4.3-Reno and 8th edition research unix (though was not in 4.1BSD where the bulk of 8th edition came from). In System III and V8 it was a shell script, though the BSD version is in C. Sponsored by: Netflix --- usr.bin/basename/basename.1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.bin/basename/basename.1 b/usr.bin/basename/basename.1 index 6d4ae51b5b8a..f7e78c8e135b 100644 --- a/usr.bin/basename/basename.1 +++ b/usr.bin/basename/basename.1 @@ -31,7 +31,7 @@ .\" @(#)basename.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd May 26, 2020 +.Dd June 21, 2021 .Dt BASENAME 1 .Os .Sh NAME @@ -114,7 +114,9 @@ compatible. .Sh HISTORY The .Nm -and +utility first appeared in +.At 7 . +The .Nm dirname -utilities first appeared in -.Bx 4.4 . +utility first appeared in +.At III . From owner-dev-commits-src-main@freebsd.org Mon Jun 21 14:42: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 3AABE649F8D; Mon, 21 Jun 2021 14:42: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 4G7sgQ0NGtz3lJh; Mon, 21 Jun 2021 14:42: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 C67201EBFA; Mon, 21 Jun 2021 14:42: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 15LEg9JU085763; Mon, 21 Jun 2021 14:42:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LEg9O6085762; Mon, 21 Jun 2021 14:42:09 GMT (envelope-from git) Date: Mon, 21 Jun 2021 14:42:09 GMT Message-Id: <202106211442.15LEg9O6085762@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: 3c22b4f83254 - main - vmstat: correct history 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: 3c22b4f83254b3233418c5aeed5b68cd27b22f9f 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, 21 Jun 2021 14:42:10 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3c22b4f83254b3233418c5aeed5b68cd27b22f9f commit 3c22b4f83254b3233418c5aeed5b68cd27b22f9f Author: Warner Losh AuthorDate: 2021-06-21 14:29:57 +0000 Commit: Warner Losh CommitDate: 2021-06-21 14:40:54 +0000 vmstat: correct history vmstat dates back to 3BSD, but wasn't in 32V nor the 7th edition. It does not seem to have been in AT&T's commercial offerings at all. Sponsored by: Netflix --- usr.bin/vmstat/vmstat.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/vmstat/vmstat.8 b/usr.bin/vmstat/vmstat.8 index b9c23dee50cf..01b7b2bd3c4b 100644 --- a/usr.bin/vmstat/vmstat.8 +++ b/usr.bin/vmstat/vmstat.8 @@ -28,7 +28,7 @@ .\" @(#)vmstat.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd July 26, 2020 +.Dd June 21, 2021 .Dt VMSTAT 8 .Os .Sh NAME @@ -386,7 +386,7 @@ The sections starting with ``Interpreting system activity'' in The .Nm utility first appeared in -.Bx 4.3 . +.Bx 3 . .Sh BUGS The .Fl c From owner-dev-commits-src-main@freebsd.org Mon Jun 21 14:42: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 5BFCA649AB9; Mon, 21 Jun 2021 14:42: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 4G7sgR0Dj9z3lDj; Mon, 21 Jun 2021 14:42: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 DFA1D1EBFB; Mon, 21 Jun 2021 14:42: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 15LEgAnq085797; Mon, 21 Jun 2021 14:42:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LEgAWv085796; Mon, 21 Jun 2021 14:42:10 GMT (envelope-from git) Date: Mon, 21 Jun 2021 14:42:10 GMT Message-Id: <202106211442.15LEgAWv085796@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: b77e235dd52a - main - banner: Correct history. 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: b77e235dd52a682c11ddd93256b3848cdc6f1d72 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, 21 Jun 2021 14:42:11 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b77e235dd52a682c11ddd93256b3848cdc6f1d72 commit b77e235dd52a682c11ddd93256b3848cdc6f1d72 Author: Warner Losh AuthorDate: 2021-06-21 14:16:10 +0000 Commit: Warner Losh CommitDate: 2021-06-21 14:40:54 +0000 banner: Correct history. Banner appeared in the 6th edition of AT&T Research unit. It was subsequently on all the Berkeley tapes, as well as PWB, System III and System V. The PWB/AT&T and BSD banner programs were different, and the current FreeBSD banner program shares many elements of the 3BSD one, though the font has changed. Sponsored by: Netflix --- usr.bin/banner/banner.6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/banner/banner.6 b/usr.bin/banner/banner.6 index 0357489b4c26..72429e8b51f3 100644 --- a/usr.bin/banner/banner.6 +++ b/usr.bin/banner/banner.6 @@ -28,7 +28,7 @@ .\" From: @(#)banner.6 8.2 (Berkeley) 4/29/95 .\" $FreeBSD$ .\" -.Dd May 26, 2020 +.Dd June 21, 2021 .Dt BANNER 6 .Os .Sh NAME @@ -64,7 +64,7 @@ suitable for a narrow terminal. The .Nm utility first appeared in -.Bx 4.4 . +.At 6 . .Sh AUTHORS .An Mark Horton .Sh BUGS From owner-dev-commits-src-main@freebsd.org Mon Jun 21 14:49: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 7F1DE64A129; Mon, 21 Jun 2021 14:49: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 4G7srL2PQ1z3lr5; Mon, 21 Jun 2021 14:49: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 3A7D91F185; Mon, 21 Jun 2021 14:49: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 15LEns8w086628; Mon, 21 Jun 2021 14:49:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LEnsxM086627; Mon, 21 Jun 2021 14:49:54 GMT (envelope-from git) Date: Mon, 21 Jun 2021 14:49:54 GMT Message-Id: <202106211449.15LEnsxM086627@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "George V. Neville-Neil" Subject: git: c6b2d024d7ee - main - Retore the vnet before returning an error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gnn X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6b2d024d7eedbf32f52a17bc029c92f5a4d1a54 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, 21 Jun 2021 14:49:54 -0000 The branch main has been updated by gnn: URL: https://cgit.FreeBSD.org/src/commit/?id=c6b2d024d7eedbf32f52a17bc029c92f5a4d1a54 commit c6b2d024d7eedbf32f52a17bc029c92f5a4d1a54 Author: George V. Neville-Neil AuthorDate: 2021-06-21 14:46:20 +0000 Commit: George V. Neville-Neil CommitDate: 2021-06-21 14:46:20 +0000 Retore the vnet before returning an error. Obtained from: Kanndula, Dheeraj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30741 --- sys/net/if_vlan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index bd3a5335a97f..39f767c2a603 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -609,6 +609,7 @@ vlan_setmulti(struct ifnet *ifp) mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_NOWAIT); if (mc == NULL) { IF_ADDR_WUNLOCK(ifp); + CURVNET_RESTORE(); return (ENOMEM); } bcopy(ifma->ifma_addr, &mc->mc_addr, ifma->ifma_addr->sa_len); @@ -619,8 +620,10 @@ vlan_setmulti(struct ifnet *ifp) CK_SLIST_FOREACH (mc, &sc->vlan_mc_listhead, mc_entries) { error = if_addmulti(ifp_p, (struct sockaddr *)&mc->mc_addr, NULL); - if (error) + if (error) { + CURVNET_RESTORE(); return (error); + } } CURVNET_RESTORE(); From owner-dev-commits-src-main@freebsd.org Mon Jun 21 15:07:23 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 5455364A559; Mon, 21 Jun 2021 15:07:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7tDW1xLXz3n0p; Mon, 21 Jun 2021 15:07:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26C4B1F50C; Mon, 21 Jun 2021 15:07:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15LF7NRK013385; Mon, 21 Jun 2021 15:07:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LF7Ntx013384; Mon, 21 Jun 2021 15:07:23 GMT (envelope-from git) Date: Mon, 21 Jun 2021 15:07:23 GMT Message-Id: <202106211507.15LF7Ntx013384@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: 6fa0b2893f98 - main - diff tests: Require root for report_identical 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: 6fa0b2893f989f1851f3280e3f2e272e887cbce9 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, 21 Jun 2021 15:07:23 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6fa0b2893f989f1851f3280e3f2e272e887cbce9 commit 6fa0b2893f989f1851f3280e3f2e272e887cbce9 Author: Mark Johnston AuthorDate: 2021-06-21 15:00:50 +0000 Commit: Mark Johnston CommitDate: 2021-06-21 15:07:03 +0000 diff tests: Require root for report_identical This test switches users and either hangs or fails when run as an unprivileged user. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- usr.bin/diff/tests/diff_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh index b9d1698d982e..cd893091d016 100755 --- a/usr.bin/diff/tests/diff_test.sh +++ b/usr.bin/diff/tests/diff_test.sh @@ -231,6 +231,7 @@ label_body() report_identical_head() { atf_set "require.config" unprivileged_user + atf_set "require.user" root } report_identical_body() { From owner-dev-commits-src-main@freebsd.org Mon Jun 21 15:14: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 D47FD64A6A3; Mon, 21 Jun 2021 15:14: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 4G7tNk5PRsz3pj7; Mon, 21 Jun 2021 15:14: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 A17BF1F4D7; Mon, 21 Jun 2021 15:14: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 15LFEUvJ026228; Mon, 21 Jun 2021 15:14:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LFEUUo026227; Mon, 21 Jun 2021 15:14:30 GMT (envelope-from git) Date: Mon, 21 Jun 2021 15:14:30 GMT Message-Id: <202106211514.15LFEUUo026227@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: ab0c68ba4ae3 - main - Emit an error when we seen absolute paths to .o files 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: ab0c68ba4ae37cb83d15e64ce2a33375135ae750 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, 21 Jun 2021 15:14:30 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ab0c68ba4ae37cb83d15e64ce2a33375135ae750 commit ab0c68ba4ae37cb83d15e64ce2a33375135ae750 Author: Alex Richardson AuthorDate: 2021-06-21 13:58:01 +0000 Commit: Alex Richardson CommitDate: 2021-06-21 15:13:54 +0000 Emit an error when we seen absolute paths to .o files This is usually an error caused by using an absolute path in SRCS. This happened to me in 83c20b8a2da0 due to changing LDADD to SRCS. I did not notice that this had created a .o file inside the source tree since .gitignore contains "*.o" and therefore git did not report any changes. Adding this warning message to bsd.lib.mk/bsd.prog.mk should prevent issues like this in the future. There was exactly one case of an absolute OBJS path in the current source tree but that was removed in e713d3a013882893fceb84dd14569052271497a9. Reviewed By: emaste (earlier version), imp Differential Revision: https://reviews.freebsd.org/D28467 --- share/mk/bsd.dep.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index a63b9e46deca..b8dc59d52543 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -192,6 +192,17 @@ DEPEND_MP?= -MP # avoid collisions. DEPEND_FILTER= C,/,_,g .if !empty(OBJS) +.if !defined(_ALLOW_ABSOLUTE_OBJ_PATH) && ${OBJS:M/*} +# Absolute paths to OBJS should be an error inside ${SRCTOP}, but some users +# might be relying on this feature, so add an opt-out mechanism. +.if defined(SRCTOP) && ${OBJS:M${SRCTOP}*} +.error "$$OBJS inside $$SRCTOP not allowed: ${OBJS:M${SRCTOP}*}" +.elif ${OBJS:N${_ABSOLUTE_PATH_OBJS}:M/*} +.error "$$OBJS absolute path not allowed: ${OBJS:N${_ABSOLUTE_PATH_OBJS}:M/*}. \ + If this is intended, add them to _ABSOLUTE_PATH_OBJS to silence this error\ + or define _ALLOW_ABSOLUTE_OBJ_PATH to disable this diagnostic." +.endif +.endif DEPENDOBJS+= ${OBJS} .else DEPENDSRCS+= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc} From owner-dev-commits-src-main@freebsd.org Mon Jun 21 16:07: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 BB2F764B482; Mon, 21 Jun 2021 16:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7vYb4wBbz3t8F; Mon, 21 Jun 2021 16:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D0BB1FF44; Mon, 21 Jun 2021 16:07:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15LG7F9A093078; Mon, 21 Jun 2021 16:07:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LG7FUJ093077; Mon, 21 Jun 2021 16:07:15 GMT (envelope-from git) Date: Mon, 21 Jun 2021 16:07:15 GMT Message-Id: <202106211607.15LG7FUJ093077@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: 06250515cff5 - main - imgact_elf: compute auxv buffer size instead of using magic value 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: 06250515cff552217d14145e8932cb1a543a7e07 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, 21 Jun 2021 16:07:15 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=06250515cff552217d14145e8932cb1a543a7e07 commit 06250515cff552217d14145e8932cb1a543a7e07 Author: Edward Tomasz Napierala AuthorDate: 2021-06-21 14:34:19 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-06-21 16:07:07 +0000 imgact_elf: compute auxv buffer size instead of using magic value The new buffer is somewhat larger, but there should be no functional changes. Reviewed By: kib, imp Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30821 --- sys/kern/imgact_elf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 57e9ac18e63b..d114070fc903 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -2456,7 +2456,8 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, size_t *sizep) p = (struct proc *)arg; if (sb == NULL) { size = 0; - sb = sbuf_new(NULL, NULL, 128, SBUF_FIXEDLEN); + sb = sbuf_new(NULL, NULL, AT_COUNT * sizeof(Elf_Auxinfo), + SBUF_FIXEDLEN); sbuf_set_drain(sb, sbuf_count_drain, &size); sbuf_bcat(sb, &structsize, sizeof(structsize)); PHOLD(p); From owner-dev-commits-src-main@freebsd.org Mon Jun 21 16:12: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 0899B64B6C9; Mon, 21 Jun 2021 16:12: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 4G7vh26TXyz3v58; Mon, 21 Jun 2021 16:12: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 BBF9820160; Mon, 21 Jun 2021 16:12: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 15LGCohC005852; Mon, 21 Jun 2021 16:12:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LGCoZ1005850; Mon, 21 Jun 2021 16:12:50 GMT (envelope-from git) Date: Mon, 21 Jun 2021 16:12:50 GMT Message-Id: <202106211612.15LGCoZ1005850@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: 224c772ca59a - main - telnet(1): add quiet mode ("telnet -Q") 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: 224c772ca59a1234b48658358a8f043e4cd09f7c 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, 21 Jun 2021 16:12:51 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=224c772ca59a1234b48658358a8f043e4cd09f7c commit 224c772ca59a1234b48658358a8f043e4cd09f7c Author: Edward Tomasz Napierala AuthorDate: 2021-06-21 16:07:39 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-06-21 16:11:57 +0000 telnet(1): add quiet mode ("telnet -Q") Reviewed By: imp, phk Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #54 Differential Revision: https://reviews.freebsd.org/D30819 --- contrib/telnet/telnet/commands.c | 18 +++++++++++++----- contrib/telnet/telnet/main.c | 6 +++++- contrib/telnet/telnet/telnet.1 | 9 +++++++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/contrib/telnet/telnet/commands.c b/contrib/telnet/telnet/commands.c index 21e973209d9b..c52af2a81a67 100644 --- a/contrib/telnet/telnet/commands.c +++ b/contrib/telnet/telnet/commands.c @@ -122,6 +122,7 @@ static char line[256]; static char saveline[256]; static int margc; static char *margv[20]; +int quiet_mode; #ifdef OPIE #include @@ -2042,7 +2043,8 @@ static int status(int argc, char *argv[]) { if (connected) { - printf("Connected to %s.\n", hostname); + if (!quiet_mode) + printf("Connected to %s.\n", hostname); if ((argc < 2) || strcmp(argv[1], "notmuch")) { int mode = getconnmode(); @@ -2071,7 +2073,8 @@ status(int argc, char *argv[]) } else { printf("No connection.\n"); } - printf("Escape character is '%s'.\n", control(escape)); + if (!quiet_mode) + printf("Escape character is '%s'.\n", control(escape)); (void) fflush(stdout); return 1; } @@ -2264,7 +2267,8 @@ tn(int argc, char *argv[]) memset(&su, 0, sizeof su); su.sun_family = AF_UNIX; strncpy(su.sun_path, hostp, sizeof su.sun_path); - printf("Trying %s...\n", hostp); + if (!quiet_mode) + printf("Trying %s...\n", hostp); net = socket(PF_UNIX, SOCK_STREAM, 0); if ( net < 0) { perror("socket"); @@ -2373,7 +2377,8 @@ tn(int argc, char *argv[]) } } do { - printf("Trying %s...\n", sockaddr_ntop(res->ai_addr)); + if (!quiet_mode) + printf("Trying %s...\n", sockaddr_ntop(res->ai_addr)); net = socket(res->ai_family, res->ai_socktype, res->ai_protocol); setuid(getuid()); if (net < 0) { @@ -2491,7 +2496,10 @@ tn(int argc, char *argv[]) (void) call(status, "status", "notmuch", 0); telnet(user); (void) NetClose(net); - ExitString("Connection closed by foreign host.\n",1); + if (quiet_mode) + ExitString("",1); + else + ExitString("Connection closed by foreign host.\n",1); /*NOTREACHED*/ fail: if (res0 != NULL) diff --git a/contrib/telnet/telnet/main.c b/contrib/telnet/telnet/main.c index befb3eecee66..8ebcc0a86259 100644 --- a/contrib/telnet/telnet/main.c +++ b/contrib/telnet/telnet/main.c @@ -63,6 +63,7 @@ char *ipsec_policy_out = NULL; #endif extern int tos; +extern int quiet_mode; int family = AF_UNSPEC; @@ -152,7 +153,7 @@ main(int argc, char *argv[]) #define IPSECOPT #endif while ((ch = getopt(argc, argv, - "468B:EKLNS:X:acde:fFk:l:n:rs:uxy" IPSECOPT)) != -1) + "468B:EKLNQS:X:acde:fFk:l:n:rs:uxy" IPSECOPT)) != -1) #undef IPSECOPT { switch(ch) { @@ -184,6 +185,9 @@ main(int argc, char *argv[]) case 'N': doaddrlookup = 0; break; + case 'Q': + quiet_mode = 1; + break; case 'S': #ifdef HAS_GETTOS diff --git a/contrib/telnet/telnet/telnet.1 b/contrib/telnet/telnet/telnet.1 index b7004ee94a5d..015401030f23 100644 --- a/contrib/telnet/telnet/telnet.1 +++ b/contrib/telnet/telnet/telnet.1 @@ -28,7 +28,7 @@ .\" @(#)telnet.1 8.6 (Berkeley) 6/1/94 .\" $FreeBSD$ .\" -.Dd August 7, 2020 +.Dd June 21, 2021 .Dt TELNET 1 .Os .Sh NAME @@ -38,7 +38,7 @@ protocol .Sh SYNOPSIS .Nm -.Op Fl 468EFKLNacdfruxy +.Op Fl 468EFKLNQacdfruxy .Op Fl B Ar baudrate .Op Fl S Ar tos .Op Fl X Ar authtype @@ -108,6 +108,11 @@ option to be negotiated on output. .It Fl N Prevents IP address to name lookup when destination host is given as an IP address. +.It Fl Q +Quiet mode. +This suppresses the messages +.Nm +would normally output upon connecting or disconnecting. .It Fl S Ar tos Sets the IP type-of-service (TOS) option for the telnet connection to the value From owner-dev-commits-src-main@freebsd.org Mon Jun 21 16:30: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 82F1664B8BE; Mon, 21 Jun 2021 16:30: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 4G7w3x39Xwz3vZn; Mon, 21 Jun 2021 16:30: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 5128E202F2; Mon, 21 Jun 2021 16:30:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15LGU5dh021856; Mon, 21 Jun 2021 16:30:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LGU59S021852; Mon, 21 Jun 2021 16:30:05 GMT (envelope-from git) Date: Mon, 21 Jun 2021 16:30:05 GMT Message-Id: <202106211630.15LGU59S021852@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: 26795a0378b5 - main - linux(4): Rework Linux ppoll system call. 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: 26795a0378b58c3e26b68577a4cc446ab527e8b5 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, 21 Jun 2021 16:30:05 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=26795a0378b58c3e26b68577a4cc446ab527e8b5 commit 26795a0378b58c3e26b68577a4cc446ab527e8b5 Author: Dmitry Chagin AuthorDate: 2021-06-22 05:06:05 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-22 05:06:05 +0000 linux(4): Rework Linux ppoll system call. For now the Linux emulation layer uses in kernel ppoll(2) without conversion of user supplied fd 'events', and does not convert the kernel supplied fd 'revents'. At least POLLRDHUP is handled by FreeBSD differently than by Linux. Seems that Linux silencly ignores POLLRDHUP on non socket fd's unlike FreeBSD, which does more strictly check and fails. Rework the Linux ppoll, using kern_poll and converting 'events' and 'revents' values. While here, move poll events defines to the MI part of code as they mostly identical on all arches except arm. Differential Revision: https://reviews.freebsd.org/D30716 MFC after: 2 weeks --- sys/amd64/linux/linux.h | 21 --------- sys/amd64/linux32/linux.h | 21 --------- sys/compat/linux/linux.c | 96 +++++++++++++++++++++++++++++++++++++++++ sys/compat/linux/linux.h | 17 ++++++++ sys/compat/linux/linux_common.h | 4 ++ sys/compat/linux/linux_misc.c | 68 ++++++++++++++++++++++++++++- sys/i386/linux/linux.h | 21 --------- 7 files changed, 184 insertions(+), 64 deletions(-) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index a9ed66689b64..4e736cc11c22 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -407,27 +407,6 @@ struct l_ifconf { #define ifc_buf ifc_ifcu.ifcu_buf #define ifc_req ifc_ifcu.ifcu_req -/* - * poll() - */ -#define LINUX_POLLIN 0x0001 -#define LINUX_POLLPRI 0x0002 -#define LINUX_POLLOUT 0x0004 -#define LINUX_POLLERR 0x0008 -#define LINUX_POLLHUP 0x0010 -#define LINUX_POLLNVAL 0x0020 -#define LINUX_POLLRDNORM 0x0040 -#define LINUX_POLLRDBAND 0x0080 -#define LINUX_POLLWRNORM 0x0100 -#define LINUX_POLLWRBAND 0x0200 -#define LINUX_POLLMSG 0x0400 - -struct l_pollfd { - l_int fd; - l_short events; - l_short revents; -}; - #define LINUX_ARCH_SET_GS 0x1001 #define LINUX_ARCH_SET_FS 0x1002 #define LINUX_ARCH_GET_FS 0x1003 diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 50a4efed1709..a95545619640 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -515,27 +515,6 @@ struct l_ifconf { #define ifc_buf ifc_ifcu.ifcu_buf #define ifc_req ifc_ifcu.ifcu_req -/* - * poll() - */ -#define LINUX_POLLIN 0x0001 -#define LINUX_POLLPRI 0x0002 -#define LINUX_POLLOUT 0x0004 -#define LINUX_POLLERR 0x0008 -#define LINUX_POLLHUP 0x0010 -#define LINUX_POLLNVAL 0x0020 -#define LINUX_POLLRDNORM 0x0040 -#define LINUX_POLLRDBAND 0x0080 -#define LINUX_POLLWRNORM 0x0100 -#define LINUX_POLLWRBAND 0x0200 -#define LINUX_POLLMSG 0x0400 - -struct l_pollfd { - l_int fd; - l_short events; - l_short revents; -}; - struct l_user_desc { l_uint entry_number; l_uint base_addr; diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c index a8c5e2baddc4..350d2c1abaf9 100644 --- a/sys/compat/linux/linux.c +++ b/sys/compat/linux/linux.c @@ -33,9 +33,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include +#include +#include #include #include #include @@ -50,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include struct futex_list futex_list; @@ -627,3 +632,94 @@ linux_to_bsd_bits_(int value, struct bsd_to_linux_bitmap *bitmap, return (no_value); return (bsd_ret); } + +void +linux_to_bsd_poll_events(struct thread *td, int fd, short lev, + short *bev) +{ + struct proc *p = td->td_proc; + struct filedesc *fdp; + struct file *fp; + int error; + short bits = 0; + + if (lev & LINUX_POLLIN) + bits |= POLLIN; + if (lev & LINUX_POLLPRI) + bits |= POLLPRI; + if (lev & LINUX_POLLOUT) + bits |= POLLOUT; + if (lev & LINUX_POLLERR) + bits |= POLLERR; + if (lev & LINUX_POLLHUP) + bits |= POLLHUP; + if (lev & LINUX_POLLNVAL) + bits |= POLLNVAL; + if (lev & LINUX_POLLRDNORM) + bits |= POLLRDNORM; + if (lev & LINUX_POLLRDBAND) + bits |= POLLRDBAND; + if (lev & LINUX_POLLWRBAND) + bits |= POLLWRBAND; + if (lev & LINUX_POLLWRNORM) + bits |= POLLWRNORM; + + if (lev & LINUX_POLLRDHUP) { + /* + * It seems that the Linux silencly ignores POLLRDHUP + * on non-socket file descriptors unlike FreeBSD, where + * events bits is more strictly checked (POLLSTANDARD). + */ + fdp = p->p_fd; + error = fget_unlocked(fdp, fd, &cap_no_rights, &fp); + if (error == 0) { + /* + * XXX. On FreeBSD POLLRDHUP applies only to + * stream sockets. + */ + if (fp->f_type == DTYPE_SOCKET) + bits |= POLLRDHUP; + fdrop(fp, td); + } + } + + if (lev & LINUX_POLLMSG) + LINUX_RATELIMIT_MSG_OPT1("unsupported POLLMSG, events(%d)", lev); + if (lev & LINUX_POLLREMOVE) + LINUX_RATELIMIT_MSG_OPT1("unsupported POLLREMOVE, events(%d)", lev); + + *bev = bits; +} + +void +bsd_to_linux_poll_events(short bev, short *lev) +{ + short bits = 0; + + if (bev & POLLIN) + bits |= LINUX_POLLIN; + if (bev & POLLPRI) + bits |= LINUX_POLLPRI; + if (bev & (POLLOUT | POLLWRNORM)) + /* + * POLLWRNORM is equal to POLLOUT on FreeBSD, + * but not on Linux + */ + bits |= LINUX_POLLOUT; + if (bev & POLLERR) + bits |= LINUX_POLLERR; + if (bev & POLLHUP) + bits |= LINUX_POLLHUP; + if (bev & POLLNVAL) + bits |= LINUX_POLLNVAL; + if (bev & POLLRDNORM) + bits |= LINUX_POLLRDNORM; + if (bev & POLLRDBAND) + bits |= LINUX_POLLRDBAND; + if (bev & POLLWRBAND) + bits |= LINUX_POLLWRBAND; + if (bev & POLLRDHUP) + bits |= LINUX_POLLRDHUP; + + *lev = bits; +} diff --git a/sys/compat/linux/linux.h b/sys/compat/linux/linux.h index 18eafa88a432..9b75e6032445 100644 --- a/sys/compat/linux/linux.h +++ b/sys/compat/linux/linux.h @@ -31,6 +31,23 @@ #include +/* + * poll() + */ +#define LINUX_POLLIN 0x0001 +#define LINUX_POLLPRI 0x0002 +#define LINUX_POLLOUT 0x0004 +#define LINUX_POLLERR 0x0008 +#define LINUX_POLLHUP 0x0010 +#define LINUX_POLLNVAL 0x0020 +#define LINUX_POLLRDNORM 0x0040 +#define LINUX_POLLRDBAND 0x0080 +#define LINUX_POLLWRNORM 0x0100 +#define LINUX_POLLWRBAND 0x0200 +#define LINUX_POLLMSG 0x0400 +#define LINUX_POLLREMOVE 0x1000 +#define LINUX_POLLRDHUP 0x2000 + #define LINUX_IFHWADDRLEN 6 #define LINUX_IFNAMSIZ 16 diff --git a/sys/compat/linux/linux_common.h b/sys/compat/linux/linux_common.h index a306bb1eb859..b0e3408e42df 100644 --- a/sys/compat/linux/linux_common.h +++ b/sys/compat/linux/linux_common.h @@ -41,5 +41,9 @@ int bsd_to_linux_sockaddr(const struct sockaddr *sa, struct l_sockaddr **lsa, socklen_t len); int linux_to_bsd_sockaddr(const struct l_sockaddr *lsa, struct sockaddr **sap, socklen_t *len); +void linux_to_bsd_poll_events(struct thread *td, int fd, + short lev, short *bev); +void bsd_to_linux_poll_events(short bev, short *lev); + #endif /* _LINUX_COMMON_H_ */ diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 53dd27dc23db..80458364017f 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -89,6 +90,7 @@ __FBSDID("$FreeBSD$"); #include #endif +#include #include #include #include @@ -144,6 +146,10 @@ static int linux_common_pselect6(struct thread *, l_int, static int linux_common_ppoll(struct thread *, struct pollfd *, uint32_t, struct timespec *, l_sigset_t *, l_size_t); +static int linux_pollin(struct thread *, struct pollfd *, + struct pollfd *, u_int); +static int linux_pollout(struct thread *, struct pollfd *, + struct pollfd *, u_int); int linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) @@ -2519,11 +2525,15 @@ linux_common_ppoll(struct thread *td, struct pollfd *fds, uint32_t nfds, struct timespec *tsp, l_sigset_t *sset, l_size_t ssize) { struct timespec ts0, ts1; + struct pollfd stackfds[32]; + struct pollfd *kfds; l_sigset_t l_ss; sigset_t *ssp; sigset_t ss; int error; + if (kern_poll_maxfds(nfds)) + return (EINVAL); if (sset != NULL) { if (ssize != sizeof(l_ss)) return (EINVAL); @@ -2537,7 +2547,17 @@ linux_common_ppoll(struct thread *td, struct pollfd *fds, uint32_t nfds, if (tsp != NULL) nanotime(&ts0); - error = kern_poll(td, fds, nfds, tsp, ssp); + if (nfds > nitems(stackfds)) + kfds = mallocarray(nfds, sizeof(*kfds), M_TEMP, M_WAITOK); + else + kfds = stackfds; + error = linux_pollin(td, kfds, fds, nfds); + if (error != 0) + goto out; + + error = kern_poll_kfds(td, kfds, nfds, tsp, ssp); + if (error == 0) + error = linux_pollout(td, kfds, fds, nfds); if (error == 0 && tsp != NULL) { if (td->td_retval[0]) { @@ -2549,6 +2569,10 @@ linux_common_ppoll(struct thread *td, struct pollfd *fds, uint32_t nfds, } else timespecclear(tsp); } + +out: + if (nfds > nitems(stackfds)) + free(kfds, M_TEMP); return (error); } @@ -2583,6 +2607,48 @@ linux_ppoll_time64(struct thread *td, struct linux_ppoll_time64_args *args) } #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ +static int +linux_pollin(struct thread *td, struct pollfd *fds, struct pollfd *ufds, u_int nfd) +{ + int error; + u_int i; + + error = copyin(ufds, fds, nfd * sizeof(*fds)); + if (error != 0) + return (error); + + for (i = 0; i < nfd; i++) { + if (fds->events != 0) + linux_to_bsd_poll_events(td, fds->fd, + fds->events, &fds->events); + fds++; + } + return (0); +} + +static int +linux_pollout(struct thread *td, struct pollfd *fds, struct pollfd *ufds, u_int nfd) +{ + int error = 0; + u_int i, n = 0; + + for (i = 0; i < nfd; i++) { + if (fds->revents != 0) { + bsd_to_linux_poll_events(fds->revents, + &fds->revents); + n++; + } + error = copyout(&fds->revents, &ufds->revents, + sizeof(ufds->revents)); + if (error) + return (error); + fds++; + ufds++; + } + td->td_retval[0] = n; + return (0); +} + int linux_sched_rr_get_interval(struct thread *td, struct linux_sched_rr_get_interval_args *uap) diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 1bb76d8e41d0..8dff1313c598 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -478,27 +478,6 @@ struct l_ifreq { #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ #define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */ -/* - * poll() - */ -#define LINUX_POLLIN 0x0001 -#define LINUX_POLLPRI 0x0002 -#define LINUX_POLLOUT 0x0004 -#define LINUX_POLLERR 0x0008 -#define LINUX_POLLHUP 0x0010 -#define LINUX_POLLNVAL 0x0020 -#define LINUX_POLLRDNORM 0x0040 -#define LINUX_POLLRDBAND 0x0080 -#define LINUX_POLLWRNORM 0x0100 -#define LINUX_POLLWRBAND 0x0200 -#define LINUX_POLLMSG 0x0400 - -struct l_pollfd { - l_int fd; - l_short events; - l_short revents; -}; - struct l_user_desc { l_uint entry_number; l_uint base_addr; From owner-dev-commits-src-main@freebsd.org Mon Jun 21 16:34: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 AB7F764B94D; Mon, 21 Jun 2021 16:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7w8w4JK1z3vwY; Mon, 21 Jun 2021 16:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BFFD20896; Mon, 21 Jun 2021 16:34: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 15LGYOQW032756; Mon, 21 Jun 2021 16:34:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LGYODJ032755; Mon, 21 Jun 2021 16:34:24 GMT (envelope-from git) Date: Mon, 21 Jun 2021 16:34:24 GMT Message-Id: <202106211634.15LGYODJ032755@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: 2eff670fde51 - main - linux(4): Implement poll system call via linux_common_ppol() for the sake of converting events to/from native. 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: 2eff670fde51762239fc64139b0cfb5272ce9cdd 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, 21 Jun 2021 16:34:24 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=2eff670fde51762239fc64139b0cfb5272ce9cdd commit 2eff670fde51762239fc64139b0cfb5272ce9cdd Author: Dmitry Chagin AuthorDate: 2021-06-22 05:07:46 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-22 05:07:46 +0000 linux(4): Implement poll system call via linux_common_ppol() for the sake of converting events to/from native. MFC after: 2 weeks --- sys/amd64/linux/syscalls.master | 4 ++-- sys/amd64/linux32/syscalls.master | 4 ++-- sys/arm/linux/syscalls.master | 4 ++-- sys/compat/linux/linux_misc.c | 20 ++++++++++++++++++++ sys/i386/linux/syscalls.master | 4 ++-- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master index 0cac26337ef1..4762a2ccc6a5 100644 --- a/sys/amd64/linux/syscalls.master +++ b/sys/amd64/linux/syscalls.master @@ -82,8 +82,8 @@ struct l_newstat *buf ); } -7 AUE_POLL NOPROTO { - int poll( +7 AUE_POLL STD { + int linux_poll( struct pollfd *fds, u_int nfds, int timeout diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 0ca919182998..be6c150eebfa 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -887,8 +887,8 @@ } 166 AUE_NULL UNIMPL vm86 167 AUE_NULL UNIMPL query_module -168 AUE_POLL NOPROTO { - int poll( +168 AUE_POLL STD { + int linux_poll( struct pollfd *fds, unsigned int nfds, int timeout diff --git a/sys/arm/linux/syscalls.master b/sys/arm/linux/syscalls.master index 42adc18bbe1e..46cf988c3dfe 100644 --- a/sys/arm/linux/syscalls.master +++ b/sys/arm/linux/syscalls.master @@ -744,8 +744,8 @@ } 166 AUE_NULL UNIMPL ; was linux_vm86 167 AUE_NULL UNIMPL ; was linux_query_module -168 AUE_POLL NOPROTO { - int poll( +168 AUE_POLL STD { + int linux_poll( struct pollfd* fds, unsigned int nfds, long timeout diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 80458364017f..1c1a8952bd79 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -2858,3 +2858,23 @@ linux_getcpu(struct thread *td, struct linux_getcpu_args *args) error = copyout(&node, args->node, sizeof(l_int)); return (error); } + +#if defined(__i386__) || defined(__amd64__) +int +linux_poll(struct thread *td, struct linux_poll_args *args) +{ + struct timespec ts, *tsp; + + if (args->timeout != INFTIM) { + if (args->timeout < 0) + return (EINVAL); + ts.tv_sec = args->timeout / 1000; + ts.tv_nsec = (args->timeout % 1000) * 1000000; + tsp = &ts; + } else + tsp = NULL; + + return (linux_common_ppoll(td, args->fds, args->nfds, + tsp, NULL, 0)); +} +#endif /* __i386__ || __amd64__ */ diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index f75b1253bc14..acbe5628e7ce 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -912,8 +912,8 @@ int linux_vm86(void); } 167 AUE_NULL UNIMPL query_module -168 AUE_POLL NOPROTO { - int poll( +168 AUE_POLL STD { + int linux_poll( struct pollfd *fds, unsigned int nfds, long timeout From owner-dev-commits-src-main@freebsd.org Mon Jun 21 16:34: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 C829A64BC87; Mon, 21 Jun 2021 16:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7w8x59q1z3vyh; Mon, 21 Jun 2021 16:34: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 9B2C820897; Mon, 21 Jun 2021 16:34: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 15LGYPL8032780; Mon, 21 Jun 2021 16:34:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LGYPrJ032779; Mon, 21 Jun 2021 16:34:25 GMT (envelope-from git) Date: Mon, 21 Jun 2021 16:34:25 GMT Message-Id: <202106211634.15LGYPrJ032779@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: 8fe8bb7cb573 - main - linux(4): Regen for linux_poll system call. 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: 8fe8bb7cb573bfc62b04f38acfb2ac79ffcbb97e 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, 21 Jun 2021 16:34:25 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=8fe8bb7cb573bfc62b04f38acfb2ac79ffcbb97e commit 8fe8bb7cb573bfc62b04f38acfb2ac79ffcbb97e Author: Dmitry Chagin AuthorDate: 2021-06-22 05:09:55 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-22 05:09:55 +0000 linux(4): Regen for linux_poll system call. MFC after: 2 weeks --- sys/amd64/linux/linux_proto.h | 7 +++++++ sys/amd64/linux/linux_syscall.h | 2 +- sys/amd64/linux/linux_syscalls.c | 2 +- sys/amd64/linux/linux_sysent.c | 2 +- sys/amd64/linux/linux_systrace_args.c | 8 ++++---- sys/amd64/linux32/linux32_proto.h | 7 +++++++ sys/amd64/linux32/linux32_syscall.h | 2 +- sys/amd64/linux32/linux32_syscalls.c | 2 +- sys/amd64/linux32/linux32_sysent.c | 2 +- sys/amd64/linux32/linux32_systrace_args.c | 8 ++++---- sys/arm/linux/linux_proto.h | 7 +++++++ sys/arm/linux/linux_syscall.h | 2 +- sys/arm/linux/linux_syscalls.c | 2 +- sys/arm/linux/linux_sysent.c | 2 +- sys/arm/linux/linux_systrace_args.c | 8 ++++---- sys/i386/linux/linux_proto.h | 7 +++++++ sys/i386/linux/linux_syscall.h | 2 +- sys/i386/linux/linux_syscalls.c | 2 +- sys/i386/linux/linux_sysent.c | 2 +- sys/i386/linux/linux_systrace_args.c | 8 ++++---- 20 files changed, 56 insertions(+), 28 deletions(-) diff --git a/sys/amd64/linux/linux_proto.h b/sys/amd64/linux/linux_proto.h index cfd2f0cf2ca7..f5eb73718c24 100644 --- a/sys/amd64/linux/linux_proto.h +++ b/sys/amd64/linux/linux_proto.h @@ -52,6 +52,11 @@ struct linux_newlstat_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; char buf_l_[PADL_(struct l_newstat *)]; struct l_newstat * buf; char buf_r_[PADR_(struct l_newstat *)]; }; +struct linux_poll_args { + char fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)]; + char nfds_l_[PADL_(u_int)]; u_int nfds; char nfds_r_[PADR_(u_int)]; + char timeout_l_[PADL_(int)]; int timeout; char timeout_r_[PADR_(int)]; +}; struct linux_lseek_args { char fdes_l_[PADL_(l_uint)]; l_uint fdes; char fdes_r_[PADR_(l_uint)]; char off_l_[PADL_(l_off_t)]; l_off_t off; char off_r_[PADR_(l_off_t)]; @@ -1381,6 +1386,7 @@ int linux_open(struct thread *, struct linux_open_args *); int linux_newstat(struct thread *, struct linux_newstat_args *); int linux_newfstat(struct thread *, struct linux_newfstat_args *); int linux_newlstat(struct thread *, struct linux_newlstat_args *); +int linux_poll(struct thread *, struct linux_poll_args *); int linux_lseek(struct thread *, struct linux_lseek_args *); int linux_mmap2(struct thread *, struct linux_mmap2_args *); int linux_mprotect(struct thread *, struct linux_mprotect_args *); @@ -1727,6 +1733,7 @@ int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); #define LINUX_SYS_AUE_linux_newstat AUE_STAT #define LINUX_SYS_AUE_linux_newfstat AUE_FSTAT #define LINUX_SYS_AUE_linux_newlstat AUE_LSTAT +#define LINUX_SYS_AUE_linux_poll AUE_POLL #define LINUX_SYS_AUE_linux_lseek AUE_LSEEK #define LINUX_SYS_AUE_linux_mmap2 AUE_MMAP #define LINUX_SYS_AUE_linux_mprotect AUE_MPROTECT diff --git a/sys/amd64/linux/linux_syscall.h b/sys/amd64/linux/linux_syscall.h index 2416d23abd6d..ca83b9d33483 100644 --- a/sys/amd64/linux/linux_syscall.h +++ b/sys/amd64/linux/linux_syscall.h @@ -12,7 +12,7 @@ #define LINUX_SYS_linux_newstat 4 #define LINUX_SYS_linux_newfstat 5 #define LINUX_SYS_linux_newlstat 6 -#define LINUX_SYS_poll 7 +#define LINUX_SYS_linux_poll 7 #define LINUX_SYS_linux_lseek 8 #define LINUX_SYS_linux_mmap2 9 #define LINUX_SYS_linux_mprotect 10 diff --git a/sys/amd64/linux/linux_syscalls.c b/sys/amd64/linux/linux_syscalls.c index 077d0230b261..285e9d47c461 100644 --- a/sys/amd64/linux/linux_syscalls.c +++ b/sys/amd64/linux/linux_syscalls.c @@ -14,7 +14,7 @@ const char *linux_syscallnames[] = { "linux_newstat", /* 4 = linux_newstat */ "linux_newfstat", /* 5 = linux_newfstat */ "linux_newlstat", /* 6 = linux_newlstat */ - "poll", /* 7 = poll */ + "linux_poll", /* 7 = linux_poll */ "linux_lseek", /* 8 = linux_lseek */ "linux_mmap2", /* 9 = linux_mmap2 */ "linux_mprotect", /* 10 = linux_mprotect */ diff --git a/sys/amd64/linux/linux_sysent.c b/sys/amd64/linux/linux_sysent.c index 390f3bb4e32b..96e74e821c43 100644 --- a/sys/amd64/linux/linux_sysent.c +++ b/sys/amd64/linux/linux_sysent.c @@ -24,7 +24,7 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_newstat_args), .sy_call = (sy_call_t *)linux_newstat, .sy_auevent = AUE_STAT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 4 = linux_newstat */ { .sy_narg = AS(linux_newfstat_args), .sy_call = (sy_call_t *)linux_newfstat, .sy_auevent = AUE_FSTAT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 5 = linux_newfstat */ { .sy_narg = AS(linux_newlstat_args), .sy_call = (sy_call_t *)linux_newlstat, .sy_auevent = AUE_LSTAT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 6 = linux_newlstat */ - { .sy_narg = AS(poll_args), .sy_call = (sy_call_t *)sys_poll, .sy_auevent = AUE_POLL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 7 = poll */ + { .sy_narg = AS(linux_poll_args), .sy_call = (sy_call_t *)linux_poll, .sy_auevent = AUE_POLL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 7 = linux_poll */ { .sy_narg = AS(linux_lseek_args), .sy_call = (sy_call_t *)linux_lseek, .sy_auevent = AUE_LSEEK, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 8 = linux_lseek */ { .sy_narg = AS(linux_mmap2_args), .sy_call = (sy_call_t *)linux_mmap2, .sy_auevent = AUE_MMAP, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 9 = linux_mmap2 */ { .sy_narg = AS(linux_mprotect_args), .sy_call = (sy_call_t *)linux_mprotect, .sy_auevent = AUE_MPROTECT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 10 = linux_mprotect */ diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c index a4c861b789fd..7d89ffbf2a23 100644 --- a/sys/amd64/linux/linux_systrace_args.c +++ b/sys/amd64/linux/linux_systrace_args.c @@ -70,9 +70,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 2; break; } - /* poll */ + /* linux_poll */ case 7: { - struct poll_args *p = params; + struct linux_poll_args *p = params; uarg[0] = (intptr_t)p->fds; /* struct pollfd * */ uarg[1] = p->nfds; /* u_int */ iarg[2] = p->timeout; /* int */ @@ -2823,7 +2823,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* poll */ + /* linux_poll */ case 7: switch (ndx) { case 0: @@ -7076,7 +7076,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* poll */ + /* linux_poll */ case 7: if (ndx == 0 || ndx == 1) p = "int"; diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index 8a0950d8c754..41724a5d24b6 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -519,6 +519,11 @@ struct linux_getresuid16_args { char euid_l_[PADL_(l_uid16_t *)]; l_uid16_t * euid; char euid_r_[PADR_(l_uid16_t *)]; char suid_l_[PADL_(l_uid16_t *)]; l_uid16_t * suid; char suid_r_[PADR_(l_uid16_t *)]; }; +struct linux_poll_args { + char fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)]; + char nfds_l_[PADL_(unsigned int)]; unsigned int nfds; char nfds_r_[PADR_(unsigned int)]; + char timeout_l_[PADL_(int)]; int timeout; char timeout_r_[PADR_(int)]; +}; struct linux_setresgid16_args { char rgid_l_[PADL_(l_gid16_t)]; l_gid16_t rgid; char rgid_r_[PADR_(l_gid16_t)]; char egid_l_[PADL_(l_gid16_t)]; l_gid16_t egid; char egid_r_[PADR_(l_gid16_t)]; @@ -1786,6 +1791,7 @@ int linux_nanosleep(struct thread *, struct linux_nanosleep_args *); int linux_mremap(struct thread *, struct linux_mremap_args *); int linux_setresuid16(struct thread *, struct linux_setresuid16_args *); int linux_getresuid16(struct thread *, struct linux_getresuid16_args *); +int linux_poll(struct thread *, struct linux_poll_args *); int linux_setresgid16(struct thread *, struct linux_setresgid16_args *); int linux_getresgid16(struct thread *, struct linux_getresgid16_args *); int linux_prctl(struct thread *, struct linux_prctl_args *); @@ -2197,6 +2203,7 @@ int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); #define LINUX32_SYS_AUE_linux_mremap AUE_NULL #define LINUX32_SYS_AUE_linux_setresuid16 AUE_SETRESUID #define LINUX32_SYS_AUE_linux_getresuid16 AUE_GETRESUID +#define LINUX32_SYS_AUE_linux_poll AUE_POLL #define LINUX32_SYS_AUE_linux_setresgid16 AUE_SETRESGID #define LINUX32_SYS_AUE_linux_getresgid16 AUE_GETRESGID #define LINUX32_SYS_AUE_linux_prctl AUE_PRCTL diff --git a/sys/amd64/linux32/linux32_syscall.h b/sys/amd64/linux32/linux32_syscall.h index 4c9db70621d3..b2724c50d6a0 100644 --- a/sys/amd64/linux32/linux32_syscall.h +++ b/sys/amd64/linux32/linux32_syscall.h @@ -152,7 +152,7 @@ #define LINUX32_SYS_linux_mremap 163 #define LINUX32_SYS_linux_setresuid16 164 #define LINUX32_SYS_linux_getresuid16 165 -#define LINUX32_SYS_poll 168 +#define LINUX32_SYS_linux_poll 168 #define LINUX32_SYS_linux_setresgid16 170 #define LINUX32_SYS_linux_getresgid16 171 #define LINUX32_SYS_linux_prctl 172 diff --git a/sys/amd64/linux32/linux32_syscalls.c b/sys/amd64/linux32/linux32_syscalls.c index b427a94c87a0..3ee1639b5971 100644 --- a/sys/amd64/linux32/linux32_syscalls.c +++ b/sys/amd64/linux32/linux32_syscalls.c @@ -175,7 +175,7 @@ const char *linux32_syscallnames[] = { "linux_getresuid16", /* 165 = linux_getresuid16 */ "#166", /* 166 = vm86 */ "#167", /* 167 = query_module */ - "poll", /* 168 = poll */ + "linux_poll", /* 168 = linux_poll */ "#169", /* 169 = nfsservctl */ "linux_setresgid16", /* 170 = linux_setresgid16 */ "linux_getresgid16", /* 171 = linux_getresgid16 */ diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index c4d35efaef96..536088b02c95 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -185,7 +185,7 @@ struct sysent linux32_sysent[] = { { .sy_narg = AS(linux_getresuid16_args), .sy_call = (sy_call_t *)linux_getresuid16, .sy_auevent = AUE_GETRESUID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 165 = linux_getresuid16 */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 166 = vm86 */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 167 = query_module */ - { .sy_narg = AS(poll_args), .sy_call = (sy_call_t *)sys_poll, .sy_auevent = AUE_POLL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 168 = poll */ + { .sy_narg = AS(linux_poll_args), .sy_call = (sy_call_t *)linux_poll, .sy_auevent = AUE_POLL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 168 = linux_poll */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 169 = nfsservctl */ { .sy_narg = AS(linux_setresgid16_args), .sy_call = (sy_call_t *)linux_setresgid16, .sy_auevent = AUE_SETRESGID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 170 = linux_setresgid16 */ { .sy_narg = AS(linux_getresgid16_args), .sy_call = (sy_call_t *)linux_getresgid16, .sy_auevent = AUE_GETRESGID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 171 = linux_getresgid16 */ diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index f9a3794c309a..93476fc84a37 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -1129,9 +1129,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } - /* poll */ + /* linux_poll */ case 168: { - struct poll_args *p = params; + struct linux_poll_args *p = params; uarg[0] = (intptr_t)p->fds; /* struct pollfd * */ uarg[1] = p->nfds; /* unsigned int */ iarg[2] = p->timeout; /* int */ @@ -4925,7 +4925,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* poll */ + /* linux_poll */ case 168: switch (ndx) { case 0: @@ -8977,7 +8977,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* poll */ + /* linux_poll */ case 168: if (ndx == 0 || ndx == 1) p = "int"; diff --git a/sys/arm/linux/linux_proto.h b/sys/arm/linux/linux_proto.h index b07dc8290016..131fa227e8f8 100644 --- a/sys/arm/linux/linux_proto.h +++ b/sys/arm/linux/linux_proto.h @@ -424,6 +424,11 @@ struct linux_getresuid16_args { char euid_l_[PADL_(l_uid16_t *)]; l_uid16_t * euid; char euid_r_[PADR_(l_uid16_t *)]; char suid_l_[PADL_(l_uid16_t *)]; l_uid16_t * suid; char suid_r_[PADR_(l_uid16_t *)]; }; +struct linux_poll_args { + char fds_l_[PADL_(struct pollfd*)]; struct pollfd* fds; char fds_r_[PADR_(struct pollfd*)]; + char nfds_l_[PADL_(unsigned int)]; unsigned int nfds; char nfds_r_[PADR_(unsigned int)]; + char timeout_l_[PADL_(long)]; long timeout; char timeout_r_[PADR_(long)]; +}; struct linux_setresgid16_args { char rgid_l_[PADL_(l_gid16_t)]; l_gid16_t rgid; char rgid_r_[PADR_(l_gid16_t)]; char egid_l_[PADL_(l_gid16_t)]; l_gid16_t egid; char egid_r_[PADR_(l_gid16_t)]; @@ -1328,6 +1333,7 @@ int linux_nanosleep(struct thread *, struct linux_nanosleep_args *); int linux_mremap(struct thread *, struct linux_mremap_args *); int linux_setresuid16(struct thread *, struct linux_setresuid16_args *); int linux_getresuid16(struct thread *, struct linux_getresuid16_args *); +int linux_poll(struct thread *, struct linux_poll_args *); int linux_setresgid16(struct thread *, struct linux_setresgid16_args *); int linux_getresgid16(struct thread *, struct linux_getresgid16_args *); int linux_prctl(struct thread *, struct linux_prctl_args *); @@ -1654,6 +1660,7 @@ int linux_set_tls(struct thread *, struct linux_set_tls_args *); #define LINUX_SYS_AUE_linux_mremap AUE_NULL #define LINUX_SYS_AUE_linux_setresuid16 AUE_SETRESUID #define LINUX_SYS_AUE_linux_getresuid16 AUE_GETRESUID +#define LINUX_SYS_AUE_linux_poll AUE_POLL #define LINUX_SYS_AUE_linux_setresgid16 AUE_SETRESGID #define LINUX_SYS_AUE_linux_getresgid16 AUE_GETRESGID #define LINUX_SYS_AUE_linux_prctl AUE_PRCTL diff --git a/sys/arm/linux/linux_syscall.h b/sys/arm/linux/linux_syscall.h index 1621fde6c0b8..8f9a7376c9b8 100644 --- a/sys/arm/linux/linux_syscall.h +++ b/sys/arm/linux/linux_syscall.h @@ -131,7 +131,7 @@ #define LINUX_SYS_linux_mremap 163 #define LINUX_SYS_linux_setresuid16 164 #define LINUX_SYS_linux_getresuid16 165 -#define LINUX_SYS_poll 168 +#define LINUX_SYS_linux_poll 168 #define LINUX_SYS_linux_setresgid16 170 #define LINUX_SYS_linux_getresgid16 171 #define LINUX_SYS_linux_prctl 172 diff --git a/sys/arm/linux/linux_syscalls.c b/sys/arm/linux/linux_syscalls.c index d7f743f1a825..8a5344c35cc5 100644 --- a/sys/arm/linux/linux_syscalls.c +++ b/sys/arm/linux/linux_syscalls.c @@ -175,7 +175,7 @@ const char *linux_syscallnames[] = { "linux_getresuid16", /* 165 = linux_getresuid16 */ "#166", /* 166 = ; */ "#167", /* 167 = ; */ - "poll", /* 168 = poll */ + "linux_poll", /* 168 = linux_poll */ "#169", /* 169 = ; */ "linux_setresgid16", /* 170 = linux_setresgid16 */ "linux_getresgid16", /* 171 = linux_getresgid16 */ diff --git a/sys/arm/linux/linux_sysent.c b/sys/arm/linux/linux_sysent.c index ad24f759cd2f..d8f58a91eb3f 100644 --- a/sys/arm/linux/linux_sysent.c +++ b/sys/arm/linux/linux_sysent.c @@ -185,7 +185,7 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_getresuid16_args), .sy_call = (sy_call_t *)linux_getresuid16, .sy_auevent = AUE_GETRESUID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 165 = linux_getresuid16 */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 166 = ; */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 167 = ; */ - { .sy_narg = AS(poll_args), .sy_call = (sy_call_t *)sys_poll, .sy_auevent = AUE_POLL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 168 = poll */ + { .sy_narg = AS(linux_poll_args), .sy_call = (sy_call_t *)linux_poll, .sy_auevent = AUE_POLL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 168 = linux_poll */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 169 = ; */ { .sy_narg = AS(linux_setresgid16_args), .sy_call = (sy_call_t *)linux_setresgid16, .sy_auevent = AUE_SETRESGID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 170 = linux_setresgid16 */ { .sy_narg = AS(linux_getresgid16_args), .sy_call = (sy_call_t *)linux_getresgid16, .sy_auevent = AUE_GETRESGID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 171 = linux_getresgid16 */ diff --git a/sys/arm/linux/linux_systrace_args.c b/sys/arm/linux/linux_systrace_args.c index 87608f6992bf..f35bb0c6b906 100644 --- a/sys/arm/linux/linux_systrace_args.c +++ b/sys/arm/linux/linux_systrace_args.c @@ -972,9 +972,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } - /* poll */ + /* linux_poll */ case 168: { - struct poll_args *p = params; + struct linux_poll_args *p = params; uarg[0] = (intptr_t)p->fds; /* struct pollfd* */ uarg[1] = p->nfds; /* unsigned int */ iarg[2] = p->timeout; /* long */ @@ -3976,7 +3976,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* poll */ + /* linux_poll */ case 168: switch (ndx) { case 0: @@ -6936,7 +6936,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* poll */ + /* linux_poll */ case 168: if (ndx == 0 || ndx == 1) p = "int"; diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index 0c7bdd56db97..c66f509ca57c 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -520,6 +520,11 @@ struct linux_getresuid16_args { struct linux_vm86_args { register_t dummy; }; +struct linux_poll_args { + char fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)]; + char nfds_l_[PADL_(unsigned int)]; unsigned int nfds; char nfds_r_[PADR_(unsigned int)]; + char timeout_l_[PADL_(long)]; long timeout; char timeout_r_[PADR_(long)]; +}; struct linux_setresgid16_args { char rgid_l_[PADL_(l_gid16_t)]; l_gid16_t rgid; char rgid_r_[PADR_(l_gid16_t)]; char egid_l_[PADL_(l_gid16_t)]; l_gid16_t egid; char egid_r_[PADR_(l_gid16_t)]; @@ -1780,6 +1785,7 @@ int linux_mremap(struct thread *, struct linux_mremap_args *); int linux_setresuid16(struct thread *, struct linux_setresuid16_args *); int linux_getresuid16(struct thread *, struct linux_getresuid16_args *); int linux_vm86(struct thread *, struct linux_vm86_args *); +int linux_poll(struct thread *, struct linux_poll_args *); int linux_setresgid16(struct thread *, struct linux_setresgid16_args *); int linux_getresgid16(struct thread *, struct linux_getresgid16_args *); int linux_prctl(struct thread *, struct linux_prctl_args *); @@ -2193,6 +2199,7 @@ int linux_mount_setattr(struct thread *, struct linux_mount_setattr_args *); #define LINUX_SYS_AUE_linux_setresuid16 AUE_SETRESUID #define LINUX_SYS_AUE_linux_getresuid16 AUE_GETRESUID #define LINUX_SYS_AUE_linux_vm86 AUE_NULL +#define LINUX_SYS_AUE_linux_poll AUE_POLL #define LINUX_SYS_AUE_linux_setresgid16 AUE_SETRESGID #define LINUX_SYS_AUE_linux_getresgid16 AUE_GETRESGID #define LINUX_SYS_AUE_linux_prctl AUE_PRCTL diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h index 9488c637fff0..d8d5b20238ae 100644 --- a/sys/i386/linux/linux_syscall.h +++ b/sys/i386/linux/linux_syscall.h @@ -158,7 +158,7 @@ #define LINUX_SYS_linux_setresuid16 164 #define LINUX_SYS_linux_getresuid16 165 #define LINUX_SYS_linux_vm86 166 -#define LINUX_SYS_poll 168 +#define LINUX_SYS_linux_poll 168 #define LINUX_SYS_linux_setresgid16 170 #define LINUX_SYS_linux_getresgid16 171 #define LINUX_SYS_linux_prctl 172 diff --git a/sys/i386/linux/linux_syscalls.c b/sys/i386/linux/linux_syscalls.c index 748d2eb18fc1..a1e54e20400f 100644 --- a/sys/i386/linux/linux_syscalls.c +++ b/sys/i386/linux/linux_syscalls.c @@ -175,7 +175,7 @@ const char *linux_syscallnames[] = { "linux_getresuid16", /* 165 = linux_getresuid16 */ "linux_vm86", /* 166 = linux_vm86 */ "#167", /* 167 = query_module */ - "poll", /* 168 = poll */ + "linux_poll", /* 168 = linux_poll */ "#169", /* 169 = nfsservctl */ "linux_setresgid16", /* 170 = linux_setresgid16 */ "linux_getresgid16", /* 171 = linux_getresgid16 */ diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index 216f46798e3a..7b94d2047071 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -185,7 +185,7 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_getresuid16_args), .sy_call = (sy_call_t *)linux_getresuid16, .sy_auevent = AUE_GETRESUID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 165 = linux_getresuid16 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_vm86, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 166 = linux_vm86 */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 167 = query_module */ - { .sy_narg = AS(poll_args), .sy_call = (sy_call_t *)sys_poll, .sy_auevent = AUE_POLL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 168 = poll */ + { .sy_narg = AS(linux_poll_args), .sy_call = (sy_call_t *)linux_poll, .sy_auevent = AUE_POLL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 168 = linux_poll */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 169 = nfsservctl */ { .sy_narg = AS(linux_setresgid16_args), .sy_call = (sy_call_t *)linux_setresgid16, .sy_auevent = AUE_SETRESGID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 170 = linux_setresgid16 */ { .sy_narg = AS(linux_getresgid16_args), .sy_call = (sy_call_t *)linux_getresgid16, .sy_auevent = AUE_GETRESGID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 171 = linux_getresgid16 */ diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index 15232a900447..bbab41700a93 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -1172,9 +1172,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 0; break; } - /* poll */ + /* linux_poll */ case 168: { - struct poll_args *p = params; + struct linux_poll_args *p = params; uarg[0] = (intptr_t)p->fds; /* struct pollfd * */ uarg[1] = p->nfds; /* unsigned int */ iarg[2] = p->timeout; /* long */ @@ -5025,7 +5025,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) /* linux_vm86 */ case 166: break; - /* poll */ + /* linux_poll */ case 168: switch (ndx) { case 0: @@ -9078,7 +9078,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_vm86 */ case 166: - /* poll */ + /* linux_poll */ case 168: if (ndx == 0 || ndx == 1) p = "int"; From owner-dev-commits-src-main@freebsd.org Mon Jun 21 16:52: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 C1F2A64BAE1; Mon, 21 Jun 2021 16:52: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 4G7wYT59bkz4R91; Mon, 21 Jun 2021 16:52: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 9A5F620C56; Mon, 21 Jun 2021 16:52: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 15LGqDWq058685; Mon, 21 Jun 2021 16:52:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LGqDPu058684; Mon, 21 Jun 2021 16:52:13 GMT (envelope-from git) Date: Mon, 21 Jun 2021 16:52:13 GMT Message-Id: <202106211652.15LGqDPu058684@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: 135dd0cab51e - main - linux: reduce differences between rt_sendsig() and sendsig() 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: 135dd0cab51e89739416d8f924ea984e364a110e 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, 21 Jun 2021 16:52:13 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=135dd0cab51e89739416d8f924ea984e364a110e commit 135dd0cab51e89739416d8f924ea984e364a110e Author: Edward Tomasz Napierala AuthorDate: 2021-06-21 16:13:53 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-06-21 16:51:56 +0000 linux: reduce differences between rt_sendsig() and sendsig() This makes it easier to compare the two. This involves moving the mutex slightly lower down, but there should be no functional changes. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30541 --- sys/amd64/linux/linux_sysvec.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 66e9fec46e60..ff18950548a5 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -610,17 +610,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) LINUX_CTR4(rt_sendsig, "%p, %d, %p, %u", catcher, sig, mask, code); - /* Allocate space for the signal handler context. */ - if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && - SIGISMEMBER(psp->ps_sigonstack, sig)) { - sp = (caddr_t)td->td_sigstk.ss_sp + td->td_sigstk.ss_size - - sizeof(struct l_rt_sigframe); - } else - sp = (caddr_t)regs->tf_rsp - sizeof(struct l_rt_sigframe) - 128; - /* Align to 16 bytes. */ - sfp = (struct l_rt_sigframe *)((unsigned long)sp & ~0xFul); - mtx_unlock(&psp->ps_mtx); - /* Translate the signal. */ sig = bsd_to_linux_signal(sig); @@ -633,7 +622,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sf.sf_sc.uc_stack.ss_size = td->td_sigstk.ss_size; sf.sf_sc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) ? ((oonstack) ? LINUX_SS_ONSTACK : 0) : LINUX_SS_DISABLE; - PROC_UNLOCK(p); sf.sf_sc.uc_mcontext.sc_rdi = regs->tf_rdi; sf.sf_sc.uc_mcontext.sc_rsi = regs->tf_rsi; @@ -658,15 +646,28 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sf.sf_sc.uc_mcontext.sc_trapno = bsd_to_linux_trapcode(code); sf.sf_sc.uc_mcontext.sc_cr2 = (register_t)ksi->ksi_addr; + /* Allocate space for the signal handler context. */ + if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && + SIGISMEMBER(psp->ps_sigonstack, sig)) { + sp = (caddr_t)td->td_sigstk.ss_sp + td->td_sigstk.ss_size - + sizeof(struct l_rt_sigframe); + } else + sp = (caddr_t)regs->tf_rsp - sizeof(struct l_rt_sigframe) - 128; + /* Align to 16 bytes. */ + sfp = (struct l_rt_sigframe *)((unsigned long)sp & ~0xFul); + /* Build the argument list for the signal handler. */ regs->tf_rdi = sig; /* arg 1 in %rdi */ regs->tf_rax = 0; regs->tf_rsi = (register_t)&sfp->sf_si; /* arg 2 in %rsi */ regs->tf_rdx = (register_t)&sfp->sf_sc; /* arg 3 in %rdx */ - sf.sf_handler = catcher; /* Fill in POSIX parts. */ siginfo_to_lsiginfo(&ksi->ksi_info, &sf.sf_si, sig); + sf.sf_handler = catcher; + + mtx_unlock(&psp->ps_mtx); + PROC_UNLOCK(p); /* Copy the sigframe out to the user's stack. */ if (copyout(&sf, sfp, sizeof(*sfp)) != 0) { From owner-dev-commits-src-main@freebsd.org Mon Jun 21 16:56: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 B54C264BDED; Mon, 21 Jun 2021 16:56: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 4G7wfT4dK0z4RFj; Mon, 21 Jun 2021 16:56: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 86C8420C63; Mon, 21 Jun 2021 16:56: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 15LGuXR9059225; Mon, 21 Jun 2021 16:56:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LGuXQU059224; Mon, 21 Jun 2021 16:56:33 GMT (envelope-from git) Date: Mon, 21 Jun 2021 16:56:33 GMT Message-Id: <202106211656.15LGuXQU059224@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: e013e36939ac - main - linux(4): Get rid of Linuxulator kernel build options. 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: e013e36939ac87b53195370fb5e29f29c1a4b5c6 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, 21 Jun 2021 16:56:33 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=e013e36939ac87b53195370fb5e29f29c1a4b5c6 commit e013e36939ac87b53195370fb5e29f29c1a4b5c6 Author: Dmitry Chagin AuthorDate: 2021-06-22 05:32:39 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-22 05:32:39 +0000 linux(4): Get rid of Linuxulator kernel build options. Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 kernel build options. Since we have 32 and 64 bit Linux emulators, we can't build both emulators together into the kernel. I don't think it matters, Linux emulation depends on loadable modules (via rc). Cut LINPROCFS and LINSYSFS for consistency. PR: 215061 Reviewed by: bcr (manpages), trasz Differential Revision: https://reviews.freebsd.org/D30751 MFC after: 2 weeks --- share/man/man4/aac.4 | 4 +--- share/man/man4/aacraid.4 | 4 +--- share/man/man4/linux.4 | 15 +----------- share/man/man4/tdfx.4 | 13 ++++++---- sys/amd64/conf/NOTES | 17 ------------- sys/conf/NOTES | 4 ++-- sys/conf/files | 5 ---- sys/conf/files.amd64 | 62 ------------------------------------------------ sys/conf/files.i386 | 58 -------------------------------------------- sys/conf/files.x86 | 1 - sys/conf/options.amd64 | 2 +- sys/i386/conf/NOTES | 16 +------------ 12 files changed, 16 insertions(+), 185 deletions(-) diff --git a/share/man/man4/aac.4 b/share/man/man4/aac.4 index e0ffcaa5407d..eec5bc1671ca 100644 --- a/share/man/man4/aac.4 +++ b/share/man/man4/aac.4 @@ -75,9 +75,7 @@ and .Pa /dev/hpn? exist for compatibility with the Dell and HP versions of management tools, respectively. -If the kernel is compiled with the -.Dv COMPAT_LINUX -option, or the +If the .Pa aac_linux.ko and .Pa linux.ko diff --git a/share/man/man4/aacraid.4 b/share/man/man4/aacraid.4 index 91725911602b..3f2e023a7a00 100644 --- a/share/man/man4/aacraid.4 +++ b/share/man/man4/aacraid.4 @@ -70,9 +70,7 @@ The .Pa /dev/aacraid? device nodes provide access to the management interface of the controller. One node exists per installed card. -If the kernel is compiled with the -.Dv COMPAT_LINUX -option, or the +If the .Pa aacraid_linux.ko and .Pa linux.ko diff --git a/share/man/man4/linux.4 b/share/man/man4/linux.4 index b2d36158c622..ce0240dd9f92 100644 --- a/share/man/man4/linux.4 +++ b/share/man/man4/linux.4 @@ -31,20 +31,7 @@ .Nm linux .Nd Linux ABI support .Sh SYNOPSIS -To compile support for this ABI into an i386 kernel -place the following line in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "options COMPAT_LINUX" -.Ed -.Pp -for an amd64 kernel use: -.Bd -ragged -offset indent -.Cd "options COMPAT_LINUX32" -.Ed -.Pp -Alternatively, to load the ABI as a -module at boot time, place the following line in +To load the ABI at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent linux_load="YES" diff --git a/share/man/man4/tdfx.4 b/share/man/man4/tdfx.4 index 2a09a71cf6ce..76dbdd3d2f29 100644 --- a/share/man/man4/tdfx.4 +++ b/share/man/man4/tdfx.4 @@ -9,7 +9,6 @@ .Nd Voodoo Graphics and VoodooII Memory Access GLIDE device driver .Sh SYNOPSIS .Cd device tdfx -.Cd device tdfx_linux .Sh DESCRIPTION This driver creates an entry in .Pa /dev @@ -50,9 +49,11 @@ It also does not currently support the Voodoo Rush. It also does not yet handle the SLI feature of the Voodoo II boards. You can only use each of them separately. .Pp -By including -.Nm tdfx_linux , -you can enable the linux ioctl code for this driver, where the only supported +By loading the +.Nm tdfx_linux.ko +and +.Nm linux.ko +modules, you can enable the linux ioctl code for this driver, where the only supported applications currently reside. .Sh FILES .Bl -tag -width /dev/voodoo* -compact @@ -70,6 +71,10 @@ Mirrors of above interfaces (Some apps use .Pa /dev/voodoo ) .El +.Sh SEE ALSO +.Xr kld 4 , +.Xr linux 4 , +.Xr kldload 8 .Sh HISTORY The .Nm diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index aa5a09475ef3..79c92a679414 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -261,11 +261,8 @@ device s3pci # linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as # the tdfx DRI module from XFree86 and is completely unrelated. # -# To enable Linuxulator support, one must also include COMPAT_LINUX in the -# config as well. The other option is to load both as modules. device tdfx # Enable 3Dfx Voodoo support -#XXX#device tdfx_linux # Enable Linuxulator support # # ACPI support using the Intel ACPI Component Architecture reference @@ -630,20 +627,6 @@ options COMPAT_CLOUDABI32 # Enable 64-bit runtime support for CloudABI binaries. options COMPAT_CLOUDABI64 -# Enable Linux ABI emulation -#XXX#options COMPAT_LINUX - -# Enable 32-bit Linux ABI emulation (requires COMPAT_FREEBSD32). -options COMPAT_LINUX32 - -# Enable the linux-like proc filesystem support (requires COMPAT_LINUX32 -# and PSEUDOFS) -options LINPROCFS - -#Enable the linux-like sys filesystem support (requires COMPAT_LINUX32 -# and PSEUDOFS) -options LINSYSFS - ##################################################################### # ZFS support diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 1cf7f85fd11f..d7972c4a7e7a 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1321,8 +1321,8 @@ envvar hint.sa.1.target="6" # The pt driver drives SCSI Processor devices. # # The sg driver provides a passthrough API that is compatible with the -# Linux SG driver. It will work in conjunction with the COMPAT_LINUX -# option to run linux SG apps. It can also stand on its own and provide +# Linux SG driver. It will work in conjunction with the Linuxulator +# to run linux SG apps. It can also stand on its own and provide # source level API compatibility for porting apps to FreeBSD. # # Target Mode support is provided here but also requires that a SIM diff --git a/sys/conf/files b/sys/conf/files index 2b37d7f4e83e..ef58ba895d2b 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -786,12 +786,10 @@ dev/aac/aac.c optional aac dev/aac/aac_cam.c optional aacp aac dev/aac/aac_debug.c optional aac dev/aac/aac_disk.c optional aac -dev/aac/aac_linux.c optional aac compat_linux dev/aac/aac_pci.c optional aac pci dev/aacraid/aacraid.c optional aacraid dev/aacraid/aacraid_cam.c optional aacraid scbus dev/aacraid/aacraid_debug.c optional aacraid -dev/aacraid/aacraid_linux.c optional aacraid compat_linux dev/aacraid/aacraid_pci.c optional aacraid pci dev/acpi_support/acpi_wmi.c optional acpi_wmi acpi dev/acpi_support/acpi_asus.c optional acpi_asus acpi @@ -914,7 +912,6 @@ dev/amdsmb/amdsmb.c optional amdsmb pci dev/amr/amr.c optional amr dev/amr/amr_cam.c optional amrp amr dev/amr/amr_disk.c optional amr -dev/amr/amr_linux.c optional amr compat_linux dev/amr/amr_pci.c optional amr pci # dev/ata/ata_if.m optional ata | atacore @@ -2419,7 +2416,6 @@ dev/mfi/mfi_pci.c optional mfi pci dev/mfi/mfi_disk.c optional mfi dev/mfi/mfi_syspd.c optional mfi dev/mfi/mfi_tbolt.c optional mfi -dev/mfi/mfi_linux.c optional mfi compat_linux dev/mfi/mfi_cam.c optional mfip scbus dev/mii/acphy.c optional miibus | acphy dev/mii/amphy.c optional miibus | amphy @@ -3219,7 +3215,6 @@ dev/syscons/syscons.c optional sc dev/syscons/sysmouse.c optional sc dev/syscons/warp/warp_saver.c optional warp_saver dev/tcp_log/tcp_log_dev.c optional tcp_blackbox inet | tcp_blackbox inet6 -dev/tdfx/tdfx_linux.c optional tdfx_linux tdfx compat_linux dev/tdfx/tdfx_pci.c optional tdfx pci dev/ti/if_ti.c optional ti pci dev/twa/tw_cl_init.c optional twa \ diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 1dd3a51a3af3..0a2e0f1d9f72 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -36,30 +36,6 @@ cloudabi64_vdso_blob.o optional compat_cloudabi64 \ no-implicit-rule \ clean "cloudabi64_vdso_blob.o" # -linux32_genassym.o optional compat_linux32 \ - dependency "$S/amd64/linux32/linux32_genassym.c offset.inc" \ - compile-with "${CC} ${CFLAGS:N-flto:N-fno-common} -fcommon -c ${.IMPSRC}" \ - no-obj no-implicit-rule \ - clean "linux32_genassym.o" -# -linux32_assym.h optional compat_linux32 \ - dependency "$S/kern/genassym.sh linux32_genassym.o" \ - compile-with "sh $S/kern/genassym.sh linux32_genassym.o > ${.TARGET}" \ - no-obj no-implicit-rule before-depend \ - clean "linux32_assym.h" -# -linux32_locore.o optional compat_linux32 \ - dependency "linux32_assym.h $S/amd64/linux32/linux32_locore.asm" \ - compile-with "${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S ${WERROR} -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ - no-obj no-implicit-rule \ - clean "linux32_locore.o" -# -linux32_vdso.so optional compat_linux32 \ - dependency "linux32_locore.o" \ - compile-with "${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd --binary-architecture i386 linux32_locore.o ${.TARGET}" \ - no-implicit-rule \ - clean "linux32_vdso.so" -# ia32_genassym.o standard \ dependency "$S/compat/ia32/ia32_genassym.c offset.inc" \ compile-with "${CC} ${CFLAGS:N-flto:N-fno-common} -fcommon -c ${.IMPSRC}" \ @@ -401,44 +377,6 @@ amd64/ia32/ia32_sigtramp.S optional compat_freebsd32 amd64/ia32/ia32_syscall.c optional compat_freebsd32 amd64/ia32/ia32_misc.c optional compat_freebsd32 compat/ia32/ia32_sysvec.c optional compat_freebsd32 -compat/linprocfs/linprocfs.c optional linprocfs -compat/linsysfs/linsysfs.c optional linsysfs -# -# Linux/i386 binary support -# -amd64/linux32/linux32_dummy_machdep.c optional compat_linux32 -amd64/linux32/linux32_machdep.c optional compat_linux32 -amd64/linux32/linux32_support.s optional compat_linux32 \ - dependency "linux32_assym.h" -amd64/linux32/linux32_sysent.c optional compat_linux32 -amd64/linux32/linux32_sysvec.c optional compat_linux32 -compat/linux/linux_dummy.c optional compat_linux32 -compat/linux/linux_emul.c optional compat_linux32 -compat/linux/linux_errno.c optional compat_linux32 -compat/linux/linux_file.c optional compat_linux32 -compat/linux/linux_fork.c optional compat_linux32 -compat/linux/linux_futex.c optional compat_linux32 -compat/linux/linux_getcwd.c optional compat_linux32 -compat/linux/linux_ioctl.c optional compat_linux32 -compat/linux/linux_ipc.c optional compat_linux32 -compat/linux/linux_mib.c optional compat_linux32 -compat/linux/linux_misc.c optional compat_linux32 -compat/linux/linux_mmap.c optional compat_linux32 -compat/linux/linux_signal.c optional compat_linux32 -compat/linux/linux_socket.c optional compat_linux32 -compat/linux/linux_stats.c optional compat_linux32 -compat/linux/linux_sysctl.c optional compat_linux32 -compat/linux/linux_time.c optional compat_linux32 -compat/linux/linux_timer.c optional compat_linux32 -compat/linux/linux_uid16.c optional compat_linux32 -compat/linux/linux_util.c optional compat_linux32 -compat/linux/linux_vdso.c optional compat_linux32 -compat/linux/linux_common.c optional compat_linux32 -compat/linux/linux_event.c optional compat_linux32 -compat/linux/linux.c optional compat_linux32 -x86/linux/linux_dummy_x86.c optional compat_linux32 -dev/amr/amr_linux.c optional compat_linux32 amr -dev/mfi/mfi_linux.c optional compat_linux32 mfi # # x86 real mode BIOS emulator, required by dpms/pci/vesa # diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 10e286dae271..d0148f280903 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -22,59 +22,9 @@ cloudabi32_vdso_blob.o optional compat_cloudabi32 \ compile-with "${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd --binary-architecture i386 cloudabi32_vdso.o ${.TARGET}" \ no-implicit-rule \ clean "cloudabi32_vdso_blob.o" -# -linux_genassym.o optional compat_linux \ - dependency "$S/i386/linux/linux_genassym.c offset.inc" \ - compile-with "${CC} ${CFLAGS:N-flto:N-fno-common} -fcommon -c ${.IMPSRC}" \ - no-obj no-implicit-rule \ - clean "linux_genassym.o" -# -linux_assym.h optional compat_linux \ - dependency "$S/kern/genassym.sh linux_genassym.o" \ - compile-with "sh $S/kern/genassym.sh linux_genassym.o > ${.TARGET}" \ - no-obj no-implicit-rule before-depend \ - clean "linux_assym.h" -# -linux_locore.o optional compat_linux \ - dependency "linux_assym.h $S/i386/linux/linux_locore.asm" \ - compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S ${WERROR} -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ - no-obj no-implicit-rule \ - clean "linux_locore.o" -# -linux_vdso.so optional compat_linux \ - dependency "linux_locore.o" \ - compile-with "${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd --binary-architecture i386 linux_locore.o ${.TARGET}" \ - no-implicit-rule \ - clean "linux_vdso.so" -# cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S optional zfs | dtrace compile-with "${ZFS_S}" cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" -compat/linprocfs/linprocfs.c optional linprocfs -compat/linsysfs/linsysfs.c optional linsysfs -compat/linux/linux_dummy.c optional compat_linux -compat/linux/linux_event.c optional compat_linux -compat/linux/linux_emul.c optional compat_linux -compat/linux/linux_errno.c optional compat_linux -compat/linux/linux_file.c optional compat_linux -compat/linux/linux_fork.c optional compat_linux -compat/linux/linux_futex.c optional compat_linux -compat/linux/linux_getcwd.c optional compat_linux -compat/linux/linux_ioctl.c optional compat_linux -compat/linux/linux_ipc.c optional compat_linux -compat/linux/linux_mib.c optional compat_linux -compat/linux/linux_misc.c optional compat_linux -compat/linux/linux_mmap.c optional compat_linux -compat/linux/linux_signal.c optional compat_linux -compat/linux/linux_socket.c optional compat_linux -compat/linux/linux_stats.c optional compat_linux -compat/linux/linux_sysctl.c optional compat_linux -compat/linux/linux_time.c optional compat_linux -compat/linux/linux_timer.c optional compat_linux -compat/linux/linux_uid16.c optional compat_linux -compat/linux/linux_util.c optional compat_linux -compat/linux/linux_vdso.c optional compat_linux -compat/linux/linux.c optional compat_linux crypto/aesni/aeskeys_i386.S optional aesni crypto/des/arch/i386/des_enc.S optional netsmb crypto/openssl/i386/chacha-x86.S optional ossl @@ -198,13 +148,6 @@ i386/i386/trap.c standard i386/i386/uio_machdep.c standard i386/i386/vm86.c standard i386/i386/vm_machdep.c standard -i386/linux/imgact_linux.c optional compat_linux -i386/linux/linux_copyout.c optional compat_linux -i386/linux/linux_dummy_machdep.c optional compat_linux -i386/linux/linux_machdep.c optional compat_linux -i386/linux/linux_ptrace.c optional compat_linux -i386/linux/linux_sysent.c optional compat_linux -i386/linux/linux_sysvec.c optional compat_linux i386/pci/pci_cfgreg.c optional pci i386/pci/pci_pir.c optional pci isa/syscons_isa.c optional sc @@ -235,7 +178,6 @@ x86/isa/atpic.c optional atpic x86/isa/elcr.c optional atpic | apic x86/isa/isa.c optional isa x86/isa/isa_dma.c optional isa -x86/linux/linux_dummy_x86.c optional compat_linux x86/x86/io_apic.c optional apic x86/x86/local_apic.c optional apic x86/x86/mptable.c optional apic diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index b8d1e5a17048..2e30e33b4c48 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -153,7 +153,6 @@ dev/ipmi/ipmi_smbus.c optional ipmi smbus dev/ipmi/ipmi_smbios.c optional ipmi dev/ipmi/ipmi_ssif.c optional ipmi smbus dev/ipmi/ipmi_pci.c optional ipmi pci -dev/ipmi/ipmi_linux.c optional ipmi compat_linux32 dev/isci/isci.c optional isci dev/isci/isci_controller.c optional isci dev/isci/isci_domain.c optional isci diff --git a/sys/conf/options.amd64 b/sys/conf/options.amd64 index 608bcd117e2f..bc809553f841 100644 --- a/sys/conf/options.amd64 +++ b/sys/conf/options.amd64 @@ -18,7 +18,7 @@ PV_STATS opt_pmap.h COMPAT_AOUT opt_dontuse.h COMPAT_FREEBSD32 opt_global.h #COMPAT_LINUX opt_dontuse.h -COMPAT_LINUX32 opt_compat.h +COMPAT_LINUX32 opt_dontuse.h LINPROCFS opt_dontuse.h LINSYSFS opt_dontuse.h diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index e02426df2df2..21bdbd668f61 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -429,11 +429,9 @@ device s3pci # linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as # the tdfx DRI module from XFree86 and is completely unrelated. # -# To enable Linuxulator support, one must also include COMPAT_LINUX in the -# config as well. The other option is to load both as modules. +# To enable Linuxulator support, one must also load linux.ko and tdfx_linux.ko. device tdfx # Enable 3Dfx Voodoo support -device tdfx_linux # Enable Linuxulator support options IOMMU # Enable IOMMU support @@ -873,18 +871,6 @@ options COMPAT_AOUT # Enable 32-bit runtime support for CloudABI binaries. options COMPAT_CLOUDABI32 -# Enable Linux ABI emulation -options COMPAT_LINUX - -# Enable the linux-like proc filesystem support (requires COMPAT_LINUX -# and PSEUDOFS) -options LINPROCFS - -#Enable the linux-like sys filesystem support (requires COMPAT_LINUX -# and PSEUDOFS) -options LINSYSFS - - ##################################################################### # VM OPTIONS From owner-dev-commits-src-main@freebsd.org Mon Jun 21 17:00: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 52DD064BEBD; Mon, 21 Jun 2021 17:00:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7wkw1ls1z4RQY; Mon, 21 Jun 2021 17:00:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24A0120AAF; Mon, 21 Jun 2021 17:00: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 15LH0OUT068603; Mon, 21 Jun 2021 17:00:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LH0O9t068602; Mon, 21 Jun 2021 17:00:24 GMT (envelope-from git) Date: Mon, 21 Jun 2021 17:00:24 GMT Message-Id: <202106211700.15LH0O9t068602@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: c1da89fec254 - main - linux(4): Retire linux_kplatform. 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: c1da89fec254f9d079fc17a186e2665a32cc718d 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, 21 Jun 2021 17:00:24 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=c1da89fec254f9d079fc17a186e2665a32cc718d commit c1da89fec254f9d079fc17a186e2665a32cc718d Author: Dmitry Chagin AuthorDate: 2021-06-22 05:36:21 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-22 05:36:21 +0000 linux(4): Retire linux_kplatform. Assuming we can't run on i486, i586 class cpu, retire linux_kplatform var and use hardcoded 'machine' value in linux_newuname(). I have added linux_kplatform for consistency with linux_platform which is placed in to vdso to avoid excess copyout it on stack for AT_PLATFORM at exec time. This is the first stage of Linuxulator's vdso revision. Reviewed by: trasz, imp Differential Revision: https://reviews.freebsd.org/D30774 MFC after: 2 weeks --- sys/amd64/linux/linux_sysvec.c | 4 ---- sys/amd64/linux32/linux32_sysvec.c | 4 ---- sys/arm64/linux/linux_sysvec.c | 4 ---- sys/compat/linux/linux_misc.c | 6 ++++-- sys/compat/linux/linux_misc.h | 2 -- sys/i386/linux/linux_locore.asm | 8 ++++++++ sys/i386/linux/linux_sysvec.c | 37 ++----------------------------------- 7 files changed, 14 insertions(+), 51 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index ff18950548a5..32db8399ad42 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -85,7 +85,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux64, 1); -const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; static char *linux_shared_page_mapping; @@ -791,9 +790,6 @@ linux_vdso_install(void *param) bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping, linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; - - linux_kplatform = linux_shared_page_mapping + - (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, linux_vdso_install, NULL); diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 4b492c110556..d534d52392b6 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -90,7 +90,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux, 1); -const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; static char *linux_shared_page_mapping; @@ -955,9 +954,6 @@ linux_vdso_install(void *param) bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping, linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; - - linux_kplatform = linux_shared_page_mapping + - (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, linux_vdso_install, NULL); diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 177f582ce11f..afcca9f7e948 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux64elf, 1); -const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; static char *linux_shared_page_mapping; @@ -467,9 +466,6 @@ linux_vdso_install(const void *param) memcpy(linux_shared_page_mapping, elf_linux_sysvec.sv_sigcode, linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; - - linux_kplatform = linux_shared_page_mapping + - (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, linux_vdso_install, NULL); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 1c1a8952bd79..65a5b0dd24d7 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -721,8 +721,10 @@ linux_newuname(struct thread *td, struct linux_newuname_args *args) * to remain "i686", though. */ strlcpy(utsname.machine, "x86_64", LINUX_MAX_UTSNAME); -#else - strlcpy(utsname.machine, linux_kplatform, LINUX_MAX_UTSNAME); +#elif defined(__aarch64__) + strlcpy(utsname.machine, "aarch64", LINUX_MAX_UTSNAME); +#elif defined(__i386__) + strlcpy(utsname.machine, "i686", LINUX_MAX_UTSNAME); #endif return (copyout(&utsname, args->buf, sizeof(utsname))); diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index bd8b2f3f63b4..dc17ed430014 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -74,8 +74,6 @@ #define LINUX_PATH_MAX 4096 -extern const char *linux_kplatform; - /* * Non-standard aux entry types used in Linux ELF binaries. */ diff --git a/sys/i386/linux/linux_locore.asm b/sys/i386/linux/linux_locore.asm index 1a521716cec6..8b4cc201574f 100644 --- a/sys/i386/linux/linux_locore.asm +++ b/sys/i386/linux/linux_locore.asm @@ -7,6 +7,14 @@ #include "assym.inc" + .data + + .globl linux_platform +linux_platform: + .asciz "i686" + + .text + /* * To avoid excess stack frame the signal trampoline code emulates * the 'call' instruction. diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index c94f0824edca..13ebadacf3e3 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -100,9 +100,6 @@ static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(void *param); static void linux_vdso_deinstall(void *param); -static int linux_szplatform; -const char *linux_kplatform; - #define LINUX_T_UNKNOWN 255 static int _bsd_to_linux_trapcode[] = { LINUX_T_UNKNOWN, /* 0 */ @@ -142,6 +139,7 @@ static int _bsd_to_linux_trapcode[] = { _bsd_to_linux_trapcode[(code)]: \ LINUX_T_UNKNOWN) +LINUX_VDSO_SYM_CHAR(linux_platform); LINUX_VDSO_SYM_INTPTR(linux_sigcode); LINUX_VDSO_SYM_INTPTR(linux_rt_sigcode); LINUX_VDSO_SYM_INTPTR(linux_vsyscall); @@ -192,14 +190,12 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) struct proc *p; Elf32_Auxargs *args; Elf32_Auxinfo *argarray, *pos; - Elf32_Addr *uplatform; struct ps_strings *arginfo; int error, issetugid; p = imgp->proc; issetugid = imgp->proc->p_flag & P_SUGID ? 1 : 0; arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; - uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szplatform); args = (Elf32_Auxargs *)imgp->auxargs; argarray = pos = malloc(LINUX_AT_COUNT * sizeof(*pos), M_TEMP, M_WAITOK | M_ZERO); @@ -231,7 +227,7 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); - AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(uplatform)); + AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary); if (imgp->execpathp != 0) AUXARGS_ENTRY_PTR(pos, LINUX_AT_EXECFN, imgp->execpathp); @@ -286,13 +282,6 @@ linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; destp = (uintptr_t)arginfo; - /* Install LINUX_PLATFORM. */ - destp -= linux_szplatform; - destp = rounddown2(destp, sizeof(void *)); - error = copyout(linux_kplatform, (void *)destp, linux_szplatform); - if (error != 0) - return (error); - if (execpath_len != 0) { destp -= execpath_len; destp = rounddown2(destp, sizeof(void *)); @@ -819,25 +808,6 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, pcb->pcb_initial_npxcw = __LINUX_NPXCW__; } -static void -linux_get_machine(const char **dst) -{ - - switch (cpu_class) { - case CPUCLASS_686: - *dst = "i686"; - break; - case CPUCLASS_586: - *dst = "i586"; - break; - case CPUCLASS_486: - *dst = "i486"; - break; - default: - *dst = "i386"; - } -} - struct sysentvec linux_sysvec = { .sv_size = LINUX_SYS_MAXSYSCALL, .sv_table = linux_sysent, @@ -1046,9 +1016,6 @@ linux_elf_modevent(module_t mod, int type, void *data) linux_ioctl_register_handler(*lihp); LIST_INIT(&futex_list); mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); - linux_get_machine(&linux_kplatform); - linux_szplatform = roundup(strlen(linux_kplatform) + 1, - sizeof(char *)); linux_dev_shm_create(); linux_osd_jail_register(); stclohz = (stathz ? stathz : hz); From owner-dev-commits-src-main@freebsd.org Mon Jun 21 17:05: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 C178464BEE7; Mon, 21 Jun 2021 17:05: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 4G7wrf4zSBz4RsY; Mon, 21 Jun 2021 17:05: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 8F490210B0; Mon, 21 Jun 2021 17:05: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 15LH5M1I073117; Mon, 21 Jun 2021 17:05:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LH5Maf073116; Mon, 21 Jun 2021 17:05:22 GMT (envelope-from git) Date: Mon, 21 Jun 2021 17:05:22 GMT Message-Id: <202106211705.15LH5Maf073116@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: bfe290379839 - main - linux(4): Do not specify shared page for aout binaries. 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: bfe29037983913f27eae9c5a6d31545ed89f4040 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, 21 Jun 2021 17:05:22 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=bfe29037983913f27eae9c5a6d31545ed89f4040 commit bfe29037983913f27eae9c5a6d31545ed89f4040 Author: Dmitry Chagin AuthorDate: 2021-06-22 05:38:45 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-22 05:38:45 +0000 linux(4): Do not specify shared page for aout binaries. In Linux vDSO is a small shared ELF library, so it is not intended for aout binaries. This was added on 64-bit Linuxulator import by mistake. MFC after: 2 weeks --- sys/i386/linux/linux_sysvec.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 13ebadacf3e3..9cc15bbfd5c3 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -834,8 +834,6 @@ struct sysentvec linux_sysvec = { .sv_set_syscall_retval = linux_set_syscall_retval, .sv_fetch_syscall_args = linux_fetch_syscall_args, .sv_syscallnames = NULL, - .sv_shared_page_base = LINUX_SHAREDPAGE, - .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = linux_schedtail, .sv_thread_detach = linux_thread_detach, .sv_trap = NULL, From owner-dev-commits-src-main@freebsd.org Mon Jun 21 17:05:23 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 D07D264C322; Mon, 21 Jun 2021 17:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7wrg5HLYz4S7t; Mon, 21 Jun 2021 17:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B70721071; Mon, 21 Jun 2021 17:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15LH5NNA073146; Mon, 21 Jun 2021 17:05:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LH5Ndq073145; Mon, 21 Jun 2021 17:05:23 GMT (envelope-from git) Date: Mon, 21 Jun 2021 17:05:23 GMT Message-Id: <202106211705.15LH5Ndq073145@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: 4efdf5820ef5 - main - linux(4): Retire a now unused include. 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: 4efdf5820ef573321b008c228b913d7e48841f59 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, 21 Jun 2021 17:05:24 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=4efdf5820ef573321b008c228b913d7e48841f59 commit 4efdf5820ef573321b008c228b913d7e48841f59 Author: Dmitry Chagin AuthorDate: 2021-06-22 05:39:47 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-22 05:39:47 +0000 linux(4): Retire a now unused include. MFC after: 2 weeks --- sys/i386/linux/linux.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 8dff1313c598..bab89cb5a43a 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -31,7 +31,6 @@ #define _I386_LINUX_H_ #include -#include /* for sigval union */ #include #include From owner-dev-commits-src-main@freebsd.org Mon Jun 21 17:05: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 171A264C323; Mon, 21 Jun 2021 17:05:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7wrj00Ksz4Rsk; Mon, 21 Jun 2021 17:05:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C050620E3B; Mon, 21 Jun 2021 17:05: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 15LH5OQU073170; Mon, 21 Jun 2021 17:05:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LH5Ov1073169; Mon, 21 Jun 2021 17:05:24 GMT (envelope-from git) Date: Mon, 21 Jun 2021 17:05:24 GMT Message-Id: <202106211705.15LH5Ov1073169@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: 79617645c6d3 - main - linux(4): Retire unused declaration. 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: 79617645c6d3dc7ac2d5af658a99cbf142646e69 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, 21 Jun 2021 17:05:25 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=79617645c6d3dc7ac2d5af658a99cbf142646e69 commit 79617645c6d3dc7ac2d5af658a99cbf142646e69 Author: Dmitry Chagin AuthorDate: 2021-06-22 05:41:33 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-22 05:41:33 +0000 linux(4): Retire unused declaration. MFC after: 2 weeks --- sys/i386/linux/linux_machdep.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index d2d713d4776d..45474991475b 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -76,8 +76,6 @@ __FBSDID("$FreeBSD$"); #include "opt_posix.h" -extern struct sysentvec elf32_freebsd_sysvec; /* defined in i386/i386/elf_machdep.c */ - struct l_descriptor { l_uint entry_number; l_ulong base_addr; From owner-dev-commits-src-main@freebsd.org Mon Jun 21 17:28: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 90A7164CB0B for ; Mon, 21 Jun 2021 17:28:34 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (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 4G7xMQ2wqbz4SpR for ; Mon, 21 Jun 2021 17:28:34 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x82d.google.com with SMTP id 17so1124616qtt.6 for ; Mon, 21 Jun 2021 10:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=N0bDf2URgE+4kagoENbnek4W/jOZnnOZI/5Byi7bY6k=; b=TTdJWaUPJgmUx3Ozx7o9EtdA0cJPccrqlUi5kjEi9LQMPTqv7mtBmnOn2aw7k0yaEj YE6CFQnNTBmmNsr965pCgYZIIiI+Cn7Qq3ys0WF9OzGwjW6QZNv17iZbrHknIcSZeGB5 5+84jYw78d2AnYyglntNnd7Wb2W9BGx1e7OCEg47tVD51gVpkdz00FhdPsfkEGoCAl1t r3+3CIjkBXPtHyaCCF4bXuqRxkOMxefP67KnDnXvjuWcfyzgd9YliEiw7DMeu8rI230e btt0vS3jPr6rTkebL0eDcUJVj/L/gz7jlMqKfKHTJPNa571PZLQ468a3vLbkO5ZIfiJ+ NpdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=N0bDf2URgE+4kagoENbnek4W/jOZnnOZI/5Byi7bY6k=; b=XK6tO4MQpx/sd41kgUyHMW+HDEQ3uzeG86pMqw3KhdTf+rTh1HmRkjwTqGPnskGnSN x784nFIX8d8eeIai5o4Yi55O9pm7dAQ6ptsqwvRcgPj8Za4pRogzTLPng6szv/8L/XEw ByzoDgF7gezp+/299sUjFz0Z5EhEmV1kY5rJO6D88HofF9G6tlLXVwD2P/iW8hSPCAAO 7C8dmirkqg7m/k+H5+pLs/Pdl3atBkV+PCmrc90l8N+NUwqYh5J1Rs4PoPMlVsyBKa+n o0xaBM/sQcmMAb0kurt1lXci04DVk4z015dr57IfydRjWFiboDIXOsVy6P0wt4DW5451 13ug== X-Gm-Message-State: AOAM530+R2Wyv5UhTzg4qwoG5/WK1VWeDACvnrOQ1EAz59sSYbJsPX3H EqLNNvLzsdBZeTHZdGKKYE4Ezg== X-Google-Smtp-Source: ABdhPJxxohwNGpzoDxnO7DfzMQCKfhs0VziOnct45lN7YlCCQDwrXOSIbEDMmY2mKUOkt/yJPpaptQ== X-Received: by 2002:ac8:b02:: with SMTP id e2mr24218745qti.159.1624296513177; Mon, 21 Jun 2021 10:28:33 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id q207sm5140280qke.72.2021.06.21.10.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 10:28:32 -0700 (PDT) Date: Mon, 21 Jun 2021 13:28:32 -0400 From: Shawn Webb To: Dmitry Chagin Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: bfe290379839 - main - linux(4): Do not specify shared page for aout binaries. Message-ID: <20210621172832.yajjiglk7odlb7fq@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202106211705.15LH5Maf073116@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="s3ociuwrdxmmt3rw" Content-Disposition: inline In-Reply-To: <202106211705.15LH5Maf073116@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4G7xMQ2wqbz4SpR 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, 21 Jun 2021 17:28:34 -0000 --s3ociuwrdxmmt3rw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 21, 2021 at 05:05:22PM +0000, Dmitry Chagin wrote: > The branch main has been updated by dchagin: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dbfe29037983913f27eae9c5a6d= 31545ed89f4040 >=20 > commit bfe29037983913f27eae9c5a6d31545ed89f4040 > Author: Dmitry Chagin > AuthorDate: 2021-06-22 05:38:45 +0000 > Commit: Dmitry Chagin > CommitDate: 2021-06-22 05:38:45 +0000 >=20 > linux(4): Do not specify shared page for aout binaries. > =20 > In Linux vDSO is a small shared ELF library, so it is not intended > for aout binaries. This was added on 64-bit Linuxulator import by mis= take. Are there even any FreeBSD users running Linux aout binaries on FreeBSD? I'm wondering if Linux aout support can be ripped out entirely. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --s3ociuwrdxmmt3rw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmDQzD0ACgkQ/y5nonf4 4fpAyA//XygHZQ8m/60v/dsHYz8qvXVL247VKaXxBJHRQrbHfuVLgBr4v/WXmSXz aHS+aGIU3yTHzvWr1MFwf5sJc5eZVW2t05tQzfWvhu3i9j2KJ5FoXEQ9kdzI0Vvi 86GPTovhqW8UeM4b5VdTVW17E3S1ulyxeVd3nlBNODCGyUMMxwki8BxW3ZcuqET0 xuT6OghXiuUF9Ip/xZs2flf325ErNm46Kbyi6JNTJlLnJW9xyRYcTH3RJE7DQPZT hud9PIki7eSEiJ4XxrI5i7c0p9xRVsVcNacSvqO1UyINe9KgtTo/4Z5wZjQvC7VD 2/V010sGDxAa4QsGd7rfw6lvIXmVOM76OGpWXjRzP+qXDv3pcHmuywq/ZnHdjIu1 46nGw+pBSqdQMmXF7C6aNFmSIe5uUoQNYm+okKzfkvZqdPhCzI/2dtLgAEYIgISD CDtce9iwvSuetbNVdWqLMcztdGAiYabw3tVbhRt18x31iL/27KAi5O0HgNQJk0Mn lf2FHy8yGWN6lhhYCQpxYr3pExTPCIqR+dZFGNX0JqIbIAaJRx6Y3bHA5E5W6u1w aDIRJN0DUlvmZzJjB6DMTe3cej8gyNMrLC0Aeg3//1MflmGRZ9q52fxUvnIJHQ4n odb+qImAZSwnbGoyNCZ5LmzX/DCP0qXxrXerDhN4+QO/sLvO5VE= =Of3r -----END PGP SIGNATURE----- --s3ociuwrdxmmt3rw-- From owner-dev-commits-src-main@freebsd.org Mon Jun 21 18:10: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 EA17264CDD0; Mon, 21 Jun 2021 18:10: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 4G7yHy64btz4XWv; Mon, 21 Jun 2021 18:10: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 B8DD321BB9; Mon, 21 Jun 2021 18:10: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 15LIAcFd063144; Mon, 21 Jun 2021 18:10:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LIAc1x063143; Mon, 21 Jun 2021 18:10:38 GMT (envelope-from git) Date: Mon, 21 Jun 2021 18:10:38 GMT Message-Id: <202106211810.15LIAc1x063143@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: 9c2c6353193b - main - aacraid: reduce max I/O size to avoid DMA issues 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: 9c2c6353193b53deb337777c2a06a2648b364f8b 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, 21 Jun 2021 18:10:39 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=9c2c6353193b53deb337777c2a06a2648b364f8b commit 9c2c6353193b53deb337777c2a06a2648b364f8b Author: Leandro Lupori AuthorDate: 2021-06-21 18:04:43 +0000 Commit: Leandro Lupori CommitDate: 2021-06-21 18:04:43 +0000 aacraid: reduce max I/O size to avoid DMA issues Reserve one page for the DMA subsystem, that may need it when the I/O buffer is not page aligned. Without this change, writes with the maximum allowed size failed, if: - physical memory was fragmented, making it necessary to use one DMA segment for each page - the buffer to be written was not page aligned, causing the DMA subsystem to need one extra segment In the scenario above, the DMA subsystem would run out of segments, resulting in a write with no SG segments, that would fail. Reviewed by: imp MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D30798 --- sys/dev/aacraid/aacraid.c | 4 ++-- sys/dev/aacraid/aacraid_cam.c | 2 +- sys/dev/aacraid/aacraid_var.h | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/dev/aacraid/aacraid.c b/sys/dev/aacraid/aacraid.c index 65c585269b78..51a633e70515 100644 --- a/sys/dev/aacraid/aacraid.c +++ b/sys/dev/aacraid/aacraid.c @@ -579,7 +579,7 @@ aac_alloc(struct aac_softc *sc) BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - sc->aac_max_sectors << 9, /* maxsize */ + AAC_MAXIO_SIZE(sc), /* maxsize */ sc->aac_sg_tablesize, /* nsegments */ BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ BUS_DMA_ALLOCNOW, /* flags */ @@ -1807,7 +1807,7 @@ aac_init(struct aac_softc *sc) } ip->MaxIoCommands = sc->aac_max_fibs; - ip->MaxIoSize = sc->aac_max_sectors << 9; + ip->MaxIoSize = AAC_MAXIO_SIZE(sc); ip->MaxFibSize = sc->aac_max_fib_size; aac_adapter_init_tole(ip); diff --git a/sys/dev/aacraid/aacraid_cam.c b/sys/dev/aacraid/aacraid_cam.c index 48da7e8d757f..9c73248472bd 100644 --- a/sys/dev/aacraid/aacraid_cam.c +++ b/sys/dev/aacraid/aacraid_cam.c @@ -1011,7 +1011,7 @@ aac_cam_action(struct cam_sim *sim, union ccb *ccb) cpi->max_lun = 7; /* Per the controller spec */ cpi->initiator_id = camsc->inf->InitiatorBusId; cpi->bus_id = camsc->inf->BusNumber; - cpi->maxio = sc->aac_max_sectors << 9; + cpi->maxio = AAC_MAXIO_SIZE(sc); /* * Resetting via the passthrough or parallel bus scan diff --git a/sys/dev/aacraid/aacraid_var.h b/sys/dev/aacraid/aacraid_var.h index 4fed21b1356b..bbafdafb8840 100644 --- a/sys/dev/aacraid/aacraid_var.h +++ b/sys/dev/aacraid/aacraid_var.h @@ -470,6 +470,14 @@ struct aac_softc u_int32_t FwDebugBufferSize; /* FW Debug Buffer size */ }; +/* + * Max. I/O size in bytes. + * Reserve one page for the DMA subsystem, that may need it when the + * I/O buffer is not page aligned. + */ +#define AAC_MAXIO_SIZE(sc) MIN(((sc)->aac_max_sectors << 9) - PAGE_SIZE, \ + maxphys) + /* * Event callback mechanism for the driver */ From owner-dev-commits-src-main@freebsd.org Mon Jun 21 18:16: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 3DAFB64D34B; Mon, 21 Jun 2021 18:16: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 4G7yQS1DM2z4Yl9; Mon, 21 Jun 2021 18:16: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 128B421CAE; Mon, 21 Jun 2021 18:16: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 15LIGGMr067742; Mon, 21 Jun 2021 18:16:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LIGGAJ067741; Mon, 21 Jun 2021 18:16:16 GMT (envelope-from git) Date: Mon, 21 Jun 2021 18:16:16 GMT Message-Id: <202106211816.15LIGGAJ067741@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: 71fd1bfd5ed5 - main - aacraid: ignore data overrun on INQUIRY 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: 71fd1bfd5ed5fdc316600a0b425d81844c021e9b 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, 21 Jun 2021 18:16:16 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=71fd1bfd5ed5fdc316600a0b425d81844c021e9b commit 71fd1bfd5ed5fdc316600a0b425d81844c021e9b Author: Leandro Lupori AuthorDate: 2021-06-21 18:13:13 +0000 Commit: Leandro Lupori CommitDate: 2021-06-21 18:13:13 +0000 aacraid: ignore data overrun on INQUIRY The INQUIRY command may return a CAM_DATA_RUN_ERR code, even when it succeeds. This happens during driver startup, causing the current and further inquiries to be aborted, resulting in some missing information about the controller. Reviewed by: imp Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D30843 --- sys/dev/aacraid/aacraid_cam.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/dev/aacraid/aacraid_cam.c b/sys/dev/aacraid/aacraid_cam.c index 9c73248472bd..a44833863891 100644 --- a/sys/dev/aacraid/aacraid_cam.c +++ b/sys/dev/aacraid/aacraid_cam.c @@ -1205,6 +1205,12 @@ aac_cam_complete(struct aac_command *cm) command = ccb->csio.cdb_io.cdb_bytes[0]; if (command == INQUIRY) { + /* Ignore Data Overrun errors on INQUIRY */ + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == + CAM_DATA_RUN_ERR) + ccb->ccb_h.status = (ccb->ccb_h.status & + ~CAM_STATUS_MASK) | CAM_REQ_CMP; + if (ccb->ccb_h.status == CAM_REQ_CMP) { device = ccb->csio.data_ptr[0] & 0x1f; /* From owner-dev-commits-src-main@freebsd.org Mon Jun 21 18:50: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 9116164D8E8; Mon, 21 Jun 2021 18:50:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7zBH3GYGz4cJT; Mon, 21 Jun 2021 18:50:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 590F222704; Mon, 21 Jun 2021 18:50:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15LIol4U019420; Mon, 21 Jun 2021 18:50:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LIoljQ019419; Mon, 21 Jun 2021 18:50:47 GMT (envelope-from git) Date: Mon, 21 Jun 2021 18:50:47 GMT Message-Id: <202106211850.15LIoljQ019419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: e7e517981a65 - main - Fix clang assertion while building recent www/chromium MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e7e517981a6591c79fb49cd8810361b0f3ad5983 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, 21 Jun 2021 18:50:47 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=e7e517981a6591c79fb49cd8810361b0f3ad5983 commit e7e517981a6591c79fb49cd8810361b0f3ad5983 Author: Dimitry Andric AuthorDate: 2021-06-21 18:46:34 +0000 Commit: Dimitry Andric CommitDate: 2021-06-21 18:48:37 +0000 Fix clang assertion while building recent www/chromium Merge commit c8227f06b335 from llvm git (by Arthur Eubanks): [clang] Don't assert in EmitAggregateCopy on trivial_abi types Fixes PR42961. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D97872 PR: 256721, 255570 Reported by: jbeich MFC after: 3 days --- contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp index 60ea1b2af037..f3ab91559d30 100644 --- a/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp +++ b/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp @@ -2056,7 +2056,7 @@ void CodeGenFunction::EmitAggregateCopy(LValue Dest, LValue Src, QualType Ty, Record->hasTrivialCopyAssignment() || Record->hasTrivialMoveConstructor() || Record->hasTrivialMoveAssignment() || - Record->isUnion()) && + Record->hasAttr() || Record->isUnion()) && "Trying to aggregate-copy a type without a trivial copy/move " "constructor or assignment operator"); // Ignore empty classes in C++. From owner-dev-commits-src-main@freebsd.org Mon Jun 21 19:56: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 3AF7164ED83; Mon, 21 Jun 2021 19:56: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 4G80dk12wNz4j3D; Mon, 21 Jun 2021 19:56: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 0954322E7E; Mon, 21 Jun 2021 19:56: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 15LJu9eA001110; Mon, 21 Jun 2021 19:56:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LJu99S001109; Mon, 21 Jun 2021 19:56:09 GMT (envelope-from git) Date: Mon, 21 Jun 2021 19:56:09 GMT Message-Id: <202106211956.15LJu99S001109@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: bf7b542e0216 - main - sdhci_fdt: Add gpio_if.h to the source 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: bf7b542e0216e6bd3bcd5ff46e376643d41f4f9f 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, 21 Jun 2021 19:56:10 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=bf7b542e0216e6bd3bcd5ff46e376643d41f4f9f commit bf7b542e0216e6bd3bcd5ff46e376643d41f4f9f Author: Emmanuel Vadot AuthorDate: 2021-06-21 19:55:03 +0000 Commit: Emmanuel Vadot CommitDate: 2021-06-21 19:55:03 +0000 sdhci_fdt: Add gpio_if.h to the source Otherwise if we compile a kernel without gpio support this file isn't compiled. Also it's needed so it's good to list all deps. PR: 256756 --- sys/modules/sdhci_fdt/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/sdhci_fdt/Makefile b/sys/modules/sdhci_fdt/Makefile index cc8c8b44f2e6..12b4af37f6e5 100644 --- a/sys/modules/sdhci_fdt/Makefile +++ b/sys/modules/sdhci_fdt/Makefile @@ -3,6 +3,6 @@ .PATH: ${SRCTOP}/sys/dev/sdhci KMOD= sdhci_fdt -SRCS= sdhci_fdt.c sdhci_fdt_gpio.c sdhci_if.h device_if.h bus_if.h mmcbr_if.h opt_mmccam.h opt_cam.h +SRCS= sdhci_fdt.c sdhci_fdt_gpio.c sdhci_if.h device_if.h bus_if.h mmcbr_if.h opt_mmccam.h opt_cam.h gpio_if.h .include From owner-dev-commits-src-main@freebsd.org Mon Jun 21 21:56: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 9C99D64FCEE for ; Mon, 21 Jun 2021 21:56:40 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 4G83Jm3kz2z4qGK for ; Mon, 21 Jun 2021 21:56:40 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f46.google.com with SMTP id a11so21286443wrt.13 for ; Mon, 21 Jun 2021 14:56:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=0UMvfdrBD4yTusOpDWh/y8Xp6bHFlxCqHpTDUdceDtY=; b=PXy3Eo186wvis6Az/9uGYJvLBlktDWVxebkI/p73ii3aPwm1nsRmDJA1bzwkOJXQph enpRN5BOJ0x/FwfOD9v8Ku4ZUWT/ljLmbp+GvDUxGXHYMMuklbzviCWBMDPqWXw3JYp8 53HdfUrqtrl8opBYsMa/9pMQa1ZKcwk9vxYoGKbdNy7y95fuQFAR/p+5Y+a7qPe1sKZG aycHz2uJfnv03N+qz1i9Ve0bTT23GAqfZDvEsIxVjKVJM7zOkJV35CGvp7sxfEDJdMSE sXK9Av1GCgL9e5An8p8wxue4mfonHVCHIFb3RoQRT0IISgiH6JTo99k5WtKaax21d+pR i70w== X-Gm-Message-State: AOAM533KvnqqY2kW8fWf4li3tuZj/hthpl8hP3El7JxSBaK1tCuyqYh4 s0Oa9Ob9ItxgaWiZm6IKGXZswA== X-Google-Smtp-Source: ABdhPJynC1RjLR2Y7cxzumbERNKEWa9KL/WXPWgMXt+FUqgN80O0QMu5FCKkyz29H4d4RG3dKI2D0g== X-Received: by 2002:a5d:6708:: with SMTP id o8mr661521wru.9.1624312599101; Mon, 21 Jun 2021 14:56:39 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id p15sm225985wmq.43.2021.06.21.14.56.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Jun 2021 14:56:38 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: e013e36939ac - main - linux(4): Get rid of Linuxulator kernel build options. From: Jessica Clarke In-Reply-To: <202106211656.15LGuXQU059224@gitrepo.freebsd.org> Date: Mon, 21 Jun 2021 22:56:38 +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: References: <202106211656.15LGuXQU059224@gitrepo.freebsd.org> To: Dmitry Chagin X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4G83Jm3kz2z4qGK 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, 21 Jun 2021 21:56:40 -0000 On 21 Jun 2021, at 17:56, Dmitry Chagin wrote: >=20 > The branch main has been updated by dchagin: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3De013e36939ac87b53195370fb5e29f29= c1a4b5c6 >=20 > commit e013e36939ac87b53195370fb5e29f29c1a4b5c6 > Author: Dmitry Chagin > AuthorDate: 2021-06-22 05:32:39 +0000 > Commit: Dmitry Chagin > CommitDate: 2021-06-22 05:32:39 +0000 >=20 > linux(4): Get rid of Linuxulator kernel build options. >=20 > Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 = kernel > build options. Since we have 32 and 64 bit Linux emulators, we = can't build both > emulators together into the kernel. I don't think it matters, Linux = emulation > depends on loadable modules (via rc). >=20 > Cut LINPROCFS and LINSYSFS for consistency. I don=E2=80=99t see why these two should be deleted? They currently = build fine, and GNU/kFreeBSD kernels enable them. They might work as modules, but I would worry that too many parts of userland would try and read them before /etc/init.d/kldutils (the init script that loads modules) loads them, so then we=E2=80=99d have to mess around with GRUB configs to = preload them. If the options work, please leave them in. There=E2=80=99s a separate debate of whether this is the =E2=80=9Cright=E2= =80=9D fix for COMPAT_LINUX*; arguably that *should* work and it=E2=80=99s a bug that = they don=E2=80=99t, not a feature, even if it=E2=80=99s not of much interest = to support=E2=80=A6 I=E2=80=99d like to see the second half reverted, please, and believe = the first should be too, but I feel less strongly about that. Jess From owner-dev-commits-src-main@freebsd.org Mon Jun 21 22:27: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 BA802650AB8; Mon, 21 Jun 2021 22:27: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 4G83zx4vG2z4sw3; Mon, 21 Jun 2021 22:27: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 906BC2515E; Mon, 21 Jun 2021 22:27: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 15LMR9av000389; Mon, 21 Jun 2021 22:27:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LMR9Bf000388; Mon, 21 Jun 2021 22:27:09 GMT (envelope-from git) Date: Mon, 21 Jun 2021 22:27:09 GMT Message-Id: <202106212227.15LMR9Bf000388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 6f6a166eaf5e - main - arm64: Use page_to_pvh() when the vm_page_t is known MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f6a166eaf5e59dedb761ea6152417433a841e3b 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, 21 Jun 2021 22:27:09 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=6f6a166eaf5e59dedb761ea6152417433a841e3b commit 6f6a166eaf5e59dedb761ea6152417433a841e3b Author: Alan Cox AuthorDate: 2021-06-21 07:45:21 +0000 Commit: Alan Cox CommitDate: 2021-06-21 22:25:06 +0000 arm64: Use page_to_pvh() when the vm_page_t is known When support for a sparse pv_table was added, the implementation of pa_to_pvh() changed from a simple constant-time calculation to iterating over the array vm_phys_segs[]. To mitigate this issue, an alternative function, page_to_pvh(), was introduced that still runs in constant time but requires the vm_page_t to be known. However, three cases where the vm_page_t is known were not converted to page_to_pvh(). This change converts those three cases. Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30832 --- sys/arm64/arm64/pmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index ffc83be852bd..5f321be98528 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -3474,7 +3474,7 @@ pmap_pv_promote_l2(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, va = va & ~L2_OFFSET; pv = pmap_pvh_remove(&m->md, pmap, va); KASSERT(pv != NULL, ("pmap_pv_promote_l2: pv not found")); - pvh = pa_to_pvh(pa); + pvh = page_to_pvh(m); TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next); pvh->pv_gen++; /* Free the remaining NPTEPG - 1 pv entries. */ @@ -3896,7 +3896,7 @@ havel3: if ((om->a.flags & PGA_WRITEABLE) != 0 && TAILQ_EMPTY(&om->md.pv_list) && ((om->flags & PG_FICTITIOUS) != 0 || - TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) + TAILQ_EMPTY(&page_to_pvh(om)->pv_list))) vm_page_aflag_clear(om, PGA_WRITEABLE); } else { KASSERT((orig_l3 & ATTR_AF) != 0, @@ -5000,7 +5000,7 @@ pmap_remove_pages(pmap_t pmap) case 1: pmap_resident_count_dec(pmap, L2_SIZE / PAGE_SIZE); - pvh = pa_to_pvh(tpte & ~ATTR_MASK); + pvh = page_to_pvh(m); TAILQ_REMOVE(&pvh->pv_list, pv,pv_next); pvh->pv_gen++; if (TAILQ_EMPTY(&pvh->pv_list)) { From owner-dev-commits-src-main@freebsd.org Mon Jun 21 22:37: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 364AA650BB8; Mon, 21 Jun 2021 22:37: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 4G84Ct0tgQz4v9b; Mon, 21 Jun 2021 22:37: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 02704254BE; Mon, 21 Jun 2021 22:37: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 15LMbTIW013566; Mon, 21 Jun 2021 22: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 15LMbTt3013565; Mon, 21 Jun 2021 22:37:29 GMT (envelope-from git) Date: Mon, 21 Jun 2021 22:37:29 GMT Message-Id: <202106212237.15LMbTt3013565@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 524260db7683 - main - EC2: Tell gptboot to skip its 3 second wait MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 524260db7683681c7deec9f1968c15a717317685 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, 21 Jun 2021 22:37:30 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=524260db7683681c7deec9f1968c15a717317685 commit 524260db7683681c7deec9f1968c15a717317685 Author: Colin Percival AuthorDate: 2021-06-21 22:35:16 +0000 Commit: Colin Percival CommitDate: 2021-06-21 22:37:15 +0000 EC2: Tell gptboot to skip its 3 second wait Nobody is going to hit a key to tell gptboot to select another disk, so there's no point waiting. --- release/tools/ec2.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/release/tools/ec2.conf b/release/tools/ec2.conf index bfda9052421f..888a446659a5 100644 --- a/release/tools/ec2.conf +++ b/release/tools/ec2.conf @@ -88,6 +88,10 @@ EOF echo 'autoboot_delay="-1"' >> ${DESTDIR}/boot/loader.conf echo 'beastie_disable="YES"' >> ${DESTDIR}/boot/loader.conf + # Tell gptboot not to wait 3 seconds for a keypress which won't + # arrive either. + printf -- "-n\n" > ${DESTDIR}/boot.config + # The emulated keyboard attached to EC2 instances is inaccessible to # users, and there is no mouse attached at all; disable to keyboard # and the keyboard controller (to which the mouse would attach, if From owner-dev-commits-src-main@freebsd.org Mon Jun 21 23:01: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 CD059651450; Mon, 21 Jun 2021 23:01:09 +0000 (UTC) (envelope-from tmunro@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G84l95Rjfz3Bs7; Mon, 21 Jun 2021 23:01:09 +0000 (UTC) (envelope-from tmunro@freebsd.org) Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: tmunro/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id A3269404A; Mon, 21 Jun 2021 23:01:09 +0000 (UTC) (envelope-from tmunro@freebsd.org) Received: by mail-il1-f172.google.com with SMTP id v5so150506ilo.5; Mon, 21 Jun 2021 16:01:09 -0700 (PDT) X-Gm-Message-State: AOAM530PCgbE2e3lpWWzzvJFQdlZW21LJBJ0PmR7uZ/663TNlKsYlbHQ 1DJQ6YF83+ocDGkQ9mWsLPlURXf69u912YqY7hQ= X-Google-Smtp-Source: ABdhPJwzQZt1j5J603PejzkulBjzlByRRQnjGxQL/PQFWL5piyUnytxOD+3tZ+ngvymIUiFc3eLPhTd2V4++15zudq4= X-Received: by 2002:a05:6e02:c74:: with SMTP id f20mr440024ilj.85.1624316468683; Mon, 21 Jun 2021 16:01:08 -0700 (PDT) MIME-Version: 1.0 References: <202106211630.15LGU59S021852@gitrepo.freebsd.org> In-Reply-To: <202106211630.15LGU59S021852@gitrepo.freebsd.org> From: Thomas Munro Date: Tue, 22 Jun 2021 11:00:32 +1200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 26795a0378b5 - main - linux(4): Rework Linux ppoll system call. To: Dmitry Chagin Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" 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, 21 Jun 2021 23:01:09 -0000 Hi Dmitry, On Tue, Jun 22, 2021 at 4:30 AM Dmitry Chagin wrote: > The branch main has been updated by dchagin: > > URL: https://cgit.FreeBSD.org/src/commit/?id=26795a0378b58c3e26b68577a4cc446ab527e8b5 > > commit 26795a0378b58c3e26b68577a4cc446ab527e8b5 > Author: Dmitry Chagin > AuthorDate: 2021-06-22 05:06:05 +0000 > Commit: Dmitry Chagin > CommitDate: 2021-06-22 05:06:05 +0000 > > linux(4): Rework Linux ppoll system call. > > For now the Linux emulation layer uses in kernel ppoll(2) without > conversion of user supplied fd 'events', and does not convert the > kernel supplied fd 'revents'. > > At least POLLRDHUP is handled by FreeBSD differently than by > Linux. Seems that Linux silencly ignores POLLRDHUP on non socket fd's > unlike FreeBSD, which does more strictly check and fails. For the record, I wondered about adding POLLRDHUP to POLLSTANDARD, but that didn't seem right as it's not "standard", and I wondered if the POLLSTANDARD check mechanism should event exist at all ((1) POSIX doesn't tell us to reject flags, its POLLNVAL is for rejecting bogus fds, (2) it was added at the same time as POLLWRITE and other extensions that were later reverted), but I wasn't sure enough about that to propose those changes when adding POLLRDHUP, or at least it seemed like an independent matter for discussion. > Rework the Linux ppoll, using kern_poll and converting 'events' > and 'revents' values. > While here, move poll events defines to the MI part of code as they > mostly identical on all arches except arm. > > Differential Revision: https://reviews.freebsd.org/D30716 > MFC after: 2 weeks Note that the POLLRDHUP support is new (commit 18f21f03) and not yet MFC'd. I was planning to MFC to 13 in the next few days if there are no objections. From owner-dev-commits-src-main@freebsd.org Tue Jun 22 00:06: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 DA9CE6521D2; Tue, 22 Jun 2021 00:06: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 4G86B65vwBz3G5h; Tue, 22 Jun 2021 00:06: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 B32F426578; Tue, 22 Jun 2021 00:06: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 15M066W7033174; Tue, 22 Jun 2021 00:06:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15M065Z1033173; Tue, 22 Jun 2021 00:06:05 GMT (envelope-from git) Date: Tue, 22 Jun 2021 00:06:05 GMT Message-Id: <202106220006.15M065Z1033173@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: 15fccd86b9dd - main - Merge tag 'vendor/NetBSD/vis/20210621' into vis 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: 15fccd86b9dd17ca2cc1a70b060a2b1a1bf8470b 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, 22 Jun 2021 00:06:06 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=15fccd86b9dd17ca2cc1a70b060a2b1a1bf8470b commit 15fccd86b9dd17ca2cc1a70b060a2b1a1bf8470b Merge: 524260db7683 04751ecc4491 Author: Warner Losh AuthorDate: 2021-06-21 23:56:21 +0000 Commit: Warner Losh CommitDate: 2021-06-22 00:04:17 +0000 Merge tag 'vendor/NetBSD/vis/20210621' into vis Bring in NetBSD's vis as of 2021-06-21 Man page fixes, -M, -N and -S support for shell meta characters (all or some) and no locale. Discussed with: emaste@ Differential Revision: https://reviews.freebsd.org/D25358 contrib/vis/vis.1 | 24 ++++++++++++++++++++---- contrib/vis/vis.c | 17 +++++++++++++---- 2 files changed, 33 insertions(+), 8 deletions(-) From owner-dev-commits-src-main@freebsd.org Tue Jun 22 01:05: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 45CD3653421; Tue, 22 Jun 2021 01:05: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 4G87W55wNtz3kwP; Tue, 22 Jun 2021 01:05: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 AE3ED2790A; Tue, 22 Jun 2021 01:05: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 15M15rT8013047; Tue, 22 Jun 2021 01:05:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15M15rMH013046; Tue, 22 Jun 2021 01:05:53 GMT (envelope-from git) Date: Tue, 22 Jun 2021 01:05:53 GMT Message-Id: <202106220105.15M15rMH013046@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: d98a4eb807e9 - main - mkimg: Add fat32lba partition type 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: d98a4eb807e972ac207264043ba3c50ba94f5df5 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, 22 Jun 2021 01:05:54 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d98a4eb807e972ac207264043ba3c50ba94f5df5 commit d98a4eb807e972ac207264043ba3c50ba94f5df5 Author: Jose Luis Duran AuthorDate: 2021-06-18 14:55:24 +0000 Commit: Ed Maste CommitDate: 2021-06-22 01:04:58 +0000 mkimg: Add fat32lba partition type Syntactic sugar for a `gpart add -t '!12' ...` equivalent. Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/484 --- usr.bin/mkimg/ebr.c | 1 + usr.bin/mkimg/mbr.c | 1 + usr.bin/mkimg/scheme.c | 1 + usr.bin/mkimg/scheme.h | 1 + 4 files changed, 4 insertions(+) diff --git a/usr.bin/mkimg/ebr.c b/usr.bin/mkimg/ebr.c index a069982e7aa3..bee2e64bea14 100644 --- a/usr.bin/mkimg/ebr.c +++ b/usr.bin/mkimg/ebr.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); static struct mkimg_alias ebr_aliases[] = { { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16) }, { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) }, + { ALIAS_FAT32LBA, ALIAS_INT2TYPE(DOSPTYP_FAT32LBA) }, { ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) }, { ALIAS_NONE, 0 } }; diff --git a/usr.bin/mkimg/mbr.c b/usr.bin/mkimg/mbr.c index 46767ea96d06..e52e9df7ca64 100644 --- a/usr.bin/mkimg/mbr.c +++ b/usr.bin/mkimg/mbr.c @@ -44,6 +44,7 @@ static struct mkimg_alias mbr_aliases[] = { { ALIAS_EFI, ALIAS_INT2TYPE(DOSPTYP_EFI) }, { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16) }, { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) }, + { ALIAS_FAT32LBA, ALIAS_INT2TYPE(DOSPTYP_FAT32LBA) }, { ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) }, { ALIAS_NTFS, ALIAS_INT2TYPE(DOSPTYP_NTFS) }, { ALIAS_PPCBOOT, ALIAS_INT2TYPE(DOSPTYP_PPCBOOT) }, diff --git a/usr.bin/mkimg/scheme.c b/usr.bin/mkimg/scheme.c index c81182837b2e..5afe3245a2ba 100644 --- a/usr.bin/mkimg/scheme.c +++ b/usr.bin/mkimg/scheme.c @@ -47,6 +47,7 @@ static struct { { "efi", ALIAS_EFI }, { "fat16b", ALIAS_FAT16B }, { "fat32", ALIAS_FAT32 }, + { "fat32lba", ALIAS_FAT32LBA }, { "freebsd", ALIAS_FREEBSD }, { "freebsd-boot", ALIAS_FREEBSD_BOOT }, { "freebsd-nandfs", ALIAS_FREEBSD_NANDFS }, diff --git a/usr.bin/mkimg/scheme.h b/usr.bin/mkimg/scheme.h index 86b92a372860..00c1b7f516c9 100644 --- a/usr.bin/mkimg/scheme.h +++ b/usr.bin/mkimg/scheme.h @@ -36,6 +36,7 @@ enum alias { ALIAS_EFI, ALIAS_FAT16B, ALIAS_FAT32, + ALIAS_FAT32LBA, ALIAS_FREEBSD, ALIAS_FREEBSD_BOOT, ALIAS_FREEBSD_NANDFS, From owner-dev-commits-src-main@freebsd.org Tue Jun 22 08:33: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 D2F816590D8; Tue, 22 Jun 2021 08:33: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 4G8KRf5Q3gz3QdX; Tue, 22 Jun 2021 08:33: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 A20C65B27; Tue, 22 Jun 2021 08:33: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 15M8XYA4017289; Tue, 22 Jun 2021 08:33:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15M8XY6f017288; Tue, 22 Jun 2021 08:33:34 GMT (envelope-from git) Date: Tue, 22 Jun 2021 08:33:34 GMT Message-Id: <202106220833.15M8XY6f017288@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: e3be51b2bc7c - main - rtld-elf: Check the return value of obj_enforce_relro() 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: e3be51b2bc7cb41eb9a238cced2ee650d9bb2d41 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, 22 Jun 2021 08:33:34 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e3be51b2bc7cb41eb9a238cced2ee650d9bb2d41 commit e3be51b2bc7cb41eb9a238cced2ee650d9bb2d41 Author: Alex Richardson AuthorDate: 2021-06-22 08:09:44 +0000 Commit: Alex Richardson CommitDate: 2021-06-22 08:10:48 +0000 rtld-elf: Check the return value of obj_enforce_relro() The mprotect() call was failing on CheriBSD when changing rtld's relro page permissions due to missing CHERI capability permissions on the mprotect() argument but did not report an error since the return value was being ignored. It should never fail on any supported FreeBSD architecture, but checking the return value seems like a good sanity check to me. Reviewed By: kib, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30820 --- libexec/rtld-elf/rtld.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 9897248bffbb..f60872f12c52 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2288,7 +2288,8 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info) obj_rtld.path = xstrdup(ld_path_rtld); parse_rtld_phdr(&obj_rtld); - obj_enforce_relro(&obj_rtld); + if (obj_enforce_relro(&obj_rtld) == -1) + rtld_die(); r_debug.r_version = R_DEBUG_VERSION; r_debug.r_brk = r_debug_state; From owner-dev-commits-src-main@freebsd.org Tue Jun 22 09:29: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 D58CA659CA8; Tue, 22 Jun 2021 09:29:36 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8LhJ1JgHz3pQb; Tue, 22 Jun 2021 09:29:35 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 15M9TT46048491; Tue, 22 Jun 2021 12:29:29 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 15M9TTLI048490; Tue, 22 Jun 2021 12:29:29 +0300 (MSK) (envelope-from dchagin) Date: Tue, 22 Jun 2021 12:29:29 +0300 From: Dmitry Chagin To: Dimitry Andric Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 23408297fbf3 - main - Merge llvm-project 12.0.1 rc2 Message-ID: References: <202106191811.15JIB4nu002236@gitrepo.freebsd.org> <2A6DC940-653A-4B96-8103-DC3DE3F134AD@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2A6DC940-653A-4B96-8103-DC3DE3F134AD@FreeBSD.org> X-Rspamd-Queue-Id: 4G8LhJ1JgHz3pQb X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of dchagin@heemeyer.club has no SPF policy when checking 2001:19f0:6400:80a1:5054:ff:fe7a:a27d) smtp.mailfrom=dchagin@heemeyer.club X-Spamd-Result: default: False [-1.80 / 15.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[dchagin]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:19f0:6400:80a1:5054:ff:fe7a:a27d:from]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[2001:19f0:6400:80a1:5054:ff:fe7a:a27d:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[dchagin@freebsd.org,dchagin@heemeyer.club]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:20473, ipnet:2001:19f0:6400::/38, country:US]; FROM_NEQ_ENVFROM(0.00)[dchagin@freebsd.org,dchagin@heemeyer.club]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] 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, 22 Jun 2021 09:29:36 -0000 On Sun, Jun 20, 2021 at 09:46:32PM +0200, Dimitry Andric wrote: > On 20 Jun 2021, at 14:49, Dmitry Chagin wrote: > > > > On Sat, Jun 19, 2021 at 06:11:04PM +0000, Dimitry Andric wrote: > >> The branch main has been updated by dim: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=23408297fbf3089f0388a8873b02fa75ab3f5bb9 > >> > >> commit 23408297fbf3089f0388a8873b02fa75ab3f5bb9 > >> Merge: cac129e60300 e4bbddaec868 > >> Author: Dimitry Andric > >> AuthorDate: 2021-06-19 10:06:00 +0000 > >> Commit: Dimitry Andric > >> CommitDate: 2021-06-19 18:09:28 +0000 > >> > >> Merge llvm-project 12.0.1 rc2 > >> > >> This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and > >> openmp to llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2. > >> > >> PR: 255570 > >> MFC after: 6 weeks > >> > > hi! with 11 clang kernel build time is about 60 sec, with 12.0.0 and > > 12.0.1 rc2 build time increased to 500 sec. > > Did you previously have llvm/clang assertions turned off (via > MK_LLVM_ASSERTIONS=no)? > no, I found the reason. I tried to build a kernel without optimization, set CFLAGS=-O and forgot to remove it before building the world. > I did a few measurements of "make -j32 buildkernel", on > main-n247475-9d1cafb3049, with clang 11.0.1 and clang 12.0.1 (both with > assertions turned off, and statically linked: > > clang 11.0.1 (n=5): > > real user sys > 138.65 3145.23 285.25 > 129.00 3240.73 290.61 > 126.38 3244.03 284.76 > 128.90 3250.95 268.71 > 136.42 3250.73 267.93 > > clang 12.0.1 (n=5): > > real user sys > 129.16 3306.13 291.84 > 128.18 3308.14 284.32 > 128.77 3301.35 281.90 > 141.37 3293.22 282.20 > 129.93 3304.08 284.47 > > $ ministat -A clang1101-real.txt clang1201-real.txt > x clang1101-real.txt > + clang1201-real.txt > N Min Max Median Avg Stddev > x 5 126.38 138.65 129 131.87 5.3354662 > + 5 128.18 141.37 129.16 131.482 5.5639707 > No difference proven at 95.0% confidence > > $ ministat -A clang1101-user.txt clang1201-user.txt > x clang1101-user.txt > + clang1201-user.txt > N Min Max Median Avg Stddev > x 5 3145.23 3250.95 3244.03 3226.334 45.550423 > + 5 3293.22 3308.14 3304.08 3302.584 5.8070759 > Difference at 95.0% confidence > 76.25 +/- 47.3552 > 2.36336% +/- 1.50191% > (Student's t, pooled s = 32.4697) > > Before I merged 12.0.1, I did the same sort of measurement, but for > "make -j32 buildworld buildkernel" (with CROSS_TOOLCHAIN set so the > bootstrap compiler isn't built), and this showed roughly similar > results: > > $ ministat -A clang1101-real.txt clang1200-real.txt > x clang1101-real.txt > + clang1200-real.txt > N Min Max Median Avg Stddev > x 5 1410.24 1461.04 1434.2 1435.296 18.210247 > + 5 1461.54 1499.69 1462.07 1469.976 16.667199 > Difference at 95.0% confidence > 34.68 +/- 25.4583 > 2.41623% +/- 1.79718% > (Student's t, pooled s = 17.4558) > > $ ministat -A clang1101-user.txt clang1200-user.txt > x clang1101-user.txt > + clang1200-user.txt > N Min Max Median Avg Stddev > x 5 37495.09 37913.2 37750.64 37750.734 165.00886 > + 5 38133.12 38396.77 38390.77 38324.132 113.63363 > Difference at 95.0% confidence > 573.398 +/- 206.617 > 1.51891% +/- 0.552972% > (Student's t, pooled s = 141.67) > > So basically ~2% slower. It's would be a little tricky to find out if > there is any particular upstream commit that might be responsible, > as the difference is so small. > > I think I'll also compare the performance with assertions enabled, and > MK_SHARED_TOOLCHAIN=yes, which should be worse than the above, but still > comparable between 11.0 and 12.0. > > -Dimitry > From owner-dev-commits-src-main@freebsd.org Tue Jun 22 11:01: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 1426565BBA4; Tue, 22 Jun 2021 11:01:03 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8Njp6ldMz4SgT; Tue, 22 Jun 2021 11:01:02 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 15MB11dF048906; Tue, 22 Jun 2021 14:01:01 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 15MB11Or048905; Tue, 22 Jun 2021 14:01:01 +0300 (MSK) (envelope-from dchagin) Date: Tue, 22 Jun 2021 14:01:01 +0300 From: Dmitry Chagin To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: e013e36939ac - main - linux(4): Get rid of Linuxulator kernel build options. Message-ID: References: <202106211656.15LGuXQU059224@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 4G8Njp6ldMz4SgT 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: Tue, 22 Jun 2021 11:01:03 -0000 On Mon, Jun 21, 2021 at 10:56:38PM +0100, Jessica Clarke wrote: > On 21 Jun 2021, at 17:56, Dmitry Chagin wrote: > > > > The branch main has been updated by dchagin: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=e013e36939ac87b53195370fb5e29f29c1a4b5c6 > > > > commit e013e36939ac87b53195370fb5e29f29c1a4b5c6 > > Author: Dmitry Chagin > > AuthorDate: 2021-06-22 05:32:39 +0000 > > Commit: Dmitry Chagin > > CommitDate: 2021-06-22 05:32:39 +0000 > > > > linux(4): Get rid of Linuxulator kernel build options. > > > > Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 kernel > > build options. Since we have 32 and 64 bit Linux emulators, we can't build both > > emulators together into the kernel. I don't think it matters, Linux emulation > > depends on loadable modules (via rc). > > > > Cut LINPROCFS and LINSYSFS for consistency. > > I don’t see why these two should be deleted? They currently build fine, > and GNU/kFreeBSD kernels enable them. They might work as modules, but I > would worry that too many parts of userland would try and read them > before /etc/init.d/kldutils (the init script that loads modules) loads > them, so then we’d have to mess around with GRUB configs to preload > them. If the options work, please leave them in. > both FS modules depend on linux.ko on i386 or linux_common.ko on amd64, so it doesn't make sense to have options for them > There’s a separate debate of whether this is the “right” fix for > COMPAT_LINUX*; arguably that *should* work and it’s a bug that they > don’t, not a feature, even if it’s not of much interest to support… > > I’d like to see the second half reverted, please, and believe the first > should be too, but I feel less strongly about that. > I think that descendants should adapt to upstream, esp since there is no KBI or ABI breakage. btw, debian wiki says gnu/kFreeBSD unmaintained since 2014. That is the reason to worry about dead project? From owner-dev-commits-src-main@freebsd.org Tue Jun 22 11:36: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 B912365C229 for ; Tue, 22 Jun 2021 11:36:29 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 4G8PVj4hVGz4VBt for ; Tue, 22 Jun 2021 11:36:29 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f53.google.com with SMTP id h11so5763176wrx.5 for ; Tue, 22 Jun 2021 04:36:29 -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=XGNIqLkRo0UVwlJselYXpTEeqYzb4toysXR4N/WYSvE=; b=BUjXxbPTJ+sDSvCsTcSUzj5P2iTjqeo+bqmRV0jyT2trNdupFwRbM7nheo/S5ih8Da EwKxQIXHlP7YpRAFb7ea3mi31shRyk5elhXr1V080JUfvndBrNSzz/36FVZUIHVt5MaY /y458ANP5b//44XU2MvVhSu21XTJS+iZD2QnJlZJOzwIlPSGRqH50CcIKGUcRA1XnbfS u4dtcrshm2RZdvH21rXfUM2NAqIZgL075gAXZ9sCIdt5j3vdQyTjREOBZ73LEjOrgSmi 4tEsKC3iQZNiyWNTUGbIhFvGXW5sTWSN4QdFtn1+0osqzS9byB15I5vZ/T4oP+gafOLy mIKQ== X-Gm-Message-State: AOAM532CubMaNto7R85d5bz/ioMUaAzI4rNB0SOvAkxDodU0ts9+UMRO WCVqBKH9H7FHub22RE/rpkf9Rg== X-Google-Smtp-Source: ABdhPJyUQ9jb0FiGt6IFUcrDhSWLeIUEOkWekmTnkrQsG5VB2f35tMusEnwUyoyueZetCoLArr+UIQ== X-Received: by 2002:adf:f20c:: with SMTP id p12mr4132538wro.257.1624361788084; Tue, 22 Jun 2021 04:36:28 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id p11sm11415159wre.57.2021.06.22.04.36.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jun 2021 04:36:27 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: e013e36939ac - main - linux(4): Get rid of Linuxulator kernel build options. From: Jessica Clarke In-Reply-To: Date: Tue, 22 Jun 2021 12:36:26 +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: <4C0E8010-EFBF-42A5-90EF-A502E7BBD3D7@freebsd.org> References: <202106211656.15LGuXQU059224@gitrepo.freebsd.org> To: Dmitry Chagin X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4G8PVj4hVGz4VBt 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: Tue, 22 Jun 2021 11:36:29 -0000 On 22 Jun 2021, at 12:01, Dmitry Chagin wrote: > On Mon, Jun 21, 2021 at 10:56:38PM +0100, Jessica Clarke wrote: >> On 21 Jun 2021, at 17:56, Dmitry Chagin wrote: >>>=20 >>> The branch main has been updated by dchagin: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3De013e36939ac87b53195370fb5e29f29= c1a4b5c6 >>>=20 >>> commit e013e36939ac87b53195370fb5e29f29c1a4b5c6 >>> Author: Dmitry Chagin >>> AuthorDate: 2021-06-22 05:32:39 +0000 >>> Commit: Dmitry Chagin >>> CommitDate: 2021-06-22 05:32:39 +0000 >>>=20 >>> linux(4): Get rid of Linuxulator kernel build options. >>>=20 >>> Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 = kernel >>> build options. Since we have 32 and 64 bit Linux emulators, we = can't build both >>> emulators together into the kernel. I don't think it matters, = Linux emulation >>> depends on loadable modules (via rc). >>>=20 >>> Cut LINPROCFS and LINSYSFS for consistency. >>=20 >> I don=E2=80=99t see why these two should be deleted? They currently = build fine, >> and GNU/kFreeBSD kernels enable them. They might work as modules, but = I >> would worry that too many parts of userland would try and read them >> before /etc/init.d/kldutils (the init script that loads modules) = loads >> them, so then we=E2=80=99d have to mess around with GRUB configs to = preload >> them. If the options work, please leave them in. >>=20 >=20 > both FS modules depend on linux.ko on i386 or linux_common.ko on = amd64, > so it doesn't make sense to have options for them But that still worked, and was even in NOTES so being tested by LINT. >> There=E2=80=99s a separate debate of whether this is the =E2=80=9Cright= =E2=80=9D fix for >> COMPAT_LINUX*; arguably that *should* work and it=E2=80=99s a bug = that they >> don=E2=80=99t, not a feature, even if it=E2=80=99s not of much = interest to support=E2=80=A6 >>=20 >> I=E2=80=99d like to see the second half reverted, please, and believe = the first >> should be too, but I feel less strongly about that. >>=20 >=20 > I think that descendants should adapt to upstream, esp since there is = no > KBI or ABI breakage. btw, debian wiki says gnu/kFreeBSD unmaintained > since 2014. That is the reason to worry about dead project? As the current maintainer this is news to me. I see no such comment on the port=E2=80=99s wiki page[1]. Jess [1] https://wiki.debian.org/Debian_GNU/kFreeBSD From owner-dev-commits-src-main@freebsd.org Tue Jun 22 11:45:52 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 735E165C60E; Tue, 22 Jun 2021 11:45:52 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8PjX2RF6z4VRC; Tue, 22 Jun 2021 11:45:52 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 15MBjoEX049248; Tue, 22 Jun 2021 14:45:50 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 15MBjonj049247; Tue, 22 Jun 2021 14:45:50 +0300 (MSK) (envelope-from dchagin) Date: Tue, 22 Jun 2021 14:45:50 +0300 From: Dmitry Chagin To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: e013e36939ac - main - linux(4): Get rid of Linuxulator kernel build options. Message-ID: References: <202106211656.15LGuXQU059224@gitrepo.freebsd.org> <4C0E8010-EFBF-42A5-90EF-A502E7BBD3D7@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4C0E8010-EFBF-42A5-90EF-A502E7BBD3D7@freebsd.org> X-Rspamd-Queue-Id: 4G8PjX2RF6z4VRC 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: Tue, 22 Jun 2021 11:45:52 -0000 On Tue, Jun 22, 2021 at 12:36:26PM +0100, Jessica Clarke wrote: > On 22 Jun 2021, at 12:01, Dmitry Chagin wrote: > > On Mon, Jun 21, 2021 at 10:56:38PM +0100, Jessica Clarke wrote: > >> On 21 Jun 2021, at 17:56, Dmitry Chagin wrote: > >>> > >>> The branch main has been updated by dchagin: > >>> > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=e013e36939ac87b53195370fb5e29f29c1a4b5c6 > >>> > >>> commit e013e36939ac87b53195370fb5e29f29c1a4b5c6 > >>> Author: Dmitry Chagin > >>> AuthorDate: 2021-06-22 05:32:39 +0000 > >>> Commit: Dmitry Chagin > >>> CommitDate: 2021-06-22 05:32:39 +0000 > >>> > >>> linux(4): Get rid of Linuxulator kernel build options. > >>> > >>> Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 kernel > >>> build options. Since we have 32 and 64 bit Linux emulators, we can't build both > >>> emulators together into the kernel. I don't think it matters, Linux emulation > >>> depends on loadable modules (via rc). > >>> > >>> Cut LINPROCFS and LINSYSFS for consistency. > >> > >> I don’t see why these two should be deleted? They currently build fine, > >> and GNU/kFreeBSD kernels enable them. They might work as modules, but I > >> would worry that too many parts of userland would try and read them > >> before /etc/init.d/kldutils (the init script that loads modules) loads > >> them, so then we’d have to mess around with GRUB configs to preload > >> them. If the options work, please leave them in. > >> > > > > both FS modules depend on linux.ko on i386 or linux_common.ko on amd64, > > so it doesn't make sense to have options for them > > But that still worked, and was even in NOTES so being tested by LINT. > > >> There’s a separate debate of whether this is the “right” fix for > >> COMPAT_LINUX*; arguably that *should* work and it’s a bug that they > >> don’t, not a feature, even if it’s not of much interest to support… > >> > >> I’d like to see the second half reverted, please, and believe the first > >> should be too, but I feel less strongly about that. > >> > > > > I think that descendants should adapt to upstream, esp since there is no > > KBI or ABI breakage. btw, debian wiki says gnu/kFreeBSD unmaintained > > since 2014. That is the reason to worry about dead project? > > As the current maintainer this is news to me. I see no such comment on > the port’s wiki page[1]. > > Jess > > [1] https://wiki.debian.org/Debian_GNU/kFreeBSD > I read: https://www.debian.org/ports/kfreebsd-gnu/index.en.html From owner-dev-commits-src-main@freebsd.org Tue Jun 22 11:49: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 090FA65C628 for ; Tue, 22 Jun 2021 11:49:05 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 4G8PnD6HR5z4WSg for ; Tue, 22 Jun 2021 11:49:04 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f48.google.com with SMTP id j10so5826473wms.1 for ; Tue, 22 Jun 2021 04:49:04 -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=VkPq37sDlXkjGcuohcgSx77hJkA14OWY8ITG4e5kPp0=; b=X5d75egkHPBtYEqat5HkNpyHIClEnvYyNZ7AIjCWXj2if3RFroQWgYrwV+RUqvyMG8 yP4u0YAchuxe+zvQKB/L68ShR6hQvaywxYeUwPyok5Dsf7p9LagSym6JtoQlQIPoSgC6 58KlkPvKoqms/Kp2wDgkU+OF/sCtgLXkBS0oRNHHth07OHrisNUBbyoone33Nsva/BqD sEbgx2fkLtXeHnu0Hu/xoOCbZ42ZNgYoR6fjjR/jZM/v0eF7EGFcxcTBqt+TkzxwhE7y aykIm5kE3EEBb+kDGxxd+dpSMXcw6QHNl99XdYE9r48j60ttFbnsVLiNvB9jkHrq2Pff qjRg== X-Gm-Message-State: AOAM531qnSNHPsi3PpfK9/riv3/bRZVL1x5dtIYc1fO1UgeZ4LB+A3MW d1QFNrFz/uxDO53xRmMknxrS7w== X-Google-Smtp-Source: ABdhPJzhQnBs2Z2rJclTNNjVraexqxwyy/AfKBpI5Kk6gk01+7MuFTCZyd0nmRA/9/9BasqLOzkkyw== X-Received: by 2002:a1c:e246:: with SMTP id z67mr3898587wmg.119.1624362543682; Tue, 22 Jun 2021 04:49:03 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id b15sm25173753wrr.27.2021.06.22.04.49.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jun 2021 04:49:03 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: e013e36939ac - main - linux(4): Get rid of Linuxulator kernel build options. From: Jessica Clarke In-Reply-To: Date: Tue, 22 Jun 2021 12:49:02 +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: <3B06AC5C-4569-4DCB-AA75-42005E781EFB@freebsd.org> References: <202106211656.15LGuXQU059224@gitrepo.freebsd.org> <4C0E8010-EFBF-42A5-90EF-A502E7BBD3D7@freebsd.org> To: Dmitry Chagin X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4G8PnD6HR5z4WSg 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: Tue, 22 Jun 2021 11:49:05 -0000 On 22 Jun 2021, at 12:45, Dmitry Chagin wrote: > On Tue, Jun 22, 2021 at 12:36:26PM +0100, Jessica Clarke wrote: >> On 22 Jun 2021, at 12:01, Dmitry Chagin wrote: >>> On Mon, Jun 21, 2021 at 10:56:38PM +0100, Jessica Clarke wrote: >>>> On 21 Jun 2021, at 17:56, Dmitry Chagin = wrote: >>>>>=20 >>>>> The branch main has been updated by dchagin: >>>>>=20 >>>>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3De013e36939ac87b53195370fb5e29f29= c1a4b5c6 >>>>>=20 >>>>> commit e013e36939ac87b53195370fb5e29f29c1a4b5c6 >>>>> Author: Dmitry Chagin >>>>> AuthorDate: 2021-06-22 05:32:39 +0000 >>>>> Commit: Dmitry Chagin >>>>> CommitDate: 2021-06-22 05:32:39 +0000 >>>>>=20 >>>>> linux(4): Get rid of Linuxulator kernel build options. >>>>>=20 >>>>> Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 = kernel >>>>> build options. Since we have 32 and 64 bit Linux emulators, we = can't build both >>>>> emulators together into the kernel. I don't think it matters, = Linux emulation >>>>> depends on loadable modules (via rc). >>>>>=20 >>>>> Cut LINPROCFS and LINSYSFS for consistency. >>>>=20 >>>> I don=E2=80=99t see why these two should be deleted? They currently = build fine, >>>> and GNU/kFreeBSD kernels enable them. They might work as modules, = but I >>>> would worry that too many parts of userland would try and read them >>>> before /etc/init.d/kldutils (the init script that loads modules) = loads >>>> them, so then we=E2=80=99d have to mess around with GRUB configs to = preload >>>> them. If the options work, please leave them in. >>>>=20 >>>=20 >>> both FS modules depend on linux.ko on i386 or linux_common.ko on = amd64, >>> so it doesn't make sense to have options for them >>=20 >> But that still worked, and was even in NOTES so being tested by LINT. >>=20 >>>> There=E2=80=99s a separate debate of whether this is the = =E2=80=9Cright=E2=80=9D fix for >>>> COMPAT_LINUX*; arguably that *should* work and it=E2=80=99s a bug = that they >>>> don=E2=80=99t, not a feature, even if it=E2=80=99s not of much = interest to support=E2=80=A6 >>>>=20 >>>> I=E2=80=99d like to see the second half reverted, please, and = believe the first >>>> should be too, but I feel less strongly about that. >>>>=20 >>>=20 >>> I think that descendants should adapt to upstream, esp since there = is no >>> KBI or ABI breakage. btw, debian wiki says gnu/kFreeBSD unmaintained >>> since 2014. That is the reason to worry about dead project? >>=20 >> As the current maintainer this is news to me. I see no such comment = on >> the port=E2=80=99s wiki page[1]. >>=20 >> Jess >>=20 >> [1] https://wiki.debian.org/Debian_GNU/kFreeBSD >>=20 > I read: https://www.debian.org/ports/kfreebsd-gnu/index.en.html That doesn=E2=80=99t say unmaintained, that says not officially = supported. It=E2=80=99s the equivalent of Tier 1 vs not Tier 1 in FreeBSD, and falls into the same category as powerpc, ppc64 and riscv64, among other architectures. It just means that there are no stable releases, only unstable (-CURRENT equivalent). Jess From owner-dev-commits-src-main@freebsd.org Tue Jun 22 14:48:08 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 B18B965E3A6; Tue, 22 Jun 2021 14:48:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8Tlr4S2lz4pvH; Tue, 22 Jun 2021 14:48:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8161F12F1E; Tue, 22 Jun 2021 14:48:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15MEm8dq009250; Tue, 22 Jun 2021 14:48:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15MEm8E7009249; Tue, 22 Jun 2021 14:48:08 GMT (envelope-from git) Date: Tue, 22 Jun 2021 14:48:08 GMT Message-Id: <202106221448.15MEm8E7009249@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: 800e82d12411 - main - UPDATING: Fix typo 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: 800e82d12411938c4484c7d7de5bf9f5e641e43c 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, 22 Jun 2021 14:48:08 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=800e82d12411938c4484c7d7de5bf9f5e641e43c commit 800e82d12411938c4484c7d7de5bf9f5e641e43c Author: Maigurs Stalidzans AuthorDate: 2021-06-22 14:45:35 +0000 Commit: Warner Losh CommitDate: 2021-06-22 14:47:27 +0000 UPDATING: Fix typo Revired by: imp@ Sponsored by: Netflix --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 5bdca3beac94..cf8b5fa287a4 100644 --- a/UPDATING +++ b/UPDATING @@ -29,7 +29,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: 20210618: Bump __FreeBSD_version to 1400024 for LinuxKPI changes. - Most notably netdev.h can change now as the (last) dependecies + Most notably netdev.h can change now as the (last) dependencies (mlx4/ofed) are now using struct ifnet directly, but also for PCI additions and others. From owner-dev-commits-src-main@freebsd.org Tue Jun 22 16:03: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 BF06C65F3A5; Tue, 22 Jun 2021 16:03:03 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8WQH4b9Bz4trj; Tue, 22 Jun 2021 16:03:03 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 15MG318P050636; Tue, 22 Jun 2021 19:03:01 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 15MG31P8050635; Tue, 22 Jun 2021 19:03:01 +0300 (MSK) (envelope-from dchagin) Date: Tue, 22 Jun 2021 19:03:01 +0300 From: Dmitry Chagin To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: e013e36939ac - main - linux(4): Get rid of Linuxulator kernel build options. Message-ID: References: <202106211656.15LGuXQU059224@gitrepo.freebsd.org> <4C0E8010-EFBF-42A5-90EF-A502E7BBD3D7@freebsd.org> <3B06AC5C-4569-4DCB-AA75-42005E781EFB@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3B06AC5C-4569-4DCB-AA75-42005E781EFB@freebsd.org> X-Rspamd-Queue-Id: 4G8WQH4b9Bz4trj 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: Tue, 22 Jun 2021 16:03:03 -0000 On Tue, Jun 22, 2021 at 12:49:02PM +0100, Jessica Clarke wrote: > On 22 Jun 2021, at 12:45, Dmitry Chagin wrote: > > On Tue, Jun 22, 2021 at 12:36:26PM +0100, Jessica Clarke wrote: > >> On 22 Jun 2021, at 12:01, Dmitry Chagin wrote: > >>> On Mon, Jun 21, 2021 at 10:56:38PM +0100, Jessica Clarke wrote: > >>>> On 21 Jun 2021, at 17:56, Dmitry Chagin wrote: > >>>>> > >>>>> The branch main has been updated by dchagin: > >>>>> > >>>>> URL: https://cgit.FreeBSD.org/src/commit/?id=e013e36939ac87b53195370fb5e29f29c1a4b5c6 > >>>>> > >>>>> commit e013e36939ac87b53195370fb5e29f29c1a4b5c6 > >>>>> Author: Dmitry Chagin > >>>>> AuthorDate: 2021-06-22 05:32:39 +0000 > >>>>> Commit: Dmitry Chagin > >>>>> CommitDate: 2021-06-22 05:32:39 +0000 > >>>>> > >>>>> linux(4): Get rid of Linuxulator kernel build options. > >>>>> > >>>>> Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 kernel > >>>>> build options. Since we have 32 and 64 bit Linux emulators, we can't build both > >>>>> emulators together into the kernel. I don't think it matters, Linux emulation > >>>>> depends on loadable modules (via rc). > >>>>> > >>>>> Cut LINPROCFS and LINSYSFS for consistency. > >>>> > >>>> I don’t see why these two should be deleted? They currently build fine, > >>>> and GNU/kFreeBSD kernels enable them. They might work as modules, but I > >>>> would worry that too many parts of userland would try and read them > >>>> before /etc/init.d/kldutils (the init script that loads modules) loads > >>>> them, so then we’d have to mess around with GRUB configs to preload > >>>> them. If the options work, please leave them in. > >>>> > >>> > >>> both FS modules depend on linux.ko on i386 or linux_common.ko on amd64, > >>> so it doesn't make sense to have options for them > >> > >> But that still worked, and was even in NOTES so being tested by LINT. > >> > >>>> There’s a separate debate of whether this is the “right” fix for > >>>> COMPAT_LINUX*; arguably that *should* work and it’s a bug that they > >>>> don’t, not a feature, even if it’s not of much interest to support… > >>>> > >>>> I’d like to see the second half reverted, please, and believe the first > >>>> should be too, but I feel less strongly about that. > >>>> > >>> > >>> I think that descendants should adapt to upstream, esp since there is no > >>> KBI or ABI breakage. btw, debian wiki says gnu/kFreeBSD unmaintained > >>> since 2014. That is the reason to worry about dead project? > >> > >> As the current maintainer this is news to me. I see no such comment on > >> the port’s wiki page[1]. > >> > >> Jess > >> > >> [1] https://wiki.debian.org/Debian_GNU/kFreeBSD > >> > > I read: https://www.debian.org/ports/kfreebsd-gnu/index.en.html > > That doesn’t say unmaintained, that says not officially supported. It’s > the equivalent of Tier 1 vs not Tier 1 in FreeBSD, and falls into the > same category as powerpc, ppc64 and riscv64, among other architectures. > It just means that there are no stable releases, only unstable > (-CURRENT equivalent). > ah, ok. I understood. nice to meet you:) some years ago i tried to rewrite compat/linux/* with Elf(function), this is so terrible... the cost of this is much more significant than kernel options removal. btw, could you please subscribe to Linux emulation on a phab? You comments are needful, but its better to get them before commit. From owner-dev-commits-src-main@freebsd.org Tue Jun 22 16:05: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 74FB565F2F5; Tue, 22 Jun 2021 16:05:00 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8WSX1Y7sz3Bxw; Tue, 22 Jun 2021 16:04:59 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 15MG4xwG050656; Tue, 22 Jun 2021 19:04:59 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 15MG4xA7050655; Tue, 22 Jun 2021 19:04:59 +0300 (MSK) (envelope-from dchagin) Date: Tue, 22 Jun 2021 19:04:59 +0300 From: Dmitry Chagin To: Thomas Munro Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 26795a0378b5 - main - linux(4): Rework Linux ppoll system call. Message-ID: References: <202106211630.15LGU59S021852@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4G8WSX1Y7sz3Bxw 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: Tue, 22 Jun 2021 16:05:00 -0000 On Tue, Jun 22, 2021 at 11:00:32AM +1200, Thomas Munro wrote: > Hi Dmitry, > > On Tue, Jun 22, 2021 at 4:30 AM Dmitry Chagin wrote: > > The branch main has been updated by dchagin: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=26795a0378b58c3e26b68577a4cc446ab527e8b5 > > > > commit 26795a0378b58c3e26b68577a4cc446ab527e8b5 > > Author: Dmitry Chagin > > AuthorDate: 2021-06-22 05:06:05 +0000 > > Commit: Dmitry Chagin > > CommitDate: 2021-06-22 05:06:05 +0000 > > > > linux(4): Rework Linux ppoll system call. > > > > For now the Linux emulation layer uses in kernel ppoll(2) without > > conversion of user supplied fd 'events', and does not convert the > > kernel supplied fd 'revents'. > > > > At least POLLRDHUP is handled by FreeBSD differently than by > > Linux. Seems that Linux silencly ignores POLLRDHUP on non socket fd's > > unlike FreeBSD, which does more strictly check and fails. > > For the record, I wondered about adding POLLRDHUP to POLLSTANDARD, but > that didn't seem right as it's not "standard", and I wondered if the > POLLSTANDARD check mechanism should event exist at all ((1) POSIX > doesn't tell us to reject flags, its POLLNVAL is for rejecting bogus > fds, (2) it was added at the same time as POLLWRITE and other > extensions that were later reverted), but I wasn't sure enough about > that to propose those changes when adding POLLRDHUP, or at least it > seemed like an independent matter for discussion. > thank you for clarification > > Rework the Linux ppoll, using kern_poll and converting 'events' > > and 'revents' values. > > While here, move poll events defines to the MI part of code as they > > mostly identical on all arches except arm. > > > > Differential Revision: https://reviews.freebsd.org/D30716 > > MFC after: 2 weeks > > Note that the POLLRDHUP support is new (commit 18f21f03) and not yet > MFC'd. I was planning to MFC to 13 in the next few days if there are > no objections. ok, what about stable/12? From owner-dev-commits-src-main@freebsd.org Tue Jun 22 16:39: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 C4AFB65FFE6; Tue, 22 Jun 2021 16:39: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 4G8XCy4y1Wz3FM8; Tue, 22 Jun 2021 16:39: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 91CD613EED; Tue, 22 Jun 2021 16:39: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 15MGdA9l055432; Tue, 22 Jun 2021 16:39:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15MGdAX0055431; Tue, 22 Jun 2021 16:39:10 GMT (envelope-from git) Date: Tue, 22 Jun 2021 16:39:10 GMT Message-Id: <202106221639.15MGdAX0055431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: df3b437c1e07 - main - Fix failures in libm's lround_test after clang 12 import MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df3b437c1e073eb83e9a93af1c417f3ee8d0de3b 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, 22 Jun 2021 16:39:10 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=df3b437c1e073eb83e9a93af1c417f3ee8d0de3b commit df3b437c1e073eb83e9a93af1c417f3ee8d0de3b Author: Dimitry Andric AuthorDate: 2021-06-22 16:38:27 +0000 Commit: Dimitry Andric CommitDate: 2021-06-22 16:38:45 +0000 Fix failures in libm's lround_test after clang 12 import It turned out that the (type)DTYPE_MAX conversions at the top of s_lround.c are now emitted as cvtsi2sd instructions, at least on SSE capable CPUs. This caused the FE_INEXACT flag to always be set, at least for the double and float variants. Under clang 11, the whole INRANGE() comparisons were still optimized away, but this has "improved" in clang 12, due to stricter adherence to the -ffp-exception-behavior=maytrap compiler flag. To avoid run-time integer to float conversions, use static constants instead, so they are computed at compile time, and the INRANGE() statements are optimized away again, if applicable. While here, use an integer instead of a floating type to store the test results in lround_test.c, as this is more appropriate, and we can also drop the volatile hack. Reported by: arichardson MFC after: 3 days --- lib/msun/src/s_lround.c | 8 +++++--- lib/msun/tests/lround_test.c | 7 +------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/msun/src/s_lround.c b/lib/msun/src/s_lround.c index 66d9183a74bc..c4d305401ac8 100644 --- a/lib/msun/src/s_lround.c +++ b/lib/msun/src/s_lround.c @@ -49,9 +49,11 @@ __FBSDID("$FreeBSD$"); * that everything is in range. At compile time, INRANGE(x) should reduce to * two floating-point comparisons in the former case, or TRUE otherwise. */ -static const type dtype_min = (type)DTYPE_MIN - 0.5; -static const type dtype_max = (type)DTYPE_MAX + 0.5; -#define INRANGE(x) (dtype_max - (type)DTYPE_MAX != 0.5 || \ +static const type type_min = (type)DTYPE_MIN; +static const type type_max = (type)DTYPE_MAX; +static const type dtype_min = type_min - 0.5; +static const type dtype_max = type_max + 0.5; +#define INRANGE(x) (dtype_max - type_max != 0.5 || \ ((x) > dtype_min && (x) < dtype_max)) dtype diff --git a/lib/msun/tests/lround_test.c b/lib/msun/tests/lround_test.c index a6daa5459c7b..ddb2b2cea9b3 100644 --- a/lib/msun/tests/lround_test.c +++ b/lib/msun/tests/lround_test.c @@ -40,14 +40,9 @@ __FBSDID("$FreeBSD$"); #define IGNORE 0x12345 -/* - * XXX The volatile here is to avoid gcc's bogus constant folding and work - * around the lack of support for the FENV_ACCESS pragma. - */ #define test(func, x, result, excepts) do { \ - volatile double _d = x; \ ATF_REQUIRE_EQ(0, feclearexcept(FE_ALL_EXCEPT)); \ - volatile double _r = (func)(_d); \ + long long _r = (func)(x); \ CHECK_FP_EXCEPTIONS_MSG(excepts, FE_ALL_EXCEPT, "for %s(%s)", \ #func, #x); \ if ((excepts & FE_INVALID) != 0) { \ From owner-dev-commits-src-main@freebsd.org Tue Jun 22 20:26:52 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 41D6A662A48; Tue, 22 Jun 2021 20:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8dGh1CXRz3w8l; Tue, 22 Jun 2021 20:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11C36178BE; Tue, 22 Jun 2021 20:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15MKQpRH063480; Tue, 22 Jun 2021 20:26:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15MKQp3H063479; Tue, 22 Jun 2021 20:26:51 GMT (envelope-from git) Date: Tue, 22 Jun 2021 20:26:51 GMT Message-Id: <202106222026.15MKQp3H063479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 014a40f8f643 - main - Disable llvm generating 128-bit multiply libcalls on 32-bit ARM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 014a40f8f643a5dad6a6ba5c4bf6ea5d4f445fe6 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, 22 Jun 2021 20:26:52 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=014a40f8f643a5dad6a6ba5c4bf6ea5d4f445fe6 commit 014a40f8f643a5dad6a6ba5c4bf6ea5d4f445fe6 Author: Dimitry Andric AuthorDate: 2021-06-22 20:26:13 +0000 Commit: Dimitry Andric CommitDate: 2021-06-22 20:26:13 +0000 Disable llvm generating 128-bit multiply libcalls on 32-bit ARM Merge commit 789708617d20 from llvm git (Koutheir Attouchi): Do not generate calls to the 128-bit function __multi3() on 32-bit ARM Re-applying this patch after bots failures. Should be fine now. The function __multi3() is undefined on 32-bit ARM, so a call to it should never be emitted. Instead, plain instructions need to be generated to perform 128-bit multiplications. Differential Revision: https://reviews.llvm.org/D103906 Reported by: mmel MFC after: 3 days --- contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp index 598062672a56..c3cb02431e66 100644 --- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -541,6 +541,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM, setLibcallName(RTLIB::SHL_I128, nullptr); setLibcallName(RTLIB::SRL_I128, nullptr); setLibcallName(RTLIB::SRA_I128, nullptr); + setLibcallName(RTLIB::MUL_I128, nullptr); // RTLIB if (Subtarget->isAAPCS_ABI() && From owner-dev-commits-src-main@freebsd.org Tue Jun 22 23:07: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 42FD1664D9D; Tue, 22 Jun 2021 23:07: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 4G8hqp1747z4dfS; Tue, 22 Jun 2021 23:07: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 0EF1619A1F; Tue, 22 Jun 2021 23:07: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 15MN7HK3077198; Tue, 22 Jun 2021 23:07:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15MN7HV5077197; Tue, 22 Jun 2021 23:07:17 GMT (envelope-from git) Date: Tue, 22 Jun 2021 23:07:17 GMT Message-Id: <202106222307.15MN7HV5077197@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: c4804b6b0b94 - main - Unbreak TFO, that was broken with 8d5719aa74f. These two assignments are unneccessary and used to be there before TFO as an invariant. With TFO and after 8d5719aa74f the "so" value is still needed. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4804b6b0b94f1c7228b62114bf294d63f6db2b7 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, 22 Jun 2021 23:07:18 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c4804b6b0b94f1c7228b62114bf294d63f6db2b7 commit c4804b6b0b94f1c7228b62114bf294d63f6db2b7 Author: Gleb Smirnoff AuthorDate: 2021-06-22 23:03:44 +0000 Commit: Gleb Smirnoff CommitDate: 2021-06-22 23:03:44 +0000 Unbreak TFO, that was broken with 8d5719aa74f. These two assignments are unneccessary and used to be there before TFO as an invariant. With TFO and after 8d5719aa74f the "so" value is still needed. Reported & tested by: tuexen Fixes: 8d5719aa74f1d1441ee5ee365d45d53f934e81d6 --- sys/netinet/tcp_syncache.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 35d9c091ab96..4be888f22a37 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1491,10 +1491,6 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, tfo_pending = tp->t_tfo_pending; } - /* By the time we drop the lock these should no longer be used. */ - so = NULL; - tp = NULL; - #ifdef MAC if (mac_syncache_init(&maclabel) != 0) { INP_RUNLOCK(inp); From owner-dev-commits-src-main@freebsd.org Tue Jun 22 23:10: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 7F621664C2B; Tue, 22 Jun 2021 23:10: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 4G8hvV355Fz4djZ; Tue, 22 Jun 2021 23:10: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 4EA3D199BB; Tue, 22 Jun 2021 23:10: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 15MNAU6D085705; Tue, 22 Jun 2021 23:10:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15MNAU4F085704; Tue, 22 Jun 2021 23:10:30 GMT (envelope-from git) Date: Tue, 22 Jun 2021 23:10:30 GMT Message-Id: <202106222310.15MNAU4F085704@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: abc273a2901b - main - cxgbei: Better handle new tasks and transfers when disconnecting. 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: abc273a2901b116cc98a1fb506c75ac1b0a14cd3 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, 22 Jun 2021 23:10:30 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=abc273a2901b116cc98a1fb506c75ac1b0a14cd3 commit abc273a2901b116cc98a1fb506c75ac1b0a14cd3 Author: John Baldwin AuthorDate: 2021-06-18 23:15:50 +0000 Commit: John Baldwin CommitDate: 2021-06-22 23:09:54 +0000 cxgbei: Better handle new tasks and transfers when disconnecting. If the connection is in the process of disconnecting, ic_socket can be NULL. For icl_cxgbei_conn_transfer_setup(), lock the connection and check ic_socket before using it. For icl_cxgbei_conn_task_setup(), the caller already holds the connection lock, so assert it and bail early with ECONNRESET if the connection is disconnecting. Reported by: Jithesh Arakkan @ Chelsio Fixes: f949967c8eb3 cxgbei: Fix a race between transfer setup and a peer reset. --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 01759d929c0e..e974ad73a935 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -988,10 +988,15 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, uint32_t itt; int rc = 0; + ICL_CONN_LOCK_ASSERT(ic); + /* This is for the offload driver's state. Must not be set already. */ MPASS(arg != NULL); MPASS(*arg == NULL); + if (ic->ic_disconnecting || ic->ic_socket == NULL) + return (ECONNRESET); + if ((csio->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_IN || csio->dxfer_len < ci->ddp_threshold) { no_ddp: @@ -1209,8 +1214,17 @@ no_ddp: * Do not get inp from toep->inp as the toepcb might * have detached already. */ + ICL_CONN_LOCK(ic); + if (ic->ic_disconnecting || ic->ic_socket == NULL) { + ICL_CONN_UNLOCK(ic); + mbufq_drain(&mq); + t4_free_page_pods(prsv); + free(ddp, M_CXGBEI); + return (ECONNRESET); + } inp = sotoinpcb(ic->ic_socket); INP_WLOCK(inp); + ICL_CONN_UNLOCK(ic); if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) != 0) { INP_WUNLOCK(inp); mbufq_drain(&mq); From owner-dev-commits-src-main@freebsd.org Tue Jun 22 23:31: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 8CAC2664DDE; Tue, 22 Jun 2021 23:31: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 4G8jMt37pZz4gS1; Tue, 22 Jun 2021 23:31: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 53DA319BBC; Tue, 22 Jun 2021 23:31: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 15MNVcvo016398; Tue, 22 Jun 2021 23:31:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15MNVce0016397; Tue, 22 Jun 2021 23:31:38 GMT (envelope-from git) Date: Tue, 22 Jun 2021 23:31:38 GMT Message-Id: <202106222331.15MNVce0016397@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: a7f6c6fd94d6 - main - toe: Read-lock the inp in toe_4tuple_check(). 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: a7f6c6fd94d658b9e3f6f9bec02edfefb1a3d652 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, 22 Jun 2021 23:31:38 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a7f6c6fd94d658b9e3f6f9bec02edfefb1a3d652 commit a7f6c6fd94d658b9e3f6f9bec02edfefb1a3d652 Author: John Baldwin AuthorDate: 2021-06-22 23:31:01 +0000 Commit: John Baldwin CommitDate: 2021-06-22 23:31:01 +0000 toe: Read-lock the inp in toe_4tuple_check(). tcp_twcheck now expects a read lock on the inp for the SYN case instead of a write lock. Reviewed by: np Fixes: 1db08fbe3ffa tcp_input: always request read-locking of PCB for any pure SYN segment. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D30782 --- sys/netinet/toecore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c index 5792298d2883..8eddb73d333c 100644 --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -390,19 +390,19 @@ toe_4tuple_check(struct in_conninfo *inc, struct tcphdr *th, struct ifnet *ifp) if (inc->inc_flags & INC_ISIPV6) { inp = in6_pcblookup(&V_tcbinfo, &inc->inc6_faddr, inc->inc_fport, &inc->inc6_laddr, inc->inc_lport, - INPLOOKUP_WLOCKPCB, ifp); + INPLOOKUP_RLOCKPCB, ifp); } else { inp = in_pcblookup(&V_tcbinfo, inc->inc_faddr, inc->inc_fport, - inc->inc_laddr, inc->inc_lport, INPLOOKUP_WLOCKPCB, ifp); + inc->inc_laddr, inc->inc_lport, INPLOOKUP_RLOCKPCB, ifp); } if (inp != NULL) { - INP_WLOCK_ASSERT(inp); + INP_RLOCK_ASSERT(inp); if ((inp->inp_flags & INP_TIMEWAIT) && th != NULL) { if (!tcp_twcheck(inp, NULL, th, NULL, 0)) return (EADDRINUSE); } else { - INP_WUNLOCK(inp); + INP_RUNLOCK(inp); return (EADDRINUSE); } } From owner-dev-commits-src-main@freebsd.org Wed Jun 23 00: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 7340A665C49; Wed, 23 Jun 2021 00:38:36 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8ks72bV3z4lSs; Wed, 23 Jun 2021 00:38:35 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 15N0cQWR073503; Tue, 22 Jun 2021 17:38:26 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 15N0cQBT073502; Tue, 22 Jun 2021 17:38:26 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202106230038.15N0cQBT073502@gndrsh.dnsmgr.net> Subject: Re: git: e013e36939ac - main - linux(4): Get rid of Linuxulator kernel build options. In-Reply-To: To: Jessica Clarke Date: Tue, 22 Jun 2021 17:38:26 -0700 (PDT) CC: Dmitry Chagin , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4G8ks72bV3z4lSs X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [-1.85 / 15.00]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; TO_DN_EQ_ADDR_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; ARC_NA(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[69.59.192.140:from:127.0.2.255]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[69.59.192.140:from]; NEURAL_HAM_SHORT(-0.75)[-0.750]; DMARC_NA(0.00)[dnsmgr.net]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; RCVD_COUNT_TWO(0.00)[2]; 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: Wed, 23 Jun 2021 00:38:36 -0000 [ Charset UTF-8 unsupported, converting... ] > On 21 Jun 2021, at 17:56, Dmitry Chagin wrote: > > > > The branch main has been updated by dchagin: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=e013e36939ac87b53195370fb5e29f29c1a4b5c6 > > > > commit e013e36939ac87b53195370fb5e29f29c1a4b5c6 > > Author: Dmitry Chagin > > AuthorDate: 2021-06-22 05:32:39 +0000 > > Commit: Dmitry Chagin > > CommitDate: 2021-06-22 05:32:39 +0000 > > > > linux(4): Get rid of Linuxulator kernel build options. > > > > Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 kernel > > build options. Since we have 32 and 64 bit Linux emulators, we can't build both > > emulators together into the kernel. I don't think it matters, Linux emulation > > depends on loadable modules (via rc). > > > > Cut LINPROCFS and LINSYSFS for consistency. > > I don?t see why these two should be deleted? They currently build fine, > and GNU/kFreeBSD kernels enable them. They might work as modules, but I > would worry that too many parts of userland would try and read them > before /etc/init.d/kldutils (the init script that loads modules) loads > them, so then we?d have to mess around with GRUB configs to preload > them. If the options work, please leave them in. I also see no good reason to remove these options, and it well actually break some of my systems as I do NOT use loadable modules in my deployed systems, and some of them use the LINUXulator. Further anything that can be built as a module should also be supported as a compiled in kernel option, people just expect that to work. > > There?s a separate debate of whether this is the ?right? fix for > COMPAT_LINUX*; arguably that *should* work and it?s a bug that they > don?t, not a feature, even if it?s not of much interest to support? > > I?d like to see the second half reverted, please, and believe the first > should be too, but I feel less strongly about that. > > Jess > > > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-main@freebsd.org Wed Jun 23 02:54: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 8101166765E; Wed, 23 Jun 2021 02:54: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 4G8nt72zKGz4sqM; Wed, 23 Jun 2021 02:54: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 4E4101CD02; Wed, 23 Jun 2021 02:54: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 15N2sdJH081577; Wed, 23 Jun 2021 02:54:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15N2sdov081576; Wed, 23 Jun 2021 02:54:39 GMT (envelope-from git) Date: Wed, 23 Jun 2021 02:54:39 GMT Message-Id: <202106230254.15N2sdov081576@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: ddfc9c4c59e2 - main - newbus: Move from bus_child_{pnpinfo, location}_src to bus_child_{pnpinfo, location} with sbuf 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: ddfc9c4c59e2ea4871100d8c076adffe3af8ff21 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, 23 Jun 2021 02:54:39 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ddfc9c4c59e2ea4871100d8c076adffe3af8ff21 commit ddfc9c4c59e2ea4871100d8c076adffe3af8ff21 Author: Warner Losh AuthorDate: 2021-06-23 02:27:57 +0000 Commit: Warner Losh CommitDate: 2021-06-23 02:52:06 +0000 newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf Now that the upper layers all go through a layer to tie into these information functions that translates an sbuf into char * and len. The current interface suffers issues of what to do in cases of truncation, etc. Instead, migrate all these functions to using struct sbuf and these issues go away. The caller is also in charge of any memory allocation and/or expansion that's needed during this process. Create a bus_generic_child_{pnpinfo,location} and make it default. It just returns success. This is for those busses that have no information for these items. Migrate the now-empty routines to using this as appropriate. Document these new interfaces with man pages, and oversight from before. Reviewed by: jhb, bcr Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29937 --- share/man/man9/BUS_CHILD_LOCATION.9 | 61 ++++++++++++++++++ share/man/man9/BUS_CHILD_PNPINFO.9 | 65 +++++++++++++++++++ share/man/man9/Makefile | 2 + sys/arm/allwinner/a10_ahci.c | 2 +- sys/arm/freescale/imx/imx6_ahci.c | 2 +- sys/arm/nvidia/tegra_ahci.c | 2 +- sys/dev/acpica/acpi.c | 36 +++++------ sys/dev/acpica/acpi_pci.c | 34 +++++----- sys/dev/acpica/acpivar.h | 6 +- sys/dev/ahci/ahci.c | 6 +- sys/dev/ahci/ahci.h | 3 +- sys/dev/ahci/ahci_fsl_fdt.c | 2 +- sys/dev/ahci/ahci_generic.c | 4 +- sys/dev/ahci/ahci_mv_fdt.c | 2 +- sys/dev/ahci/ahci_pci.c | 4 +- sys/dev/ata/ata-pci.c | 8 +-- sys/dev/ata/ata-pci.h | 5 +- sys/dev/ata/chipsets/ata-fsl.c | 2 +- sys/dev/bhnd/bhnd.c | 39 ++++-------- sys/dev/bhnd/bhndb/bhndb.c | 17 ++--- sys/dev/bhnd/cores/chipc/chipc.c | 24 ------- sys/dev/cxgbe/t4_main.c | 13 ++-- sys/dev/fdt/simplebus.c | 2 +- sys/dev/gpio/gpiobus.c | 72 ++++++++------------- sys/dev/gpio/ofw_gpiobus.c | 2 +- sys/dev/hid/hidbus.c | 17 +++-- sys/dev/hyperv/vmbus/vmbus.c | 14 ++--- sys/dev/iicbus/acpi_iicbus.c | 34 +++------- sys/dev/iicbus/iicbus.c | 16 +++-- sys/dev/iicbus/iicbus.h | 6 +- sys/dev/iicbus/ofw_iicbus.c | 2 +- sys/dev/mii/mii.c | 19 +++--- sys/dev/mmc/mmc.c | 11 ++-- sys/dev/mvs/mvs_pci.c | 8 +-- sys/dev/mvs/mvs_soc.c | 9 ++- sys/dev/ntb/ntb.c | 6 +- sys/dev/ntb/ntb.h | 3 +- sys/dev/ntb/ntb_hw/ntb_hw_amd.c | 2 +- sys/dev/ntb/ntb_hw/ntb_hw_intel.c | 2 +- sys/dev/ntb/ntb_hw/ntb_hw_plx.c | 2 +- sys/dev/ntb/ntb_transport.c | 8 +-- sys/dev/nvdimm/nvdimm_acpi.c | 13 ++-- sys/dev/ofw/ofw_bus_subr.h | 2 +- sys/dev/ofw/ofw_cpu.c | 2 +- sys/dev/ow/ow.c | 22 ++----- sys/dev/pccard/pccard.c | 26 +++----- sys/dev/pci/pci.c | 15 +++-- sys/dev/pci/pci_private.h | 8 +-- sys/dev/puc/puc.c | 11 ++-- sys/dev/puc/puc_bfe.h | 4 +- sys/dev/puc/puc_pci.c | 4 +- sys/dev/pwm/ofw_pwmbus.c | 2 +- sys/dev/pwm/pwmbus.c | 16 ++--- sys/dev/siis/siis.c | 8 +-- sys/dev/smbus/smbus.c | 12 ++-- sys/dev/sound/pci/hda/hdaa.c | 15 ++--- sys/dev/sound/pci/hda/hdac.c | 13 ++-- sys/dev/sound/pci/hda/hdacc.c | 13 ++-- sys/dev/spibus/ofw_spibus.c | 2 +- sys/dev/spibus/spibus.c | 18 ++---- sys/dev/superio/superio.c | 15 +++-- sys/dev/usb/usb_hub.c | 38 +++-------- sys/dev/usb/usb_hub_acpi.c | 15 ++--- sys/dev/usb/usb_hub_private.h | 2 +- sys/dev/virtio/mmio/virtio_mmio.c | 4 +- sys/dev/virtio/pci/virtio_pci_legacy.c | 2 +- sys/dev/virtio/pci/virtio_pci_modern.c | 2 +- sys/dev/virtio/virtio.c | 5 +- sys/dev/virtio/virtio.h | 3 +- sys/isa/isa_common.c | 17 +++-- sys/kern/bus_if.m | 28 +++------ sys/kern/subr_bus.c | 112 ++++++++++----------------------- sys/powerpc/ofw/ofw_pcibus.c | 15 +++-- sys/powerpc/powermac/macgpio.c | 2 +- sys/powerpc/powermac/macio.c | 2 +- sys/powerpc/powermac/smu.c | 2 +- sys/powerpc/powermac/uninorth.c | 2 +- sys/powerpc/powernv/opal_dev.c | 2 +- sys/powerpc/pseries/vdevice.c | 2 +- sys/sys/bus.h | 6 +- 80 files changed, 471 insertions(+), 585 deletions(-) diff --git a/share/man/man9/BUS_CHILD_LOCATION.9 b/share/man/man9/BUS_CHILD_LOCATION.9 new file mode 100644 index 000000000000..647b942b087a --- /dev/null +++ b/share/man/man9/BUS_CHILD_LOCATION.9 @@ -0,0 +1,61 @@ +.\" +.\" Copyright (c) 2021 Netflix, Inc. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 22, 2021 +.Dt BUS_CHILD_LOCATION 9 +.Os +.Sh NAME +.Nm BUS_CHILD_LOCATION +.Nd "obtain the location of a child on the bus." +.Sh SYNOPSIS +.In sys/param.h +.In sys/bus.h +.In sys/sbuf.h +.Ft void +.Fn BUS_CHILD_LOCATION "device_t dev" "device_t child" "struct sbuf *sb" +.Sh DESCRIPTION +The +.Fn BUS_CHILD_LOCATION +method returns the location of the +.Dv child +device. +This location is a series of key=value pairs. +The string must be formatted as a space-separated list of key=value pairs. +Names may only contain alphanumeric characters, underscores ('_') and hyphens ('-'). +Values can contain any non-whitespace characters. +Values containing whitespace can be quoted with double quotes ('"'). +Double quotes and backslashes in quoted values can be escaped with backslashes ('\'). +.Pp +The location is defined as a series of characteristics of the +.Dv child +device that can be used to locate that device independent of what drivers are +attached. +Typically, these are slot numbers, bus addresses, or some topology formation. +Where possible, buses are encouraged to provide locations that are stable from +boot to boot and when other devices are added or removed. +A location is not dependent on the kind of device at that location. +.Sh SEE ALSO +.Xr bus 9 , +.Xr device 9 diff --git a/share/man/man9/BUS_CHILD_PNPINFO.9 b/share/man/man9/BUS_CHILD_PNPINFO.9 new file mode 100644 index 000000000000..eac9072d0514 --- /dev/null +++ b/share/man/man9/BUS_CHILD_PNPINFO.9 @@ -0,0 +1,65 @@ +.\" +.\" Copyright (c) 2021 Netflix, Inc. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 22, 2021 +.Dt BUS_CHILD_PNPINFO 9 +.Os +.Sh NAME +.Nm BUS_CHILD_PNPINFO +.Nd "obtain the plug and play information from a device" +.Sh SYNOPSIS +.In sys/param.h +.In sys/bus.h +.In sys/sbuf.h +.Ft void +.Fn BUS_CHILD_PNPINFO "device_t dev" "device_t child" "struct sbuf *sb" +.Sh DESCRIPTION +The +.Fn BUS_CHILD_LOCATION +method returns the identifying information about the +.Dv child +device. +This information is called the plug and play (pnp) details by some buses. +This information is a series of key=value pairs. +The string must be formatted as a space-separated list of key=value pairs. +Names may only contain alphanumeric characters, underscores ('_') and hyphens ('-'). +Values can contain any non-whitespace characters. +Values containing whitespace can be quoted with double quotes ('"'). +Double quotes and backslashes in quoted values can be escaped with backslashes ('\'). +.Pp +The pnpinfo is defined as a series of characteristics of the +.Dv child +device that are independent of which drivers are attached, but +are used to allow drivers to claim a device. +Typically, plug and play information encodes who made the device, what the model +number is, and some generic details about the device. +By convention, only the generic information about the device that's used by +drivers on that bus to decide on accepting the device is reported. +Other configuration information (such as the cache burst size) needed for the +operation of the device, but that doesn't distinguish it broadly from other +devices is not reported. +.Sh SEE ALSO +.Xr bus 9 , +.Xr device 9 diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 153870c34af9..19da0a012912 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -34,6 +34,8 @@ MAN= accept_filter.9 \ bus_child_present.9 \ BUS_CHILD_DELETED.9 \ BUS_CHILD_DETACHED.9 \ + BUS_CHILD_LOCATION.9 \ + BUS_CHILD_PNPINFO.9 \ BUS_CONFIG_INTR.9 \ bus_delayed_attach_children.9 \ BUS_DESCRIBE_INTR.9 \ diff --git a/sys/arm/allwinner/a10_ahci.c b/sys/arm/allwinner/a10_ahci.c index 399f17b079ef..5e6f53291394 100644 --- a/sys/arm/allwinner/a10_ahci.c +++ b/sys/arm/allwinner/a10_ahci.c @@ -413,7 +413,7 @@ static device_method_t ahci_ata_methods[] = { DEVMETHOD(bus_release_resource, ahci_release_resource), DEVMETHOD(bus_setup_intr, ahci_setup_intr), DEVMETHOD(bus_teardown_intr,ahci_teardown_intr), - DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_child_location, ahci_child_location), DEVMETHOD_END }; diff --git a/sys/arm/freescale/imx/imx6_ahci.c b/sys/arm/freescale/imx/imx6_ahci.c index 8b49c71c34a0..457966d9b219 100644 --- a/sys/arm/freescale/imx/imx6_ahci.c +++ b/sys/arm/freescale/imx/imx6_ahci.c @@ -347,7 +347,7 @@ static device_method_t imx6_ahci_ata_methods[] = { DEVMETHOD(bus_release_resource, ahci_release_resource), DEVMETHOD(bus_setup_intr, ahci_setup_intr), DEVMETHOD(bus_teardown_intr, ahci_teardown_intr), - DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_child_location, ahci_child_location), DEVMETHOD_END }; diff --git a/sys/arm/nvidia/tegra_ahci.c b/sys/arm/nvidia/tegra_ahci.c index 725fc999a3a3..80416bf3582a 100644 --- a/sys/arm/nvidia/tegra_ahci.c +++ b/sys/arm/nvidia/tegra_ahci.c @@ -773,7 +773,7 @@ static device_method_t tegra_ahci_methods[] = { DEVMETHOD(bus_release_resource, ahci_release_resource), DEVMETHOD(bus_setup_intr, ahci_setup_intr), DEVMETHOD(bus_teardown_intr, ahci_teardown_intr), - DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_child_location, ahci_child_location), DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag), DEVMETHOD_END diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 18623a6ab240..02358d407c66 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -177,10 +177,10 @@ static int acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_debug_objects_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_pm_func(u_long cmd, void *arg, ...); -static int acpi_child_location_str_method(device_t acdev, device_t child, - char *buf, size_t buflen); -static int acpi_child_pnpinfo_str_method(device_t acdev, device_t child, - char *buf, size_t buflen); +static int acpi_child_location_method(device_t acdev, device_t child, + struct sbuf *sb); +static int acpi_child_pnpinfo_method(device_t acdev, device_t child, + struct sbuf *sb); static void acpi_enable_pcie(void); static void acpi_hint_device_unit(device_t acdev, device_t child, const char *name, int *unitp); @@ -210,8 +210,8 @@ static device_method_t acpi_methods[] = { DEVMETHOD(bus_adjust_resource, acpi_adjust_resource), DEVMETHOD(bus_release_resource, acpi_release_resource), DEVMETHOD(bus_delete_resource, acpi_delete_resource), - DEVMETHOD(bus_child_pnpinfo_str, acpi_child_pnpinfo_str_method), - DEVMETHOD(bus_child_location_str, acpi_child_location_str_method), + DEVMETHOD(bus_child_pnpinfo, acpi_child_pnpinfo_method), + DEVMETHOD(bus_child_location, acpi_child_location_method), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), @@ -865,37 +865,32 @@ acpi_driver_added(device_t dev, driver_t *driver) /* Location hint for devctl(8) */ static int -acpi_child_location_str_method(device_t cbdev, device_t child, char *buf, - size_t buflen) +acpi_child_location_method(device_t cbdev, device_t child, struct sbuf *sb) { struct acpi_device *dinfo = device_get_ivars(child); - char buf2[32]; int pxm; if (dinfo->ad_handle) { - snprintf(buf, buflen, "handle=%s", acpi_name(dinfo->ad_handle)); + sbuf_printf(sb, "handle=%s", acpi_name(dinfo->ad_handle)); if (ACPI_SUCCESS(acpi_GetInteger(dinfo->ad_handle, "_PXM", &pxm))) { - snprintf(buf2, 32, " _PXM=%d", pxm); - strlcat(buf, buf2, buflen); - } - } else { - snprintf(buf, buflen, ""); + sbuf_printf(sb, " _PXM=%d", pxm); + } } return (0); } /* PnP information for devctl(8) */ int -acpi_pnpinfo_str(ACPI_HANDLE handle, char *buf, size_t buflen) +acpi_pnpinfo(ACPI_HANDLE handle, struct sbuf *sb) { ACPI_DEVICE_INFO *adinfo; if (ACPI_FAILURE(AcpiGetObjectInfo(handle, &adinfo))) { - snprintf(buf, buflen, "unknown"); + sbuf_printf(sb, "unknown"); return (0); } - snprintf(buf, buflen, "_HID=%s _UID=%lu _CID=%s", + sbuf_printf(sb, "_HID=%s _UID=%lu _CID=%s", (adinfo->Valid & ACPI_VALID_HID) ? adinfo->HardwareId.String : "none", (adinfo->Valid & ACPI_VALID_UID) ? @@ -909,12 +904,11 @@ acpi_pnpinfo_str(ACPI_HANDLE handle, char *buf, size_t buflen) } static int -acpi_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf, - size_t buflen) +acpi_child_pnpinfo_method(device_t cbdev, device_t child, struct sbuf *sb) { struct acpi_device *dinfo = device_get_ivars(child); - return (acpi_pnpinfo_str(dinfo->ad_handle, buf, buflen)); + return (acpi_pnpinfo(dinfo->ad_handle, sb)); } /* diff --git a/sys/dev/acpica/acpi_pci.c b/sys/dev/acpica/acpi_pci.c index c8d37268f466..90618f43bbef 100644 --- a/sys/dev/acpica/acpi_pci.c +++ b/sys/dev/acpica/acpi_pci.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -78,8 +79,8 @@ CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3); static struct pci_devinfo *acpi_pci_alloc_devinfo(device_t dev); static int acpi_pci_attach(device_t dev); static void acpi_pci_child_deleted(device_t dev, device_t child); -static int acpi_pci_child_location_str_method(device_t cbdev, - device_t child, char *buf, size_t buflen); +static int acpi_pci_child_location_method(device_t cbdev, + device_t child, struct sbuf *sb); static int acpi_pci_detach(device_t dev); static int acpi_pci_probe(device_t dev); static int acpi_pci_read_ivar(device_t dev, device_t child, int which, @@ -103,7 +104,7 @@ static device_method_t acpi_pci_methods[] = { DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar), DEVMETHOD(bus_write_ivar, acpi_pci_write_ivar), DEVMETHOD(bus_child_deleted, acpi_pci_child_deleted), - DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method), + DEVMETHOD(bus_child_location, acpi_pci_child_location_method), DEVMETHOD(bus_get_cpus, acpi_get_cpus), DEVMETHOD(bus_get_dma_tag, acpi_pci_get_dma_tag), DEVMETHOD(bus_get_domain, acpi_get_domain), @@ -179,25 +180,20 @@ acpi_pci_child_deleted(device_t dev, device_t child) } static int -acpi_pci_child_location_str_method(device_t cbdev, device_t child, char *buf, - size_t buflen) +acpi_pci_child_location_method(device_t cbdev, device_t child, struct sbuf *sb) { - struct acpi_pci_devinfo *dinfo = device_get_ivars(child); - int pxm; - char buf2[32]; - - pci_child_location_str_method(cbdev, child, buf, buflen); + struct acpi_pci_devinfo *dinfo = device_get_ivars(child); + int pxm; - if (dinfo->ap_handle) { - strlcat(buf, " handle=", buflen); - strlcat(buf, acpi_name(dinfo->ap_handle), buflen); + pci_child_location_method(cbdev, child, sb); - if (ACPI_SUCCESS(acpi_GetInteger(dinfo->ap_handle, "_PXM", &pxm))) { - snprintf(buf2, 32, " _PXM=%d", pxm); - strlcat(buf, buf2, buflen); - } - } - return (0); + if (dinfo->ap_handle) { + sbuf_printf(sb, " handle=%s", acpi_name(dinfo->ap_handle)); + if (ACPI_SUCCESS(acpi_GetInteger(dinfo->ap_handle, "_PXM", &pxm))) { + sbuf_printf(sb, " _PXM=%d", pxm); + } + } + return (0); } /* diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index fb196c2f4713..980a004e2c35 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -236,8 +236,8 @@ extern int acpi_quirks; * is compatible with ids parameter of ACPI_ID_PROBE bus method. * * XXX: While ACPI_ID_PROBE matches against _HID and all _CIDs, current - * acpi_pnpinfo_str() exports only _HID and first _CID. That means second - * and further _CIDs should be added to both acpi_pnpinfo_str() and + * acpi_pnpinfo() exports only _HID and first _CID. That means second + * and further _CIDs should be added to both acpi_pnpinfo() and * ACPICOMPAT_PNP_INFO if device matching against them is required. */ #define ACPICOMPAT_PNP_INFO(t, busname) \ @@ -490,7 +490,7 @@ int acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, int intr_enabled); int acpi_table_quirks(int *quirks); int acpi_machdep_quirks(int *quirks); -int acpi_pnpinfo_str(ACPI_HANDLE handle, char *buf, size_t buflen); +int acpi_pnpinfo(ACPI_HANDLE handle, struct sbuf *sb); uint32_t hpet_get_uid(device_t dev); diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c index 8991d9c23fbc..47a5ef455f82 100644 --- a/sys/dev/ahci/ahci.c +++ b/sys/dev/ahci/ahci.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -697,14 +698,13 @@ ahci_print_child(device_t dev, device_t child) } int -ahci_child_location_str(device_t dev, device_t child, char *buf, - size_t buflen) +ahci_child_location(device_t dev, device_t child, struct sbuf *sb) { intptr_t ivars; ivars = (intptr_t)device_get_ivars(child); if ((ivars & AHCI_EM_UNIT) == 0) - snprintf(buf, buflen, "channel=%d", (int)ivars & AHCI_UNIT); + sbuf_printf(sb, "channel=%d", (int)ivars & AHCI_UNIT); return (0); } diff --git a/sys/dev/ahci/ahci.h b/sys/dev/ahci/ahci.h index 472f9845117d..f1d5b18806b3 100644 --- a/sys/dev/ahci/ahci.h +++ b/sys/dev/ahci/ahci.h @@ -663,8 +663,7 @@ int ahci_setup_intr(device_t dev, device_t child, struct resource *irq, void *argument, void **cookiep); int ahci_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie); -int ahci_child_location_str(device_t dev, device_t child, char *buf, - size_t buflen); +int ahci_child_location(device_t dev, device_t child, struct sbuf *sb); bus_dma_tag_t ahci_get_dma_tag(device_t dev, device_t child); int ahci_ctlr_reset(device_t dev); int ahci_ctlr_setup(device_t dev); diff --git a/sys/dev/ahci/ahci_fsl_fdt.c b/sys/dev/ahci/ahci_fsl_fdt.c index f7491ee9768c..0fda9c28294b 100644 --- a/sys/dev/ahci/ahci_fsl_fdt.c +++ b/sys/dev/ahci/ahci_fsl_fdt.c @@ -406,7 +406,7 @@ static const device_method_t ahci_fsl_fdt_methods[] = { DEVMETHOD(bus_setup_intr, ahci_setup_intr), DEVMETHOD(bus_teardown_intr, ahci_teardown_intr), DEVMETHOD(bus_print_child, ahci_print_child), - DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_child_location, ahci_child_location), DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag), DEVMETHOD_END }; diff --git a/sys/dev/ahci/ahci_generic.c b/sys/dev/ahci/ahci_generic.c index 79130e9e9e57..108aaa2adf3a 100644 --- a/sys/dev/ahci/ahci_generic.c +++ b/sys/dev/ahci/ahci_generic.c @@ -182,7 +182,7 @@ static device_method_t ahci_fdt_methods[] = { DEVMETHOD(bus_release_resource, ahci_release_resource), DEVMETHOD(bus_setup_intr, ahci_setup_intr), DEVMETHOD(bus_teardown_intr,ahci_teardown_intr), - DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_child_location, ahci_child_location), DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag), DEVMETHOD_END }; @@ -206,7 +206,7 @@ static device_method_t ahci_acpi_methods[] = { DEVMETHOD(bus_release_resource, ahci_release_resource), DEVMETHOD(bus_setup_intr, ahci_setup_intr), DEVMETHOD(bus_teardown_intr,ahci_teardown_intr), - DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_child_location, ahci_child_location), DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag), DEVMETHOD_END }; diff --git a/sys/dev/ahci/ahci_mv_fdt.c b/sys/dev/ahci/ahci_mv_fdt.c index b88ff2713587..ee08093482c5 100644 --- a/sys/dev/ahci/ahci_mv_fdt.c +++ b/sys/dev/ahci/ahci_mv_fdt.c @@ -140,7 +140,7 @@ static device_method_t ahci_methods[] = { DEVMETHOD(bus_setup_intr, ahci_setup_intr), DEVMETHOD(bus_teardown_intr, ahci_teardown_intr), DEVMETHOD(bus_print_child, ahci_print_child), - DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_child_location, ahci_child_location), DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag), DEVMETHOD_END }; diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index ccc107a14bc8..b60119f3ab64 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -740,7 +740,7 @@ static device_method_t ahci_methods[] = { DEVMETHOD(bus_release_resource, ahci_release_resource), DEVMETHOD(bus_setup_intr, ahci_setup_intr), DEVMETHOD(bus_teardown_intr,ahci_teardown_intr), - DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_child_location, ahci_child_location), DEVMETHOD(bus_get_dma_tag, ahci_get_dma_tag), DEVMETHOD_END }; @@ -764,7 +764,7 @@ static device_method_t ahci_ata_methods[] = { DEVMETHOD(bus_release_resource, ahci_release_resource), DEVMETHOD(bus_setup_intr, ahci_setup_intr), DEVMETHOD(bus_teardown_intr,ahci_teardown_intr), - DEVMETHOD(bus_child_location_str, ahci_child_location_str), + DEVMETHOD(bus_child_location, ahci_child_location), DEVMETHOD_END }; static driver_t ahci_ata_driver = { diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index 578f719f40e4..d8f97158709b 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -558,11 +559,10 @@ ata_pci_print_child(device_t dev, device_t child) } int -ata_pci_child_location_str(device_t dev, device_t child, char *buf, - size_t buflen) +ata_pci_child_location(device_t dev, device_t child, struct sbuf *sb) { - snprintf(buf, buflen, "channel=%d", + sbuf_printf(sb, "channel=%d", (int)(intptr_t)device_get_ivars(child)); return (0); } @@ -595,7 +595,7 @@ static device_method_t ata_pci_methods[] = { DEVMETHOD(pci_read_config, ata_pci_read_config), DEVMETHOD(pci_write_config, ata_pci_write_config), DEVMETHOD(bus_print_child, ata_pci_print_child), - DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), + DEVMETHOD(bus_child_location, ata_pci_child_location), DEVMETHOD(bus_get_dma_tag, ata_pci_get_dma_tag), DEVMETHOD_END diff --git a/sys/dev/ata/ata-pci.h b/sys/dev/ata/ata-pci.h index 2fc8b278d589..ab0e661de29f 100644 --- a/sys/dev/ata/ata-pci.h +++ b/sys/dev/ata/ata-pci.h @@ -535,8 +535,7 @@ uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width); void ata_pci_write_config(device_t dev, device_t child, int reg, uint32_t val, int width); int ata_pci_print_child(device_t dev, device_t child); -int ata_pci_child_location_str(device_t dev, device_t child, char *buf, - size_t buflen); +int ata_pci_child_location(device_t dev, device_t child, struct sbuf *sb); struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep); @@ -586,7 +585,7 @@ static device_method_t __CONCAT(dname,_methods)[] = { \ DEVMETHOD(pci_read_config, ata_pci_read_config), \ DEVMETHOD(pci_write_config, ata_pci_write_config), \ DEVMETHOD(bus_print_child, ata_pci_print_child), \ - DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), \ + DEVMETHOD(bus_child_location, ata_pci_child_location), \ DEVMETHOD_END \ }; \ static driver_t __CONCAT(dname,_driver) = { \ diff --git a/sys/dev/ata/chipsets/ata-fsl.c b/sys/dev/ata/chipsets/ata-fsl.c index f7545e211358..32fe2a04bd19 100644 --- a/sys/dev/ata/chipsets/ata-fsl.c +++ b/sys/dev/ata/chipsets/ata-fsl.c @@ -227,7 +227,7 @@ static device_method_t imx_ata_methods[] = { DEVMETHOD(pci_read_config, ata_pci_read_config), DEVMETHOD(pci_write_config, ata_pci_write_config), DEVMETHOD(bus_print_child, ata_pci_print_child), - DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), + DEVMETHOD(bus_child_location, ata_pci_child_location), DEVMETHOD_END }; static driver_t imx_ata_driver = { diff --git a/sys/dev/bhnd/bhnd.c b/sys/dev/bhnd/bhnd.c index 1ec4cb1ce48d..654f42864233 100644 --- a/sys/dev/bhnd/bhnd.c +++ b/sys/dev/bhnd/bhnd.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -899,48 +900,32 @@ bhnd_generic_probe_nomatch(device_t dev, device_t child) bhnd_get_core_index(child)); } -/** - * Default implementation of BUS_CHILD_PNPINFO_STR(). - */ static int -bhnd_child_pnpinfo_str(device_t dev, device_t child, char *buf, - size_t buflen) +bhnd_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb) { - if (device_get_parent(child) != dev) { - return (BUS_CHILD_PNPINFO_STR(device_get_parent(dev), child, - buf, buflen)); - } + if (device_get_parent(child) != dev) + return (BUS_CHILD_PNPINFO(device_get_parent(dev), child, sb)); - snprintf(buf, buflen, "vendor=0x%hx device=0x%hx rev=0x%hhx", + sbuf_printf(sb, "vendor=0x%hx device=0x%hx rev=0x%hhx", bhnd_get_vendor(child), bhnd_get_device(child), bhnd_get_hwrev(child)); return (0); } -/** - * Default implementation of BUS_CHILD_LOCATION_STR(). - */ static int -bhnd_child_location_str(device_t dev, device_t child, char *buf, - size_t buflen) +bhnd_child_location(device_t dev, device_t child, struct sbuf *sb) { bhnd_addr_t addr; bhnd_size_t size; - if (device_get_parent(child) != dev) { - return (BUS_CHILD_LOCATION_STR(device_get_parent(dev), child, - buf, buflen)); - } + if (device_get_parent(child) != dev) + return (BUS_CHILD_LOCATION(device_get_parent(dev), child, sb)); - if (bhnd_get_region_addr(child, BHND_PORT_DEVICE, 0, 0, &addr, &size)) { - /* No device default port/region */ - if (buflen > 0) - *buf = '\0'; + if (bhnd_get_region_addr(child, BHND_PORT_DEVICE, 0, 0, &addr, &size)) return (0); - } - snprintf(buf, buflen, "port0.0=0x%llx", (unsigned long long) addr); + sbuf_printf(sb, "port0.0=0x%llx", (unsigned long long) addr); return (0); } @@ -1104,8 +1089,8 @@ static device_method_t bhnd_methods[] = { DEVMETHOD(bus_child_deleted, bhnd_generic_child_deleted), DEVMETHOD(bus_probe_nomatch, bhnd_generic_probe_nomatch), DEVMETHOD(bus_print_child, bhnd_generic_print_child), - DEVMETHOD(bus_child_pnpinfo_str, bhnd_child_pnpinfo_str), - DEVMETHOD(bus_child_location_str, bhnd_child_location_str), + DEVMETHOD(bus_child_pnpinfo, bhnd_child_pnpinfo), + DEVMETHOD(bus_child_location, bhnd_child_location), DEVMETHOD(bus_suspend_child, bhnd_generic_suspend_child), DEVMETHOD(bus_resume_child, bhnd_generic_resume_child), diff --git a/sys/dev/bhnd/bhndb/bhndb.c b/sys/dev/bhnd/bhndb/bhndb.c index c90ed9abf671..9a2beb50e9bb 100644 --- a/sys/dev/bhnd/bhndb/bhndb.c +++ b/sys/dev/bhnd/bhndb/bhndb.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -168,22 +169,13 @@ bhndb_print_child(device_t dev, device_t child) } static int -bhndb_child_pnpinfo_str(device_t bus, device_t child, char *buf, - size_t buflen) -{ - *buf = '\0'; - return (0); -} - -static int -bhndb_child_location_str(device_t dev, device_t child, char *buf, - size_t buflen) +bhndb_child_location(device_t dev, device_t child, struct sbuf *sb) { struct bhndb_softc *sc; sc = device_get_softc(dev); - snprintf(buf, buflen, "base=0x%llx", + sbuf_printf(sb, "base=0x%llx", (unsigned long long) sc->chipid.enum_addr); return (0); } @@ -2215,8 +2207,7 @@ static device_method_t bhndb_methods[] = { /* Bus interface */ DEVMETHOD(bus_probe_nomatch, bhndb_probe_nomatch), DEVMETHOD(bus_print_child, bhndb_print_child), - DEVMETHOD(bus_child_pnpinfo_str, bhndb_child_pnpinfo_str), - DEVMETHOD(bus_child_location_str, bhndb_child_location_str), + DEVMETHOD(bus_child_location, bhndb_child_location), DEVMETHOD(bus_add_child, bhndb_add_child), DEVMETHOD(bus_child_deleted, bhndb_child_deleted), diff --git a/sys/dev/bhnd/cores/chipc/chipc.c b/sys/dev/bhnd/cores/chipc/chipc.c index 1449c3b565dc..314f214d08b1 100644 --- a/sys/dev/bhnd/cores/chipc/chipc.c +++ b/sys/dev/bhnd/cores/chipc/chipc.c @@ -596,28 +596,6 @@ chipc_print_child(device_t dev, device_t child) return (retval); } -static int -chipc_child_pnpinfo_str(device_t dev, device_t child, char *buf, - size_t buflen) -{ - if (buflen == 0) - return (EOVERFLOW); - - *buf = '\0'; - return (0); -} - -static int -chipc_child_location_str(device_t dev, device_t child, char *buf, - size_t buflen) -{ - if (buflen == 0) - return (EOVERFLOW); - - *buf = '\0'; - return (ENXIO); -} - static device_t chipc_add_child(device_t dev, u_int order, const char *name, int unit) { @@ -1412,8 +1390,6 @@ static device_method_t chipc_methods[] = { /* Bus interface */ DEVMETHOD(bus_probe_nomatch, chipc_probe_nomatch), DEVMETHOD(bus_print_child, chipc_print_child), - DEVMETHOD(bus_child_pnpinfo_str, chipc_child_pnpinfo_str), - DEVMETHOD(bus_child_location_str, chipc_child_location_str), DEVMETHOD(bus_add_child, chipc_add_child), DEVMETHOD(bus_child_deleted, chipc_child_deleted), diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 650300c805a1..c5a3e6dd200e 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -97,7 +97,7 @@ __FBSDID("$FreeBSD$"); static int t4_probe(device_t); static int t4_attach(device_t); static int t4_detach(device_t); -static int t4_child_location_str(device_t, device_t, char *, size_t); +static int t4_child_location(device_t, device_t, struct sbuf *); static int t4_ready(device_t); static int t4_read_port_device(device_t, int, device_t *); static int t4_suspend(device_t); @@ -111,7 +111,7 @@ static device_method_t t4_methods[] = { DEVMETHOD(device_suspend, t4_suspend), DEVMETHOD(device_resume, t4_resume), - DEVMETHOD(bus_child_location_str, t4_child_location_str), + DEVMETHOD(bus_child_location, t4_child_location), DEVMETHOD(bus_reset_prepare, t4_reset_prepare), DEVMETHOD(bus_reset_post, t4_reset_post), @@ -176,7 +176,7 @@ static device_method_t t5_methods[] = { DEVMETHOD(device_suspend, t4_suspend), DEVMETHOD(device_resume, t4_resume), - DEVMETHOD(bus_child_location_str, t4_child_location_str), + DEVMETHOD(bus_child_location, t4_child_location), DEVMETHOD(bus_reset_prepare, t4_reset_prepare), DEVMETHOD(bus_reset_post, t4_reset_post), @@ -215,7 +215,7 @@ static device_method_t t6_methods[] = { DEVMETHOD(device_suspend, t4_suspend), DEVMETHOD(device_resume, t4_resume), - DEVMETHOD(bus_child_location_str, t4_child_location_str), + DEVMETHOD(bus_child_location, t4_child_location), DEVMETHOD(bus_reset_prepare, t4_reset_prepare), DEVMETHOD(bus_reset_post, t4_reset_post), @@ -1572,18 +1572,17 @@ done: } static int -t4_child_location_str(device_t bus, device_t dev, char *buf, size_t buflen) +t4_child_location(device_t bus, device_t dev, struct sbuf *sb) { struct adapter *sc; struct port_info *pi; int i; sc = device_get_softc(bus); - buf[0] = '\0'; for_each_port(sc, i) { pi = sc->port[i]; if (pi != NULL && pi->dev == dev) { - snprintf(buf, buflen, "port=%d", pi->port_id); + sbuf_printf(sb, "port=%d", pi->port_id); break; } } diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c index 4496d2caaad7..76814ed40b04 100644 --- a/sys/dev/fdt/simplebus.c +++ b/sys/dev/fdt/simplebus.c @@ -87,7 +87,7 @@ static device_method_t simplebus_methods[] = { DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), - DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), + DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo), DEVMETHOD(bus_get_resource_list, simplebus_get_resource_list), /* ofw_bus interface */ diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index e1f74d81955e..4ed8e14aedb9 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -51,7 +52,7 @@ __FBSDID("$FreeBSD$"); #define dprintf(x, arg...) #endif -static void gpiobus_print_pins(struct gpiobus_ivar *, char *, size_t); +static void gpiobus_print_pins(struct gpiobus_ivar *, struct sbuf *); static int gpiobus_parse_pins(struct gpiobus_softc *, device_t, int); static int gpiobus_probe(device_t); static int gpiobus_attach(device_t); @@ -60,8 +61,7 @@ static int gpiobus_suspend(device_t); static int gpiobus_resume(device_t); static void gpiobus_probe_nomatch(device_t, device_t); static int gpiobus_print_child(device_t, device_t); -static int gpiobus_child_location_str(device_t, device_t, char *, size_t); -static int gpiobus_child_pnpinfo_str(device_t, device_t, char *, size_t); +static int gpiobus_child_location(device_t, device_t, struct sbuf *); static device_t gpiobus_add_child(device_t, u_int, const char *, int); static void gpiobus_hinted_child(device_t, const char *, int); @@ -265,9 +265,8 @@ gpio_pin_setflags(gpio_pin_t pin, uint32_t flags) } static void -gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen) +gpiobus_print_pins(struct gpiobus_ivar *devi, struct sbuf *sb) { - char tmp[128]; int i, range_start, range_stop, need_coma; if (devi->npins == 0) @@ -278,16 +277,11 @@ gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen) for (i = 1; i < devi->npins; i++) { if (devi->pins[i] != (range_stop + 1)) { if (need_coma) - strlcat(buf, ",", buflen); - memset(tmp, 0, sizeof(tmp)); + sbuf_cat(sb, ","); if (range_start != range_stop) - snprintf(tmp, sizeof(tmp) - 1, "%d-%d", - range_start, range_stop); + sbuf_printf(sb, "%d-%d", range_start, range_stop); else - snprintf(tmp, sizeof(tmp) - 1, "%d", - range_start); - strlcat(buf, tmp, buflen); - + sbuf_printf(sb, "%d", range_start); range_start = range_stop = devi->pins[i]; need_coma = 1; } @@ -296,15 +290,11 @@ gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen) } if (need_coma) - strlcat(buf, ",", buflen); - memset(tmp, 0, sizeof(tmp)); + sbuf_cat(sb, ","); if (range_start != range_stop) - snprintf(tmp, sizeof(tmp) - 1, "%d-%d", - range_start, range_stop); + sbuf_printf(sb, "%d-%d", range_start, range_stop); else *** 2116 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Jun 23 04:15: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 0CF02648468; Wed, 23 Jun 2021 04:15: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 4G8qfs6kZxz3D5R; Wed, 23 Jun 2021 04: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 CF20D1D7D9; Wed, 23 Jun 2021 04: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 15N4F1bq089443; Wed, 23 Jun 2021 04: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 15N4F1m9089442; Wed, 23 Jun 2021 04:15:01 GMT (envelope-from git) Date: Wed, 23 Jun 2021 04:15:01 GMT Message-Id: <202106230415.15N4F1m9089442@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: c90902d39e7a - main - bus_child_pnpinfo: fix two stragglers 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: c90902d39e7af742581ae1c3de910f11fb3588d2 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, 23 Jun 2021 04:15:02 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c90902d39e7af742581ae1c3de910f11fb3588d2 commit c90902d39e7af742581ae1c3de910f11fb3588d2 Author: Warner Losh AuthorDate: 2021-06-23 04:10:31 +0000 Commit: Warner Losh CommitDate: 2021-06-23 04:10:31 +0000 bus_child_pnpinfo: fix two stragglers ddfc9c4c59e2 was missing changes to two files to complete the bus_child_pnpinfo_str->bus_child_pnpinfo. This fixes the broken kernel builds. Sponsored by: Netflix --- sys/dev/ofw/ofw_bus_subr.c | 11 ++++------- sys/powerpc/ofw/ofw_pcibus.c | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c index 5ce8d7b7bd48..12fbafe4077f 100644 --- a/sys/dev/ofw/ofw_bus_subr.c +++ b/sys/dev/ofw/ofw_bus_subr.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -86,22 +87,18 @@ ofw_bus_gen_destroy_devinfo(struct ofw_bus_devinfo *obd) } int -ofw_bus_gen_child_pnpinfo_str(device_t cbdev, device_t child, char *buf, - size_t buflen) +ofw_bus_gen_child_pnpinfo(device_t cbdev, device_t child, struct sbuf *sb) { - *buf = '\0'; if (!ofw_bus_status_okay(child)) return (0); if (ofw_bus_get_name(child) != NULL) { - strlcat(buf, "name=", buflen); - strlcat(buf, ofw_bus_get_name(child), buflen); + sbuf_printf(sb, "name=%s ", ofw_bus_get_name(child)); } if (ofw_bus_get_compat(child) != NULL) { - strlcat(buf, " compat=", buflen); - strlcat(buf, ofw_bus_get_compat(child), buflen); + sbuf_printf(sb, "compat=%s ", ofw_bus_get_compat(child)); } return (0); diff --git a/sys/powerpc/ofw/ofw_pcibus.c b/sys/powerpc/ofw/ofw_pcibus.c index 21ce8b04e88a..2c0a78812cc6 100644 --- a/sys/powerpc/ofw/ofw_pcibus.c +++ b/sys/powerpc/ofw/ofw_pcibus.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-dev-commits-src-main@freebsd.org Wed Jun 23 08:08: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 6688064B79E; Wed, 23 Jun 2021 08:08: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 4G8wr12DN8z3lRs; Wed, 23 Jun 2021 08:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3483D20A7D; Wed, 23 Jun 2021 08:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15N88Hpt096114; Wed, 23 Jun 2021 08:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15N88HfU096113; Wed, 23 Jun 2021 08:08:17 GMT (envelope-from git) Date: Wed, 23 Jun 2021 08:08:17 GMT Message-Id: <202106230808.15N88HfU096113@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: f70c98a2f5d9 - main - libalias: Fix compile time warning about unused functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f70c98a2f5d993dc518efd606aa341eda99400ef 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, 23 Jun 2021 08:08:17 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=f70c98a2f5d993dc518efd606aa341eda99400ef commit f70c98a2f5d993dc518efd606aa341eda99400ef Author: Lutz Donnerhacke AuthorDate: 2021-06-21 15:19:35 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-06-23 08:06:04 +0000 libalias: Fix compile time warning about unused functions Compiling libalias results in warnings about unused functions. Those warnings are caused by clang's heuristic to consider an inline function as in use, iff the declaration is in a *.c file. Declarations in *.h files do not emit those warnings. Hence the declarations must be moved to an extra *.h file. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30844 --- sys/netinet/libalias/alias_db.c | 405 +----------------------------------- sys/netinet/libalias/alias_db.h | 442 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 444 insertions(+), 403 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 53ad3396d66b..19529271f49f 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -29,120 +29,6 @@ #include __FBSDID("$FreeBSD$"); -/* - Alias_db.c encapsulates all data structures used for storing - packet aliasing data. Other parts of the aliasing software - access data through functions provided in this file. - - Data storage is based on the notion of a "link", which is - established for ICMP echo/reply packets, UDP datagrams and - TCP stream connections. A link stores the original source - and destination addresses. For UDP and TCP, it also stores - source and destination port numbers, as well as an alias - port number. Links are also used to store information about - fragments. - - There is a facility for sweeping through and deleting old - links as new packets are sent through. A simple timeout is - used for ICMP and UDP links. TCP links are left alone unless - there is an incomplete connection, in which case the link - can be deleted after a certain amount of time. - - Initial version: August, 1996 (cjm) - - Version 1.4: September 16, 1996 (cjm) - Facility for handling incoming links added. - - Version 1.6: September 18, 1996 (cjm) - ICMP data handling simplified. - - Version 1.7: January 9, 1997 (cjm) - Fragment handling simplified. - Saves pointers for unresolved fragments. - Permits links for unspecified remote ports - or unspecified remote addresses. - Fixed bug which did not properly zero port - table entries after a link was deleted. - Cleaned up some obsolete comments. - - Version 1.8: January 14, 1997 (cjm) - Fixed data type error in StartPoint(). - (This error did not exist prior to v1.7 - and was discovered and fixed by Ari Suutari) - - Version 1.9: February 1, 1997 - Optionally, connections initiated from packet aliasing host - machine will will not have their port number aliased unless it - conflicts with an aliasing port already being used. (cjm) - - All options earlier being #ifdef'ed are now available through - a new interface, SetPacketAliasMode(). This allows run time - control (which is now available in PPP+pktAlias through the - 'alias' keyword). (ee) - - Added ability to create an alias port without - either destination address or port specified. - port type = ALIAS_PORT_UNKNOWN_DEST_ALL (ee) - - Removed K&R style function headers - and general cleanup. (ee) - - Added packetAliasMode to replace compiler #defines's (ee) - - Allocates sockets for partially specified - ports if ALIAS_USE_SOCKETS defined. (cjm) - - Version 2.0: March, 1997 - SetAliasAddress() will now clean up alias links - if the aliasing address is changed. (cjm) - - PacketAliasPermanentLink() function added to support permanent - links. (J. Fortes suggested the need for this.) - Examples: - - (192.168.0.1, port 23) <-> alias port 6002, unknown dest addr/port - - (192.168.0.2, port 21) <-> alias port 3604, known dest addr - unknown dest port - - These permanent links allow for incoming connections to - machines on the local network. They can be given with a - user-chosen amount of specificity, with increasing specificity - meaning more security. (cjm) - - Quite a bit of rework to the basic engine. The portTable[] - array, which kept track of which ports were in use was replaced - by a table/linked list structure. (cjm) - - SetExpire() function added. (cjm) - - DeleteLink() no longer frees memory association with a pointer - to a fragment (this bug was first recognized by E. Eklund in - v1.9). - - Version 2.1: May, 1997 (cjm) - Packet aliasing engine reworked so that it can handle - multiple external addresses rather than just a single - host address. - - PacketAliasRedirectPort() and PacketAliasRedirectAddr() - added to the API. The first function is a more generalized - version of PacketAliasPermanentLink(). The second function - implements static network address translation. - - Version 3.2: July, 2000 (salander and satoh) - Added FindNewPortGroup to get contiguous range of port values. - - Added QueryUdpTcpIn and QueryUdpTcpOut to look for an aliasing - link but not actually add one. - - Added FindRtspOut, which is closely derived from FindUdpTcpOut, - except that the alias port (from FindNewPortGroup) is provided - as input. - - See HISTORY file for additional revisions. -*/ - #ifdef _KERNEL #include #include @@ -175,177 +61,11 @@ __FBSDID("$FreeBSD$"); #include "alias_mod.h" #endif +#include "alias_db.h" + static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); int LibAliasTime; -/* - Constants (note: constants are also defined - near relevant functions or structs) -*/ - -/* Timeouts (in seconds) for different link types */ -#define ICMP_EXPIRE_TIME 60 -#define UDP_EXPIRE_TIME 60 -#define PROTO_EXPIRE_TIME 60 -#define FRAGMENT_ID_EXPIRE_TIME 10 -#define FRAGMENT_PTR_EXPIRE_TIME 30 - -/* TCP link expire time for different cases */ -/* When the link has been used and closed - minimal grace time to - allow ACKs and potential re-connect in FTP (XXX - is this allowed?) */ -#ifndef TCP_EXPIRE_DEAD -#define TCP_EXPIRE_DEAD 10 -#endif - -/* When the link has been used and closed on one side - the other side - is allowed to still send data */ -#ifndef TCP_EXPIRE_SINGLEDEAD -#define TCP_EXPIRE_SINGLEDEAD 90 -#endif - -/* When the link isn't yet up */ -#ifndef TCP_EXPIRE_INITIAL -#define TCP_EXPIRE_INITIAL 300 -#endif - -/* When the link is up */ -#ifndef TCP_EXPIRE_CONNECTED -#define TCP_EXPIRE_CONNECTED 86400 -#endif - -/* Dummy port number codes used for FindLinkIn/Out() and AddLink(). - These constants can be anything except zero, which indicates an - unknown port number. */ - -#define NO_DEST_PORT 1 -#define NO_SRC_PORT 1 - -/* Matches any/unknown address in FindLinkIn/Out() and AddLink(). */ -static struct in_addr const ANY_ADDR = { INADDR_ANY }; - -/* Data Structures - - The fundamental data structure used in this program is - "struct alias_link". Whenever a TCP connection is made, - a UDP datagram is sent out, or an ICMP echo request is made, - a link record is made (if it has not already been created). - The link record is identified by the source address/port - and the destination address/port. In the case of an ICMP - echo request, the source port is treated as being equivalent - with the 16-bit ID number of the ICMP packet. - - The link record also can store some auxiliary data. For - TCP connections that have had sequence and acknowledgment - modifications, data space is available to track these changes. - A state field is used to keep track in changes to the TCP - connection state. ID numbers of fragments can also be - stored in the auxiliary space. Pointers to unresolved - fragments can also be stored. - - The link records support two independent chainings. Lookup - tables for input and out tables hold the initial pointers - the link chains. On input, the lookup table indexes on alias - port and link type. On output, the lookup table indexes on - source address, destination address, source port, destination - port and link type. -*/ - -/* used to save changes to ACK/sequence numbers */ -struct ack_data_record { - u_long ack_old; - u_long ack_new; - int delta; - int active; -}; - -/* Information about TCP connection */ -struct tcp_state { - int in; /* State for outside -> inside */ - int out; /* State for inside -> outside */ - int index; /* Index to ACK data array */ - /* Indicates whether ACK and sequence numbers been modified */ - int ack_modified; -}; - -/* Number of distinct ACK number changes - * saved for a modified TCP stream */ -#define N_LINK_TCP_DATA 3 -struct tcp_dat { - struct tcp_state state; - struct ack_data_record ack[N_LINK_TCP_DATA]; - /* Which firewall record is used for this hole? */ - int fwhole; -}; - -/* LSNAT server pool (circular list) */ -struct server { - struct in_addr addr; - u_short port; - struct server *next; -}; - -/* Main data structure */ -struct alias_link { - struct libalias *la; - /* Address and port information */ - struct in_addr src_addr; - struct in_addr dst_addr; - struct in_addr alias_addr; - struct in_addr proxy_addr; - u_short src_port; - u_short dst_port; - u_short alias_port; - u_short proxy_port; - struct server *server; - /* Type of link: TCP, UDP, ICMP, proto, frag */ - int link_type; -/* values for link_type */ -#define LINK_ICMP IPPROTO_ICMP -#define LINK_UDP IPPROTO_UDP -#define LINK_TCP IPPROTO_TCP -#define LINK_FRAGMENT_ID (IPPROTO_MAX + 1) -#define LINK_FRAGMENT_PTR (IPPROTO_MAX + 2) -#define LINK_ADDR (IPPROTO_MAX + 3) -#define LINK_PPTP (IPPROTO_MAX + 4) - - int flags; /* indicates special characteristics */ - int pflags; /* protocol-specific flags */ -/* flag bits */ -#define LINK_UNKNOWN_DEST_PORT 0x01 -#define LINK_UNKNOWN_DEST_ADDR 0x02 -#define LINK_PERMANENT 0x04 -#define LINK_PARTIALLY_SPECIFIED 0x03 /* logical-or of first two bits */ -#define LINK_UNFIREWALLED 0x08 - - int timestamp; /* Time link was last accessed */ -#ifndef NO_USE_SOCKETS - int sockfd; /* socket descriptor */ -#endif - /* Linked list of pointers for input and output lookup tables */ - union { - struct { - SPLAY_ENTRY(alias_link) out; - LIST_ENTRY (alias_link) in; - } all; - struct { - LIST_ENTRY (alias_link) list; - } pptp; - }; - struct { - TAILQ_ENTRY(alias_link) list; - int time; /* Expire time for link */ - } expire; - /* Auxiliary data */ - union { - char *frag_ptr; - struct in_addr frag_addr; - struct tcp_dat *tcp; - } data; -}; - -/* Clean up procedure. */ -static void finishoff(void); - /* Kernel module definition. */ #ifdef _KERNEL MALLOC_DEFINE(M_ALIAS, "libalias", "packet aliasing"); @@ -373,67 +93,7 @@ static moduledata_t alias_mod = { DECLARE_MODULE(alias, alias_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND); #endif -/* Internal utility routines (used only in alias_db.c) - -Lookup table starting points: - StartPointIn() -- link table initial search point for - incoming packets - StartPointOut() -- link table initial search point for - outgoing packets - -Miscellaneous: - SeqDiff() -- difference between two TCP sequences - ShowAliasStats() -- send alias statistics to a monitor file -*/ - -/* Local prototypes */ -static struct group_in * -StartPointIn(struct libalias *, struct in_addr, u_short, int, int); -static int SeqDiff(u_long, u_long); - -#ifndef NO_FW_PUNCH -/* Firewall control */ -static void InitPunchFW(struct libalias *); -static void UninitPunchFW(struct libalias *); -static void ClearFWHole(struct alias_link *); - -#endif - -/* Log file control */ -static void ShowAliasStats(struct libalias *); -static int InitPacketAliasLog(struct libalias *); -static void UninitPacketAliasLog(struct libalias *); - -void SctpShowAliasStats(struct libalias *la); - - -/* Splay handling */ -static inline int -cmp_out(struct alias_link *a, struct alias_link *b) { - int i = a->src_port - b->src_port; - if (i != 0) return (i); - i = a->src_addr.s_addr - b->src_addr.s_addr; - if (i != 0) return (i); - i = a->dst_addr.s_addr - b->dst_addr.s_addr; - if (i != 0) return (i); - i = a->dst_port - b->dst_port; - if (i != 0) return (i); - i = a->link_type - b->link_type; - return (i); -} -SPLAY_PROTOTYPE(splay_out, alias_link, all.out, cmp_out); SPLAY_GENERATE(splay_out, alias_link, all.out, cmp_out); - -static inline int -cmp_in(struct group_in *a, struct group_in *b) { - int i = a->alias_port - b->alias_port; - if (i != 0) return (i); - i = a->link_type - b->link_type; - if (i != 0) return (i); - i = a->alias_addr.s_addr - b->alias_addr.s_addr; - return (i); -} -SPLAY_PROTOTYPE(splay_in, group_in, in, cmp_in); SPLAY_GENERATE(splay_in, group_in, in, cmp_in); static struct group_in * @@ -528,53 +188,6 @@ void SctpShowAliasStats(struct libalias *la) ShowAliasStats(la); } -/* Internal routines for finding, deleting and adding links - -Port Allocation: - GetNewPort() -- find and reserve new alias port number - GetSocket() -- try to allocate a socket for a given port - -Link creation and deletion: - CleanupAliasData() - remove all link chains from lookup table - CleanupLink() - look for a stale link - DeleteLink() - remove link - AddLink() - add link - ReLink() - change link - -Link search: - FindLinkOut() - find link for outgoing packets - FindLinkIn() - find link for incoming packets - -Port search: - FindNewPortGroup() - find an available group of ports -*/ - -/* Local prototypes */ -static int GetNewPort(struct libalias *, struct alias_link *, int); -#ifndef NO_USE_SOCKETS -static u_short GetSocket(struct libalias *, u_short, int *, int); -#endif -static void CleanupAliasData(struct libalias *, int); -static void CleanupLink(struct libalias *, struct alias_link **, int); -static void DeleteLink(struct alias_link **, int); -static struct alias_link * -UseLink(struct libalias *, struct alias_link *); - -static struct alias_link * -ReLink(struct alias_link *, - struct in_addr, struct in_addr, struct in_addr, - u_short, u_short, int, int, int); - -static struct alias_link * -FindLinkOut(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); - -static struct alias_link * -FindLinkIn(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); - -static u_short _RandomPort(struct libalias *la); - -#define GET_NEW_PORT_MAX_ATTEMPTS 20 - /* get random port in network byte order */ static u_short _RandomPort(struct libalias *la) { @@ -2670,20 +2283,6 @@ fill_rule(void *buf, int bufsize, int rulenum, return ((char *)cmd - (char *)buf); } -static void ClearAllFWHoles(struct libalias *la); - -#define fw_setfield(la, field, num) \ -do { \ - (field)[(num) - la->fireWallBaseNum] = 1; \ -} /*lint -save -e717 */ while(0)/* lint -restore */ - -#define fw_clrfield(la, field, num) \ -do { \ - (field)[(num) - la->fireWallBaseNum] = 0; \ -} /*lint -save -e717 */ while(0)/* lint -restore */ - -#define fw_tstfield(la, field, num) ((field)[(num) - la->fireWallBaseNum]) - static void InitPunchFW(struct libalias *la) { diff --git a/sys/netinet/libalias/alias_db.h b/sys/netinet/libalias/alias_db.h new file mode 100644 index 000000000000..ec0b69c01f82 --- /dev/null +++ b/sys/netinet/libalias/alias_db.h @@ -0,0 +1,442 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2001 Charles Mott + * 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. + */ + +/* + Alias_db.c encapsulates all data structures used for storing + packet aliasing data. Other parts of the aliasing software + access data through functions provided in this file. + + Data storage is based on the notion of a "link", which is + established for ICMP echo/reply packets, UDP datagrams and + TCP stream connections. A link stores the original source + and destination addresses. For UDP and TCP, it also stores + source and destination port numbers, as well as an alias + port number. Links are also used to store information about + fragments. + + There is a facility for sweeping through and deleting old + links as new packets are sent through. A simple timeout is + used for ICMP and UDP links. TCP links are left alone unless + there is an incomplete connection, in which case the link + can be deleted after a certain amount of time. + + Initial version: August, 1996 (cjm) + + Version 1.4: September 16, 1996 (cjm) + Facility for handling incoming links added. + + Version 1.6: September 18, 1996 (cjm) + ICMP data handling simplified. + + Version 1.7: January 9, 1997 (cjm) + Fragment handling simplified. + Saves pointers for unresolved fragments. + Permits links for unspecified remote ports + or unspecified remote addresses. + Fixed bug which did not properly zero port + table entries after a link was deleted. + Cleaned up some obsolete comments. + + Version 1.8: January 14, 1997 (cjm) + Fixed data type error in StartPoint(). + (This error did not exist prior to v1.7 + and was discovered and fixed by Ari Suutari) + + Version 1.9: February 1, 1997 + Optionally, connections initiated from packet aliasing host + machine will will not have their port number aliased unless it + conflicts with an aliasing port already being used. (cjm) + + All options earlier being #ifdef'ed are now available through + a new interface, SetPacketAliasMode(). This allows run time + control (which is now available in PPP+pktAlias through the + 'alias' keyword). (ee) + + Added ability to create an alias port without + either destination address or port specified. + port type = ALIAS_PORT_UNKNOWN_DEST_ALL (ee) + + Removed K&R style function headers + and general cleanup. (ee) + + Added packetAliasMode to replace compiler #defines's (ee) + + Allocates sockets for partially specified + ports if ALIAS_USE_SOCKETS defined. (cjm) + + Version 2.0: March, 1997 + SetAliasAddress() will now clean up alias links + if the aliasing address is changed. (cjm) + + PacketAliasPermanentLink() function added to support permanent + links. (J. Fortes suggested the need for this.) + Examples: + + (192.168.0.1, port 23) <-> alias port 6002, unknown dest addr/port + + (192.168.0.2, port 21) <-> alias port 3604, known dest addr + unknown dest port + + These permanent links allow for incoming connections to + machines on the local network. They can be given with a + user-chosen amount of specificity, with increasing specificity + meaning more security. (cjm) + + Quite a bit of rework to the basic engine. The portTable[] + array, which kept track of which ports were in use was replaced + by a table/linked list structure. (cjm) + + SetExpire() function added. (cjm) + + DeleteLink() no longer frees memory association with a pointer + to a fragment (this bug was first recognized by E. Eklund in + v1.9). + + Version 2.1: May, 1997 (cjm) + Packet aliasing engine reworked so that it can handle + multiple external addresses rather than just a single + host address. + + PacketAliasRedirectPort() and PacketAliasRedirectAddr() + added to the API. The first function is a more generalized + version of PacketAliasPermanentLink(). The second function + implements static network address translation. + + Version 3.2: July, 2000 (salander and satoh) + Added FindNewPortGroup to get contiguous range of port values. + + Added QueryUdpTcpIn and QueryUdpTcpOut to look for an aliasing + link but not actually add one. + + Added FindRtspOut, which is closely derived from FindUdpTcpOut, + except that the alias port (from FindNewPortGroup) is provided + as input. + + See HISTORY file for additional revisions. +*/ + +#ifndef _ALIAS_DB_H_ +#define _ALIAS_DB_H_ + + +/* + Constants (note: constants are also defined + near relevant functions or structs) +*/ + +/* Timeouts (in seconds) for different link types */ +#define ICMP_EXPIRE_TIME 60 +#define UDP_EXPIRE_TIME 60 +#define PROTO_EXPIRE_TIME 60 +#define FRAGMENT_ID_EXPIRE_TIME 10 +#define FRAGMENT_PTR_EXPIRE_TIME 30 + +/* TCP link expire time for different cases */ +/* When the link has been used and closed - minimal grace time to + allow ACKs and potential re-connect in FTP (XXX - is this allowed?) */ +#ifndef TCP_EXPIRE_DEAD +#define TCP_EXPIRE_DEAD 10 +#endif + +/* When the link has been used and closed on one side - the other side + is allowed to still send data */ +#ifndef TCP_EXPIRE_SINGLEDEAD +#define TCP_EXPIRE_SINGLEDEAD 90 +#endif + +/* When the link isn't yet up */ +#ifndef TCP_EXPIRE_INITIAL +#define TCP_EXPIRE_INITIAL 300 +#endif + +/* When the link is up */ +#ifndef TCP_EXPIRE_CONNECTED +#define TCP_EXPIRE_CONNECTED 86400 +#endif + +/* Dummy port number codes used for FindLinkIn/Out() and AddLink(). + These constants can be anything except zero, which indicates an + unknown port number. */ + +#define NO_DEST_PORT 1 +#define NO_SRC_PORT 1 + +/* Matches any/unknown address in FindLinkIn/Out() and AddLink(). */ +static struct in_addr const ANY_ADDR = { INADDR_ANY }; + +/* Data Structures + + The fundamental data structure used in this program is + "struct alias_link". Whenever a TCP connection is made, + a UDP datagram is sent out, or an ICMP echo request is made, + a link record is made (if it has not already been created). + The link record is identified by the source address/port + and the destination address/port. In the case of an ICMP + echo request, the source port is treated as being equivalent + with the 16-bit ID number of the ICMP packet. + + The link record also can store some auxiliary data. For + TCP connections that have had sequence and acknowledgment + modifications, data space is available to track these changes. + A state field is used to keep track in changes to the TCP + connection state. ID numbers of fragments can also be + stored in the auxiliary space. Pointers to unresolved + fragments can also be stored. + + The link records support two independent chainings. Lookup + tables for input and out tables hold the initial pointers + the link chains. On input, the lookup table indexes on alias + port and link type. On output, the lookup table indexes on + source address, destination address, source port, destination + port and link type. +*/ + +/* used to save changes to ACK/sequence numbers */ +struct ack_data_record { + u_long ack_old; + u_long ack_new; + int delta; + int active; +}; + +/* Information about TCP connection */ +struct tcp_state { + int in; /* State for outside -> inside */ + int out; /* State for inside -> outside */ + int index; /* Index to ACK data array */ + /* Indicates whether ACK and sequence numbers been modified */ + int ack_modified; +}; + +/* Number of distinct ACK number changes + * saved for a modified TCP stream */ +#define N_LINK_TCP_DATA 3 +struct tcp_dat { + struct tcp_state state; + struct ack_data_record ack[N_LINK_TCP_DATA]; + /* Which firewall record is used for this hole? */ + int fwhole; +}; + +/* LSNAT server pool (circular list) */ +struct server { + struct in_addr addr; + u_short port; + struct server *next; +}; + +/* Main data structure */ +struct alias_link { + struct libalias *la; + /* Address and port information */ + struct in_addr src_addr; + struct in_addr dst_addr; + struct in_addr alias_addr; + struct in_addr proxy_addr; + u_short src_port; + u_short dst_port; + u_short alias_port; + u_short proxy_port; + struct server *server; + /* Type of link: TCP, UDP, ICMP, proto, frag */ + int link_type; +/* values for link_type */ +#define LINK_ICMP IPPROTO_ICMP +#define LINK_UDP IPPROTO_UDP +#define LINK_TCP IPPROTO_TCP +#define LINK_FRAGMENT_ID (IPPROTO_MAX + 1) +#define LINK_FRAGMENT_PTR (IPPROTO_MAX + 2) +#define LINK_ADDR (IPPROTO_MAX + 3) +#define LINK_PPTP (IPPROTO_MAX + 4) + + int flags; /* indicates special characteristics */ + int pflags; /* protocol-specific flags */ +/* flag bits */ +#define LINK_UNKNOWN_DEST_PORT 0x01 +#define LINK_UNKNOWN_DEST_ADDR 0x02 +#define LINK_PERMANENT 0x04 +#define LINK_PARTIALLY_SPECIFIED 0x03 /* logical-or of first two bits */ +#define LINK_UNFIREWALLED 0x08 + + int timestamp; /* Time link was last accessed */ +#ifndef NO_USE_SOCKETS + int sockfd; /* socket descriptor */ +#endif + /* Linked list of pointers for input and output lookup tables */ + union { + struct { + SPLAY_ENTRY(alias_link) out; + LIST_ENTRY (alias_link) in; + } all; + struct { + LIST_ENTRY (alias_link) list; + } pptp; + }; + struct { + TAILQ_ENTRY(alias_link) list; + int time; /* Expire time for link */ + } expire; + /* Auxiliary data */ + union { + char *frag_ptr; + struct in_addr frag_addr; + struct tcp_dat *tcp; + } data; +}; + +/* Clean up procedure. */ +static void finishoff(void); + +/* Internal utility routines (used only in alias_db.c) + +Lookup table starting points: + StartPointIn() -- link table initial search point for + incoming packets + StartPointOut() -- link table initial search point for + outgoing packets + +Miscellaneous: + SeqDiff() -- difference between two TCP sequences + ShowAliasStats() -- send alias statistics to a monitor file +*/ + +/* Local prototypes */ +static struct group_in * +StartPointIn(struct libalias *, struct in_addr, u_short, int, int); +static int SeqDiff(u_long, u_long); + +#ifndef NO_FW_PUNCH +/* Firewall control */ +static void InitPunchFW(struct libalias *); +static void UninitPunchFW(struct libalias *); +static void ClearFWHole(struct alias_link *); + +#endif + +/* Log file control */ +static void ShowAliasStats(struct libalias *); +static int InitPacketAliasLog(struct libalias *); +static void UninitPacketAliasLog(struct libalias *); + +void SctpShowAliasStats(struct libalias *la); + + +/* Splay handling */ +static inline int +cmp_out(struct alias_link *a, struct alias_link *b) { + int i = a->src_port - b->src_port; + if (i != 0) return (i); + i = a->src_addr.s_addr - b->src_addr.s_addr; + if (i != 0) return (i); + i = a->dst_addr.s_addr - b->dst_addr.s_addr; + if (i != 0) return (i); + i = a->dst_port - b->dst_port; + if (i != 0) return (i); + i = a->link_type - b->link_type; + return (i); +} +SPLAY_PROTOTYPE(splay_out, alias_link, all.out, cmp_out); + +static inline int +cmp_in(struct group_in *a, struct group_in *b) { + int i = a->alias_port - b->alias_port; + if (i != 0) return (i); + i = a->link_type - b->link_type; + if (i != 0) return (i); + i = a->alias_addr.s_addr - b->alias_addr.s_addr; + return (i); +} +SPLAY_PROTOTYPE(splay_in, group_in, in, cmp_in); + +/* Internal routines for finding, deleting and adding links + +Port Allocation: + GetNewPort() -- find and reserve new alias port number + GetSocket() -- try to allocate a socket for a given port + +Link creation and deletion: + CleanupAliasData() - remove all link chains from lookup table + CleanupLink() - look for a stale link + DeleteLink() - remove link + AddLink() - add link + ReLink() - change link + +Link search: + FindLinkOut() - find link for outgoing packets + FindLinkIn() - find link for incoming packets + +Port search: + FindNewPortGroup() - find an available group of ports +*/ + +/* Local prototypes */ +static int GetNewPort(struct libalias *, struct alias_link *, int); +#ifndef NO_USE_SOCKETS +static u_short GetSocket(struct libalias *, u_short, int *, int); +#endif +static void CleanupAliasData(struct libalias *, int); +static void CleanupLink(struct libalias *, struct alias_link **, int); +static void DeleteLink(struct alias_link **, int); +static struct alias_link * +UseLink(struct libalias *, struct alias_link *); + +static struct alias_link * +ReLink(struct alias_link *, + struct in_addr, struct in_addr, struct in_addr, + u_short, u_short, int, int, int); + +static struct alias_link * +FindLinkOut(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); + +static struct alias_link * +FindLinkIn(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); + +static u_short _RandomPort(struct libalias *la); + +#define GET_NEW_PORT_MAX_ATTEMPTS 20 + + +#ifndef NO_FW_PUNCH + +static void ClearAllFWHoles(struct libalias *la); + +#define fw_setfield(la, field, num) \ +do { \ + (field)[(num) - la->fireWallBaseNum] = 1; \ +} /*lint -save -e717 */ while(0)/* lint -restore */ + +#define fw_clrfield(la, field, num) \ +do { \ + (field)[(num) - la->fireWallBaseNum] = 0; \ +} /*lint -save -e717 */ while(0)/* lint -restore */ + +#define fw_tstfield(la, field, num) ((field)[(num) - la->fireWallBaseNum]) + +#endif /* !NO_FW_PUNCH */ + +#endif /* _ALIAS_DB_H_ */ From owner-dev-commits-src-main@freebsd.org Wed Jun 23 08:14: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 3E22D64B64A; Wed, 23 Jun 2021 08:14: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 4G8wz81B2Vz3mmh; Wed, 23 Jun 2021 08:14: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 0CF2320ED0; Wed, 23 Jun 2021 08:14: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 15N8ERww009161; Wed, 23 Jun 2021 08:14:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15N8ERvj009160; Wed, 23 Jun 2021 08:14:27 GMT (envelope-from git) Date: Wed, 23 Jun 2021 08:14:27 GMT Message-Id: <202106230814.15N8ERvj009160@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 17ac6d94dbc0 - main - ip_mroute: initialize vif ifnet properly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17ac6d94dbc03e3723acec1acfb004f789b9a033 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, 23 Jun 2021 08:14:28 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=17ac6d94dbc03e3723acec1acfb004f789b9a033 commit 17ac6d94dbc03e3723acec1acfb004f789b9a033 Author: Wojciech Macek AuthorDate: 2021-06-02 06:46:29 +0000 Commit: Wojciech Macek CommitDate: 2021-06-23 08:13:52 +0000 ip_mroute: initialize vif ifnet properly Use if_alloc to ensure all fields of ifnet are allocated properly Reported by: Damien Deville Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: mw Differential revision: https://reviews.freebsd.org/D30608 --- sys/netinet/ip_mroute.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index ee0c886f9f3d..72100b84fd59 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -103,6 +103,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -290,7 +291,7 @@ static struct pim_encap_pimhdr pim_encap_pimhdr = { VNET_DEFINE_STATIC(vifi_t, reg_vif_num) = VIFI_INVALID; #define V_reg_vif_num VNET(reg_vif_num) -VNET_DEFINE_STATIC(struct ifnet, multicast_register_if); +VNET_DEFINE_STATIC(struct ifnet *, multicast_register_if); #define V_multicast_register_if VNET(multicast_register_if) /* @@ -944,11 +945,10 @@ add_vif(struct vifctl *vifcp) MRW_WUNLOCK(); return EOPNOTSUPP; } else if (vifcp->vifc_flags & VIFF_REGISTER) { - ifp = &V_multicast_register_if; + ifp = V_multicast_register_if = if_alloc(IFT_LOOP); CTR2(KTR_IPMF, "%s: add register vif for ifp %p", __func__, ifp); if (V_reg_vif_num == VIFI_INVALID) { - if_initname(&V_multicast_register_if, "register_vif", 0); - V_multicast_register_if.if_flags = IFF_LOOPBACK; + if_initname(V_multicast_register_if, "register_vif", 0); V_reg_vif_num = vifcp->vifc_vifi; } } else { /* Make sure the interface supports multicast */ @@ -1012,8 +1012,11 @@ del_vif_locked(vifi_t vifi) if (!(vifp->v_flags & (VIFF_TUNNEL | VIFF_REGISTER))) if_allmulti(vifp->v_ifp, 0); - if (vifp->v_flags & VIFF_REGISTER) + if (vifp->v_flags & VIFF_REGISTER) { V_reg_vif_num = VIFI_INVALID; + if_free(V_multicast_register_if); + V_multicast_register_if = NULL; + } mtx_destroy(&vifp->v_spin); @@ -1568,7 +1571,7 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif) */ if (V_pim_assert_enabled && (vifi < V_numvifs) && V_viftable[vifi].v_ifp) { - if (ifp == &V_multicast_register_if) + if (ifp == V_multicast_register_if) PIMSTAT_INC(pims_rcv_registers_wrongiif); /* Get vifi for the incoming packet */ From owner-dev-commits-src-main@freebsd.org Wed Jun 23 10:05: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 D937D64C9AF; Wed, 23 Jun 2021 10:05:57 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8zRn1Grxz3vyv; Wed, 23 Jun 2021 10:05:56 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f47.google.com with SMTP id nb6so3095049ejc.10; Wed, 23 Jun 2021 03:05: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:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Swlsjn6KWVWCwoUlQkIbgaG7TpbEZZrbkSBE+z7ZSJw=; b=GexjGVC3fPNQNFmLsfAtLWZJWBETWO8VylzD5CdVr8Qss2z08NGCPB5zZeUr2qMd6t bQxDwnxMtO+QEvh540Q5fLZcINmpDb51wr5WXJSj3j9wWKg2nrW1eQk743nyD13xXiZk p6TOKU4jbBOrq/+Nuxy6gjDfSo4yK8Yxw34xnbJdwDAzmlZpCrvVVE9A14OiCAkQ1vdn I9bHPnTDAtJ7f2c/YQd7rYnThIjC05PtDQIXmPDgtEKEdYuQE1Y8y8Ccx7adRKw7XPff e2BudRhwrRDxaKeKj+L0qWOVA9YXwXSM2f7avMZoVJanj41GyV+KtjRSUaaVwbJbODGk cqnA== X-Gm-Message-State: AOAM532kxA/7s/Z7eX9ib0ws6/JLMqxvsnW36lAcCCPPDD1HM+3naEjx wADrQ8twXtqedA1tt/NKRZOyyI2IY/Jnpg== X-Google-Smtp-Source: ABdhPJx1g/oy37CdT55R9DAC4FbaxiqKBjKkxxCeqtiE57+zEF5CU0xNlaUxjdN6JevV478KDvWquw== X-Received: by 2002:a17:906:a019:: with SMTP id p25mr9051794ejy.483.1624442755594; Wed, 23 Jun 2021 03:05:55 -0700 (PDT) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com. [209.85.128.52]) by smtp.gmail.com with ESMTPSA id p19sm3568630edr.73.2021.06.23.03.05.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jun 2021 03:05:55 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id n23so1215971wms.2; Wed, 23 Jun 2021 03:05:55 -0700 (PDT) X-Received: by 2002:a7b:c187:: with SMTP id y7mr9600185wmi.13.1624442754990; Wed, 23 Jun 2021 03:05:54 -0700 (PDT) MIME-Version: 1.0 References: <202106191953.15JJrdpI039180@gitrepo.freebsd.org> In-Reply-To: <202106191953.15JJrdpI039180@gitrepo.freebsd.org> From: Alexander Richardson Date: Wed, 23 Jun 2021 11:05:44 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 9efcad61d830 - main - libalias: Restructure - Use AliasRange instead of PORT_BASE To: Lutz Donnerhacke Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4G8zRn1Grxz3vyv X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of arichardsonkde@gmail.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=arichardsonkde@gmail.com X-Spamd-Result: default: False [-2.94 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-0.94)[-0.940]; FORGED_SENDER(0.30)[arichardson@freebsd.org,arichardsonkde@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[arichardson@freebsd.org,arichardsonkde@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; TAGGED_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.218.47:from]; SPAMHAUS_ZRD(0.00)[209.85.218.47:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[209.85.218.47:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.218.47:from]; RCVD_TLS_ALL(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: Wed, 23 Jun 2021 10:05:57 -0000 On Sat, 19 Jun 2021 at 20:53, Lutz Donnerhacke wrote: > > The branch main has been updated by donner: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9efcad61d8309ecad3c15392b277fd329a1e45e4 > > commit 9efcad61d8309ecad3c15392b277fd329a1e45e4 > Author: Lutz Donnerhacke > AuthorDate: 2021-05-28 17:17:40 +0000 > Commit: Lutz Donnerhacke > CommitDate: 2021-06-19 19:40:09 +0000 > > libalias: Restructure - Use AliasRange instead of PORT_BASE > > Get rid of PORT_BASE, replace by AliasRange. Simplify code. > Factor out the search for a new port. Improves the perfomance a bit. > > Discussed with: Dimitry Luhtionov > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D30581 > --- > sys/netinet/libalias/alias_db.c | 171 +++++++++++++++++----------------------- > 1 file changed, 74 insertions(+), 97 deletions(-) > > diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c > index 5f199394eb99..6bfe19a9b2a9 100644 > --- a/sys/netinet/libalias/alias_db.c > +++ b/sys/netinet/libalias/alias_db.c > @@ -574,12 +574,20 @@ FindLinkOut(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, > static struct alias_link * > FindLinkIn(struct libalias *, struct in_addr, struct in_addr, u_short, u_short, int, int); > > -#define ALIAS_PORT_BASE 0x08000 > -#define ALIAS_PORT_MASK 0x07fff > -#define ALIAS_PORT_MASK_EVEN 0x07ffe > +static u_short _RandomPort(struct libalias *la); > + > #define GET_NEW_PORT_MAX_ATTEMPTS 20 > > -#define FIND_EVEN_ALIAS_BASE 1 > +/* get random port in network byte order */ > +static u_short > +_RandomPort(struct libalias *la) { > + u_short port; > + > + port = la->aliasPortLower + > + arc4random_uniform(la->aliasPortLength); > + > + return ntohs(port); > +} > > /* GetNewPort() allocates port numbers. Note that if a port number > is already in use, that does not mean that it cannot be used by > @@ -591,8 +599,7 @@ GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param) > { > int i; > int max_trials; > - u_short port_sys; > - u_short port_net; > + u_short port; > > LIBALIAS_LOCK_ASSERT(la); > /* > @@ -600,41 +607,18 @@ GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param) > * this parameter is zero or positive, it precisely specifies > * the port number. GetNewPort() will return this number > * without check that it is in use. > - > + * > + * The aliasing port is automatically selected by one of > + * two methods below: > + * > * When this parameter is GET_ALIAS_PORT, it indicates to get > * a randomly selected port number. > */ > - if (alias_port_param == GET_ALIAS_PORT) { > - /* > - * The aliasing port is automatically selected by one of > - * two methods below: > - */ > - max_trials = GET_NEW_PORT_MAX_ATTEMPTS; > - > - if (la->packetAliasMode & PKT_ALIAS_SAME_PORTS) { > - /* > - * When the PKT_ALIAS_SAME_PORTS option is chosen, > - * the first try will be the actual source port. If > - * this is already in use, the remainder of the > - * trials will be random. > - */ > - port_net = lnk->src_port; > - port_sys = ntohs(port_net); > - } else if (la->aliasPortLower) { > - /* First trial is a random port in the aliasing range. */ > - port_sys = la->aliasPortLower + > - (arc4random() % la->aliasPortLength); > - port_net = htons(port_sys); > - } else { > - /* First trial and all subsequent are random. */ > - port_sys = arc4random() & ALIAS_PORT_MASK; > - port_sys += ALIAS_PORT_BASE; > - port_net = htons(port_sys); > - } > - } else if (alias_port_param >= 0 && alias_port_param < 0x10000) { > + if (alias_port_param >= 0 && alias_port_param < 0x10000) { > lnk->alias_port = (u_short) alias_port_param; > return (0); > - } else { > + } > + if (alias_port_param != GET_ALIAS_PORT) { > #ifdef LIBALIAS_DEBUG > fprintf(stderr, "PacketAlias/GetNewPort(): "); > fprintf(stderr, "input parameter error\n"); > @@ -642,58 +626,57 @@ GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param) > return (-1); > } > > + max_trials = GET_NEW_PORT_MAX_ATTEMPTS; > + > + /* > + * When the PKT_ALIAS_SAME_PORTS option is chosen, > + * the first try will be the actual source port. If > + * this is already in use, the remainder of the > + * trials will be random. > + */ > + port = (la->packetAliasMode & PKT_ALIAS_SAME_PORTS) > + ? lnk->src_port > + : _RandomPort(la); > + > /* Port number search */ > - for (i = 0; i < max_trials; i++) { > - int go_ahead; > + for (i = 0; i < max_trials; i++, port = _RandomPort(la)) { > + struct group_in *grp; > struct alias_link *search_result; > > - search_result = FindLinkIn(la, lnk->dst_addr, lnk->alias_addr, > - lnk->dst_port, port_net, > - lnk->link_type, 0); > + grp = StartPointIn(la, lnk->alias_addr, port, lnk->link_type, 0); > + if (grp == NULL) > + break; > > + LIST_FOREACH(search_result, &grp->full, all.in) { > + if (lnk->dst_addr.s_addr == search_result->dst_addr.s_addr && > + lnk->dst_port == search_result->dst_port) > + break; /* found match */ > + } > if (search_result == NULL) > - go_ahead = 1; > - else if (!(lnk->flags & LINK_PARTIALLY_SPECIFIED) > - && (search_result->flags & LINK_PARTIALLY_SPECIFIED)) > - go_ahead = 1; > - else > - go_ahead = 0; > + break; > + } > > - if (go_ahead) { > -#ifndef NO_USE_SOCKETS > - if ((la->packetAliasMode & PKT_ALIAS_USE_SOCKETS) > - && (lnk->flags & LINK_PARTIALLY_SPECIFIED) > - && ((lnk->link_type == LINK_TCP) || > - (lnk->link_type == LINK_UDP))) { > - if (GetSocket(la, port_net, &lnk->sockfd, lnk->link_type)) { > - lnk->alias_port = port_net; > - return (0); > - } > - } else { > + if (i >= max_trials) { > +#ifdef LIBALIAS_DEBUG > + fprintf(stderr, "PacketAlias/GetNewPort(): "); > + fprintf(stderr, "could not find free port\n"); > #endif > - lnk->alias_port = port_net; > - return (0); > + return (-1); > + } > + > #ifndef NO_USE_SOCKETS > - } > -#endif > - } > - if (la->aliasPortLower) { > - port_sys = la->aliasPortLower + > - (arc4random() % la->aliasPortLength); > - port_net = htons(port_sys); > - } else { > - port_sys = arc4random() & ALIAS_PORT_MASK; > - port_sys += ALIAS_PORT_BASE; > - port_net = htons(port_sys); > + if ((la->packetAliasMode & PKT_ALIAS_USE_SOCKETS) && > + (lnk->flags & LINK_PARTIALLY_SPECIFIED) && > + ((lnk->link_type == LINK_TCP) || > + (lnk->link_type == LINK_UDP))) { > + if (!GetSocket(la, port, &lnk->sockfd, lnk->link_type)) { > + return (-1); > } > } > - > -#ifdef LIBALIAS_DEBUG > - fprintf(stderr, "PacketAlias/GetNewPort(): "); > - fprintf(stderr, "could not find free port\n"); > #endif > + lnk->alias_port = port; > > - return (-1); > + return (0); > } > > #ifndef NO_USE_SOCKETS > @@ -760,7 +743,7 @@ FindNewPortGroup(struct libalias *la, > { > int i, j; > int max_trials; > - u_short port_sys; > + u_short port; > int link_type; > > LIBALIAS_LOCK_ASSERT(la); > @@ -792,39 +775,31 @@ FindNewPortGroup(struct libalias *la, > * try will be the actual source port. If this is already > * in use, the remainder of the trials will be random. > */ > - port_sys = ntohs(src_port); > + port = src_port; > > } else { > - /* First trial and all subsequent are random. */ > - if (align == FIND_EVEN_ALIAS_BASE) > - port_sys = arc4random() & ALIAS_PORT_MASK_EVEN; > - else > - port_sys = arc4random() & ALIAS_PORT_MASK; > - > - port_sys += ALIAS_PORT_BASE; > + port = _RandomPort(la); > } > > /* Port number search */ > - for (i = 0; i < max_trials; i++) { > + for (i = 0; i < max_trials; i++, port = _RandomPort(la)) { > struct alias_link *search_result; > > - for (j = 0; j < port_count; j++) > + if (align) > + port &= htons(0xfffe); > + > + for (j = 0; j < port_count; j++) { > + u_short port_j = ntohs(port) + j; > + > if ((search_result = FindLinkIn(la, dst_addr, > - alias_addr, dst_port, htons(port_sys + j), > + alias_addr, dst_port, htons(port_j), > link_type, 0)) != NULL) > break; > + } > > /* Found a good range, return base */ > if (j == port_count) > - return (htons(port_sys)); > - > - /* Find a new base to try */ > - if (align == FIND_EVEN_ALIAS_BASE) > - port_sys = arc4random() & ALIAS_PORT_MASK_EVEN; > - else > - port_sys = arc4random() & ALIAS_PORT_MASK; > - > - port_sys += ALIAS_PORT_BASE; > + return (port); > } > > #ifdef LIBALIAS_DEBUG > @@ -2555,6 +2530,8 @@ LibAliasInit(struct libalias *la) > > la->aliasAddress.s_addr = INADDR_ANY; > la->targetAddress.s_addr = INADDR_ANY; > + la->aliasPortLower = 0x8000; > + la->aliasPortLength = 0x8000; > > la->icmpLinkCount = 0; > la->udpLinkCount = 0; Hi, This commit or one of the previous ones appears to have broken three tests: sys.netpfil.common.nat.ipfw_basic sys.netpfil.common.nat.ipfw_cgn sys.netpfil.common.nat.ipfw_portalias See https://ci.freebsd.org/job/FreeBSD-main-amd64-test/18437/ Could you look into this? Thanks, Alex From owner-dev-commits-src-main@freebsd.org Wed Jun 23 10:08: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 911A764D033; Wed, 23 Jun 2021 10:08:27 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.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 4G8zVf4MqTz3wXG; Wed, 23 Jun 2021 10:08:26 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ed1-f45.google.com with SMTP id h17so2614289edw.11; Wed, 23 Jun 2021 03:08:26 -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=eOO16uLSDCDSk89LRrhA7b3IB+GxhUcogJhqXbQjEpE=; b=PRFYcaNm7e1DIxX6T63fAX/G183CYPcWFHHLC7Q4S4PaEDJqhIv7Vwapj//jBbnfff Ot62pe+F3aKJvN1M/cF5dIdYU2xE6QVfgbtM/L1pQitoCf6ePXN96Y6EixfG5Wt5zsCn 5VpHWE9rmUIKeF4xpRMo9371Vkc2OFaWuCyAYaHmtpZrNZY+KBLG5uVx33Af75cx7kZq EyrAMFXO/ThawR4Cu941xr1TPf62LmFyiG0G/r+bGVVJ28qJ6VuFP9Bh56oJF9LddvQ2 KEUcO5DfEGZw5KYRRFjYG6rjWGhU+pezYuVGi/lBrYVoY8ZMY/d+St3o+oxqZHvem1lf oEjw== X-Gm-Message-State: AOAM533pQw1a3WnPi0qqeVeC/PvtT9FJMMwIPKdOsKSgE7YzRdrcZuDi wC198/1F5PGTulbNZ594iW7VeIwEFQGhBw== X-Google-Smtp-Source: ABdhPJxNUBrCMwavN6T6Fdb46CpWzAGrFQXZAkL+R1FRMFg6+YNrFhwmnODW39uKDiNuoZ47/B4qXg== X-Received: by 2002:a05:6402:50cb:: with SMTP id h11mr1971781edb.97.1624442904785; Wed, 23 Jun 2021 03:08:24 -0700 (PDT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com. [209.85.128.48]) by smtp.gmail.com with ESMTPSA id y6sm796360edr.65.2021.06.23.03.08.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jun 2021 03:08:24 -0700 (PDT) Received: by mail-wm1-f48.google.com with SMTP id j11-20020a05600c1c0bb02901e23d4c0977so2986156wms.0; Wed, 23 Jun 2021 03:08:24 -0700 (PDT) X-Received: by 2002:a7b:c187:: with SMTP id y7mr9612097wmi.13.1624442904342; Wed, 23 Jun 2021 03:08:24 -0700 (PDT) MIME-Version: 1.0 References: <202106192010.15JKAbQ8061792@gitrepo.freebsd.org> In-Reply-To: <202106192010.15JKAbQ8061792@gitrepo.freebsd.org> From: Alexander Richardson Date: Wed, 23 Jun 2021 11:08:13 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 935fc93af157 - main - libalias: Switch to efficient data structure for outgoing traffic To: Lutz Donnerhacke Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4G8zVf4MqTz3wXG X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of arichardsonkde@gmail.com designates 209.85.208.45 as permitted sender) smtp.mailfrom=arichardsonkde@gmail.com X-Spamd-Result: default: False [-2.93 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-0.93)[-0.933]; FORGED_SENDER(0.30)[arichardson@freebsd.org,arichardsonkde@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.208.45:from]; R_DKIM_NA(0.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[arichardson@freebsd.org,arichardsonkde@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.208.45:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[209.85.208.45:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.208.45:from]; RCVD_TLS_ALL(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: Wed, 23 Jun 2021 10:08:27 -0000 On Sat, 19 Jun 2021 at 21:10, Lutz Donnerhacke wrote: > > The branch main has been updated by donner: > > URL: https://cgit.FreeBSD.org/src/commit/?id=935fc93af157dee352eb4b6c83f8a2a9e7fd9a4e > > commit 935fc93af157dee352eb4b6c83f8a2a9e7fd9a4e > Author: Lutz Donnerhacke > AuthorDate: 2021-05-27 21:42:54 +0000 > Commit: Lutz Donnerhacke > CommitDate: 2021-06-19 20:09:44 +0000 > > libalias: Switch to efficient data structure for outgoing traffic > > Current data structure is using a hash of unordered lists. Those > unordered lists are quite efficient, because the least recently > inserted entries are most likely to be used again. In order to avoid > long search times in other cases, the lists are hashed into many > buckets. Unfortunatly a search for a miss needs an exhaustive > inspection and a careful definition of the hash. > > Splay trees offer a similar feature - almost O(1) for access of the > least recently used entries), and amortized O(ln(n) - for almost all > other cases. Get rid of the hash. > > Discussed with: Dimitry Luhtionov > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D30516 > --- > sys/netinet/libalias/alias_db.c | 81 ++++++++++++++++---------------------- > sys/netinet/libalias/alias_local.h | 4 +- > 2 files changed, 36 insertions(+), 49 deletions(-) > > diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c > index c5ecc49ed191..a5a21e40d0cf 100644 > --- a/sys/netinet/libalias/alias_db.c > +++ b/sys/netinet/libalias/alias_db.c > @@ -324,11 +324,11 @@ struct alias_link { > /* Linked list of pointers for input and output lookup tables */ > union { > struct { > - LIST_ENTRY(alias_link) in; > - LIST_ENTRY(alias_link) out; > + SPLAY_ENTRY(alias_link) out; > + LIST_ENTRY (alias_link) in; > } all; > struct { > - LIST_ENTRY(alias_link) list; > + LIST_ENTRY (alias_link) list; > } pptp; > }; > struct { > @@ -389,8 +389,6 @@ Miscellaneous: > /* Local prototypes */ > static struct group_in * > StartPointIn(struct libalias *, struct in_addr, u_short, int, int); > -static u_int > -StartPointOut(struct in_addr, struct in_addr, u_short, u_short, int); > static int SeqDiff(u_long, u_long); > > #ifndef NO_FW_PUNCH > @@ -408,6 +406,24 @@ static void UninitPacketAliasLog(struct libalias *); > > void SctpShowAliasStats(struct libalias *la); > > + > +/* Splay handling */ > +static inline int > +cmp_out(struct alias_link *a, struct alias_link *b) { > + int i = a->src_port - b->src_port; > + if (i != 0) return (i); > + i = a->src_addr.s_addr - b->src_addr.s_addr; > + if (i != 0) return (i); > + i = a->dst_addr.s_addr - b->dst_addr.s_addr; > + if (i != 0) return (i); > + i = a->dst_port - b->dst_port; > + if (i != 0) return (i); > + i = a->link_type - b->link_type; > + return (i); > +} > +SPLAY_PROTOTYPE(splay_out, alias_link, all.out, cmp_out); > +SPLAY_GENERATE(splay_out, alias_link, all.out, cmp_out); > + > #define INGUARD \ > if (grp->alias_port != alias_port || \ > grp->link_type != link_type || \ > @@ -449,21 +465,6 @@ StartPointIn(struct libalias *la, > } > #undef INGUARD > > -static u_int > -StartPointOut(struct in_addr src_addr, struct in_addr dst_addr, > - u_short src_port, u_short dst_port, int link_type) > -{ > - u_int n; > - > - n = src_addr.s_addr; > - n += dst_addr.s_addr; > - n += src_port; > - n += dst_port; > - n += link_type; > - > - return (n % LINK_TABLE_OUT_SIZE); > -} > - > static int > SeqDiff(u_long x, u_long y) > { > @@ -893,7 +894,7 @@ DeleteLink(struct alias_link **plnk, int deletePermanent) > } while ((curr = next) != head); > } else { > /* Adjust output table pointers */ > - LIST_REMOVE(lnk, all.out); > + SPLAY_REMOVE(splay_out, &la->linkSplayOut, lnk); > } > > /* Adjust input table pointers */ > @@ -956,7 +957,6 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, > struct in_addr alias_addr, u_short src_port, u_short dst_port, > int alias_port_param, int link_type) > { > - u_int start_point; > struct alias_link *lnk; > > LIBALIAS_LOCK_ASSERT(la); > @@ -1085,9 +1085,7 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, > } > > /* Set up pointers for output lookup table */ > - start_point = StartPointOut(src_addr, dst_addr, > - src_port, dst_port, link_type); > - LIST_INSERT_HEAD(&la->linkTableOut[start_point], lnk, all.out); > + SPLAY_INSERT(splay_out, &la->linkSplayOut, lnk); > > /* Set up pointers for input lookup table */ > if (lnk->flags & LINK_PARTIALLY_SPECIFIED) > @@ -1140,35 +1138,25 @@ ReLink(struct alias_link *old_lnk, > return (new_lnk); > } > > - > -#define OUTGUARD \ > - if (lnk->src_port != src_port || \ > - lnk->src_addr.s_addr != src_addr.s_addr || \ > - lnk->dst_addr.s_addr != dst_addr.s_addr || \ > - lnk->dst_port != dst_port || \ > - lnk->link_type != link_type) \ > - continue; > - > static struct alias_link * > _SearchLinkOut(struct libalias *la, struct in_addr src_addr, > struct in_addr dst_addr, > u_short src_port, > u_short dst_port, > int link_type) { > - u_int i; > struct alias_link *lnk; > + struct alias_link needle = { > + .src_addr = src_addr, > + .dst_addr = dst_addr, > + .src_port = src_port, > + .dst_port = dst_port, > + .link_type = link_type > + }; > > - i = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); > - LIST_FOREACH(lnk, &la->linkTableOut[i], all.out) { > - OUTGUARD; > - return (UseLink(la, lnk)); > - } > - > - return (NULL); > + lnk = SPLAY_FIND(splay_out, &la->linkSplayOut, &needle); > + return (UseLink(la, lnk)); > } > > -#undef OUTGUARD > - > static struct alias_link * > _FindLinkOut(struct libalias *la, struct in_addr src_addr, > struct in_addr dst_addr, > @@ -2333,7 +2321,7 @@ LibAliasAddServer(struct libalias *la, struct alias_link *lnk, struct in_addr ad > if (head == NULL) { > server->next = server; > /* not usable for outgoing connections */ > - LIST_REMOVE(lnk, all.out); > + SPLAY_REMOVE(splay_out, &la->linkSplayOut, lnk); > } else { > struct server *s; > > @@ -2502,8 +2490,7 @@ LibAliasInit(struct libalias *la) > LibAliasTime = time(NULL); > #endif > > - for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) > - LIST_INIT(&la->linkTableOut[i]); > + SPLAY_INIT(&la->linkSplayOut); > for (i = 0; i < LINK_TABLE_IN_SIZE; i++) > LIST_INIT(&la->groupTableIn[i]); > LIST_INIT(&la->pptpList); > diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h > index 5628adac203e..a1ad08a979d2 100644 > --- a/sys/netinet/libalias/alias_local.h > +++ b/sys/netinet/libalias/alias_local.h > @@ -48,6 +48,7 @@ > #ifndef _ALIAS_LOCAL_H_ > #define _ALIAS_LOCAL_H_ > > +#include > #include > #include > > @@ -66,7 +67,6 @@ > #endif > > /* Sizes of input and output link tables */ > -#define LINK_TABLE_OUT_SIZE 4001 > #define LINK_TABLE_IN_SIZE 4001 > > #define GET_ALIAS_PORT -1 > @@ -100,7 +100,7 @@ struct libalias { > /* Lookup table of pointers to chains of link records. > * Each link record is doubly indexed into input and > * output lookup tables. */ > - LIST_HEAD (, alias_link) linkTableOut[LINK_TABLE_OUT_SIZE]; > + SPLAY_HEAD(splay_out, alias_link) linkSplayOut; > LIST_HEAD (, group_in) groupTableIn[LINK_TABLE_IN_SIZE]; > LIST_HEAD (, alias_link) pptpList; > /* HouseKeeping */ Hi, This commit appears to have introduced a SIGBUS when running some of the tests: Program terminated with signal SIGBUS, Bus error. #0 cmp_out (a=0x80180e080, b=0x5a5a5a5a5a5a5a5a) at /usr/src/sys/netinet/libalias/alias_db.c:413 413 /usr/src/sys/netinet/libalias/alias_db.c: No such file or directory. #0 cmp_out (a=0x80180e080, b=0x5a5a5a5a5a5a5a5a) at /usr/src/sys/netinet/libalias/alias_db.c:413 #1 splay_out_SPLAY (head=head@entry=0x8018100e0, elm=elm@entry=0x80180e080) at /usr/src/sys/netinet/libalias/alias_db.c:425 #2 0x00000008010908d9 in splay_out_SPLAY_REMOVE (head=0x8018100e0, elm=0x80180e080) at /usr/src/sys/netinet/libalias/alias_db.c:425 #3 DeleteLink (plnk=plnk@entry=0x7fffffffd530, deletePermanent=, deletePermanent@entry=1) at /usr/src/sys/netinet/libalias/alias_db.c:883 #4 0x0000000801091251 in CleanupAliasData (la=0x8018100c0, deletePermanent=1) at /usr/src/sys/netinet/libalias/alias_db.c:819 #5 LibAliasUninit (la=0x8018100c0) at /usr/src/sys/netinet/libalias/alias_db.c:2542 #6 0x000000080107f0a7 in atf_tc_run (tc=0x102a628, tc@entry=0x801809020, resfile=, resfile@entry=0x0) at /usr/src/contrib/atf/atf-c/tc.c:1060 #7 0x00000008010811de in atf_tp_run (tp=tp@entry=0x7fffffffd9e8, tcname=tcname@entry=0x801809020 "3_redirectany", resfile=) at /usr/src/contrib/atf/atf-c/tp.c:201 #8 0x0000000801081bdb in run_tc (tp=0x7fffffffd9e8, p=0x7fffffffda00, exitcode=) at /usr/src/contrib/atf/atf-c/detail/tp_main.c:504 #9 controlled_main (argc=, argv=0x7fffffffeaa0, add_tcs_hook=0x1023b90, exitcode=) at /usr/src/contrib/atf/atf-c/detail/tp_main.c:574 #10 atf_tp_main (argc=, argv=0x7fffffffeaa0, add_tcs_hook=0x1023b90) at /usr/src/contrib/atf/atf-c/detail/tp_main.c:604 #11 0x000000000102395d in ?? () #12 0x00007fffffffed68 in ?? () #13 0x0000000000000000 in ?? () Source: https://ci.freebsd.org/job/FreeBSD-main-amd64-test/18438/testReport/junit/sys.netinet.libalias/3_natin/1_portforward/ See https://ci.freebsd.org/job/FreeBSD-main-amd64-test/18438/#showFailuresLink Could you have a look? Thanks, Alex From owner-dev-commits-src-main@freebsd.org Wed Jun 23 14:38:58 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 66991650EF0; Wed, 23 Jun 2021 14:38: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 4G95Vp21rDz4n4K; Wed, 23 Jun 2021 14:38: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 2E68326189; Wed, 23 Jun 2021 14:38: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 15NEcwLj014385; Wed, 23 Jun 2021 14:38:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NEcwhr014384; Wed, 23 Jun 2021 14:38:58 GMT (envelope-from git) Date: Wed, 23 Jun 2021 14:38:58 GMT Message-Id: <202106231438.15NEcwhr014384@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: 2bbeada0f75a - main - rpc.lockd: Use libc strnlen() instead of reimplementing it 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: 2bbeada0f75a78c24ef9eaeb97c24a672425791d 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, 23 Jun 2021 14:38:58 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2bbeada0f75a78c24ef9eaeb97c24a672425791d commit 2bbeada0f75a78c24ef9eaeb97c24a672425791d Author: Mark Johnston AuthorDate: 2021-06-23 14:06:57 +0000 Commit: Mark Johnston CommitDate: 2021-06-23 14:06:57 +0000 rpc.lockd: Use libc strnlen() instead of reimplementing it No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- usr.sbin/rpc.lockd/lockd_lock.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/usr.sbin/rpc.lockd/lockd_lock.c b/usr.sbin/rpc.lockd/lockd_lock.c index 25e74ed6a7de..1fc4ce23597a 100644 --- a/usr.sbin/rpc.lockd/lockd_lock.c +++ b/usr.sbin/rpc.lockd/lockd_lock.c @@ -217,7 +217,6 @@ enum nlm_stats do_test(struct file_lock *fl, enum nlm_stats do_unlock(struct file_lock *fl); enum nlm_stats do_lock(struct file_lock *fl); void do_clear(const char *hostname); -size_t strnlen(const char *, size_t); void debuglog(char const *fmt, ...) @@ -373,17 +372,6 @@ copy_nlm4_lock_to_nlm4_holder(src, exclusive, dest) dest->l_len = src->l_len; } - -size_t -strnlen(const char *s, size_t len) -{ - size_t n; - - for (n = 0; s[n] != 0 && n < len; n++) - ; - return n; -} - /* * allocate_file_lock: Create a lock with the given parameters */ From owner-dev-commits-src-main@freebsd.org Wed Jun 23 14:38: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 8A98D651894; Wed, 23 Jun 2021 14:38: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 4G95Vq3N10z4n6b; Wed, 23 Jun 2021 14:38: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 5975C25D5A; Wed, 23 Jun 2021 14:38: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 15NEcxQR014409; Wed, 23 Jun 2021 14:38:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NEcxQW014408; Wed, 23 Jun 2021 14:38:59 GMT (envelope-from git) Date: Wed, 23 Jun 2021 14:38:59 GMT Message-Id: <202106231438.15NEcxQW014408@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: 4420bb6a8642 - main - mdconfig tests: Correct a copy-pasted test description 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: 4420bb6a8642e3a24f30c2917dc994cf5800ea6f 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, 23 Jun 2021 14:38:59 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4420bb6a8642e3a24f30c2917dc994cf5800ea6f commit 4420bb6a8642e3a24f30c2917dc994cf5800ea6f Author: Mark Johnston AuthorDate: 2021-06-23 14:37:40 +0000 Commit: Mark Johnston CommitDate: 2021-06-23 14:37:40 +0000 mdconfig tests: Correct a copy-pasted test description MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sbin/mdconfig/tests/mdconfig_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/mdconfig/tests/mdconfig_test.sh b/sbin/mdconfig/tests/mdconfig_test.sh index 0dd520826056..92ba0342447c 100755 --- a/sbin/mdconfig/tests/mdconfig_test.sh +++ b/sbin/mdconfig/tests/mdconfig_test.sh @@ -171,7 +171,7 @@ attach_vnode_larger_than_file_cleanup() atf_test_case attach_vnode_sector_size cleanup attach_vnode_sector_size_head() { - atf_set "descr" "Tests mdconfig -s with size greater than the file size" + atf_set "descr" "Tests mdconfig -S with a backing file" } attach_vnode_sector_size_body() { From owner-dev-commits-src-main@freebsd.org Wed Jun 23 16:31: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 B0096653255; Wed, 23 Jun 2021 16:31: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 4G98194Rsfz3Gqn; Wed, 23 Jun 2021 16:31: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 7FF6D27833; Wed, 23 Jun 2021 16:31: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 15NGVvpd071688; Wed, 23 Jun 2021 16:31:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NGVv4G071671; Wed, 23 Jun 2021 16:31:57 GMT (envelope-from git) Date: Wed, 23 Jun 2021 16:31:57 GMT Message-Id: <202106231631.15NGVv4G071671@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: 4fb3e0bb94ab - main - devctl: add RENAME devctl event for IFNET 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: 4fb3e0bb94abdd2d44b23937670a83876d11b97f 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, 23 Jun 2021 16:31:57 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4fb3e0bb94abdd2d44b23937670a83876d11b97f commit 4fb3e0bb94abdd2d44b23937670a83876d11b97f Author: Rozhuk Ivan AuthorDate: 2021-06-23 16:15:11 +0000 Commit: Warner Losh CommitDate: 2021-06-23 16:20:58 +0000 devctl: add RENAME devctl event for IFNET Add devd event on network iface rename. Reviewed by: imp@,asomers@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30839 --- sbin/devd/devd.conf.5 | 4 +++- sys/net/if.c | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5 index 1a1071584f70..56e2df684f32 100644 --- a/sbin/devd/devd.conf.5 +++ b/sbin/devd/devd.conf.5 @@ -40,7 +40,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd October 12, 2020 +.Dd June 23, 2021 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -467,6 +467,8 @@ Carrier status changed to DOWN. The network interface is attached to the system. .It Li IFNET Ta Em inet Ta Li DETACH Ta The network interface is detached from the system. +.It Li IFNET Ta Em inet Ta Li RENAME Ta +The network interface is renamed. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact diff --git a/sys/net/if.c b/sys/net/if.c index f615d82636be..cfa795904bc9 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2468,6 +2468,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) size_t descrlen; char *descrbuf, *odescrbuf; char new_name[IFNAMSIZ]; + char old_name[IFNAMSIZ], strbuf[IFNAMSIZ + 8]; struct ifaddr *ifa; struct sockaddr_dl *sdl; @@ -2673,6 +2674,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) if_printf(ifp, "changing name to '%s'\n", new_name); IF_ADDR_WLOCK(ifp); + strlcpy(old_name, ifp->if_xname, sizeof(old_name)); strlcpy(ifp->if_xname, new_name, sizeof(ifp->if_xname)); ifa = ifp->if_addr; sdl = (struct sockaddr_dl *)ifa->ifa_addr; @@ -2700,6 +2702,9 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) rt_ifannouncemsg(ifp, IFAN_ARRIVAL); ifp->if_flags &= ~IFF_RENAMING; + + snprintf(strbuf, sizeof(strbuf), "name=%s", new_name); + devctl_notify("IFNET", old_name, "RENAME", strbuf); break; #ifdef VIMAGE From owner-dev-commits-src-main@freebsd.org Wed Jun 23 16:31:58 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 D5CDD6530B4; Wed, 23 Jun 2021 16:31: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 4G981B5hl5z3HL9; Wed, 23 Jun 2021 16:31: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 A1FC427A9A; Wed, 23 Jun 2021 16:31: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 15NGVwtt072784; Wed, 23 Jun 2021 16:31:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NGVwUD072783; Wed, 23 Jun 2021 16:31:58 GMT (envelope-from git) Date: Wed, 23 Jun 2021 16:31:58 GMT Message-Id: <202106231631.15NGVwUD072783@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: a75819461ec7 - main - devctl: add ADDR_ADD and ADDR_DEL devctl event for IFNET 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: a75819461ec7c7d8468498362f9104637ff7c9e9 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, 23 Jun 2021 16:31:58 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a75819461ec7c7d8468498362f9104637ff7c9e9 commit a75819461ec7c7d8468498362f9104637ff7c9e9 Author: Rozhuk Ivan AuthorDate: 2021-06-23 16:20:10 +0000 Commit: Warner Losh CommitDate: 2021-06-23 16:26:56 +0000 devctl: add ADDR_ADD and ADDR_DEL devctl event for IFNET Add devd event on network iface address add/remove. Can be used to automate actions on any address change. Reviewed by: imp@ (and minor style tweaks) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30840 --- sbin/devd/devd.conf.5 | 4 ++++ sys/net/route.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5 index 56e2df684f32..f6579ac3f20f 100644 --- a/sbin/devd/devd.conf.5 +++ b/sbin/devd/devd.conf.5 @@ -469,6 +469,10 @@ The network interface is attached to the system. The network interface is detached from the system. .It Li IFNET Ta Em inet Ta Li RENAME Ta The network interface is renamed. +.It Li IFNET Ta Em inet Ta Li ADDR_ADD Ta +The network interface address added. +.It Li IFNET Ta Em inet Ta Li ADDR_DEL Ta +The network interface address removed. .El .Pp .Bl -column "System" "Subsystem" "1234567" -compact diff --git a/sys/net/route.c b/sys/net/route.c index 2416aa9a983f..4f7eb6f64210 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,7 @@ #include #include +#include VNET_PCPUSTAT_DEFINE(struct rtstat, rtstat); @@ -685,6 +687,10 @@ rt_maskedcopy(struct sockaddr *src, struct sockaddr *dst, struct sockaddr *netma int rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum) { +#if defined(INET) || defined(INET6) + struct sockaddr *sa = ifa->ifa_addr; + struct ifnet *ifp = ifa->ifa_ifp; +#endif KASSERT(cmd == RTM_ADD || cmd == RTM_DELETE, ("unexpected cmd %d", cmd)); @@ -693,6 +699,29 @@ rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum) EVENTHANDLER_DIRECT_INVOKE(rt_addrmsg, ifa, cmd); +#ifdef INET + if (sa->sa_family == AF_INET) { + char addrstr[INET_ADDRSTRLEN]; + char strbuf[INET_ADDRSTRLEN + 12]; + + inet_ntoa_r(((struct sockaddr_in *)sa)->sin_addr, addrstr); + snprintf(strbuf, sizeof(strbuf), "address=%s", addrstr); + devctl_notify("IFNET", ifp->if_xname, + (cmd == RTM_ADD) ? "ADDR_ADD" : "ADDR_DEL", strbuf); + } +#endif +#ifdef INET6 + if (sa->sa_family == AF_INET6) { + char addrstr[INET6_ADDRSTRLEN]; + char strbuf[INET6_ADDRSTRLEN + 12]; + + ip6_sprintf(addrstr, IFA_IN6(ifa)); + snprintf(strbuf, sizeof(strbuf), "address=%s", addrstr); + devctl_notify("IFNET", ifp->if_xname, + (cmd == RTM_ADD) ? "ADDR_ADD" : "ADDR_DEL", strbuf); + } +#endif + if (V_rt_add_addr_allfibs) fibnum = RT_ALL_FIBS; return (rtsock_addrmsg(cmd, ifa, fibnum)); From owner-dev-commits-src-main@freebsd.org Wed Jun 23 16:41: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 076696537BE; Wed, 23 Jun 2021 16:41: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 4G98Cd6mGHz3HS0; Wed, 23 Jun 2021 16:41: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 D120227C1E; Wed, 23 Jun 2021 16:41: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 15NGf1re083696; Wed, 23 Jun 2021 16:41:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NGf1xH083695; Wed, 23 Jun 2021 16:41:01 GMT (envelope-from git) Date: Wed, 23 Jun 2021 16:41:01 GMT Message-Id: <202106231641.15NGf1xH083695@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: f13da24715a7 - main - net/bpf: Fix writing of buffer bigger than PAGESIZE 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: f13da24715a75ce0fdac31062866877d980aa908 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, 23 Jun 2021 16:41:02 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f13da24715a75ce0fdac31062866877d980aa908 commit f13da24715a75ce0fdac31062866877d980aa908 Author: Florian Florensa AuthorDate: 2018-02-16 09:53:22 +0000 Commit: Warner Losh CommitDate: 2021-06-23 16:39:18 +0000 net/bpf: Fix writing of buffer bigger than PAGESIZE When allocating the mbuf we used m_get2 which fails if len is superior to MJUMPAGESIZE, if its the case, use m_getjcl instead. Reviewed by: kp@ PR: 205164 Pull Request: https://github.com/freebsd/freebsd-src/pull/131 --- sys/net/bpf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 605e7aa39fdb..ec05dd6d337b 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -641,7 +641,15 @@ bpf_movein(struct uio *uio, int linktype, struct ifnet *ifp, struct mbuf **mp, if (len < hlen || len - hlen > ifp->if_mtu) return (EMSGSIZE); - m = m_get2(len, M_WAITOK, MT_DATA, M_PKTHDR); + /* Allocate a mbuf for our write, since m_get2 fails if len >= to MJUMPAGESIZE, use m_getjcl for bigger buffers */ + if (len < MJUMPAGESIZE) + m = m_get2(len, M_WAITOK, MT_DATA, M_PKTHDR); + else if (len <= MJUM9BYTES) + m = m_getjcl(M_WAITOK, MT_DATA, M_PKTHDR, MJUM9BYTES); + else if (len <= MJUM16BYTES) + m = m_getjcl(M_WAITOK, MT_DATA, M_PKTHDR, MJUM16BYTES); + else + m = NULL; if (m == NULL) return (EIO); m->m_pkthdr.len = m->m_len = len; From owner-dev-commits-src-main@freebsd.org Wed Jun 23 17:44: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 9EA4B654730; Wed, 23 Jun 2021 17:44:10 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (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 4G99cV1tmZz3MxD; Wed, 23 Jun 2021 17:44:09 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 15NHi1eL028663 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 23 Jun 2021 19:44:01 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 15NHi1XG021412; Wed, 23 Jun 2021 19:44:01 +0200 Date: Wed, 23 Jun 2021 19:44:01 +0200 From: Lutz Donnerhacke To: Alexander Richardson Cc: Lutz Donnerhacke , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 9efcad61d830 - main - libalias: Restructure - Use AliasRange instead of PORT_BASE Message-ID: <20210623174401.GA21369@belenus.iks-jena.de> References: <202106191953.15JJrdpI039180@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4G99cV1tmZz3MxD 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: Wed, 23 Jun 2021 17:44:10 -0000 On Wed, Jun 23, 2021 at 11:05:44AM +0100, Alexander Richardson wrote: > On Sat, 19 Jun 2021 at 20:53, Lutz Donnerhacke wrote: > > commit 9efcad61d8309ecad3c15392b277fd329a1e45e4 > > Author: Lutz Donnerhacke > > AuthorDate: 2021-05-28 17:17:40 +0000 > > Commit: Lutz Donnerhacke > > CommitDate: 2021-06-19 19:40:09 +0000 > > > > libalias: Restructure - Use AliasRange instead of PORT_BASE [shorten the output for better readability of the messages] > This commit or one of the previous ones appears to have broken three tests: > sys.netpfil.common.nat.ipfw_basic > sys.netpfil.common.nat.ipfw_cgn > sys.netpfil.common.nat.ipfw_portalias > > See https://ci.freebsd.org/job/FreeBSD-main-amd64-test/18437/ Thank you for notifying. This will certainly delay the MFC until the issue is solved. > Could you look into this? I tried to, but failed to reproduce so far. But this is entirely my fault. From owner-dev-commits-src-main@freebsd.org Wed Jun 23 17:47: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 156B0654DA7; Wed, 23 Jun 2021 17:47:16 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (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 4G99h36Rg5z3NTD; Wed, 23 Jun 2021 17:47:15 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 15NHl4la029127 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 23 Jun 2021 19:47:04 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 15NHl4BK021455; Wed, 23 Jun 2021 19:47:04 +0200 Date: Wed, 23 Jun 2021 19:47:04 +0200 From: Lutz Donnerhacke To: Alexander Richardson Cc: Lutz Donnerhacke , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 935fc93af157 - main - libalias: Switch to efficient data structure for outgoing traffic Message-ID: <20210623174704.GB21369@belenus.iks-jena.de> References: <202106192010.15JKAbQ8061792@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4G99h36Rg5z3NTD 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: Wed, 23 Jun 2021 17:47:16 -0000 On Wed, Jun 23, 2021 at 11:08:13AM +0100, Alexander Richardson wrote: > On Sat, 19 Jun 2021 at 21:10, Lutz Donnerhacke wrote: > > commit 935fc93af157dee352eb4b6c83f8a2a9e7fd9a4e > > Author: Lutz Donnerhacke > > AuthorDate: 2021-05-27 21:42:54 +0000 > > Commit: Lutz Donnerhacke > > CommitDate: 2021-06-19 20:09:44 +0000 > > > > libalias: Switch to efficient data structure for outgoing traffic [shorten the output to make the messages readable] > This commit appears to have introduced a SIGBUS when running some of the tests: > > Program terminated with signal SIGBUS, Bus error. > #0 cmp_out (a=0x80180e080, b=0x5a5a5a5a5a5a5a5a) at > /usr/src/sys/netinet/libalias/alias_db.c:413 > 413 /usr/src/sys/netinet/libalias/alias_db.c: No such file or directory. > #0 cmp_out (a=0x80180e080, b=0x5a5a5a5a5a5a5a5a) at > /usr/src/sys/netinet/libalias/alias_db.c:413 > #1 splay_out_SPLAY (head=head@entry=0x8018100e0, > elm=elm@entry=0x80180e080) at > /usr/src/sys/netinet/libalias/alias_db.c:425 > #2 0x00000008010908d9 in splay_out_SPLAY_REMOVE (head=0x8018100e0, > elm=0x80180e080) at /usr/src/sys/netinet/libalias/alias_db.c:425 > #3 DeleteLink (plnk=plnk@entry=0x7fffffffd530, > deletePermanent=, deletePermanent@entry=1) at > /usr/src/sys/netinet/libalias/alias_db.c:883 > #4 0x0000000801091251 in CleanupAliasData (la=0x8018100c0, > deletePermanent=1) at /usr/src/sys/netinet/libalias/alias_db.c:819 > #5 LibAliasUninit (la=0x8018100c0) at > /usr/src/sys/netinet/libalias/alias_db.c:2542 [...] A use after free in the final cleanup. Thank you for catching this. It will delay the MFC until this issue is solved. > Source: https://ci.freebsd.org/job/FreeBSD-main-amd64-test/18438/testReport/junit/sys.netinet.libalias/3_natin/1_portforward/ > See https://ci.freebsd.org/job/FreeBSD-main-amd64-test/18438/#showFailuresLink > Could you have a look? Yep, try to reproduce. From owner-dev-commits-src-main@freebsd.org Wed Jun 23 19:28: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 162306562A5; Wed, 23 Jun 2021 19:28: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 4G9CxF71x9z3jbb; Wed, 23 Jun 2021 19:28: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 D61B31F15; Wed, 23 Jun 2021 19:28: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 15NJSnmR001902; Wed, 23 Jun 2021 19:28:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NJSnJj001900; Wed, 23 Jun 2021 19:28:49 GMT (envelope-from git) Date: Wed, 23 Jun 2021 19:28:49 GMT Message-Id: <202106231928.15NJSnJj001900@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 62ea198e95f1 - main - arm64: remove an unneeded test from pmap_clear_modify() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62ea198e95f139e6b8041ec44f75d65aa26970d0 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, 23 Jun 2021 19:28:50 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=62ea198e95f139e6b8041ec44f75d65aa26970d0 commit 62ea198e95f139e6b8041ec44f75d65aa26970d0 Author: Alan Cox AuthorDate: 2021-06-23 05:10:20 +0000 Commit: Alan Cox CommitDate: 2021-06-23 19:22:46 +0000 arm64: remove an unneeded test from pmap_clear_modify() The page table entry for a 4KB page mapping must be valid if a PV entry for the mapping exists, so there is no point in testing each page table entry's validity when iterating over a PV list. Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30875 --- sys/arm64/arm64/pmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 5f321be98528..7def96bca70b 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -5664,8 +5664,7 @@ restart: l2 = pmap_l2(pmap, pv->pv_va); l3 = pmap_l2_to_l3(l2, pv->pv_va); oldl3 = pmap_load(l3); - if (pmap_l3_valid(oldl3) && - (oldl3 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == ATTR_SW_DBM){ + if ((oldl3 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == ATTR_SW_DBM){ pmap_set_bits(l3, ATTR_S1_AP(ATTR_S1_AP_RO)); pmap_invalidate_page(pmap, pv->pv_va); } From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:35: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 735F1656E3A; Wed, 23 Jun 2021 20:35:19 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher 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 "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G9FPz1hfxz3qZv; Wed, 23 Jun 2021 20:35:18 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 15NKZHUt020728 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 23 Jun 2021 13:35:17 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 15NKZHRC020727; Wed, 23 Jun 2021 13:35:17 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Wed, 23 Jun 2021 13:35:17 -0700 From: Gleb Smirnoff To: Warner Losh , kp@freebsd.org Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: f13da24715a7 - main - net/bpf: Fix writing of buffer bigger than PAGESIZE Message-ID: References: <202106231641.15NGf1xH083695@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202106231641.15NGf1xH083695@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4G9FPz1hfxz3qZv 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: Wed, 23 Jun 2021 20:35:19 -0000 Warner, Kristof, On Wed, Jun 23, 2021 at 04:41:01PM +0000, Warner Losh wrote: W> net/bpf: Fix writing of buffer bigger than PAGESIZE W> W> When allocating the mbuf we used m_get2 which fails W> if len is superior to MJUMPAGESIZE, if its the case, W> use m_getjcl instead. W> W> Reviewed by: kp@ W> PR: 205164 W> Pull Request: https://github.com/freebsd/freebsd-src/pull/131 m_get2() used to provide jumbo mbufs in the past, see 3112ae76449ae0931d207603f14b083627bd731d. IMHO, makes sense to create m_get3() and use it in bpf. What do you think? W> @@ -641,7 +641,15 @@ bpf_movein(struct uio *uio, int linktype, struct ifnet *ifp, struct mbuf **mp, W> if (len < hlen || len - hlen > ifp->if_mtu) W> return (EMSGSIZE); W> W> - m = m_get2(len, M_WAITOK, MT_DATA, M_PKTHDR); W> + /* Allocate a mbuf for our write, since m_get2 fails if len >= to MJUMPAGESIZE, use m_getjcl for bigger buffers */ W> + if (len < MJUMPAGESIZE) W> + m = m_get2(len, M_WAITOK, MT_DATA, M_PKTHDR); W> + else if (len <= MJUM9BYTES) W> + m = m_getjcl(M_WAITOK, MT_DATA, M_PKTHDR, MJUM9BYTES); W> + else if (len <= MJUM16BYTES) W> + m = m_getjcl(M_WAITOK, MT_DATA, M_PKTHDR, MJUM16BYTES); W> + else W> + m = NULL; W> if (m == NULL) W> return (EIO); W> m->m_pkthdr.len = m->m_len = len; -- Gleb Smirnoff From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 0B43B657580; Wed, 23 Jun 2021 20:47: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 4G9Fgs6jsbz3sBB; Wed, 23 Jun 2021 20:47: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 CE6D331A6; Wed, 23 Jun 2021 20:47: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 15NKlLe3009694; Wed, 23 Jun 2021 20:47:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlLGA009693; Wed, 23 Jun 2021 20:47:21 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:21 GMT Message-Id: <202106232047.15NKlLGA009693@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: 71faea93070e - main - seqc: add symbolic name for in-modify bit 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: 71faea93070e6df371bf73ed12e2a1da27dc8e2d 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, 23 Jun 2021 20:47:22 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=71faea93070e6df371bf73ed12e2a1da27dc8e2d commit 71faea93070e6df371bf73ed12e2a1da27dc8e2d Author: Konstantin Belousov AuthorDate: 2021-04-29 22:39:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:46:15 +0000 seqc: add symbolic name for in-modify bit Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/sys/seqc.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/sys/seqc.h b/sys/sys/seqc.h index 3cfaaf3acbda..fd9f196aceca 100644 --- a/sys/sys/seqc.h +++ b/sys/sys/seqc.h @@ -45,13 +45,15 @@ #include +#define SEQC_MOD 1 + /* * Predicts from inline functions are not honored by clang. */ #define seqc_in_modify(seqc) ({ \ seqc_t __seqc = (seqc); \ \ - __predict_false(__seqc & 1); \ + __predict_false(__seqc & SEQC_MOD); \ }) static __inline void @@ -60,7 +62,7 @@ seqc_write_begin(seqc_t *seqcp) critical_enter(); MPASS(!seqc_in_modify(*seqcp)); - *seqcp += 1; + *seqcp += SEQC_MOD; atomic_thread_fence_rel(); } @@ -69,7 +71,7 @@ seqc_write_end(seqc_t *seqcp) { atomic_thread_fence_rel(); - *seqcp += 1; + *seqcp += SEQC_MOD; MPASS(!seqc_in_modify(*seqcp)); critical_exit(); } @@ -85,7 +87,7 @@ static __inline seqc_t seqc_read_notmodify(const seqc_t *seqcp) { - return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp)) & ~1); + return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp)) & ~SEQC_MOD); } static __inline seqc_t @@ -126,7 +128,7 @@ seqc_sleepable_write_begin(seqc_t *seqcp) { MPASS(!seqc_in_modify(*seqcp)); - *seqcp += 1; + *seqcp += SEQC_MOD; atomic_thread_fence_rel(); } @@ -135,7 +137,7 @@ seqc_sleepable_write_end(seqc_t *seqcp) { atomic_thread_fence_rel(); - *seqcp += 1; + *seqcp += SEQC_MOD; MPASS(!seqc_in_modify(*seqcp)); } From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47:23 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 4AEBA657265; Wed, 23 Jun 2021 20:47:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G9Fgv0WMJz3s3R; Wed, 23 Jun 2021 20:47:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E44BA2FBA; Wed, 23 Jun 2021 20:47: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 15NKlMFS009718; Wed, 23 Jun 2021 20:47:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlM0m009717; Wed, 23 Jun 2021 20:47:22 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:22 GMT Message-Id: <202106232047.15NKlM0m009717@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: 802cf4ab0ee9 - main - namei: add NDPREINIT() macro 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: 802cf4ab0ee9cae7af523cfcf1221febd2143210 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, 23 Jun 2021 20:47:23 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=802cf4ab0ee9cae7af523cfcf1221febd2143210 commit 802cf4ab0ee9cae7af523cfcf1221febd2143210 Author: Konstantin Belousov AuthorDate: 2021-06-14 19:03:41 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:46:15 +0000 namei: add NDPREINIT() macro Its intent is to do the initialization of the future part of struct nameidata which should be used across several namei() and VOPs. Right now it is NOP. Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/kern/vfs_syscalls.c | 9 +++++++++ sys/sys/namei.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 2f4a6036ef88..0b80faa5a27d 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1328,6 +1328,7 @@ kern_mknodat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, } if (error != 0) return (error); + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | @@ -1436,6 +1437,7 @@ kern_mkfifoat(struct thread *td, int fd, const char *path, int error; AUDIT_ARG_MODE(mode); + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | @@ -1566,6 +1568,7 @@ kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, struct nameidata nd; int error; + NDPREINIT(&nd); do { bwillwrite(); NDINIT_ATRIGHTS(&nd, LOOKUP, AUDITVNODE1 | at2cnpflags(flag, @@ -1714,6 +1717,7 @@ kern_symlinkat(struct thread *td, const char *path1, int fd, const char *path2, syspath = tmppath; } AUDIT_ARG_TEXT(syspath); + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | @@ -1778,6 +1782,7 @@ sys_undelete(struct thread *td, struct undelete_args *uap) struct nameidata nd; int error; + NDPREINIT(&nd); restart: bwillwrite(); NDINIT(&nd, DELETE, LOCKPARENT | DOWHITEOUT | AUDITVNODE1, @@ -1891,6 +1896,7 @@ kern_funlinkat(struct thread *td, int dfd, const char *path, int fd, return (error); } + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | @@ -3422,6 +3428,7 @@ kern_truncate(struct thread *td, const char *path, enum uio_seg pathseg, if (length < 0) return (EINVAL); + NDPREINIT(&nd); retry: NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td); if ((error = namei(&nd)) != 0) @@ -3789,6 +3796,7 @@ kern_mkdirat(struct thread *td, int fd, const char *path, enum uio_seg segflg, int error; AUDIT_ARG_MODE(mode); + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | @@ -3859,6 +3867,7 @@ kern_frmdirat(struct thread *td, int dfd, const char *path, int fd, return (error); } + NDPREINIT(&nd); restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 5f3d917083a5..b4db0e758e2b 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -265,6 +265,9 @@ do { \ _ndp->ni_startdir = NULL; \ } while (0) +#define NDPREINIT(ndp) do { \ +} while (0) + #define NDF_NO_DVP_RELE 0x00000001 #define NDF_NO_DVP_UNLOCK 0x00000002 #define NDF_NO_DVP_PUT 0x00000003 From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 177736570D5; Wed, 23 Jun 2021 20:47: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 4G9Fgx4m0Hz3sM4; Wed, 23 Jun 2021 20:47: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 37E7627F0; Wed, 23 Jun 2021 20:47: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 15NKlPvm009766; Wed, 23 Jun 2021 20:47:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlP3K009765; Wed, 23 Jun 2021 20:47:25 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:25 GMT Message-Id: <202106232047.15NKlP3K009765@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: b2b40b28b178 - main - ufs_vnops.c: 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: b2b40b28b1784fb153f8aefb4f86e085a149e91e 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, 23 Jun 2021 20:47:26 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b2b40b28b1784fb153f8aefb4f86e085a149e91e commit b2b40b28b1784fb153f8aefb4f86e085a149e91e Author: Konstantin Belousov AuthorDate: 2021-05-01 21:40:50 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:46:15 +0000 ufs_vnops.c: style Wrap too long functions declarations. Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/ufs/ufs/ufs_vnops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index ef288a32e815..00249e3902c8 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -105,14 +105,16 @@ VFS_SMR_DECLARE; static vop_accessx_t ufs_accessx; static vop_fplookup_vexec_t ufs_fplookup_vexec; static int ufs_chmod(struct vnode *, int, struct ucred *, struct thread *); -static int ufs_chown(struct vnode *, uid_t, gid_t, struct ucred *, struct thread *); +static int ufs_chown(struct vnode *, uid_t, gid_t, struct ucred *, + struct thread *); static vop_close_t ufs_close; static vop_create_t ufs_create; static vop_stat_t ufs_stat; static vop_getattr_t ufs_getattr; static vop_ioctl_t ufs_ioctl; static vop_link_t ufs_link; -static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *, const char *); +static int ufs_makeinode(int mode, struct vnode *, struct vnode **, + struct componentname *, const char *); static vop_mmapped_t ufs_mmapped; static vop_mkdir_t ufs_mkdir; static vop_mknod_t ufs_mknod; From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 ADAFB65758C; Wed, 23 Jun 2021 20:47:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G9Fgx1DnWz3sH8; Wed, 23 Jun 2021 20:47:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FF9331A7; Wed, 23 Jun 2021 20:47: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 15NKlNhK009742; Wed, 23 Jun 2021 20:47:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlNf9009741; Wed, 23 Jun 2021 20:47:23 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:23 GMT Message-Id: <202106232047.15NKlNf9009741@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: 190110f2eba1 - main - unionfs: do not use bare struct componentname 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: 190110f2eba1551793f290a9f01e52ffe015a5da 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, 23 Jun 2021 20:47:25 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=190110f2eba1551793f290a9f01e52ffe015a5da commit 190110f2eba1551793f290a9f01e52ffe015a5da Author: Konstantin Belousov AuthorDate: 2021-06-14 18:45:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:46:15 +0000 unionfs: do not use bare struct componentname Allocate nameidata on stack and NDPREINIT() it, for compatibility with assumptions from other filesystems' lookup code. Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/fs/unionfs/union_subr.c | 70 ++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 30b637171021..93e4f50d98c5 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -760,7 +760,7 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, struct vnode *uvp; struct vattr va; struct vattr lva; - struct componentname cn; + struct nameidata nd; struct mount *mp; struct ucred *cred; struct ucred *credbk; @@ -787,12 +787,14 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, uifree(rootinfo); cnp->cn_cred = cred; - memset(&cn, 0, sizeof(cn)); + memset(&nd.ni_cnd, 0, sizeof(struct componentname)); + NDPREINIT(&nd); if ((error = VOP_GETATTR(lvp, &lva, cnp->cn_cred))) goto unionfs_mkshadowdir_abort; - if ((error = unionfs_relookup(udvp, &uvp, cnp, &cn, td, cnp->cn_nameptr, cnp->cn_namelen, CREATE))) + if ((error = unionfs_relookup(udvp, &uvp, cnp, &nd.ni_cnd, td, + cnp->cn_nameptr, cnp->cn_namelen, CREATE))) goto unionfs_mkshadowdir_abort; if (uvp != NULLVP) { if (udvp == uvp) @@ -808,7 +810,7 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, goto unionfs_mkshadowdir_free_out; unionfs_create_uppervattr_core(ump, &lva, &va, td); - error = VOP_MKDIR(udvp, &uvp, &cn, &va); + error = VOP_MKDIR(udvp, &uvp, &nd.ni_cnd, &va); if (!error) { unionfs_node_update(unp, uvp, td); @@ -818,14 +820,14 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, * Ignore errors. */ va.va_type = VNON; - VOP_SETATTR(uvp, &va, cn.cn_cred); + VOP_SETATTR(uvp, &va, nd.ni_cnd.cn_cred); } vn_finished_write(mp); unionfs_mkshadowdir_free_out: - if (cn.cn_flags & HASBUF) { - uma_zfree(namei_zone, cn.cn_pnbuf); - cn.cn_flags &= ~HASBUF; + if (nd.ni_cnd.cn_flags & HASBUF) { + uma_zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + nd.ni_cnd.cn_flags &= ~HASBUF; } unionfs_mkshadowdir_abort: @@ -847,19 +849,21 @@ unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, { int error; struct vnode *wvp; - struct componentname cn; + struct nameidata nd; struct mount *mp; if (path == NULL) path = cnp->cn_nameptr; wvp = NULLVP; - if ((error = unionfs_relookup(dvp, &wvp, cnp, &cn, td, path, strlen(path), CREATE))) + NDPREINIT(&nd); + if ((error = unionfs_relookup(dvp, &wvp, cnp, &nd.ni_cnd, td, path, + strlen(path), CREATE))) return (error); if (wvp != NULLVP) { - if (cn.cn_flags & HASBUF) { - uma_zfree(namei_zone, cn.cn_pnbuf); - cn.cn_flags &= ~HASBUF; + if (nd.ni_cnd.cn_flags & HASBUF) { + uma_zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + nd.ni_cnd.cn_flags &= ~HASBUF; } if (dvp == wvp) vrele(wvp); @@ -871,14 +875,14 @@ unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, if ((error = vn_start_write(dvp, &mp, V_WAIT | PCATCH))) goto unionfs_mkwhiteout_free_out; - error = VOP_WHITEOUT(dvp, &cn, CREATE); + error = VOP_WHITEOUT(dvp, &nd.ni_cnd, CREATE); vn_finished_write(mp); unionfs_mkwhiteout_free_out: - if (cn.cn_flags & HASBUF) { - uma_zfree(namei_zone, cn.cn_pnbuf); - cn.cn_flags &= ~HASBUF; + if (nd.ni_cnd.cn_flags & HASBUF) { + uma_zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + nd.ni_cnd.cn_flags &= ~HASBUF; } return (error); @@ -904,7 +908,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, struct vattr lva; int fmode; int error; - struct componentname cn; + struct nameidata nd; ump = MOUNTTOUNIONFSMOUNT(UNIONFSTOV(unp)->v_mount); vp = NULLVP; @@ -920,18 +924,20 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, if (unp->un_path == NULL) panic("unionfs: un_path is null"); - cn.cn_namelen = strlen(unp->un_path); - cn.cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); - bcopy(unp->un_path, cn.cn_pnbuf, cn.cn_namelen + 1); - cn.cn_nameiop = CREATE; - cn.cn_flags = (LOCKPARENT | LOCKLEAF | HASBUF | SAVENAME | ISLASTCN); - cn.cn_lkflags = LK_EXCLUSIVE; - cn.cn_thread = td; - cn.cn_cred = cred; - cn.cn_nameptr = cn.cn_pnbuf; + nd.ni_cnd.cn_namelen = strlen(unp->un_path); + nd.ni_cnd.cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); + bcopy(unp->un_path, nd.ni_cnd.cn_pnbuf, nd.ni_cnd.cn_namelen + 1); + nd.ni_cnd.cn_nameiop = CREATE; + nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | HASBUF | SAVENAME | + ISLASTCN; + nd.ni_cnd.cn_lkflags = LK_EXCLUSIVE; + nd.ni_cnd.cn_thread = td; + nd.ni_cnd.cn_cred = cred; + nd.ni_cnd.cn_nameptr = nd.ni_cnd.cn_pnbuf; + NDPREINIT(&nd); vref(udvp); - if ((error = relookup(udvp, &vp, &cn)) != 0) + if ((error = relookup(udvp, &vp, &nd.ni_cnd)) != 0) goto unionfs_vn_create_on_upper_free_out2; vrele(udvp); @@ -944,7 +950,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, goto unionfs_vn_create_on_upper_free_out1; } - if ((error = VOP_CREATE(udvp, &vp, &cn, uvap)) != 0) + if ((error = VOP_CREATE(udvp, &vp, &nd.ni_cnd, uvap)) != 0) goto unionfs_vn_create_on_upper_free_out1; if ((error = VOP_OPEN(vp, fmode, cred, td, NULL)) != 0) { @@ -964,9 +970,9 @@ unionfs_vn_create_on_upper_free_out1: VOP_UNLOCK(udvp); unionfs_vn_create_on_upper_free_out2: - if (cn.cn_flags & HASBUF) { - uma_zfree(namei_zone, cn.cn_pnbuf); - cn.cn_flags &= ~HASBUF; + if (nd.ni_cnd.cn_flags & HASBUF) { + uma_zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + nd.ni_cnd.cn_flags &= ~HASBUF; } return (error); From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 5457465726B; Wed, 23 Jun 2021 20:47: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 4G9Fgy6zSGz3sBV; Wed, 23 Jun 2021 20:47: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 598A22F4F; Wed, 23 Jun 2021 20:47: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 15NKlQjT009790; Wed, 23 Jun 2021 20:47:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlQCm009789; Wed, 23 Jun 2021 20:47:26 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:26 GMT Message-Id: <202106232047.15NKlQCm009789@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: d0929a990c80 - main - ffs: reduce number of dvp relocks in softdep_prelink() 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: d0929a990c80b78bc84326234cf54cd4382d42fd 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, 23 Jun 2021 20:47:28 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d0929a990c80b78bc84326234cf54cd4382d42fd commit d0929a990c80b78bc84326234cf54cd4382d42fd Author: Konstantin Belousov AuthorDate: 2021-04-29 22:21:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:46:15 +0000 ffs: reduce number of dvp relocks in softdep_prelink() If vp == NULL, we unlocked and then immediately relocked dvp there. Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/ufs/ffs/ffs_softdep.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 23c0cf6e128b..2a76ec41f03d 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3415,10 +3415,9 @@ softdep_prelink(dvp, vp) if (vp != NULL) VOP_UNLOCK(vp); ffs_syncvnode(dvp, MNT_WAIT, 0); - VOP_UNLOCK(dvp); - /* Process vp before dvp as it may create .. removes. */ if (vp != NULL) { + VOP_UNLOCK(dvp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_data == NULL) { vn_lock_pair(dvp, false, vp, true); @@ -3429,12 +3428,11 @@ softdep_prelink(dvp, vp) process_truncates(vp); FREE_LOCK(ump); VOP_UNLOCK(vp); - } - - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); - if (dvp->v_data == NULL) { - vn_lock_pair(dvp, true, vp, false); - return (ERELOOKUP); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); + if (dvp->v_data == NULL) { + vn_lock_pair(dvp, true, vp, false); + return (ERELOOKUP); + } } ACQUIRE_LOCK(ump); From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 4A43F65751F; Wed, 23 Jun 2021 20:47: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 4G9Fh04ystz3s67; Wed, 23 Jun 2021 20:47: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 95B6927F1; Wed, 23 Jun 2021 20:47: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 15NKlRZx009820; Wed, 23 Jun 2021 20:47:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlRUH009819; Wed, 23 Jun 2021 20:47:27 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:27 GMT Message-Id: <202106232047.15NKlRUH009819@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: 5eacde3eb83d - main - ufs_rename(): softdep_prerename() does something only for SU+J 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: 5eacde3eb83de6ef1e0b126c019c759bf411e36a 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, 23 Jun 2021 20:47:29 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5eacde3eb83de6ef1e0b126c019c759bf411e36a commit 5eacde3eb83de6ef1e0b126c019c759bf411e36a Author: Konstantin Belousov AuthorDate: 2021-04-29 22:23:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:46:15 +0000 ufs_rename(): softdep_prerename() does something only for SU+J so call it only in SU+J case Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/ufs/ufs/ufs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 00249e3902c8..2154f7aa7f95 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1364,7 +1364,7 @@ relock: } } - if (DOINGSOFTDEP(fdvp)) { + if (DOINGSUJ(fdvp)) { error = softdep_prerename(fdvp, fvp, tdvp, tvp); if (error != 0) { if (error == ERELOOKUP) { From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 4B6B8657272; Wed, 23 Jun 2021 20:47: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 4G9Fh472Srz3s6L; Wed, 23 Jun 2021 20:47: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 0849531A9; Wed, 23 Jun 2021 20:47: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 15NKlVBK009917; Wed, 23 Jun 2021 20:47:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlVrk009916; Wed, 23 Jun 2021 20:47:31 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:31 GMT Message-Id: <202106232047.15NKlVrk009916@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: 2126f103e043 - main - ffs_softdep.c: add journal_check_space() helper 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: 2126f103e0434db6ca34f0a5167bf5f03d4f02ad 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, 23 Jun 2021 20:47:35 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2126f103e0434db6ca34f0a5167bf5f03d4f02ad commit 2126f103e0434db6ca34f0a5167bf5f03d4f02ad Author: Konstantin Belousov AuthorDate: 2021-06-15 10:23:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:47:05 +0000 ffs_softdep.c: add journal_check_space() helper Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/ufs/ffs/ffs_softdep.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index d274e0898dfb..efb63d94af31 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3222,6 +3222,19 @@ journal_unsuspend(struct ufsmount *ump) return (0); } +static void +journal_check_space(ump) + struct ufsmount *ump; +{ + LOCK_OWNED(ump); + + if (journal_space(ump, 0) == 0) { + softdep_speedup(ump); + if (journal_space(ump, 1) == 0) + journal_suspend(ump); + } +} + /* * Called before any allocation function to be certain that there is * sufficient space in the journal prior to creating any new records. @@ -3272,11 +3285,7 @@ softdep_prealloc(vp, waitok) ACQUIRE_LOCK(ump); process_removes(vp); process_truncates(vp); - if (journal_space(ump, 0) == 0) { - softdep_speedup(ump); - if (journal_space(ump, 1) == 0) - journal_suspend(ump); - } + journal_check_space(ump); FREE_LOCK(ump); return (0); @@ -3363,11 +3372,7 @@ softdep_prerename(fdvp, fvp, tdvp, tvp) ACQUIRE_LOCK(ump); softdep_speedup(ump); process_worklist_item(UFSTOVFS(ump), 2, LK_NOWAIT); - if (journal_space(ump, 0) == 0) { - softdep_speedup(ump); - if (journal_space(ump, 1) == 0) - journal_suspend(ump); - } + journal_check_space(ump); FREE_LOCK(ump); return (ERELOOKUP); } @@ -3460,11 +3465,7 @@ softdep_prelink(dvp, vp, cnp) softdep_speedup(ump); process_worklist_item(UFSTOVFS(ump), 2, LK_NOWAIT); - if (journal_space(ump, 0) == 0) { - softdep_speedup(ump); - if (journal_space(ump, 1) == 0) - journal_suspend(ump); - } + journal_check_space(ump); FREE_LOCK(ump); vn_lock_pair(dvp, false, vp, false); From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 A4BD665726C; Wed, 23 Jun 2021 20:47: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 4G9Fh113BBz3sBZ; Wed, 23 Jun 2021 20:47: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 98B142EED; Wed, 23 Jun 2021 20:47: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 15NKlStK009845; Wed, 23 Jun 2021 20:47:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlSQF009844; Wed, 23 Jun 2021 20:47:28 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:28 GMT Message-Id: <202106232047.15NKlSQF009844@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: d4d289cd5107 - main - ffs: mark block (re-)allocations as seqc writes 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: d4d289cd51078de9e82c9d83977cfa614032cd06 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, 23 Jun 2021 20:47:32 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d4d289cd51078de9e82c9d83977cfa614032cd06 commit d4d289cd51078de9e82c9d83977cfa614032cd06 Author: Konstantin Belousov AuthorDate: 2021-05-21 14:12:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:46:15 +0000 ffs: mark block (re-)allocations as seqc writes Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/ufs/ffs/ffs_alloc.c | 9 ++-- sys/ufs/ffs/ffs_balloc.c | 116 ++++++++++++++++++++++++++++------------------- 2 files changed, 75 insertions(+), 50 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index c895c8c7bf07..771377b7cefc 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -517,6 +517,7 @@ ffs_reallocblks(ap) } */ *ap; { struct ufsmount *ump; + int error; /* * We used to skip reallocating the blocks of a file into a @@ -546,9 +547,11 @@ ffs_reallocblks(ap) if (DOINGSUJ(ap->a_vp)) if (softdep_prealloc(ap->a_vp, MNT_NOWAIT) != 0) return (ENOSPC); - if (ump->um_fstype == UFS1) - return (ffs_reallocblks_ufs1(ap)); - return (ffs_reallocblks_ufs2(ap)); + vn_seqc_write_begin(ap->a_vp); + error = ump->um_fstype == UFS1 ? ffs_reallocblks_ufs1(ap) : + ffs_reallocblks_ufs2(ap); + vn_seqc_write_end(ap->a_vp); + return (error); } static int diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c index 1b53a90a48c4..d7718e56dd87 100644 --- a/sys/ufs/ffs/ffs_balloc.c +++ b/sys/ufs/ffs/ffs_balloc.c @@ -128,6 +128,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, return (EFBIG); gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0; + vn_seqc_write_begin(vp); + /* * If the next write will extend the file into a new block, * and the file is currently composed of a fragment @@ -144,7 +146,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, &dp->di_db[0]), osize, (int)fs->fs_bsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocdirect(ip, nb, dbtofsb(fs, bp->b_blkno), dp->di_db[nb], @@ -174,17 +176,20 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, error = bread(vp, lbn, fs->fs_bsize, NOCRED, &bp); if (error != 0) - return (error); + goto done; } else { bp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); - if (bp == NULL) - return (EIO); + if (bp == NULL) { + error = EIO; + goto done; + } vfs_bio_clrbuf(bp); } bp->b_blkno = fsbtodb(fs, nb); *bpp = bp; - return (0); + error = 0; + goto done; } if (nb != 0) { /* @@ -194,9 +199,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, nsize = fragroundup(fs, size); if (nsize <= osize) { error = bread(vp, lbn, osize, NOCRED, &bp); - if (error) { - return (error); - } + if (error) + goto done; bp->b_blkno = fsbtodb(fs, nb); } else { UFS_LOCK(ump); @@ -205,7 +209,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, &dp->di_db[0]), osize, nsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocdirect(ip, lbn, dbtofsb(fs, bp->b_blkno), nb, @@ -221,7 +225,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, ffs_blkpref_ufs1(ip, lbn, (int)lbn, &dp->di_db[0]), nsize, flags, cred, &newb); if (error) - return (error); + goto done; bp = getblk(vp, lbn, nsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, newb); if (flags & BA_CLRBUF) @@ -233,14 +237,15 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, dp->di_db[lbn] = dbtofsb(fs, bp->b_blkno); UFS_INODE_SET_FLAG(ip, IN_CHANGE | IN_UPDATE | IN_IBLKDATA); *bpp = bp; - return (0); + error = 0; + goto done; } /* * Determine the number of levels of indirection. */ pref = 0; if ((error = ufs_getlbns(vp, lbn, indirs, &num)) != 0) - return(error); + goto done; #ifdef INVARIANTS if (num < 1) panic ("ffs_balloc_ufs1: ufs_getlbns returned indirect block"); @@ -261,7 +266,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size, if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags, cred, &newb)) != 0) { curthread_pflags_restore(saved_inbdflush); - return (error); + goto done; } pref = newb + fs->fs_frag; nb = newb; @@ -387,7 +392,8 @@ retry: if (flags & BA_METAONLY) { curthread_pflags_restore(saved_inbdflush); *bpp = bp; - return (0); + error = 0; + goto done; } /* * Get the data block, allocating if necessary. @@ -453,7 +459,8 @@ retry: } curthread_pflags_restore(saved_inbdflush); *bpp = nbp; - return (0); + error = 0; + goto done; } brelse(bp); if (flags & BA_CLRBUF) { @@ -478,7 +485,8 @@ retry: } curthread_pflags_restore(saved_inbdflush); *bpp = nbp; - return (0); + error = 0; + goto done; fail: curthread_pflags_restore(saved_inbdflush); /* @@ -486,7 +494,7 @@ fail: * This is the usual case and avoids the need to fsync the file. */ if (allocblk == allociblk && allocib == NULL && unwindidx == -1) - return (error); + goto done; /* * If we have failed part way through block allocation, we * have to deallocate any indirect blocks that we have allocated. @@ -574,6 +582,8 @@ fail: ffs_blkfree(ump, fs, ump->um_devvp, *blkp, fs->fs_bsize, ip->i_number, vp->v_type, NULL, SINGLETON_KEY); } +done: + vn_seqc_write_end(vp); return (error); } @@ -619,12 +629,17 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, return (EFBIG); gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0; + vn_seqc_write_begin(vp); + /* * Check for allocating external data. */ if (flags & IO_EXT) { - if (lbn >= UFS_NXADDR) - return (EFBIG); + if (lbn >= UFS_NXADDR) { + error = EFBIG; + goto done; + } + /* * If the next write will extend the data into a new block, * and the data is currently composed of a fragment @@ -642,7 +657,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, &dp->di_extb[0]), osize, (int)fs->fs_bsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocext(ip, nb, dbtofsb(fs, bp->b_blkno), @@ -668,13 +683,12 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, if (nb != 0 && dp->di_extsize >= smalllblktosize(fs, lbn + 1)) { error = bread_gb(vp, -1 - lbn, fs->fs_bsize, NOCRED, gbflags, &bp); - if (error) { - return (error); - } + if (error) + goto done; bp->b_blkno = fsbtodb(fs, nb); bp->b_xflags |= BX_ALTDATA; *bpp = bp; - return (0); + goto done; } if (nb != 0) { /* @@ -685,9 +699,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, if (nsize <= osize) { error = bread_gb(vp, -1 - lbn, osize, NOCRED, gbflags, &bp); - if (error) { - return (error); - } + if (error) + goto done; bp->b_blkno = fsbtodb(fs, nb); bp->b_xflags |= BX_ALTDATA; } else { @@ -698,7 +711,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, &dp->di_extb[0]), osize, nsize, flags, cred, &bp); if (error) - return (error); + goto done; bp->b_xflags |= BX_ALTDATA; if (DOINGSOFTDEP(vp)) softdep_setup_allocext(ip, lbn, @@ -715,7 +728,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, ffs_blkpref_ufs2(ip, lbn, (int)lbn, &dp->di_extb[0]), nsize, flags, cred, &newb); if (error) - return (error); + goto done; bp = getblk(vp, -1 - lbn, nsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, newb); bp->b_xflags |= BX_ALTDATA; @@ -728,7 +741,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, dp->di_extb[lbn] = dbtofsb(fs, bp->b_blkno); UFS_INODE_SET_FLAG(ip, IN_CHANGE | IN_IBLKDATA); *bpp = bp; - return (0); + error = 0; + goto done; } /* * If the next write will extend the file into a new block, @@ -746,7 +760,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, &dp->di_db[0]), osize, (int)fs->fs_bsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocdirect(ip, nb, dbtofsb(fs, bp->b_blkno), @@ -775,17 +789,20 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, error = bread_gb(vp, lbn, fs->fs_bsize, NOCRED, gbflags, &bp); if (error != 0) - return (error); + goto done; } else { bp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); - if (bp == NULL) - return (EIO); + if (bp == NULL) { + error = EIO; + goto done; + } vfs_bio_clrbuf(bp); } bp->b_blkno = fsbtodb(fs, nb); *bpp = bp; - return (0); + error = 0; + goto done; } if (nb != 0) { /* @@ -796,9 +813,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, if (nsize <= osize) { error = bread_gb(vp, lbn, osize, NOCRED, gbflags, &bp); - if (error) { - return (error); - } + if (error) + goto done; bp->b_blkno = fsbtodb(fs, nb); } else { UFS_LOCK(ump); @@ -807,7 +823,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, &dp->di_db[0]), osize, nsize, flags, cred, &bp); if (error) - return (error); + goto done; if (DOINGSOFTDEP(vp)) softdep_setup_allocdirect(ip, lbn, dbtofsb(fs, bp->b_blkno), nb, @@ -823,7 +839,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, ffs_blkpref_ufs2(ip, lbn, (int)lbn, &dp->di_db[0]), nsize, flags, cred, &newb); if (error) - return (error); + goto done; bp = getblk(vp, lbn, nsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, newb); if (flags & BA_CLRBUF) @@ -835,14 +851,15 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, dp->di_db[lbn] = dbtofsb(fs, bp->b_blkno); UFS_INODE_SET_FLAG(ip, IN_CHANGE | IN_UPDATE | IN_IBLKDATA); *bpp = bp; - return (0); + error = 0; + goto done; } /* * Determine the number of levels of indirection. */ pref = 0; if ((error = ufs_getlbns(vp, lbn, indirs, &num)) != 0) - return(error); + goto done; #ifdef INVARIANTS if (num < 1) panic ("ffs_balloc_ufs2: ufs_getlbns returned indirect block"); @@ -863,7 +880,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size, if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags, cred, &newb)) != 0) { curthread_pflags_restore(saved_inbdflush); - return (error); + goto done; } pref = newb + fs->fs_frag; nb = newb; @@ -991,7 +1008,8 @@ retry: if (flags & BA_METAONLY) { curthread_pflags_restore(saved_inbdflush); *bpp = bp; - return (0); + error = 0; + goto done; } /* * Get the data block, allocating if necessary. @@ -1057,7 +1075,8 @@ retry: } curthread_pflags_restore(saved_inbdflush); *bpp = nbp; - return (0); + error = 0; + goto done; } brelse(bp); /* @@ -1088,7 +1107,8 @@ retry: } curthread_pflags_restore(saved_inbdflush); *bpp = nbp; - return (0); + error = 0; + goto done; fail: curthread_pflags_restore(saved_inbdflush); /* @@ -1096,7 +1116,7 @@ fail: * This is the usual case and avoids the need to fsync the file. */ if (allocblk == allociblk && allocib == NULL && unwindidx == -1) - return (error); + goto done; /* * If we have failed part way through block allocation, we * have to deallocate any indirect blocks that we have allocated. @@ -1184,5 +1204,7 @@ fail: ffs_blkfree(ump, fs, ump->um_devvp, *blkp, fs->fs_bsize, ip->i_number, vp->v_type, NULL, SINGLETON_KEY); } +done: + vn_seqc_write_end(vp); return (error); } From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 85EB3657618; Wed, 23 Jun 2021 20:47: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 4G9Fh73W9wz3s8l; Wed, 23 Jun 2021 20:47: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 2A8FB2F50; Wed, 23 Jun 2021 20:47: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 15NKlXah009943; Wed, 23 Jun 2021 20:47:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlXjQ009942; Wed, 23 Jun 2021 20:47:33 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:33 GMT Message-Id: <202106232047.15NKlXjQ009942@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: 50acaaef54b4 - main - ffs_softdep: force sync if journal is low in journal_check_space 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: 50acaaef54b4d7811393eb8c05a398d7a1882418 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, 23 Jun 2021 20:47:38 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=50acaaef54b4d7811393eb8c05a398d7a1882418 commit 50acaaef54b4d7811393eb8c05a398d7a1882418 Author: Konstantin Belousov AuthorDate: 2021-06-15 10:27:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:47:05 +0000 ffs_softdep: force sync if journal is low in journal_check_space This effectively causes syncing of the mount point from softdep_prealloc(), softdep_prerename(), and softdep_prelink(). Typically it avoids the need for journal suspension at this point, at all. Suggested and reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/ufs/ffs/ffs_softdep.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index efb63d94af31..2f9819ff7023 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3226,10 +3226,17 @@ static void journal_check_space(ump) struct ufsmount *ump; { + struct mount *mp; + LOCK_OWNED(ump); if (journal_space(ump, 0) == 0) { softdep_speedup(ump); + mp = UFSTOVFS(ump); + FREE_LOCK(ump); + VFS_SYNC(mp, MNT_NOWAIT); + ffs_sbupdate(ump, MNT_WAIT, 0); + ACQUIRE_LOCK(ump); if (journal_space(ump, 1) == 0) journal_suspend(ump); } From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 33BFA65726E; Wed, 23 Jun 2021 20:47: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 4G9Fh36XNjz3s6C; Wed, 23 Jun 2021 20:47: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 B275031A8; Wed, 23 Jun 2021 20:47: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 15NKlT1a009869; Wed, 23 Jun 2021 20:47:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlTdN009868; Wed, 23 Jun 2021 20:47:29 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:29 GMT Message-Id: <202106232047.15NKlTdN009868@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: f7565466622a - main - ufs_rename(): only do softdep_prerename() when other thread changed a vnode 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: f7565466622a411a50522f23528faeb1e57d4571 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, 23 Jun 2021 20:47:32 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f7565466622a411a50522f23528faeb1e57d4571 commit f7565466622a411a50522f23528faeb1e57d4571 Author: Konstantin Belousov AuthorDate: 2021-04-29 22:39:57 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:46:15 +0000 ufs_rename(): only do softdep_prerename() when other thread changed a vnode Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/ufs/ufs/ufs_vnops.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 2154f7aa7f95..b0fb1b74b900 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1248,6 +1248,7 @@ ufs_rename(ap) int error = 0; struct mount *mp; ino_t ino; + seqc_t fdvp_s, fvp_s, tdvp_s, tvp_s; bool want_seqc_end; want_seqc_end = false; @@ -1271,6 +1272,8 @@ ufs_rename(ap) mp = NULL; goto releout; } + + fdvp_s = fvp_s = tdvp_s = tvp_s = SEQC_MOD; relock: /* * We need to acquire 2 to 4 locks depending on whether tvp is NULL @@ -1364,10 +1367,20 @@ relock: } } - if (DOINGSUJ(fdvp)) { + if (DOINGSUJ(fdvp) && + (seqc_in_modify(fdvp_s) || !vn_seqc_consistent(fdvp, fdvp_s) || + seqc_in_modify(fvp_s) || !vn_seqc_consistent(fvp, fvp_s) || + seqc_in_modify(tdvp_s) || !vn_seqc_consistent(tdvp, tdvp_s) || + (tvp != NULL && (seqc_in_modify(tvp_s) || + !vn_seqc_consistent(tvp, tvp_s))))) { error = softdep_prerename(fdvp, fvp, tdvp, tvp); if (error != 0) { if (error == ERELOOKUP) { + fdvp_s = vn_seqc_read_any(fdvp); + fvp_s = vn_seqc_read_any(fvp); + tdvp_s = vn_seqc_read_any(tdvp); + if (tvp != NULL) + tvp_s = vn_seqc_read_any(tvp); atomic_add_int(&rename_restarts, 1); goto relock; } From owner-dev-commits-src-main@freebsd.org Wed Jun 23 20:47: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 B90BD657274; Wed, 23 Jun 2021 20:47: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 4G9Fh457hJz3s6G; Wed, 23 Jun 2021 20:47: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 0F6D22EEE; Wed, 23 Jun 2021 20:47: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 15NKlUqL009893; Wed, 23 Jun 2021 20:47:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NKlUSI009892; Wed, 23 Jun 2021 20:47:30 GMT (envelope-from git) Date: Wed, 23 Jun 2021 20:47:30 GMT Message-Id: <202106232047.15NKlUSI009892@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: 64b494a1050a - main - softdep_prelink(): only do sync if other thread changed the vnode metadata since previous prelink 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: 64b494a1050ae2cf2412edc19b57dc80f49eeda1 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, 23 Jun 2021 20:47:35 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=64b494a1050ae2cf2412edc19b57dc80f49eeda1 commit 64b494a1050ae2cf2412edc19b57dc80f49eeda1 Author: Konstantin Belousov AuthorDate: 2021-05-01 21:53:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 20:46:54 +0000 softdep_prelink(): only do sync if other thread changed the vnode metadata since previous prelink We call into softdep_prerename() and softdep_prelink() when there is low free space in the journal. Functions sync all vnodes participating in the VOP, in the hope that this would reduce journal utilization. But if the vnodes are already synced, doing sync would only spend writes, journal is filled not due to the records from modifications of our vnodes. Remember original seqc numbers for vnodes, and only initiate syncs when seqc changed. Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30041 --- sys/sys/namei.h | 12 +++++++++++- sys/ufs/ffs/ffs_extern.h | 3 ++- sys/ufs/ffs/ffs_softdep.c | 32 +++++++++++++++++++++++++++----- sys/ufs/ufs/ufs_vnops.c | 12 ++++++------ 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/sys/sys/namei.h b/sys/sys/namei.h index b4db0e758e2b..9e0a82ea1659 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -38,6 +38,7 @@ #include #include #include +#include #include enum nameiop { LOOKUP, CREATE, DELETE, RENAME }; @@ -111,6 +112,12 @@ struct nameidata { */ struct componentname ni_cnd; struct nameicap_tracker_head ni_cap_tracker; + /* + * Private helper data for UFS, must be at the end. See + * NDINIT_PREFILL(). + */ + seqc_t ni_dvp_seqc; + seqc_t ni_vp_seqc; }; #ifdef _KERNEL @@ -224,7 +231,8 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, * Note the constant pattern may *hide* bugs. */ #ifdef INVARIANTS -#define NDINIT_PREFILL(arg) memset(arg, 0xff, sizeof(*arg)) +#define NDINIT_PREFILL(arg) memset(arg, 0xff, offsetof(struct nameidata, \ + ni_dvp_seqc)) #define NDINIT_DBG(arg) { (arg)->ni_debugflags = NAMEI_DBG_INITED; } #define NDREINIT_DBG(arg) { \ if (((arg)->ni_debugflags & NAMEI_DBG_INITED) == 0) \ @@ -266,6 +274,8 @@ do { \ } while (0) #define NDPREINIT(ndp) do { \ + (ndp)->ni_dvp_seqc = SEQC_MOD; \ + (ndp)->ni_vp_seqc = SEQC_MOD; \ } while (0) #define NDF_NO_DVP_RELE 0x00000001 diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 7080edd21ab3..2ea828861b42 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -181,7 +181,8 @@ int softdep_request_cleanup(struct fs *, struct vnode *, struct ucred *, int); int softdep_prerename(struct vnode *, struct vnode *, struct vnode *, struct vnode *); -int softdep_prelink(struct vnode *, struct vnode *); +int softdep_prelink(struct vnode *, struct vnode *, + struct componentname *); void softdep_setup_freeblocks(struct inode *, off_t, int); void softdep_setup_inomapdep(struct buf *, struct inode *, ino_t, int); void softdep_setup_blkmapdep(struct buf *, struct mount *, ufs2_daddr_t, diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 2a76ec41f03d..d274e0898dfb 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -621,9 +621,10 @@ softdep_prerename(fdvp, fvp, tdvp, tvp) } int -softdep_prelink(dvp, vp) +softdep_prelink(dvp, vp, cnp) struct vnode *dvp; struct vnode *vp; + struct componentname *cnp; { panic("softdep_prelink called"); @@ -3384,11 +3385,13 @@ softdep_prerename(fdvp, fvp, tdvp, tvp) * syscall must be restarted at top level from the lookup. */ int -softdep_prelink(dvp, vp) +softdep_prelink(dvp, vp, cnp) struct vnode *dvp; struct vnode *vp; + struct componentname *cnp; { struct ufsmount *ump; + struct nameidata *ndp; ASSERT_VOP_ELOCKED(dvp, "prelink dvp"); if (vp != NULL) @@ -3404,13 +3407,28 @@ softdep_prelink(dvp, vp) if (journal_space(ump, 0) || (vp != NULL && IS_SNAPSHOT(VTOI(vp)))) return (0); + /* + * Check if the journal space consumption can in theory be + * accounted on dvp and vp. If the vnodes metadata was not + * changed comparing with the previous round-trip into + * softdep_prelink(), as indicated by the seqc generation + * recorded in the nameidata, then there is no point in + * starting the sync. + */ + ndp = __containerof(cnp, struct nameidata, ni_cnd); + if (!seqc_in_modify(ndp->ni_dvp_seqc) && + vn_seqc_consistent(dvp, ndp->ni_dvp_seqc) && + (vp == NULL || (!seqc_in_modify(ndp->ni_vp_seqc) && + vn_seqc_consistent(vp, ndp->ni_vp_seqc)))) + return (0); + stat_journal_low++; if (vp != NULL) { VOP_UNLOCK(dvp); ffs_syncvnode(vp, MNT_NOWAIT, 0); vn_lock_pair(dvp, false, vp, true); if (dvp->v_data == NULL) - return (ERELOOKUP); + goto out; } if (vp != NULL) VOP_UNLOCK(vp); @@ -3421,7 +3439,7 @@ softdep_prelink(dvp, vp) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_data == NULL) { vn_lock_pair(dvp, false, vp, true); - return (ERELOOKUP); + goto out; } ACQUIRE_LOCK(ump); process_removes(vp); @@ -3431,7 +3449,7 @@ softdep_prelink(dvp, vp) vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); if (dvp->v_data == NULL) { vn_lock_pair(dvp, true, vp, false); - return (ERELOOKUP); + goto out; } } @@ -3450,6 +3468,10 @@ softdep_prelink(dvp, vp) FREE_LOCK(ump); vn_lock_pair(dvp, false, vp, false); +out: + ndp->ni_dvp_seqc = vn_seqc_read_any(dvp); + if (vp != NULL) + ndp->ni_vp_seqc = vn_seqc_read_any(vp); return (ERELOOKUP); } diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index b0fb1b74b900..2dfc2e24f772 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1010,7 +1010,7 @@ ufs_remove(ap) (VTOI(dvp)->i_flags & APPEND)) return (EPERM); if (DOINGSUJ(dvp)) { - error = softdep_prelink(dvp, vp); + error = softdep_prelink(dvp, vp, ap->a_cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -1075,7 +1075,7 @@ ufs_link(ap) #endif if (DOINGSUJ(tdvp)) { - error = softdep_prelink(tdvp, vp); + error = softdep_prelink(tdvp, vp, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -1147,7 +1147,7 @@ ufs_whiteout(ap) if (DOINGSUJ(dvp) && (ap->a_flags == CREATE || ap->a_flags == DELETE)) { - error = softdep_prelink(dvp, NULL); + error = softdep_prelink(dvp, NULL, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -1962,7 +1962,7 @@ ufs_mkdir(ap) } if (DOINGSUJ(dvp)) { - error = softdep_prelink(dvp, NULL); + error = softdep_prelink(dvp, NULL, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -2226,7 +2226,7 @@ ufs_rmdir(ap) goto out; } if (DOINGSUJ(dvp)) { - error = softdep_prelink(dvp, vp); + error = softdep_prelink(dvp, vp, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); @@ -2751,7 +2751,7 @@ ufs_makeinode(mode, dvp, vpp, cnp, callfunc) return (EINVAL); } if (DOINGSUJ(dvp)) { - error = softdep_prelink(dvp, NULL); + error = softdep_prelink(dvp, NULL, cnp); if (error != 0) { MPASS(error == ERELOOKUP); return (error); From owner-dev-commits-src-main@freebsd.org Wed Jun 23 21:25: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 C63026581AD; Wed, 23 Jun 2021 21:25: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 4G9GXC55wbz4SKC; Wed, 23 Jun 2021 21:25: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 949183B8B; Wed, 23 Jun 2021 21:25: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 15NLPlCL063632; Wed, 23 Jun 2021 21:25:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NLPljW063631; Wed, 23 Jun 2021 21:25:47 GMT (envelope-from git) Date: Wed, 23 Jun 2021 21:25:47 GMT Message-Id: <202106232125.15NLPljW063631@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Moeller Subject: git: b50db44f021c - main - bsdinstall: Avoid double-mounting /dev MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b50db44f021c12283a2e140063a6b6fcc30295e5 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, 23 Jun 2021 21:25:47 -0000 The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b50db44f021c12283a2e140063a6b6fcc30295e5 commit b50db44f021c12283a2e140063a6b6fcc30295e5 Author: Ryan Moeller AuthorDate: 2021-06-23 13:42:43 +0000 Commit: Ryan Moeller CommitDate: 2021-06-23 21:24:53 +0000 bsdinstall: Avoid double-mounting /dev After 34766aa8cb514472c571f8b0e90e833833acef51 we are mounting and unmounting devfs elsewhere already. Reviewed by: nwhitehorn MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D30877 --- usr.sbin/bsdinstall/scripts/script | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script index cb42aed7706a..8d9dd5205132 100755 --- a/usr.sbin/bsdinstall/scripts/script +++ b/usr.sbin/bsdinstall/scripts/script @@ -162,9 +162,7 @@ fi if [ -f $TMPDIR/bsdinstall-installscript-ab ]; then cp $TMPDIR/bsdinstall-installscript-ab $BSDINSTALL_CHROOT/tmp/installscript chmod a+x $BSDINSTALL_CHROOT/tmp/installscript - mount -t devfs devfs "$BSDINSTALL_CHROOT/dev" chroot $BSDINSTALL_CHROOT /tmp/installscript $@ 2>&1 - umount "$BSDINSTALL_CHROOT/dev" rm $BSDINSTALL_CHROOT/tmp/installscript fi From owner-dev-commits-src-main@freebsd.org Wed Jun 23 21:36: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 8A0F4658793; Wed, 23 Jun 2021 21:36: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 4G9Gmn3bHdz4V1X; Wed, 23 Jun 2021 21:36: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 5FDBD3D8B; Wed, 23 Jun 2021 21:36: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 15NLafis077078; Wed, 23 Jun 2021 21:36:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NLafqJ077077; Wed, 23 Jun 2021 21:36:41 GMT (envelope-from git) Date: Wed, 23 Jun 2021 21:36:41 GMT Message-Id: <202106232136.15NLafqJ077077@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: e912fbe16757 - main - vdso gettimeofday: minor restructuring 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: e912fbe1675714aab0179999923c171615e78c07 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, 23 Jun 2021 21:36:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e912fbe1675714aab0179999923c171615e78c07 commit e912fbe1675714aab0179999923c171615e78c07 Author: Konstantin Belousov AuthorDate: 2021-06-22 23:58:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 21:36:33 +0000 vdso gettimeofday: minor restructuring Call binuptime inside switch statement, instead of pre-calculating the abs argument. Change the type of the abs argument to bool. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30873 --- lib/libc/sys/__vdso_gettimeofday.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/libc/sys/__vdso_gettimeofday.c b/lib/libc/sys/__vdso_gettimeofday.c index 32c416a54392..4c1f4bda23e1 100644 --- a/lib/libc/sys/__vdso_gettimeofday.c +++ b/lib/libc/sys/__vdso_gettimeofday.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -59,7 +60,7 @@ tc_delta(const struct vdso_timehands *th, u_int *delta) * is based on the kernel implementation. */ static int -binuptime(struct bintime *bt, struct vdso_timekeep *tk, int abs) +binuptime(struct bintime *bt, struct vdso_timekeep *tk, bool abs) { struct vdso_timehands *th; uint32_t curr, gen; @@ -123,7 +124,7 @@ __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) } if (tk->tk_ver != VDSO_TK_VER_CURR) return (ENOSYS); - error = binuptime(&bt, tk, 1); + error = binuptime(&bt, tk, true); if (error != 0) return (error); bintime2timeval(&bt, tv); @@ -135,7 +136,7 @@ int __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) { struct bintime bt; - int abs, error; + int error; if (tk == NULL) { error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); @@ -149,7 +150,7 @@ __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) case CLOCK_REALTIME_PRECISE: case CLOCK_REALTIME_FAST: case CLOCK_SECOND: - abs = 1; + error = binuptime(&bt, tk, true); break; case CLOCK_MONOTONIC: case CLOCK_MONOTONIC_PRECISE: @@ -157,12 +158,12 @@ __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) case CLOCK_UPTIME: case CLOCK_UPTIME_PRECISE: case CLOCK_UPTIME_FAST: - abs = 0; + error = getnanouptime(&bt, tk); break; default: - return (ENOSYS); + error = ENOSYS; + break; } - error = binuptime(&bt, tk, abs); if (error != 0) return (error); bintime2timespec(&bt, ts); From owner-dev-commits-src-main@freebsd.org Wed Jun 23 21:36: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 DDD14658888; Wed, 23 Jun 2021 21:36: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 4G9Gmp5jPYz4VHy; Wed, 23 Jun 2021 21:36: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 8EE6137E4; Wed, 23 Jun 2021 21:36: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 15NLagCV077102; Wed, 23 Jun 2021 21:36:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15NLag2E077101; Wed, 23 Jun 2021 21:36:42 GMT (envelope-from git) Date: Wed, 23 Jun 2021 21:36:42 GMT Message-Id: <202106232136.15NLag2E077101@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: 60b0ad10dd0f - main - vdso: lower precision of vdso implementation of CLOCK_MONOTONIC_FAST and CLOCK_UPTIME_FAST 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: 60b0ad10dd0fc7ff6892ecc7ba3458482fcc064c 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, 23 Jun 2021 21:36:43 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=60b0ad10dd0fc7ff6892ecc7ba3458482fcc064c commit 60b0ad10dd0fc7ff6892ecc7ba3458482fcc064c Author: Konstantin Belousov AuthorDate: 2021-06-22 23:24:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 21:36:33 +0000 vdso: lower precision of vdso implementation of CLOCK_MONOTONIC_FAST and CLOCK_UPTIME_FAST so that libc vdso and kernel syscall give closer results. Reported by: dchagin Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30873 --- lib/libc/sys/__vdso_gettimeofday.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/__vdso_gettimeofday.c b/lib/libc/sys/__vdso_gettimeofday.c index 4c1f4bda23e1..c1457a54d37e 100644 --- a/lib/libc/sys/__vdso_gettimeofday.c +++ b/lib/libc/sys/__vdso_gettimeofday.c @@ -106,6 +106,30 @@ binuptime(struct bintime *bt, struct vdso_timekeep *tk, bool abs) return (0); } +static int +getnanouptime(struct bintime *bt, struct vdso_timekeep *tk) +{ + struct vdso_timehands *th; + uint32_t curr, gen; + + do { + if (!tk->tk_enabled) + return (ENOSYS); + + curr = atomic_load_acq_32(&tk->tk_current); + th = &tk->tk_th[curr]; + gen = atomic_load_acq_32(&th->th_gen); + *bt = th->th_offset; + + /* + * Ensure that the load of th_offset is completed + * before the load of th_gen. + */ + atomic_thread_fence_acq(); + } while (curr != tk->tk_current || gen == 0 || gen != th->th_gen); + return (0); +} + static struct vdso_timekeep *tk; #pragma weak __vdso_gettimeofday @@ -154,9 +178,11 @@ __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) break; case CLOCK_MONOTONIC: case CLOCK_MONOTONIC_PRECISE: - case CLOCK_MONOTONIC_FAST: case CLOCK_UPTIME: case CLOCK_UPTIME_PRECISE: + error = binuptime(&bt, tk, false); + break; + case CLOCK_MONOTONIC_FAST: case CLOCK_UPTIME_FAST: error = getnanouptime(&bt, tk); break; From owner-dev-commits-src-main@freebsd.org Wed Jun 23 21:49: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 22D57658B4D; Wed, 23 Jun 2021 21:49: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 4G9H3b0Lgsz4WJh; Wed, 23 Jun 2021 21: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 E97CC3F1F; Wed, 23 Jun 2021 21: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 15NLnUAn090259; Wed, 23 Jun 2021 21: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 15NLnUVh090258; Wed, 23 Jun 2021 21:49:30 GMT (envelope-from git) Date: Wed, 23 Jun 2021 21:49:30 GMT Message-Id: <202106232149.15NLnUVh090258@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: 33e1287b6a54 - main - amd64: do not touch BIOS reset flag halfword, unless we boot through BIOS 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: 33e1287b6a54672860d6646111ef0e544a00c569 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, 23 Jun 2021 21:49:31 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=33e1287b6a54672860d6646111ef0e544a00c569 commit 33e1287b6a54672860d6646111ef0e544a00c569 Author: Konstantin Belousov AuthorDate: 2021-06-20 14:58:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-23 21:38:00 +0000 amd64: do not touch BIOS reset flag halfword, unless we boot through BIOS Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30872 --- sys/amd64/amd64/locore.S | 3 --- sys/amd64/amd64/machdep.c | 12 ++++++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 4f6283b88bd2..a9bb9be330d8 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -56,9 +56,6 @@ */ ENTRY(btext) - /* Tell the bios to warmboot next time */ - movw $0x1234,0x472 - /* Don't trust what the loader gives for rflags. */ pushq $PSL_KERNEL popfq diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 9ddad323449b..83fc6b26fa44 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1604,11 +1604,20 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct region_descriptor r_gdt; size_t kstack0_sz; int late_console; + bool efi_boot; TSRAW(&thread0, TS_ENTER, __func__, NULL); kmdp = init_ops.parse_preload_data(modulep); + efi_boot = preload_search_info(kmdp, MODINFO_METADATA | + MODINFOMD_EFI_MAP) != NULL; + + if (!efi_boot) { + /* Tell the bios to warmboot next time */ + atomic_store_short((u_short *)0x472, 0x1234); + } + physfree += ucode_load_bsp(physfree + KERNBASE); physfree = roundup2(physfree, PAGE_SIZE); @@ -1760,8 +1769,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) * Once bootblocks have updated, we can test directly for * efi_systbl != NULL here... */ - if (preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP) - != NULL) + if (efi_boot) vty_set_preferred(VTY_VT); TUNABLE_INT_FETCH("hw.ibrs_disable", &hw_ibrs_disable); From owner-dev-commits-src-main@freebsd.org Thu Jun 24 03:37: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 7D12365CC20; Thu, 24 Jun 2021 03:37: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 4G9Qng2qBVz5023; Thu, 24 Jun 2021 03:37: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 4901D10BB0; Thu, 24 Jun 2021 03:37: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 15O3bxO0055314; Thu, 24 Jun 2021 03:37:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15O3bxZN055313; Thu, 24 Jun 2021 03:37:59 GMT (envelope-from git) Date: Thu, 24 Jun 2021 03:37:59 GMT Message-Id: <202106240337.15O3bxZN055313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 0c188c06c627 - main - arm64: replace pa_to_pvh() with page_to_pvh() in pmap_remove_l2() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c188c06c627b5de30eeeeb7cde00d071a80ecfa 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, 24 Jun 2021 03:37:59 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=0c188c06c627b5de30eeeeb7cde00d071a80ecfa commit 0c188c06c627b5de30eeeeb7cde00d071a80ecfa Author: Alan Cox AuthorDate: 2021-06-23 19:14:31 +0000 Commit: Alan Cox CommitDate: 2021-06-24 03:35:46 +0000 arm64: replace pa_to_pvh() with page_to_pvh() in pmap_remove_l2() Revise pmap_remove_l2() to use the constant-time function page_to_pvh() instead of the linear-time function pa_to_pvh(). Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30876 --- sys/arm64/arm64/pmap.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 7def96bca70b..bc3d4fd6446b 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -2834,8 +2834,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, { struct md_page *pvh; pt_entry_t old_l2; - vm_offset_t eva, va; - vm_page_t m, ml3; + vm_page_t m, ml3, mt; PMAP_LOCK_ASSERT(pmap, MA_OWNED); KASSERT((sva & L2_OFFSET) == 0, ("pmap_remove_l2: sva is not aligned")); @@ -2853,19 +2852,18 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, pmap->pm_stats.wired_count -= L2_SIZE / PAGE_SIZE; pmap_resident_count_dec(pmap, L2_SIZE / PAGE_SIZE); if (old_l2 & ATTR_SW_MANAGED) { + m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); + pvh = page_to_pvh(m); CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, old_l2 & ~ATTR_MASK); - pvh = pa_to_pvh(old_l2 & ~ATTR_MASK); pmap_pvh_free(pvh, pmap, sva); - eva = sva + L2_SIZE; - for (va = sva, m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); - va < eva; va += PAGE_SIZE, m++) { + for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) { if (pmap_pte_dirty(pmap, old_l2)) - vm_page_dirty(m); + vm_page_dirty(mt); if (old_l2 & ATTR_AF) - vm_page_aflag_set(m, PGA_REFERENCED); - if (TAILQ_EMPTY(&m->md.pv_list) && + vm_page_aflag_set(mt, PGA_REFERENCED); + if (TAILQ_EMPTY(&mt->md.pv_list) && TAILQ_EMPTY(&pvh->pv_list)) - vm_page_aflag_clear(m, PGA_WRITEABLE); + vm_page_aflag_clear(mt, PGA_WRITEABLE); } } if (pmap == kernel_pmap) { From owner-dev-commits-src-main@freebsd.org Thu Jun 24 05:27: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 22FEF65E381; Thu, 24 Jun 2021 05:27: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 4G9TCy0Gyfz57FC; Thu, 24 Jun 2021 05:27: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 E5E491270B; Thu, 24 Jun 2021 05:27: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 15O5RP3n000809; Thu, 24 Jun 2021 05:27:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15O5RPHD000808; Thu, 24 Jun 2021 05:27:25 GMT (envelope-from git) Date: Thu, 24 Jun 2021 05:27:25 GMT Message-Id: <202106240527.15O5RPHD000808@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 0acc529dc35f - main - arm64: Disable early printf if TSLOG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0acc529dc35f88836dbcbe75940954c75595b058 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, 24 Jun 2021 05:27:26 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=0acc529dc35f88836dbcbe75940954c75595b058 commit 0acc529dc35f88836dbcbe75940954c75595b058 Author: Colin Percival AuthorDate: 2021-06-24 05:10:26 +0000 Commit: Colin Percival CommitDate: 2021-06-24 05:10:26 +0000 arm64: Disable early printf if TSLOG The warning message "ERROR loading DTB" (for systems without a device tree blob) is printed extremely early in the boot process -- among other things, before curthread or other pcpu data has been set up. Unfortunately, printf is instrumented with TSLOG, which cannot run quite this early. Wrap the printf in #ifndef TSLOG; the situations where the printf will be useful are not ones where TSLOG would be in use. --- sys/arm64/arm64/machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 82a77ce184d8..439656f57f6d 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -1101,7 +1101,9 @@ try_load_dtb(caddr_t kmdp) #endif if (dtbp == (vm_offset_t)NULL) { +#ifndef TSLOG printf("ERROR loading DTB\n"); +#endif return; } From owner-dev-commits-src-main@freebsd.org Thu Jun 24 05:27: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 5038765E289; Thu, 24 Jun 2021 05:27: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 4G9TCz1LBpz57Hn; Thu, 24 Jun 2021 05:27: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 1406112784; Thu, 24 Jun 2021 05:27: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 15O5RQdn000833; Thu, 24 Jun 2021 05:27:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15O5RQtO000832; Thu, 24 Jun 2021 05:27:26 GMT (envelope-from git) Date: Thu, 24 Jun 2021 05:27:26 GMT Message-Id: <202106240527.15O5RQtO000832@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: ccadcb8f3343 - main - arm64: Instrument initarm with TSLOG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccadcb8f3343562f22a426e845dba640319d4355 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, 24 Jun 2021 05:27:27 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=ccadcb8f3343562f22a426e845dba640319d4355 commit ccadcb8f3343562f22a426e845dba640319d4355 Author: Colin Percival AuthorDate: 2021-06-24 05:17:55 +0000 Commit: Colin Percival CommitDate: 2021-06-24 05:17:55 +0000 arm64: Instrument initarm with TSLOG The "function entry" needs to be recorded with TSRAW() rather than TSENTER() since curthread is not yet defined. (The same approach is taken in amd64's hammer_time.) --- sys/arm64/arm64/machdep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 439656f57f6d..25f0a108311e 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -1253,6 +1253,8 @@ initarm(struct arm64_bootparams *abp) caddr_t kmdp; bool valid; + TSRAW(&thread0, TS_ENTER, __func__, NULL); + boot_el = abp->boot_el; /* Parse loader or FDT boot parametes. Determine last used address. */ @@ -1383,6 +1385,8 @@ initarm(struct arm64_bootparams *abp) } early_boot = 0; + + TSEXIT(); } void From owner-dev-commits-src-main@freebsd.org Thu Jun 24 05:27: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 8B80665E28B; Thu, 24 Jun 2021 05:27: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 4G9TD03Q4Qz57Qs; Thu, 24 Jun 2021 05:27: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 39789124AA; Thu, 24 Jun 2021 05:27: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 15O5RSnA000857; Thu, 24 Jun 2021 05:27:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15O5RS2m000856; Thu, 24 Jun 2021 05:27:28 GMT (envelope-from git) Date: Thu, 24 Jun 2021 05:27:28 GMT Message-Id: <202106240527.15O5RS2m000856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: e6caac717b4f - main - libsa: Add tslog support for arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6caac717b4fc2b87cf93f67109884e768253e77 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, 24 Jun 2021 05:27:28 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=e6caac717b4fc2b87cf93f67109884e768253e77 commit e6caac717b4fc2b87cf93f67109884e768253e77 Author: Colin Percival AuthorDate: 2021-06-24 05:21:23 +0000 Commit: Colin Percival CommitDate: 2021-06-24 05:21:23 +0000 libsa: Add tslog support for arm64 The original code only supported x86 and used rdtsc(); we now also support arm64 and use the CNTVCT_EL0 special register. --- stand/libsa/tslog.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stand/libsa/tslog.c b/stand/libsa/tslog.c index 7ea18e0bb8f8..c6164aab02a9 100644 --- a/stand/libsa/tslog.c +++ b/stand/libsa/tslog.c @@ -29,7 +29,11 @@ __FBSDID("$FreeBSD$"); #include +#if defined(__amd64__) || defined(__i386__) #include +#elif defined(__aarch64__) +#include +#endif #include @@ -60,6 +64,8 @@ tslog(const char * type, const char * f, const char * s) { #if defined(__amd64__) || defined(__i386__) uint64_t tsc = rdtsc(); +#elif defined(__aarch64__) + uint64_t tsc = READ_SPECIALREG(cntvct_el0); #else uint64_t tsc = 0; #endif From owner-dev-commits-src-main@freebsd.org Thu Jun 24 10:05: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 41717640455; Thu, 24 Jun 2021 10:05: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 4G9bNx1Rg1z3mDK; Thu, 24 Jun 2021 10:05: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 1814C1610E; Thu, 24 Jun 2021 10:05: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 15OA5b8k072714; Thu, 24 Jun 2021 10:05:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OA5ahB072713; Thu, 24 Jun 2021 10:05:36 GMT (envelope-from git) Date: Thu, 24 Jun 2021 10:05:36 GMT Message-Id: <202106241005.15OA5ahB072713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michal Meloun Subject: git: 3eae4e106ac7 - main - Fix error value returned by ofw_bus_gen_get_node(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3eae4e106ac7222364fc9dc8c3d35d4ad8c5293a 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, 24 Jun 2021 10:05:37 -0000 The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=3eae4e106ac7222364fc9dc8c3d35d4ad8c5293a commit 3eae4e106ac7222364fc9dc8c3d35d4ad8c5293a Author: Michal Meloun AuthorDate: 2021-06-24 09:56:20 +0000 Commit: Michal Meloun CommitDate: 2021-06-24 10:01:05 +0000 Fix error value returned by ofw_bus_gen_get_node(). By definition ofw_bus_get_node() should consistently return -1 when there is no associated OF node. MFC after: 4 weeks Discussed with: nwhitehorn Analyzed in: https://reviews.freebsd.org/D30761 --- sys/dev/ofw/ofw_bus_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c index 12fbafe4077f..ea57d1086779 100644 --- a/sys/dev/ofw/ofw_bus_subr.c +++ b/sys/dev/ofw/ofw_bus_subr.c @@ -144,7 +144,7 @@ ofw_bus_gen_get_node(device_t bus, device_t dev) obd = OFW_BUS_GET_DEVINFO(bus, dev); if (obd == NULL) - return (0); + return ((phandle_t)-1); return (obd->obd_node); } From owner-dev-commits-src-main@freebsd.org Thu Jun 24 11:12: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 3F4B9649838; Thu, 24 Jun 2021 11:12: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 4G9ctK016fz3rWt; Thu, 24 Jun 2021 11:12: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 DCFF716F93; Thu, 24 Jun 2021 11:12: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 15OBCerC065249; Thu, 24 Jun 2021 11:12:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OBCerB065248; Thu, 24 Jun 2021 11:12:40 GMT (envelope-from git) Date: Thu, 24 Jun 2021 11:12:40 GMT Message-Id: <202106241112.15OBCerB065248@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 58632fa7a386 - main - iflib: Add a new quirk MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 58632fa7a386f6338996b945fb38e807fc44db72 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, 24 Jun 2021 11:12:41 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=58632fa7a386f6338996b945fb38e807fc44db72 commit 58632fa7a386f6338996b945fb38e807fc44db72 Author: Marcin Wojtas AuthorDate: 2021-05-19 09:09:16 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 11:00:56 +0000 iflib: Add a new quirk ENETC NIC found in LS1028A has a bug where clearing TX pidx/cidx causes the ring to hang after being re-enabled. Add a new flag, if set iflib will preserve the indices during restart. Submitted by: Kornel Duleba Reviewed by: gallatin, erj Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30728 --- sys/net/iflib.c | 7 ++++++- sys/net/iflib.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 01da882f0d12..ea3754a07ee6 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2604,7 +2604,12 @@ iflib_stop(if_ctx_t ctx) iflib_txsd_free(ctx, txq, j); } txq->ift_processed = txq->ift_cleaned = txq->ift_cidx_processed = 0; - txq->ift_in_use = txq->ift_gen = txq->ift_cidx = txq->ift_pidx = txq->ift_no_desc_avail = 0; + txq->ift_in_use = txq->ift_gen = txq->ift_no_desc_avail = 0; + if (sctx->isc_flags & IFLIB_PRESERVE_TX_INDICES) + txq->ift_cidx = txq->ift_pidx; + else + txq->ift_cidx = txq->ift_pidx = 0; + txq->ift_closed = txq->ift_mbuf_defrag = txq->ift_mbuf_defrag_failed = 0; txq->ift_no_tx_dma_setup = txq->ift_txd_encap_efbig = txq->ift_map_failed = 0; txq->ift_pullups = 0; diff --git a/sys/net/iflib.h b/sys/net/iflib.h index f88294b3d01a..b6dcf6311d2b 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -402,6 +402,10 @@ typedef enum { * Interface has an admin completion queue */ #define IFLIB_HAS_ADMINCQ 0x100000 +/* + * Interface needs to preserve TX ring indices across restarts. + */ +#define IFLIB_PRESERVE_TX_INDICES 0x200000 /* * These enum values are used in iflib_needs_restart to indicate to iflib From owner-dev-commits-src-main@freebsd.org Thu Jun 24 11:12: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 680F56494BF; Thu, 24 Jun 2021 11:12: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 4G9ctL23FMz3rZJ; Thu, 24 Jun 2021 11:12: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 0BC3816E64; Thu, 24 Jun 2021 11:12: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 15OBCfCB065275; Thu, 24 Jun 2021 11:12:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OBCfKg065274; Thu, 24 Jun 2021 11:12:41 GMT (envelope-from git) Date: Thu, 24 Jun 2021 11:12:41 GMT Message-Id: <202106241112.15OBCfKg065274@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 59061c7ebcaa - main - Introduce MDIO read/write functions for LS1028A. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 59061c7ebcaae90e59551320f641a762ae31080d 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, 24 Jun 2021 11:12:42 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=59061c7ebcaae90e59551320f641a762ae31080d commit 59061c7ebcaae90e59551320f641a762ae31080d Author: Marcin Wojtas AuthorDate: 2021-05-19 14:31:35 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 11:01:05 +0000 Introduce MDIO read/write functions for LS1028A. Provide common MDIO code for two LS1028 ENETC controllers - an external one found on the PCI bus and internal one found in ENETC. Submitted by: Lukasz Hajec Reviewed by: manu Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30730 --- sys/dev/enetc/enetc_mdio.c | 155 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/enetc/enetc_mdio.h | 58 +++++++++++++++++ 2 files changed, 213 insertions(+) diff --git a/sys/dev/enetc/enetc_mdio.c b/sys/dev/enetc/enetc_mdio.c new file mode 100644 index 000000000000..c998f31a041d --- /dev/null +++ b/sys/dev/enetc/enetc_mdio.c @@ -0,0 +1,155 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Alstom Group. + * Copyright (c) 2021 Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#define ENETC_MDIO_RD4(regs, base, off) \ + bus_read_4((regs), (base) + (off)) +#define ENETC_MDIO_WR4(regs, base, off, value) \ + bus_write_4((regs), (base) + (off), (value)) + +static int +enetc_mdio_wait(struct resource *regs, int mdio_base) +{ + int i; + uint32_t val; + + i = 0; + do { + DELAY(100); + val = ENETC_MDIO_RD4(regs, mdio_base, ENETC_MDIO_CFG); + if ((val & MDIO_CFG_BSY) == 0) + return (0); + } while (i++ < ENETC_TIMEOUT); + + return (ETIMEDOUT); +} + +int +enetc_mdio_read(struct resource *regs, int mdio_base, int phy, int reg) +{ + uint32_t mdio_cfg, mdio_ctl; + uint16_t dev_addr; + + mdio_cfg = MDIO_CFG_CLKDIV(ENETC_MDC_DIV) | MDIO_CFG_NEG; + if (reg & MII_ADDR_C45) { + /* clause 45 */ + dev_addr = (reg >> 16) & 0x1f; + mdio_cfg |= MDIO_CFG_ENC45; + } else { + /* clause 22 */ + dev_addr = reg & 0x1f; + mdio_cfg &= ~MDIO_CFG_ENC45; + } + + ENETC_MDIO_WR4(regs, mdio_base, ENETC_MDIO_CFG, mdio_cfg); + + if (enetc_mdio_wait(regs, mdio_base) == ETIMEDOUT) + return (EIO); + + /* Set port and device addr. */ + mdio_ctl = MDIO_CTL_PORT_ADDR(phy) | MDIO_CTL_DEV_ADDR(dev_addr); + ENETC_MDIO_WR4(regs, mdio_base, ENETC_MDIO_CTL, mdio_ctl); + + /* Set the register address. */ + if (reg & MII_ADDR_C45) { + ENETC_MDIO_WR4(regs, mdio_base, ENETC_MDIO_ADDR, reg & 0xffff); + + if (enetc_mdio_wait(regs, mdio_base) == ETIMEDOUT) + return (EIO); + } + + /* Initiate the read. */ + ENETC_MDIO_WR4(regs, mdio_base, ENETC_MDIO_CTL, mdio_ctl | MDIO_CTL_READ); + + if (enetc_mdio_wait(regs, mdio_base) == ETIMEDOUT) + return (EIO); + + /* Check if any error occurred while reading PHY register. */ + if (ENETC_MDIO_RD4(regs, mdio_base, ENETC_MDIO_CFG) & MDIO_CFG_RD_ER) + return (ENXIO); + + return (MDIO_DATA(ENETC_MDIO_RD4(regs, mdio_base, ENETC_MDIO_DATA))); +} + +int +enetc_mdio_write(struct resource *regs, int mdio_base, int phy, int reg, + int data) +{ + uint32_t mdio_cfg, mdio_ctl; + uint16_t dev_addr; + + mdio_cfg = MDIO_CFG_CLKDIV(ENETC_MDC_DIV) | MDIO_CFG_NEG; + if (reg & MII_ADDR_C45) { + /* clause 45 */ + dev_addr = (reg >> 16) & 0x1f; + mdio_cfg |= MDIO_CFG_ENC45; + } else { + /* clause 22 */ + dev_addr = reg & 0x1f; + mdio_cfg &= ~MDIO_CFG_ENC45; + } + + ENETC_MDIO_WR4(regs, mdio_base, ENETC_MDIO_CFG, mdio_cfg); + + if (enetc_mdio_wait(regs, mdio_base) == ETIMEDOUT) + return (EIO); + + /* Set port and device addr. */ + mdio_ctl = MDIO_CTL_PORT_ADDR(phy) | MDIO_CTL_DEV_ADDR(dev_addr); + ENETC_MDIO_WR4(regs, mdio_base, ENETC_MDIO_CTL, mdio_ctl); + + /* Set the register address. */ + if (reg & MII_ADDR_C45) { + ENETC_MDIO_WR4(regs, mdio_base, ENETC_MDIO_ADDR, reg & 0xffff); + + if (enetc_mdio_wait(regs, mdio_base) == ETIMEDOUT) + return (EIO); + } + + /* Write the value. */ + ENETC_MDIO_WR4(regs, mdio_base, ENETC_MDIO_DATA, MDIO_DATA(data)); + + if (enetc_mdio_wait(regs, mdio_base) == ETIMEDOUT) + return (EIO); + + return (0); +} diff --git a/sys/dev/enetc/enetc_mdio.h b/sys/dev/enetc/enetc_mdio.h new file mode 100644 index 000000000000..782748a6fd88 --- /dev/null +++ b/sys/dev/enetc/enetc_mdio.h @@ -0,0 +1,58 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Alstom Group. + * Copyright (c) 2021 Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ENETC_MDIO_H_ +#define _ENETC_MDIO_H_ + +/* MDIO registers */ +#define ENETC_MDIO_CFG 0x0 /* MDIO configuration and status */ +#define MDIO_CFG_CLKDIV(x) ((((x) >> 1) & 0xff) << 8) + +#define ENETC_MDIO_CTL 0x4 /* MDIO control */ +#define MDIO_CTL_DEV_ADDR(x) ((x) & 0x1f) +#define MDIO_CTL_PORT_ADDR(x) (((x) & 0x1f) << 5) + +#define ENETC_MDIO_DATA 0x8 /* MDIO data */ +#define MDIO_DATA(x) ((x) & 0xffff) + +#define ENETC_MDIO_ADDR 0xc /* MDIO address */ + +#define MDIO_CFG_BSY BIT(0) +#define MDIO_CFG_RD_ER BIT(1) +#define MDIO_CFG_ENC45 BIT(6) +#define MDIO_CFG_NEG BIT(23) +#define MDIO_CTL_READ BIT(15) +#define MII_ADDR_C45 BIT(30) + +/* MDIO configuration and helpers */ +#define ENETC_MDC_DIV 258 +#define ENETC_TIMEOUT 1000 + +int enetc_mdio_write(struct resource*, int, int, int, int); +int enetc_mdio_read(struct resource*, int, int, int); + +#endif From owner-dev-commits-src-main@freebsd.org Thu Jun 24 11:12:43 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 CF5FE648F5E; Thu, 24 Jun 2021 11:12:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G9ctM40Hrz3rX0; Thu, 24 Jun 2021 11:12:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30C8916F94; Thu, 24 Jun 2021 11:12:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15OBChdD065299; Thu, 24 Jun 2021 11:12:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OBChoq065298; Thu, 24 Jun 2021 11:12:43 GMT (envelope-from git) Date: Thu, 24 Jun 2021 11:12:43 GMT Message-Id: <202106241112.15OBChoq065298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 19aa95e4b30d - main - Introduce new driver for NXP Ethernet controller MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19aa95e4b30d0560b849fb59dbe76360a3de2254 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, 24 Jun 2021 11:12:43 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=19aa95e4b30d0560b849fb59dbe76360a3de2254 commit 19aa95e4b30d0560b849fb59dbe76360a3de2254 Author: Marcin Wojtas AuthorDate: 2021-04-07 14:39:58 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 11:01:13 +0000 Introduce new driver for NXP Ethernet controller ENETC it a gigabit Ethernet controller found on the LS1028A board. It supports basic VLAN offloads - tag extraction, injection and hardware filtering. Inband MDIO connectivity is used for link status monitoring through the miibus interface. Fixed-link mode is also supported, which allows for operation of internal cpu to switch port. Since no admin interrupts are present in hardware, link status polling has to be used. Due to a hardware bug software reset of the NIC results in a external abort. Because of that most of the hardware initialization is done during attach. This also means that in the case of an fatal error full board reset is required. The enetc_hw.h header was imporoted from Linux. It is dual licensed. Submitted by: Kornel Duleba Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30729 --- share/man/man4/man4.aarch64/Makefile | 1 + share/man/man4/man4.aarch64/enetc.4 | 69 ++ sys/arm64/conf/GENERIC | 1 + sys/conf/files.arm64 | 3 + sys/dev/enetc/enetc.h | 160 ++++ sys/dev/enetc/enetc_hw.h | 755 +++++++++++++++++ sys/dev/enetc/if_enetc.c | 1468 ++++++++++++++++++++++++++++++++++ 7 files changed, 2457 insertions(+) diff --git a/share/man/man4/man4.aarch64/Makefile b/share/man/man4/man4.aarch64/Makefile index 978b1e1e068b..6714a47011ef 100644 --- a/share/man/man4/man4.aarch64/Makefile +++ b/share/man/man4/man4.aarch64/Makefile @@ -11,6 +11,7 @@ MAN= \ aw_spi.4 \ aw_syscon.4 \ bcm283x_pwm.4 \ + enetc.4 \ rk_gpio.4 \ rk_grf.4 \ rk_i2c.4 \ diff --git a/share/man/man4/man4.aarch64/enetc.4 b/share/man/man4/man4.aarch64/enetc.4 new file mode 100644 index 000000000000..4680fd478813 --- /dev/null +++ b/share/man/man4/man4.aarch64/enetc.4 @@ -0,0 +1,69 @@ +.\" - +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 Alstom Group. +.\" Copyright (c) 2021 Semihalf. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd June 11, 2021 +.Dt ENETC 4 +.Os +.Sh NAME +.Nm enetc +.Nd "Freescale ENETC PCIe Gigabit Ethernet driver" +.Sh SYNOPSIS +To compile this driver into the kernel the following lines must be present +in the kernel configuration file: +.sp +.Cd "options SOC_NXP_LS" +.Cd "device pci" +.Cd "device fdt" +.Cd "device iflib" +.Cd "device enetc" +.Sh DESCRIPTION +The +.Nm +driver provides support for ENETC Gigabit Ethernet NIC found in LS1028A SoC. +.Xr iflib 9 +is used to communicate with the rest of kernel. +Both physical ports, as well as virtual interfaces connected to the internal +switch are supported. +.Pp +The following hardware offloads have been implemented in this version +of the driver: +.Bd -literal +- Receive IP checksum validation. +- VLAN tag insertion and extraction. +- VLAN tag based packet filtering. +.Ed +.Pp +For more information about configuring this device refer to +.Xr ifconfig 8 . +.Sh SEE ALSO +.Xr vlan 4 , +.Xr ifconfig 8 , +.Xr iflib 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 14.0 . diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 8b3adc9f1357..954631ca68b2 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -272,6 +272,7 @@ device pl011 # PCI/PCI-X/PCIe Ethernet NICs that use iflib infrastructure device iflib +device enetc # NXP Gigabit NIC device em # Intel PRO/1000 Gigabit Ethernet Family device ix # Intel 10Gb Ethernet Family device vmx # VMware VMXNET3 Ethernet diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 8457d7203322..6571b66d22c1 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -175,6 +175,9 @@ dev/cpufreq/cpufreq_dt.c optional cpufreq fdt dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 +dev/enetc/enetc_mdio.c optional enetc soc_nxp_ls +dev/enetc/if_enetc.c optional enetc iflib pci fdt soc_nxp_ls + dev/gpio/pl061.c optional pl061 gpio dev/gpio/pl061_acpi.c optional pl061 gpio acpi dev/gpio/pl061_fdt.c optional pl061 gpio fdt diff --git a/sys/dev/enetc/enetc.h b/sys/dev/enetc/enetc.h new file mode 100644 index 000000000000..d3064a48df76 --- /dev/null +++ b/sys/dev/enetc/enetc.h @@ -0,0 +1,160 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Alstom Group. + * Copyright (c) 2021 Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _ENETC_H_ +#define _ENETC_H_ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include + +struct enetc_softc; +struct enetc_rx_queue { + struct enetc_softc *sc; + uint16_t qid; + + union enetc_rx_bd *ring; + uint64_t ring_paddr; + + struct if_irq irq; + bool enabled; +}; + +struct enetc_tx_queue { + struct enetc_softc *sc; + + union enetc_tx_bd *ring; + uint64_t ring_paddr; + + qidx_t next_to_clean; + bool ring_full; + + struct if_irq irq; +}; + +struct enetc_ctrl_queue { + qidx_t pidx; + + struct iflib_dma_info dma; + struct enetc_cbd *ring; + + struct if_irq irq; +}; + +struct enetc_softc { + device_t dev; + + if_ctx_t ctx; + if_softc_ctx_t shared; +#define tx_num_queues shared->isc_ntxqsets +#define rx_num_queues shared->isc_nrxqsets +#define tx_queue_size shared->isc_ntxd[0] +#define rx_queue_size shared->isc_nrxd[0] + + struct resource *regs; + + device_t miibus; + + struct enetc_tx_queue *tx_queues; + struct enetc_rx_queue *rx_queues; + struct enetc_ctrl_queue ctrl_queue; + + /* Default RX queue configuration. */ + uint32_t rbmr; + /* + * Hardware VLAN hash based filtering uses a 64bit bitmap. + * We need to know how many vids are in given position to + * know when to remove the bit from the bitmap. + */ +#define VLAN_BITMAP_SIZE 64 + uint8_t vlan_bitmap[64]; + + struct if_irq admin_irq; + int phy_addr; + + struct ifmedia fixed_ifmedia; + bool fixed_link; +}; + +#define ENETC_RD4(sc, reg) \ + bus_read_4((sc)->regs, reg) +#define ENETC_WR4(sc, reg, value) \ + bus_write_4((sc)->regs, reg, value) + +#define ENETC_PORT_RD8(sc, reg) \ + bus_read_8((sc)->regs, ENETC_PORT_BASE + (reg)) +#define ENETC_PORT_RD4(sc, reg) \ + bus_read_4((sc)->regs, ENETC_PORT_BASE + (reg)) +#define ENETC_PORT_WR4(sc, reg, value) \ + bus_write_4((sc)->regs, ENETC_PORT_BASE + (reg), value) +#define ENETC_PORT_RD2(sc, reg) \ + bus_read_2((sc)->regs, ENETC_PORT_BASE + (reg)) +#define ENETC_PORT_WR2(sc, reg, value) \ + bus_write_2((sc)->regs, ENETC_PORT_BASE + (reg), value) + +#define ENETC_TXQ_RD4(sc, q, reg) \ + ENETC_RD4((sc), ENETC_BDR(TX, q, reg)) +#define ENETC_TXQ_WR4(sc, q, reg, value) \ + ENETC_WR4((sc), ENETC_BDR(TX, q, reg), value) +#define ENETC_RXQ_RD4(sc, q, reg) \ + ENETC_RD4((sc), ENETC_BDR(RX, q, reg)) +#define ENETC_RXQ_WR4(sc, q, reg, value) \ + ENETC_WR4((sc), ENETC_BDR(RX, q, reg), value) + +/* Device constants */ + +#define ENETC_MAX_FRAME_LEN 9600 + +#define ENETC_MAX_QUEUES 4 + +/* Max supported nr of descriptors per frame. */ +#define ENETC_MAX_SCATTER 15 + +/* + * Up to 4096 transmit/receive descriptors are supported, + * their number has to be a multple of 64. + */ +#define ENETC_MIN_DESC 64 +#define ENETC_MAX_DESC 4096 +#define ENETC_DEFAULT_DESC 512 +#define ENETC_DESC_ALIGN 64 + +/* Rings have to be 128B aligned. */ +#define ENETC_RING_ALIGN 128 + +#define ENETC_MSIX_COUNT 32 + +#define ENETC_RX_INTR_PKT_THR 16 + +/* Rx threshold irq timeout, 100us */ +#define ENETC_RX_INTR_TIME_THR ((100ULL * ENETC_CLK) / 1000000ULL) + +#define ENETC_RX_IP_ALIGN 2 + +#endif diff --git a/sys/dev/enetc/enetc_hw.h b/sys/dev/enetc/enetc_hw.h new file mode 100644 index 000000000000..507c4657453d --- /dev/null +++ b/sys/dev/enetc/enetc_hw.h @@ -0,0 +1,755 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* Copyright 2017-2019 NXP */ +#ifndef _ENETC_HW_H_ +#define _ENETC_HW_H_ + +#include + +#include + +#define BIT(x) (1UL << (x)) +#define GENMASK(h, l) (((~0U) - (1U << (l)) + 1) & (~0U >> (32 - 1 - (h)))) +#define ilog2(x) (flsl(x) - 1) + +#define PCI_VENDOR_FREESCALE 0x1957 + +/* ENETC device IDs */ +#define ENETC_DEV_ID_PF 0xe100 +#define ENETC_DEV_ID_VF 0xef00 +#define ENETC_DEV_ID_PTP 0xee02 + +/* ENETC register block BAR */ +#define ENETC_BAR_REGS 0 + +/** SI regs, offset: 0h */ +#define ENETC_SIMR 0 +#define ENETC_SIMR_EN BIT(31) +#define ENETC_SIMR_DRXG BIT(16) +#define ENETC_SIMR_RSSE BIT(0) +#define ENETC_SICTR0 0x18 +#define ENETC_SICTR1 0x1c +#define ENETC_SIPCAPR0 0x20 +#define ENETC_SIPCAPR0_QBV BIT(4) +#define ENETC_SIPCAPR0_PSFP BIT(9) +#define ENETC_SIPCAPR0_RSS BIT(8) +#define ENETC_SIPCAPR1 0x24 +#define ENETC_SITGTGR 0x30 +#define ENETC_SIRBGCR 0x38 +/* cache attribute registers for transactions initiated by ENETC */ +#define ENETC_SICAR0 0x40 +#define ENETC_SICAR1 0x44 +#define ENETC_SICAR2 0x48 +/* rd snoop, no alloc + * wr snoop, no alloc, partial cache line update for BDs and full cache line + * update for data + */ +#define ENETC_SICAR_RD_COHERENT 0x2b2b0000 +#define ENETC_SICAR_WR_COHERENT 0x00006727 +#define ENETC_SICAR_MSI 0x00300030 /* rd/wr device, no snoop, no alloc */ + +#define ENETC_SIPMAR0 0x80 +#define ENETC_SIPMAR1 0x84 + +/* VF-PF Message passing */ +#define ENETC_DEFAULT_MSG_SIZE 1024 /* and max size */ + +#define ENETC_PSIMSGRR 0x204 +#define ENETC_PSIMSGRR_MR_MASK GENMASK(2, 1) +#define ENETC_PSIMSGRR_MR(n) BIT((n) + 1) /* n = VSI index */ +#define ENETC_PSIVMSGRCVAR0(n) (0x210 + (n) * 0x8) /* n = VSI index */ +#define ENETC_PSIVMSGRCVAR1(n) (0x214 + (n) * 0x8) + +#define ENETC_VSIMSGSR 0x204 /* RO */ +#define ENETC_VSIMSGSR_MB BIT(0) +#define ENETC_VSIMSGSR_MS BIT(1) +#define ENETC_VSIMSGSNDAR0 0x210 +#define ENETC_VSIMSGSNDAR1 0x214 + +#define ENETC_SIMSGSR_SET_MC(val) ((val) << 16) +#define ENETC_SIMSGSR_GET_MC(val) ((val) >> 16) + +/* SI statistics */ +#define ENETC_SIROCT 0x300 +#define ENETC_SIRFRM 0x308 +#define ENETC_SIRUCA 0x310 +#define ENETC_SIRMCA 0x318 +#define ENETC_SITOCT 0x320 +#define ENETC_SITFRM 0x328 +#define ENETC_SITUCA 0x330 +#define ENETC_SITMCA 0x338 +#define ENETC_RBDCR(n) (0x8180 + (n) * 0x200) + +/* Control BDR regs */ +#define ENETC_SICBDRMR 0x800 +#define ENETC_SICBDRMR_EN BIT(31) +#define ENETC_SICBDRSR 0x804 /* RO */ +#define ENETC_SICBDRBAR0 0x810 +#define ENETC_SICBDRBAR1 0x814 +#define ENETC_SICBDRPIR 0x818 +#define ENETC_SICBDRCIR 0x81c +#define ENETC_SICBDRLENR 0x820 + +#define ENETC_SICAPR0 0x900 +#define ENETC_SICAPR1 0x904 + +#define ENETC_PSIIER 0xa00 +#define ENETC_PSIIER_MR_MASK GENMASK(2, 1) +#define ENETC_PSIIDR 0xa08 +#define ENETC_SITXIDR 0xa18 +#define ENETC_SIRXIDR 0xa28 +#define ENETC_SIMSIVR 0xa30 + +#define ENETC_SIMSITRV(n) (0xB00 + (n) * 0x4) +#define ENETC_SIMSIRRV(n) (0xB80 + (n) * 0x4) + +#define ENETC_SIUEFDCR 0xe28 + +#define ENETC_SIRFSCAPR 0x1200 +#define ENETC_SIRFSCAPR_GET_NUM_RFS(val) ((val) & 0x7f) +#define ENETC_SIRSSCAPR 0x1600 +#define ENETC_SIRSSCAPR_GET_NUM_RSS(val) (BIT((val) & 0xf) * 32) + +/** SI BDR sub-blocks, n = 0..7 */ +enum enetc_bdr_type {TX, RX}; +#define ENETC_BDR_OFF(i) ((i) * 0x200) +#define ENETC_BDR(t, i, r) (0x8000 + (t) * 0x100 + ENETC_BDR_OFF(i) + (r)) +/* RX BDR reg offsets */ +#define ENETC_RBMR 0 +#define ENETC_RBMR_AL BIT(0) +#define ENETC_RBMR_BDS BIT(2) +#define ENETC_RBMR_VTE BIT(5) +#define ENETC_RBMR_EN BIT(31) +#define ENETC_RBSR 0x4 +#define ENETC_RBBSR 0x8 +#define ENETC_RBCIR 0xc +#define ENETC_RBBAR0 0x10 +#define ENETC_RBBAR1 0x14 +#define ENETC_RBPIR 0x18 +#define ENETC_RBLENR 0x20 +#define ENETC_RBIER 0xa0 +#define ENETC_RBIER_RXTIE BIT(0) +#define ENETC_RBIDR 0xa4 +#define ENETC_RBICR0 0xa8 +#define ENETC_RBICR0_ICEN BIT(31) +#define ENETC_RBICR0_ICPT_MASK 0x1ff +#define ENETC_RBICR0_SET_ICPT(n) ((n) & ENETC_RBICR0_ICPT_MASK) +#define ENETC_RBICR1 0xac + +/* TX BDR reg offsets */ +#define ENETC_TBMR 0 +#define ENETC_TBSR_BUSY BIT(0) +#define ENETC_TBMR_VIH BIT(9) +#define ENETC_TBMR_PRIO_MASK GENMASK(2, 0) +#define ENETC_TBMR_SET_PRIO(val) ((val) & ENETC_TBMR_PRIO_MASK) +#define ENETC_TBMR_EN BIT(31) +#define ENETC_TBSR 0x4 +#define ENETC_TBBAR0 0x10 +#define ENETC_TBBAR1 0x14 +#define ENETC_TBPIR 0x18 +#define ENETC_TBCIR 0x1c +#define ENETC_TBCIR_IDX_MASK 0xffff +#define ENETC_TBLENR 0x20 +#define ENETC_TBIER 0xa0 +#define ENETC_TBIER_TXT BIT(0) +#define ENETC_TBIER_TXF BIT(1) +#define ENETC_TBIDR 0xa4 +#define ENETC_TBICR0 0xa8 +#define ENETC_TBICR0_ICEN BIT(31) +#define ENETC_TBICR0_ICPT_MASK 0xf +#define ENETC_TBICR0_SET_ICPT(n) ((ilog2(n) + 1) & ENETC_TBICR0_ICPT_MASK) +#define ENETC_TBICR1 0xac + +#define ENETC_RTBLENR_LEN(n) ((n) & ~0x7) + +/* Port regs, offset: 1_0000h */ +#define ENETC_PORT_BASE 0x10000 +#define ENETC_PMR 0x0000 +#define ENETC_PMR_SI0EN BIT(16) +#define ENETC_PMR_EN GENMASK(18, 16) +#define ENETC_PMR_PSPEED_MASK GENMASK(11, 8) +#define ENETC_PMR_PSPEED_10M 0 +#define ENETC_PMR_PSPEED_100M BIT(8) +#define ENETC_PMR_PSPEED_1000M BIT(9) +#define ENETC_PMR_PSPEED_2500M BIT(10) +#define ENETC_PSR 0x0004 /* RO */ +#define ENETC_PSIPMR 0x0018 +#define ENETC_PSIPMR_SET_UP(n) BIT(n) /* n = SI index */ +#define ENETC_PSIPMR_SET_MP(n) BIT((n) + 16) +#define ENETC_PSIPVMR 0x001c +#define ENETC_VLAN_PROMISC_MAP_ALL 0x7 +#define ENETC_PSIPVMR_SET_VP(simap) ((simap) & 0x7) +#define ENETC_PSIPVMR_SET_VUTA(simap) (((simap) & 0x7) << 16) +#define ENETC_PSIPMAR0(n) (0x0100 + (n) * 0x8) /* n = SI index */ +#define ENETC_PSIPMAR1(n) (0x0104 + (n) * 0x8) +#define ENETC_PVCLCTR 0x0208 +#define ENETC_PCVLANR1 0x0210 +#define ENETC_PCVLANR2 0x0214 +#define ENETC_VLAN_TYPE_C BIT(0) +#define ENETC_VLAN_TYPE_S BIT(1) +#define ENETC_PVCLCTR_OVTPIDL(bmp) ((bmp) & 0xff) /* VLAN_TYPE */ +#define ENETC_PSIVLANR(n) (0x0240 + (n) * 4) /* n = SI index */ +#define ENETC_PSIVLAN_EN BIT(31) +#define ENETC_PSIVLAN_SET_QOS(val) ((uint32_t)(val) << 12) +#define ENETC_PTXMBAR 0x0608 +#define ENETC_PCAPR0 0x0900 +#define ENETC_PCAPR0_RXBDR(val) ((val) >> 24) +#define ENETC_PCAPR0_TXBDR(val) (((val) >> 16) & 0xff) +#define ENETC_PCAPR1 0x0904 +#define ENETC_PSICFGR0(n) (0x0940 + (n) * 0xc) /* n = SI index */ +#define ENETC_PSICFGR0_SET_TXBDR(val) ((val) & 0xff) +#define ENETC_PSICFGR0_SET_RXBDR(val) (((val) & 0xff) << 16) +#define ENETC_PSICFGR0_VTE BIT(12) +#define ENETC_PSICFGR0_SIVIE BIT(14) +#define ENETC_PSICFGR0_ASE BIT(15) +#define ENETC_PSICFGR0_SIVC(bmp) (((bmp) & 0xff) << 24) /* VLAN_TYPE */ + +#define ENETC_PTCCBSR0(n) (0x1110 + (n) * 8) /* n = 0 to 7*/ +#define ENETC_CBSE BIT(31) +#define ENETC_CBS_BW_MASK GENMASK(6, 0) +#define ENETC_PTCCBSR1(n) (0x1114 + (n) * 8) /* n = 0 to 7*/ +#define ENETC_RSSHASH_KEY_SIZE 40 +#define ENETC_PRSSCAPR 0x1404 +#define ENETC_PRSSCAPR_GET_NUM_RSS(val) (BIT((val) & 0xf) * 32) +#define ENETC_PRSSK(n) (0x1410 + (n) * 4) /* n = [0..9] */ +#define ENETC_PSIVLANFMR 0x1700 +#define ENETC_PSIVLANFMR_VS BIT(0) +#define ENETC_PRFSMR 0x1800 +#define ENETC_PRFSMR_RFSE BIT(31) +#define ENETC_PRFSCAPR 0x1804 +#define ENETC_PRFSCAPR_GET_NUM_RFS(val) ((((val) & 0xf) + 1) * 16) +#define ENETC_PSIRFSCFGR(n) (0x1814 + (n) * 4) /* n = SI index */ +#define ENETC_PFPMR 0x1900 +#define ENETC_PFPMR_PMACE BIT(1) +#define ENETC_PFPMR_MWLM BIT(0) +#define ENETC_EMDIO_BASE 0x1c00 +#define ENETC_PSIUMHFR0(n, err) (((err) ? 0x1d08 : 0x1d00) + (n) * 0x10) +#define ENETC_PSIUMHFR1(n) (0x1d04 + (n) * 0x10) +#define ENETC_PSIMMHFR0(n, err) (((err) ? 0x1d00 : 0x1d08) + (n) * 0x10) +#define ENETC_PSIMMHFR1(n) (0x1d0c + (n) * 0x10) +#define ENETC_PSIVHFR0(n) (0x1e00 + (n) * 8) /* n = SI index */ +#define ENETC_PSIVHFR1(n) (0x1e04 + (n) * 8) /* n = SI index */ +#define ENETC_MMCSR 0x1f00 +#define ENETC_MMCSR_ME BIT(16) +#define ENETC_PTCMSDUR(n) (0x2020 + (n) * 4) /* n = TC index [0..7] */ + +#define ENETC_PAR_PORT_CFG 0x3050 +#define ENETC_PAR_PORT_L4CD BIT(0) +#define ENETC_PAR_PORT_L3CD BIT(1) + +#define ENETC_PM0_CMD_CFG 0x8008 +#define ENETC_PM1_CMD_CFG 0x9008 +#define ENETC_PM0_TX_EN BIT(0) +#define ENETC_PM0_RX_EN BIT(1) +#define ENETC_PM0_PROMISC BIT(4) +#define ENETC_PM0_CMD_XGLP BIT(10) +#define ENETC_PM0_CMD_TXP BIT(11) +#define ENETC_PM0_CMD_PHY_TX_EN BIT(15) +#define ENETC_PM0_CMD_SFD BIT(21) +#define ENETC_PM0_MAXFRM 0x8014 +#define ENETC_SET_TX_MTU(val) ((val) << 16) +#define ENETC_SET_MAXFRM(val) ((val) & 0xffff) +#define ENETC_PM0_RX_FIFO 0x801c +#define ENETC_PM0_RX_FIFO_VAL 1 + +#define ENETC_PM_IMDIO_BASE 0x8030 + +#define ENETC_PM0_IF_MODE 0x8300 +#define ENETC_PM0_IFM_RG BIT(2) +#define ENETC_PM0_IFM_RLP (BIT(5) | BIT(11)) +#define ENETC_PM0_IFM_EN_AUTO BIT(15) +#define ENETC_PM0_IFM_SSP_MASK GENMASK(14, 13) +#define ENETC_PM0_IFM_SSP_1000 (2 << 13) +#define ENETC_PM0_IFM_SSP_100 (0 << 13) +#define ENETC_PM0_IFM_SSP_10 (1 << 13) +#define ENETC_PM0_IFM_FULL_DPX BIT(12) +#define ENETC_PM0_IFM_IFMODE_MASK GENMASK(1, 0) +#define ENETC_PM0_IFM_IFMODE_XGMII 0 +#define ENETC_PM0_IFM_IFMODE_GMII 2 +#define ENETC_PSIDCAPR 0x1b08 +#define ENETC_PSIDCAPR_MSK GENMASK(15, 0) +#define ENETC_PSFCAPR 0x1b18 +#define ENETC_PSFCAPR_MSK GENMASK(15, 0) +#define ENETC_PSGCAPR 0x1b28 +#define ENETC_PSGCAPR_GCL_MSK GENMASK(18, 16) +#define ENETC_PSGCAPR_SGIT_MSK GENMASK(15, 0) +#define ENETC_PFMCAPR 0x1b38 +#define ENETC_PFMCAPR_MSK GENMASK(15, 0) + +/* MAC counters */ +#define ENETC_PM0_REOCT 0x8100 +#define ENETC_PM0_RALN 0x8110 +#define ENETC_PM0_RXPF 0x8118 +#define ENETC_PM0_RFRM 0x8120 +#define ENETC_PM0_RFCS 0x8128 +#define ENETC_PM0_RVLAN 0x8130 +#define ENETC_PM0_RERR 0x8138 +#define ENETC_PM0_RUCA 0x8140 +#define ENETC_PM0_RMCA 0x8148 +#define ENETC_PM0_RBCA 0x8150 +#define ENETC_PM0_RDRP 0x8158 +#define ENETC_PM0_RPKT 0x8160 +#define ENETC_PM0_RUND 0x8168 +#define ENETC_PM0_R64 0x8170 +#define ENETC_PM0_R127 0x8178 +#define ENETC_PM0_R255 0x8180 +#define ENETC_PM0_R511 0x8188 +#define ENETC_PM0_R1023 0x8190 +#define ENETC_PM0_R1522 0x8198 +#define ENETC_PM0_R1523X 0x81A0 +#define ENETC_PM0_ROVR 0x81A8 +#define ENETC_PM0_RJBR 0x81B0 +#define ENETC_PM0_RFRG 0x81B8 +#define ENETC_PM0_RCNP 0x81C0 +#define ENETC_PM0_RDRNTP 0x81C8 +#define ENETC_PM0_TEOCT 0x8200 +#define ENETC_PM0_TOCT 0x8208 +#define ENETC_PM0_TCRSE 0x8210 +#define ENETC_PM0_TXPF 0x8218 +#define ENETC_PM0_TFRM 0x8220 +#define ENETC_PM0_TFCS 0x8228 +#define ENETC_PM0_TVLAN 0x8230 +#define ENETC_PM0_TERR 0x8238 +#define ENETC_PM0_TUCA 0x8240 +#define ENETC_PM0_TMCA 0x8248 +#define ENETC_PM0_TBCA 0x8250 +#define ENETC_PM0_TPKT 0x8260 +#define ENETC_PM0_TUND 0x8268 +#define ENETC_PM0_T64 0x8270 +#define ENETC_PM0_T127 0x8278 +#define ENETC_PM0_T255 0x8280 +#define ENETC_PM0_T511 0x8288 +#define ENETC_PM0_T1023 0x8290 +#define ENETC_PM0_T1522 0x8298 +#define ENETC_PM0_T1523X 0x82A0 +#define ENETC_PM0_TCNP 0x82C0 +#define ENETC_PM0_TDFR 0x82D0 +#define ENETC_PM0_TMCOL 0x82D8 +#define ENETC_PM0_TSCOL 0x82E0 +#define ENETC_PM0_TLCOL 0x82E8 +#define ENETC_PM0_TECOL 0x82F0 + +/* Port counters */ +#define ENETC_PICDR(n) (0x0700 + (n) * 8) /* n = [0..3] */ +#define ENETC_PBFDSIR 0x0810 +#define ENETC_PFDMSAPR 0x0814 +#define ENETC_UFDMF 0x1680 +#define ENETC_MFDMF 0x1684 +#define ENETC_PUFDVFR 0x1780 +#define ENETC_PMFDVFR 0x1784 +#define ENETC_PBFDVFR 0x1788 + +/** Global regs, offset: 2_0000h */ +#define ENETC_GLOBAL_BASE 0x20000 +#define ENETC_G_EIPBRR0 0x0bf8 +#define ENETC_G_EIPBRR1 0x0bfc +#define ENETC_G_EPFBLPR(n) (0xd00 + 4 * (n)) +#define ENETC_G_EPFBLPR1_XGMII 0x80000000 + +/* Buffer Descriptors (BD) */ +union enetc_tx_bd { + struct { + uint64_t addr; + uint16_t buf_len; + uint16_t frm_len; + union { + struct { + uint8_t reserved[3]; + uint8_t flags; + }; /* default layout */ + uint32_t txstart; + uint32_t lstatus; + }; + }; + struct { + uint32_t tstamp; + uint16_t tpid; + uint16_t vid; + uint8_t reserved[6]; + uint8_t e_flags; + uint8_t flags; + } ext; /* Tx BD extension */ + struct { + uint32_t tstamp; + uint8_t reserved[10]; + uint8_t status; + uint8_t flags; + } wb; /* writeback descriptor */ +}; + +enum enetc_txbd_flags { + ENETC_TXBD_FLAGS_RES0 = BIT(0), /* reserved */ + ENETC_TXBD_FLAGS_TSE = BIT(1), + ENETC_TXBD_FLAGS_W = BIT(2), + ENETC_TXBD_FLAGS_RES3 = BIT(3), /* reserved */ + ENETC_TXBD_FLAGS_TXSTART = BIT(4), + ENETC_TXBD_FLAGS_FI = BIT(5), + ENETC_TXBD_FLAGS_EX = BIT(6), + ENETC_TXBD_FLAGS_F = BIT(7) +}; +#define ENETC_TXBD_TXSTART_MASK GENMASK(24, 0) +#define ENETC_TXBD_FLAGS_OFFSET 24 + +static inline void enetc_clear_tx_bd(union enetc_tx_bd *txbd) +{ + memset(txbd, 0, sizeof(*txbd)); +} + +/* Extension flags */ +#define ENETC_TXBD_E_FLAGS_VLAN_INS BIT(0) +#define ENETC_TXBD_E_FLAGS_TWO_STEP_PTP BIT(2) + +union enetc_rx_bd { + struct { + uint64_t addr; + uint8_t reserved[8]; + } w; + struct { + uint16_t inet_csum; + uint16_t parse_summary; + uint32_t rss_hash; + uint16_t buf_len; + uint16_t vlan_opt; + union { + struct { + uint16_t flags; + uint16_t error; + }; + uint32_t lstatus; + }; + } r; + struct { + uint32_t tstamp; + uint8_t reserved[12]; + } ext; +}; + +#define ENETC_RXBD_PARSER_ERROR BIT(15) + +#define ENETC_RXBD_LSTATUS_R BIT(30) +#define ENETC_RXBD_LSTATUS_F BIT(31) +#define ENETC_RXBD_ERR_MASK 0xff +#define ENETC_RXBD_LSTATUS(flags) ((flags) << 16) +#define ENETC_RXBD_FLAG_RSSV BIT(8) +#define ENETC_RXBD_FLAG_VLAN BIT(9) +#define ENETC_RXBD_FLAG_TSTMP BIT(10) +#define ENETC_RXBD_FLAG_TPID GENMASK(1, 0) + +#define ENETC_MAC_ADDR_FILT_CNT 8 /* # of supported entries per port */ +#define EMETC_MAC_ADDR_FILT_RES 3 /* # of reserved entries at the beginning */ +#define ENETC_MAX_NUM_VFS 2 + +#define ENETC_CBD_FLAGS_SF BIT(7) /* short format */ +#define ENETC_CBD_STATUS_MASK 0xf + +struct enetc_cmd_rfse { + uint8_t smac_h[6]; + uint8_t smac_m[6]; + uint8_t dmac_h[6]; + uint8_t dmac_m[6]; + uint32_t sip_h[4]; /* Big-endian */ + uint32_t sip_m[4]; /* Big-endian */ + uint32_t dip_h[4]; /* Big-endian */ + uint32_t dip_m[4]; /* Big-endian */ + uint16_t ethtype_h; + uint16_t ethtype_m; + uint16_t ethtype4_h; + uint16_t ethtype4_m; + uint16_t sport_h; + uint16_t sport_m; + uint16_t dport_h; + uint16_t dport_m; + uint16_t vlan_h; + uint16_t vlan_m; + uint8_t proto_h; + uint8_t proto_m; + uint16_t flags; + uint16_t result; + uint16_t mode; +}; + +#define ENETC_RFSE_EN BIT(15) +#define ENETC_RFSE_MODE_BD 2 + +#define ENETC_SI_INT_IDX 0 +/* base index for Rx/Tx interrupts */ +#define ENETC_BDR_INT_BASE_IDX 1 + +/* Messaging */ + +/* Command completion status */ +enum enetc_msg_cmd_status { + ENETC_MSG_CMD_STATUS_OK, + ENETC_MSG_CMD_STATUS_FAIL +}; + +/* VSI-PSI command message types */ +enum enetc_msg_cmd_type { + ENETC_MSG_CMD_MNG_MAC = 1, /* manage MAC address */ + ENETC_MSG_CMD_MNG_RX_MAC_FILTER,/* manage RX MAC table */ + ENETC_MSG_CMD_MNG_RX_VLAN_FILTER /* manage RX VLAN table */ +}; + +/* VSI-PSI command action types */ +enum enetc_msg_cmd_action_type { + ENETC_MSG_CMD_MNG_ADD = 1, + ENETC_MSG_CMD_MNG_REMOVE +}; + +/* PSI-VSI command header format */ +struct enetc_msg_cmd_header { + uint16_t type; /* command class type */ + uint16_t id; /* denotes the specific required action */ +}; + +enum bdcr_cmd_class { + BDCR_CMD_UNSPEC = 0, + BDCR_CMD_MAC_FILTER, + BDCR_CMD_VLAN_FILTER, + BDCR_CMD_RSS, + BDCR_CMD_RFS, + BDCR_CMD_PORT_GCL, + BDCR_CMD_RECV_CLASSIFIER, + BDCR_CMD_STREAM_IDENTIFY, + BDCR_CMD_STREAM_FILTER, + BDCR_CMD_STREAM_GCL, + BDCR_CMD_FLOW_METER, + __BDCR_CMD_MAX_LEN, + BDCR_CMD_MAX_LEN = __BDCR_CMD_MAX_LEN - 1, +}; + +enum bdcr_cmd_rss { + BDCR_CMD_RSS_WRITE = 1, + BDCR_CMD_RSS_READ = 2, +}; + +/* class 5, command 0 */ +struct tgs_gcl_conf { + uint8_t atc; /* init gate value */ + uint8_t res[7]; + struct { + uint8_t res1[4]; + uint16_t acl_len; + uint8_t res2[2]; + }; +}; + +/* gate control list entry */ +struct gce { + uint32_t period; + uint8_t gate; + uint8_t res[3]; +}; + +/* tgs_gcl_conf address point to this data space */ +struct tgs_gcl_data { + uint32_t btl; + uint32_t bth; + uint32_t ct; + uint32_t cte; + struct gce entry[]; +}; + +/* class 7, command 0, Stream Identity Entry Configuration */ +struct streamid_conf { + uint32_t stream_handle; /* init gate value */ + uint32_t iports; + uint8_t id_type; + uint8_t oui[3]; + uint8_t res[3]; + uint8_t en; +}; + +#define ENETC_CBDR_SID_VID_MASK 0xfff +#define ENETC_CBDR_SID_VIDM BIT(12) +#define ENETC_CBDR_SID_TG_MASK 0xc000 +/* streamid_conf address point to this data space */ +struct streamid_data { + union { + uint8_t dmac[6]; + uint8_t smac[6]; + }; + uint16_t vid_vidm_tg; +}; + +#define ENETC_CBDR_SFI_PRI_MASK 0x7 +#define ENETC_CBDR_SFI_PRIM BIT(3) +#define ENETC_CBDR_SFI_BLOV BIT(4) +#define ENETC_CBDR_SFI_BLEN BIT(5) +#define ENETC_CBDR_SFI_MSDUEN BIT(6) +#define ENETC_CBDR_SFI_FMITEN BIT(7) +#define ENETC_CBDR_SFI_ENABLE BIT(7) +/* class 8, command 0, Stream Filter Instance, Short Format */ +struct sfi_conf { + uint32_t stream_handle; + uint8_t multi; + uint8_t res[2]; + uint8_t sthm; + /* Max Service Data Unit or Flow Meter Instance Table index. + * Depending on the value of FLT this represents either Max + * Service Data Unit (max frame size) allowed by the filter + * entry or is an index into the Flow Meter Instance table + * index identifying the policer which will be used to police + * it. + */ + uint16_t fm_inst_table_index; + uint16_t msdu; + uint16_t sg_inst_table_index; + uint8_t res1[2]; + uint32_t input_ports; + uint8_t res2[3]; + uint8_t en; +}; + +/* class 8, command 2 stream Filter Instance status query short format + * command no need structure define + * Stream Filter Instance Query Statistics Response data + */ +struct sfi_counter_data { + uint32_t matchl; + uint32_t matchh; + uint32_t msdu_dropl; + uint32_t msdu_droph; + uint32_t stream_gate_dropl; + uint32_t stream_gate_droph; + uint32_t flow_meter_dropl; + uint32_t flow_meter_droph; +}; + +#define ENETC_CBDR_SGI_OIPV_MASK 0x7 +#define ENETC_CBDR_SGI_OIPV_EN BIT(3) +#define ENETC_CBDR_SGI_CGTST BIT(6) +#define ENETC_CBDR_SGI_OGTST BIT(7) +#define ENETC_CBDR_SGI_CFG_CHG BIT(1) +#define ENETC_CBDR_SGI_CFG_PND BIT(2) +#define ENETC_CBDR_SGI_OEX BIT(4) +#define ENETC_CBDR_SGI_OEXEN BIT(5) +#define ENETC_CBDR_SGI_IRX BIT(6) +#define ENETC_CBDR_SGI_IRXEN BIT(7) +#define ENETC_CBDR_SGI_ACLLEN_MASK 0x3 +#define ENETC_CBDR_SGI_OCLLEN_MASK 0xc +#define ENETC_CBDR_SGI_EN BIT(7) +/* class 9, command 0, Stream Gate Instance Table, Short Format + * class 9, command 2, Stream Gate Instance Table entry query write back + * Short Format + */ +struct sgi_table { + uint8_t res[8]; + uint8_t oipv; + uint8_t res0[2]; + uint8_t ocgtst; + uint8_t res1[7]; + uint8_t gset; + uint8_t oacl_len; + uint8_t res2[2]; + uint8_t en; +}; + +#define ENETC_CBDR_SGI_AIPV_MASK 0x7 +#define ENETC_CBDR_SGI_AIPV_EN BIT(3) +#define ENETC_CBDR_SGI_AGTST BIT(7) + +/* class 9, command 1, Stream Gate Control List, Long Format */ +struct sgcl_conf { + uint8_t aipv; + uint8_t res[2]; + uint8_t agtst; + uint8_t res1[4]; + union { + struct { + uint8_t res2[4]; + uint8_t acl_len; + uint8_t res3[3]; + }; + uint8_t cct[8]; /* Config change time */ *** 1566 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Jun 24 11: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 74A33649844; Thu, 24 Jun 2021 11: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 4G9ctN2l1hz3rTw; Thu, 24 Jun 2021 11: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 4474E16E65; Thu, 24 Jun 2021 11: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 15OBCiL6065323; Thu, 24 Jun 2021 11: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 15OBCihk065322; Thu, 24 Jun 2021 11:12:44 GMT (envelope-from git) Date: Thu, 24 Jun 2021 11:12:44 GMT Message-Id: <202106241112.15OBCihk065322@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: a2dc172dda10 - main - Introduce LS1028A PCI MDIO driver. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2dc172dda101ee602ade2232ea29f50d5433ece 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, 24 Jun 2021 11:12:44 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=a2dc172dda101ee602ade2232ea29f50d5433ece commit a2dc172dda101ee602ade2232ea29f50d5433ece Author: Marcin Wojtas AuthorDate: 2021-05-19 14:35:19 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 11:01:22 +0000 Introduce LS1028A PCI MDIO driver. Implement support for the NXP LS1028A SoC MDIO controller. It is attached to the internal PCI root complex. The controller is used to communicate with PHYs of ports connected to the internal switch. Submitted by: Lukasz Hajec Reviewed by: manu Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30731 --- sys/conf/files.arm64 | 1 + sys/dev/enetc/enetc_mdio_pci.c | 191 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 6571b66d22c1..a1664cc9d299 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -176,6 +176,7 @@ dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_roc dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga soc_intel_stratix10 dev/enetc/enetc_mdio.c optional enetc soc_nxp_ls +dev/enetc/enetc_mdio_pci.c optional enetc pci soc_nxp_ls dev/enetc/if_enetc.c optional enetc iflib pci fdt soc_nxp_ls dev/gpio/pl061.c optional pl061 gpio diff --git a/sys/dev/enetc/enetc_mdio_pci.c b/sys/dev/enetc/enetc_mdio_pci.c new file mode 100644 index 000000000000..0fd540008e57 --- /dev/null +++ b/sys/dev/enetc/enetc_mdio_pci.c @@ -0,0 +1,191 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Alstom Group. + * Copyright (c) 2021 Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "miibus_if.h" + +#define ENETC_MDIO_DEV_ID 0xee01 +#define ENETC_MDIO_DEV_NAME "FSL PCIe IE Central MDIO" + +static struct entec_mdio_pci_id { + uint16_t vendor; + uint16_t device; + const char *desc; +} enetc_mdio_pci_ids[] = { + {PCI_VENDOR_FREESCALE, ENETC_MDIO_DEV_ID, ENETC_MDIO_DEV_NAME}, +}; +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, enetc_mdio_pci, + enetc_mdio_pci_ids, nitems(enetc_mdio_pci_ids)); + +struct enetc_mdio_pci_softc { + device_t sc_dev; + struct mtx sc_lock; + struct resource *sc_regs; +}; + +static device_attach_t enetc_mdio_pci_attach; +static device_detach_t enetc_mdio_pci_detach; +static device_probe_t enetc_mdio_pci_probe; + +static int +enetc_mdio_pci_readreg(device_t dev, int phy, int reg) +{ + struct enetc_mdio_pci_softc *sc; + uint32_t ret; + + sc = device_get_softc(dev); + + mtx_lock(&sc->sc_lock); + ret = enetc_mdio_read(sc->sc_regs, ENETC_EMDIO_BASE, phy, reg); + mtx_unlock(&sc->sc_lock); + + return (ret); +} + +static int +enetc_mdio_pci_writereg(device_t dev, int phy, int reg, int data) +{ + struct enetc_mdio_pci_softc *sc; + int err; + + sc = device_get_softc(dev); + + mtx_lock(&sc->sc_lock); + err = enetc_mdio_write(sc->sc_regs, ENETC_EMDIO_BASE, phy, reg, data); + mtx_unlock(&sc->sc_lock); + if (err != 0) + return (err); + + return (0); +} + +static int +enetc_mdio_pci_probe(device_t dev) +{ + struct entec_mdio_pci_id *id; + + for (id = enetc_mdio_pci_ids; id->vendor != 0; ++id) { + if (pci_get_device(dev) != id->device || + pci_get_vendor(dev) != id->vendor) + continue; + + device_set_desc(dev, id->desc); + + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +enetc_mdio_pci_attach(device_t dev) +{ + struct enetc_mdio_pci_softc *sc; + int rid; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + /* Init locks */ + mtx_init(&sc->sc_lock, device_get_nameunit(dev), "MDIO lock", MTX_DEF); + + rid = PCIR_BAR(0); + sc->sc_regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_regs == NULL) { + device_printf(dev, "can't allocate resources for PCI MDIO \n"); + return (ENXIO); + } + + OF_device_register_xref(ofw_bus_get_node(dev), dev); + + return (0); +} + +static int +enetc_mdio_pci_detach(device_t dev) +{ + struct enetc_mdio_pci_softc *sc; + + sc = device_get_softc(dev); + + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_regs); + mtx_destroy(&sc->sc_lock); + + return (0); +} + +static device_method_t enetc_mdio_pci_methods[] ={ + DEVMETHOD(device_probe, enetc_mdio_pci_probe), + DEVMETHOD(device_attach, enetc_mdio_pci_attach), + DEVMETHOD(device_detach, enetc_mdio_pci_detach), + + DEVMETHOD(miibus_readreg, enetc_mdio_pci_readreg), + DEVMETHOD(miibus_writereg, enetc_mdio_pci_writereg), + + DEVMETHOD_END +}; + +static driver_t enetc_mdio_pci_driver = { + "enetc_mdio_pci", + enetc_mdio_pci_methods, + sizeof(struct enetc_mdio_pci_softc), +}; + +static devclass_t enetc_mdio_pci_devclass; + +DRIVER_MODULE(enetc_mdio_pci, pci, enetc_mdio_pci_driver, + enetc_mdio_pci_devclass, 0, 0); +DRIVER_MODULE(miibus, enetc_mdio_pci, miibus_driver, miibus_devclass, + 0, 0); +MODULE_VERSION(enetc_mdio_pci, 1); From owner-dev-commits-src-main@freebsd.org Thu Jun 24 14:35: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 957D864CCFD; Thu, 24 Jun 2021 14:35: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 4G9jNg3tjYz4cHM; Thu, 24 Jun 2021 14:35: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 6D8DD19654; Thu, 24 Jun 2021 14:35: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 15OEZl6J032412; Thu, 24 Jun 2021 14:35:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OEZlHG032411; Thu, 24 Jun 2021 14:35:47 GMT (envelope-from git) Date: Thu, 24 Jun 2021 14:35:47 GMT Message-Id: <202106241435.15OEZlHG032411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 438c9e3cf894 - main - ena: change ENA C++-style comment into C-style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 438c9e3cf89403628ec237cfecdd0538f208087b 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, 24 Jun 2021 14:35:47 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=438c9e3cf89403628ec237cfecdd0538f208087b commit 438c9e3cf89403628ec237cfecdd0538f208087b Author: Marcin Wojtas AuthorDate: 2021-06-14 08:57:45 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 14:02:39 +0000 ena: change ENA C++-style comment into C-style According to man style(9), only C-style comments should be used. Submitted by: Michal Krawczyk Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena_datapath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c index 4dd0fb58e3ed..0dcc9d45a01c 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -431,7 +431,7 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_rx_buf_info *ena_bufs, mbuf->m_flags |= M_PKTHDR; mbuf->m_pkthdr.len = len; mbuf->m_len = len; - // Only for the first segment the data starts at specific offset + /* Only for the first segment the data starts at specific offset */ mbuf->m_data = mtodo(mbuf, ena_rx_ctx->pkt_offset); ena_trace(NULL, ENA_DBG | ENA_RXPTH, "Mbuf data offset=%u\n", ena_rx_ctx->pkt_offset); From owner-dev-commits-src-main@freebsd.org Thu Jun 24 14:35: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 BA0CB64CCFE; Thu, 24 Jun 2021 14:35: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 4G9jNh4x19z4cP2; Thu, 24 Jun 2021 14:35: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 90D68195D6; Thu, 24 Jun 2021 14:35: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 15OEZmmT032443; Thu, 24 Jun 2021 14:35:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OEZmII032442; Thu, 24 Jun 2021 14:35:48 GMT (envelope-from git) Date: Thu, 24 Jun 2021 14:35:48 GMT Message-Id: <202106241435.15OEZmII032442@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: beaadec9eaec - main - ena: add support for the large LLQ headers in ENA MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: beaadec9eaec8e6b266faff3b0880a141728fcef 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, 24 Jun 2021 14:35:48 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=beaadec9eaec8e6b266faff3b0880a141728fcef commit beaadec9eaec8e6b266faff3b0880a141728fcef Author: Marcin Wojtas AuthorDate: 2021-06-14 08:57:47 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 14:02:39 +0000 ena: add support for the large LLQ headers in ENA Default LLQ (Low-latency queue) maximum header size is 96 bytes and can be too small for some types of packets - like IPv6 packets with multiple extension. This can be fixed, by using large LLQ headers. If the device supports larger LLQ headers, the user can activate this feature by setting sysctl tunable 'hw.ena.force_large_llq_header' to '1' in the /boot/loader.conf file. In case the device isn't supporting this feature, the default value (96B) will be used. Submitted by: Michal Krawczyk Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena.c | 41 ++++++++++++++++++++++++++++++++++++----- sys/dev/ena/ena_sysctl.c | 15 ++++++++++++++- sys/dev/ena/ena_sysctl.h | 5 ++++- 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index 680eb0e9d049..20da750bcac0 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates. + * Copyright (c) 2015-2021 Amazon.com, Inc. or its affiliates. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -2606,14 +2606,25 @@ ena_set_queues_placement_policy(device_t pdev, struct ena_com_dev *ena_dev, } static inline -void set_default_llq_configurations(struct ena_llq_configurations *llq_config) +void set_default_llq_configurations(struct ena_llq_configurations *llq_config, + struct ena_admin_feature_llq_desc *llq) { + llq_config->llq_header_location = ENA_ADMIN_INLINE_HEADER; - llq_config->llq_ring_entry_size = ENA_ADMIN_LIST_ENTRY_SIZE_128B; llq_config->llq_stride_ctrl = ENA_ADMIN_MULTIPLE_DESCS_PER_ENTRY; llq_config->llq_num_decs_before_header = ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_2; - llq_config->llq_ring_entry_size_value = 128; + if ((llq->entry_size_ctrl_supported & + ENA_ADMIN_LIST_ENTRY_SIZE_256B) != 0 && + ena_force_large_llq_header) { + llq_config->llq_ring_entry_size = + ENA_ADMIN_LIST_ENTRY_SIZE_256B; + llq_config->llq_ring_entry_size_value = 256; + } else { + llq_config->llq_ring_entry_size = + ENA_ADMIN_LIST_ENTRY_SIZE_128B; + llq_config->llq_ring_entry_size_value = 128; + } } static int @@ -2672,6 +2683,26 @@ ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx) max_tx_queue_size = 1 << (flsl(max_tx_queue_size) - 1); max_rx_queue_size = 1 << (flsl(max_rx_queue_size) - 1); + /* + * When forcing large headers, we multiply the entry size by 2, + * and therefore divide the queue size by 2, leaving the amount + * of memory used by the queues unchanged. + */ + if (ena_force_large_llq_header) { + if ((llq->entry_size_ctrl_supported & + ENA_ADMIN_LIST_ENTRY_SIZE_256B) != 0 && + ena_dev->tx_mem_queue_type == + ENA_ADMIN_PLACEMENT_POLICY_DEV) { + max_tx_queue_size /= 2; + device_printf(ctx->pdev, + "Forcing large headers and decreasing maximum Tx queue size to %d\n", + max_tx_queue_size); + } else { + device_printf(ctx->pdev, + "Forcing large headers failed: LLQ is disabled or device does not support large headers\n"); + } + } + tx_queue_size = clamp_val(tx_queue_size, ENA_MIN_RING_SIZE, max_tx_queue_size); rx_queue_size = clamp_val(rx_queue_size, ENA_MIN_RING_SIZE, @@ -3618,7 +3649,7 @@ ena_attach(device_t pdev) goto err_bus_free; } - set_default_llq_configurations(&llq_config); + set_default_llq_configurations(&llq_config, &get_feat_ctx.llq); rc = ena_set_queues_placement_policy(pdev, ena_dev, &get_feat_ctx.llq, &llq_config); diff --git a/sys/dev/ena/ena_sysctl.c b/sys/dev/ena/ena_sysctl.c index 3bc49790b450..26fc79379e33 100644 --- a/sys/dev/ena/ena_sysctl.c +++ b/sys/dev/ena/ena_sysctl.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates. + * Copyright (c) 2015-2021 Amazon.com, Inc. or its affiliates. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,6 +69,19 @@ int ena_enable_9k_mbufs = 0; SYSCTL_INT(_hw_ena, OID_AUTO, enable_9k_mbufs, CTLFLAG_RDTUN, &ena_enable_9k_mbufs, 0, "Use 9 kB mbufs for Rx descriptors"); +/* + * Force the driver to use large LLQ (Low Latency Queue) header. Defaults to + * false. This option may be important for platforms, which often handle packet + * headers on Tx with total header size greater than 96B, as it may + * reduce the latency. + * It also reduces the maximum Tx queue size by half, so it may cause more Tx + * packet drops. + */ +bool ena_force_large_llq_header = false; +SYSCTL_BOOL(_hw_ena, OID_AUTO, force_large_llq_header, CTLFLAG_RDTUN, + &ena_force_large_llq_header, 0, + "Increases maximum supported header size in LLQ mode to 224 bytes, while reducing the maximum Tx queue size by half.\n"); + void ena_sysctl_add_nodes(struct ena_adapter *adapter) { diff --git a/sys/dev/ena/ena_sysctl.h b/sys/dev/ena/ena_sysctl.h index 5aa0b795fbb5..360e32c3ad18 100644 --- a/sys/dev/ena/ena_sysctl.h +++ b/sys/dev/ena/ena_sysctl.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates. + * Copyright (c) 2015-2021 Amazon.com, Inc. or its affiliates. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,4 +44,7 @@ void ena_sysctl_add_nodes(struct ena_adapter *adapter); extern int ena_enable_9k_mbufs; #define ena_mbuf_sz (ena_enable_9k_mbufs ? MJUM9BYTES : MJUMPAGESIZE) +/* Force the driver to use large LLQ (Low Latency Queue) headers. */ +extern bool ena_force_large_llq_header; + #endif /* !(ENA_SYSCTL_H) */ From owner-dev-commits-src-main@freebsd.org Thu Jun 24 14:35: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 3C83B64D461; Thu, 24 Jun 2021 14:35: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 4G9jNk0sh7z4cQ9; Thu, 24 Jun 2021 14:35: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 CDAAB19AB3; Thu, 24 Jun 2021 14:35: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 15OEZnUh032467; Thu, 24 Jun 2021 14:35:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OEZngG032466; Thu, 24 Jun 2021 14:35:49 GMT (envelope-from git) Date: Thu, 24 Jun 2021 14:35:49 GMT Message-Id: <202106241435.15OEZngG032466@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: ddec69e6a796 - main - ena: remove surplus NULL checks when freeing ENA resources MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ddec69e6a796283497ebada0569f34bd41bbdf37 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, 24 Jun 2021 14:35:50 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=ddec69e6a796283497ebada0569f34bd41bbdf37 commit ddec69e6a796283497ebada0569f34bd41bbdf37 Author: Marcin Wojtas AuthorDate: 2021-06-14 08:57:49 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 14:02:39 +0000 ena: remove surplus NULL checks when freeing ENA resources Calling free on a NULL pointer is valid, as appropriate check is already done internally: /* free(NULL, ...) does nothing */ if (addr == NULL) return; Submitted by: Artur Rojek Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index 20da750bcac0..d7a68e94d361 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -1898,8 +1898,7 @@ ena_disable_msix(struct ena_adapter *adapter) } adapter->msix_vecs = 0; - if (adapter->msix_entries != NULL) - free(adapter->msix_entries, M_DEVBUF); + free(adapter->msix_entries, M_DEVBUF); adapter->msix_entries = NULL; } @@ -3863,11 +3862,9 @@ ena_detach(device_t pdev) if_free(adapter->ifp); - if (ena_dev->bus != NULL) - free(ena_dev->bus, M_DEVBUF); + free(ena_dev->bus, M_DEVBUF); - if (ena_dev != NULL) - free(ena_dev, M_DEVBUF); + free(ena_dev, M_DEVBUF); return (bus_generic_detach(pdev)); } From owner-dev-commits-src-main@freebsd.org Thu Jun 24 14:35:52 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 E4AF864D688; Thu, 24 Jun 2021 14:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G9jNm4YbPz4c8D; Thu, 24 Jun 2021 14:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63C6019BC2; Thu, 24 Jun 2021 14:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15OEZqVP032516; Thu, 24 Jun 2021 14:35:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OEZqmR032514; Thu, 24 Jun 2021 14:35:52 GMT (envelope-from git) Date: Thu, 24 Jun 2021 14:35:52 GMT Message-Id: <202106241435.15OEZqmR032514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 3fc5d816f883 - main - Merge tag 'vendor/ena-com/2.4.0' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3fc5d816f8831d6fc2816ac97bd78dc486cd080c 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, 24 Jun 2021 14:35:53 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=3fc5d816f8831d6fc2816ac97bd78dc486cd080c commit 3fc5d816f8831d6fc2816ac97bd78dc486cd080c Merge: 0e7d31f63b9d 1f4f67f52424 Author: Marcin Wojtas AuthorDate: 2021-06-24 14:07:33 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 14:15:18 +0000 Merge tag 'vendor/ena-com/2.4.0' Update the driver in order not to break its compilation and make use of the new ENA logging system Migrate platform code to the new logging system provided by ena_com layer. Make ENA_INFO the new default log level. Remove all explicit use of `device_printf`, all new logs requiring one of the log macros to be used. sys/contrib/ena-com/ena_com.c | 37 +-- sys/contrib/ena-com/ena_com.h | 6 +- sys/contrib/ena-com/ena_defs/ena_admin_defs.h | 23 +- sys/contrib/ena-com/ena_defs/ena_gen_info.h | 6 +- sys/contrib/ena-com/ena_eth_com.c | 4 +- sys/contrib/ena-com/ena_fbsd_log.h | 74 ++++++ sys/contrib/ena-com/ena_plat.h | 37 +-- sys/dev/ena/ena.c | 342 +++++++++++++------------- sys/dev/ena/ena_datapath.c | 83 ++++--- sys/dev/ena/ena_netmap.c | 73 +++--- sys/dev/ena/ena_sysctl.c | 30 +-- 11 files changed, 397 insertions(+), 318 deletions(-) diff --cc sys/contrib/ena-com/ena_fbsd_log.h index 000000000000,311e2f0f280a..311e2f0f280a mode 000000,100644..100644 --- a/sys/contrib/ena-com/ena_fbsd_log.h +++ b/sys/contrib/ena-com/ena_fbsd_log.h diff --cc sys/dev/ena/ena.c index fbe32a7a930e,000000000000..84d58c844332 mode 100644,000000..100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@@ -1,3980 -1,0 +1,3984 @@@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2015-2021 Amazon.com, Inc. or its affiliates. + * 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 COPYRIGHT HOLDERS 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 COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include "opt_rss.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef RSS +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "ena_datapath.h" +#include "ena.h" +#include "ena_sysctl.h" + +#ifdef DEV_NETMAP +#include "ena_netmap.h" +#endif /* DEV_NETMAP */ + +/********************************************************* + * Function prototypes + *********************************************************/ +static int ena_probe(device_t); +static void ena_intr_msix_mgmnt(void *); +static void ena_free_pci_resources(struct ena_adapter *); +static int ena_change_mtu(if_t, int); +static inline void ena_alloc_counters(counter_u64_t *, int); +static inline void ena_free_counters(counter_u64_t *, int); +static inline void ena_reset_counters(counter_u64_t *, int); +static void ena_init_io_rings_common(struct ena_adapter *, + struct ena_ring *, uint16_t); +static void ena_init_io_rings_basic(struct ena_adapter *); +static void ena_init_io_rings_advanced(struct ena_adapter *); +static void ena_init_io_rings(struct ena_adapter *); +static void ena_free_io_ring_resources(struct ena_adapter *, unsigned int); +static void ena_free_all_io_rings_resources(struct ena_adapter *); +static int ena_setup_tx_dma_tag(struct ena_adapter *); +static int ena_free_tx_dma_tag(struct ena_adapter *); +static int ena_setup_rx_dma_tag(struct ena_adapter *); +static int ena_free_rx_dma_tag(struct ena_adapter *); +static void ena_release_all_tx_dmamap(struct ena_ring *); +static int ena_setup_tx_resources(struct ena_adapter *, int); +static void ena_free_tx_resources(struct ena_adapter *, int); +static int ena_setup_all_tx_resources(struct ena_adapter *); +static void ena_free_all_tx_resources(struct ena_adapter *); +static int ena_setup_rx_resources(struct ena_adapter *, unsigned int); +static void ena_free_rx_resources(struct ena_adapter *, unsigned int); +static int ena_setup_all_rx_resources(struct ena_adapter *); +static void ena_free_all_rx_resources(struct ena_adapter *); +static inline int ena_alloc_rx_mbuf(struct ena_adapter *, struct ena_ring *, + struct ena_rx_buffer *); +static void ena_free_rx_mbuf(struct ena_adapter *, struct ena_ring *, + struct ena_rx_buffer *); +static void ena_free_rx_bufs(struct ena_adapter *, unsigned int); +static void ena_refill_all_rx_bufs(struct ena_adapter *); +static void ena_free_all_rx_bufs(struct ena_adapter *); +static void ena_free_tx_bufs(struct ena_adapter *, unsigned int); +static void ena_free_all_tx_bufs(struct ena_adapter *); +static void ena_destroy_all_tx_queues(struct ena_adapter *); +static void ena_destroy_all_rx_queues(struct ena_adapter *); +static void ena_destroy_all_io_queues(struct ena_adapter *); +static int ena_create_io_queues(struct ena_adapter *); +static int ena_handle_msix(void *); +static int ena_enable_msix(struct ena_adapter *); +static void ena_setup_mgmnt_intr(struct ena_adapter *); +static int ena_setup_io_intr(struct ena_adapter *); +static int ena_request_mgmnt_irq(struct ena_adapter *); +static int ena_request_io_irq(struct ena_adapter *); +static void ena_free_mgmnt_irq(struct ena_adapter *); +static void ena_free_io_irq(struct ena_adapter *); +static void ena_free_irqs(struct ena_adapter*); +static void ena_disable_msix(struct ena_adapter *); +static void ena_unmask_all_io_irqs(struct ena_adapter *); +static int ena_rss_configure(struct ena_adapter *); +static int ena_up_complete(struct ena_adapter *); +static uint64_t ena_get_counter(if_t, ift_counter); +static int ena_media_change(if_t); +static void ena_media_status(if_t, struct ifmediareq *); +static void ena_init(void *); +static int ena_ioctl(if_t, u_long, caddr_t); +static int ena_get_dev_offloads(struct ena_com_dev_get_features_ctx *); +static void ena_update_host_info(struct ena_admin_host_info *, if_t); +static void ena_update_hwassist(struct ena_adapter *); +static int ena_setup_ifnet(device_t, struct ena_adapter *, + struct ena_com_dev_get_features_ctx *); - static int ena_enable_wc(struct resource *); ++static int ena_enable_wc(device_t, struct resource *); +static int ena_set_queues_placement_policy(device_t, struct ena_com_dev *, + struct ena_admin_feature_llq_desc *, struct ena_llq_configurations *); +static uint32_t ena_calc_max_io_queue_num(device_t, struct ena_com_dev *, + struct ena_com_dev_get_features_ctx *); +static int ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *); +static int ena_rss_init_default(struct ena_adapter *); +static void ena_rss_init_default_deferred(void *); +static void ena_config_host_info(struct ena_com_dev *, device_t); +static int ena_attach(device_t); +static int ena_detach(device_t); +static int ena_device_init(struct ena_adapter *, device_t, + struct ena_com_dev_get_features_ctx *, int *); +static int ena_enable_msix_and_set_admin_interrupts(struct ena_adapter *); +static void ena_update_on_link_change(void *, struct ena_admin_aenq_entry *); +static void unimplemented_aenq_handler(void *, + struct ena_admin_aenq_entry *); +static int ena_copy_eni_metrics(struct ena_adapter *); +static void ena_timer_service(void *); + +static char ena_version[] = DEVICE_NAME DRV_MODULE_NAME " v" DRV_MODULE_VERSION; + +static ena_vendor_info_t ena_vendor_info_array[] = { + { PCI_VENDOR_ID_AMAZON, PCI_DEV_ID_ENA_PF, 0}, + { PCI_VENDOR_ID_AMAZON, PCI_DEV_ID_ENA_PF_RSERV0, 0}, + { PCI_VENDOR_ID_AMAZON, PCI_DEV_ID_ENA_VF, 0}, + { PCI_VENDOR_ID_AMAZON, PCI_DEV_ID_ENA_VF_RSERV0, 0}, + /* Last entry */ + { 0, 0, 0 } +}; + +/* + * Contains pointers to event handlers, e.g. link state chage. + */ +static struct ena_aenq_handlers aenq_handlers; + +void +ena_dmamap_callback(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + if (error != 0) + return; + *(bus_addr_t *) arg = segs[0].ds_addr; +} + +int +ena_dma_alloc(device_t dmadev, bus_size_t size, + ena_mem_handle_t *dma, int mapflags, bus_size_t alignment) +{ + struct ena_adapter* adapter = device_get_softc(dmadev); ++ device_t pdev = adapter->pdev; + uint32_t maxsize; + uint64_t dma_space_addr; + int error; + + maxsize = ((size - 1) / PAGE_SIZE + 1) * PAGE_SIZE; + + dma_space_addr = ENA_DMA_BIT_MASK(adapter->dma_width); + if (unlikely(dma_space_addr == 0)) + dma_space_addr = BUS_SPACE_MAXADDR; + + error = bus_dma_tag_create(bus_get_dma_tag(dmadev), /* parent */ + alignment, 0, /* alignment, bounds */ + dma_space_addr, /* lowaddr of exclusion window */ + BUS_SPACE_MAXADDR,/* highaddr of exclusion window */ + NULL, NULL, /* filter, filterarg */ + maxsize, /* maxsize */ + 1, /* nsegments */ + maxsize, /* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockarg */ + &dma->tag); + if (unlikely(error != 0)) { - ena_trace(NULL, ENA_ALERT, "bus_dma_tag_create failed: %d\n", error); ++ ena_log(pdev, ERR, "bus_dma_tag_create failed: %d\n", error); + goto fail_tag; + } + + error = bus_dmamem_alloc(dma->tag, (void**) &dma->vaddr, + BUS_DMA_COHERENT | BUS_DMA_ZERO, &dma->map); + if (unlikely(error != 0)) { - ena_trace(NULL, ENA_ALERT, "bus_dmamem_alloc(%ju) failed: %d\n", ++ ena_log(pdev, ERR, "bus_dmamem_alloc(%ju) failed: %d\n", + (uintmax_t)size, error); + goto fail_map_create; + } + + dma->paddr = 0; + error = bus_dmamap_load(dma->tag, dma->map, dma->vaddr, + size, ena_dmamap_callback, &dma->paddr, mapflags); + if (unlikely((error != 0) || (dma->paddr == 0))) { - ena_trace(NULL, ENA_ALERT, ": bus_dmamap_load failed: %d\n", error); ++ ena_log(pdev, ERR, "bus_dmamap_load failed: %d\n", error); + goto fail_map_load; + } + + bus_dmamap_sync(dma->tag, dma->map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + return (0); + +fail_map_load: + bus_dmamem_free(dma->tag, dma->vaddr, dma->map); +fail_map_create: + bus_dma_tag_destroy(dma->tag); +fail_tag: + dma->tag = NULL; + dma->vaddr = NULL; + dma->paddr = 0; + + return (error); +} + +/* + * This function should generate unique key for the whole driver. + * If the key was already genereated in the previous call (for example + * for another adapter), then it should be returned instead. + */ +void +ena_rss_key_fill(void *key, size_t size) +{ + static bool key_generated; + static uint8_t default_key[ENA_HASH_KEY_SIZE]; + + KASSERT(size <= ENA_HASH_KEY_SIZE, ("Requested more bytes than ENA RSS key can hold")); + + if (!key_generated) { + arc4random_buf(default_key, ENA_HASH_KEY_SIZE); + key_generated = true; + } + + memcpy(key, default_key, size); +} + +static void +ena_free_pci_resources(struct ena_adapter *adapter) +{ + device_t pdev = adapter->pdev; + + if (adapter->memory != NULL) { + bus_release_resource(pdev, SYS_RES_MEMORY, + PCIR_BAR(ENA_MEM_BAR), adapter->memory); + } + + if (adapter->registers != NULL) { + bus_release_resource(pdev, SYS_RES_MEMORY, + PCIR_BAR(ENA_REG_BAR), adapter->registers); + } + + if (adapter->msix != NULL) { + bus_release_resource(pdev, SYS_RES_MEMORY, + adapter->msix_rid, adapter->msix); + } +} + +static int +ena_probe(device_t dev) +{ + ena_vendor_info_t *ent; + char adapter_name[60]; + uint16_t pci_vendor_id = 0; + uint16_t pci_device_id = 0; + + pci_vendor_id = pci_get_vendor(dev); + pci_device_id = pci_get_device(dev); + + ent = ena_vendor_info_array; + while (ent->vendor_id != 0) { + if ((pci_vendor_id == ent->vendor_id) && + (pci_device_id == ent->device_id)) { - ena_trace(NULL, ENA_DBG, "vendor=%x device=%x\n", ++ ena_log_raw(DBG, "vendor=%x device=%x\n", + pci_vendor_id, pci_device_id); + + sprintf(adapter_name, DEVICE_DESC); + device_set_desc_copy(dev, adapter_name); + return (BUS_PROBE_DEFAULT); + } + + ent++; + + } + + return (ENXIO); +} + +static int +ena_change_mtu(if_t ifp, int new_mtu) +{ + struct ena_adapter *adapter = if_getsoftc(ifp); ++ device_t pdev = adapter->pdev; + int rc; + + if ((new_mtu > adapter->max_mtu) || (new_mtu < ENA_MIN_MTU)) { - device_printf(adapter->pdev, "Invalid MTU setting. " ++ ena_log(pdev, ERR, "Invalid MTU setting. " + "new_mtu: %d max mtu: %d min mtu: %d\n", + new_mtu, adapter->max_mtu, ENA_MIN_MTU); + return (EINVAL); + } + + rc = ena_com_set_dev_mtu(adapter->ena_dev, new_mtu); + if (likely(rc == 0)) { - ena_trace(NULL, ENA_DBG, "set MTU to %d\n", new_mtu); ++ ena_log(pdev, DBG, "set MTU to %d\n", new_mtu); + if_setmtu(ifp, new_mtu); + } else { - device_printf(adapter->pdev, "Failed to set MTU to %d\n", - new_mtu); ++ ena_log(pdev, ERR, "Failed to set MTU to %d\n", new_mtu); + } + + return (rc); +} + +static inline void +ena_alloc_counters(counter_u64_t *begin, int size) +{ + counter_u64_t *end = (counter_u64_t *)((char *)begin + size); + + for (; begin < end; ++begin) + *begin = counter_u64_alloc(M_WAITOK); +} + +static inline void +ena_free_counters(counter_u64_t *begin, int size) +{ + counter_u64_t *end = (counter_u64_t *)((char *)begin + size); + + for (; begin < end; ++begin) + counter_u64_free(*begin); +} + +static inline void +ena_reset_counters(counter_u64_t *begin, int size) +{ + counter_u64_t *end = (counter_u64_t *)((char *)begin + size); + + for (; begin < end; ++begin) + counter_u64_zero(*begin); +} + +static void +ena_init_io_rings_common(struct ena_adapter *adapter, struct ena_ring *ring, + uint16_t qid) +{ + + ring->qid = qid; + ring->adapter = adapter; + ring->ena_dev = adapter->ena_dev; + ring->first_interrupt = false; + ring->no_interrupt_event_cnt = 0; +} + +static void +ena_init_io_rings_basic(struct ena_adapter *adapter) +{ + struct ena_com_dev *ena_dev; + struct ena_ring *txr, *rxr; + struct ena_que *que; + int i; + + ena_dev = adapter->ena_dev; + + for (i = 0; i < adapter->num_io_queues; i++) { + txr = &adapter->tx_ring[i]; + rxr = &adapter->rx_ring[i]; + + /* TX/RX common ring state */ + ena_init_io_rings_common(adapter, txr, i); + ena_init_io_rings_common(adapter, rxr, i); + + /* TX specific ring state */ + txr->tx_max_header_size = ena_dev->tx_max_header_size; + txr->tx_mem_queue_type = ena_dev->tx_mem_queue_type; + + que = &adapter->que[i]; + que->adapter = adapter; + que->id = i; + que->tx_ring = txr; + que->rx_ring = rxr; + + txr->que = que; + rxr->que = que; + + rxr->empty_rx_queue = 0; + rxr->rx_mbuf_sz = ena_mbuf_sz; + } +} + +static void +ena_init_io_rings_advanced(struct ena_adapter *adapter) +{ + struct ena_ring *txr, *rxr; + int i; + + for (i = 0; i < adapter->num_io_queues; i++) { + txr = &adapter->tx_ring[i]; + rxr = &adapter->rx_ring[i]; + + /* Allocate a buf ring */ + txr->buf_ring_size = adapter->buf_ring_size; + txr->br = buf_ring_alloc(txr->buf_ring_size, M_DEVBUF, + M_WAITOK, &txr->ring_mtx); + + /* Allocate Tx statistics. */ + ena_alloc_counters((counter_u64_t *)&txr->tx_stats, + sizeof(txr->tx_stats)); + + /* Allocate Rx statistics. */ + ena_alloc_counters((counter_u64_t *)&rxr->rx_stats, + sizeof(rxr->rx_stats)); + + /* Initialize locks */ + snprintf(txr->mtx_name, nitems(txr->mtx_name), "%s:tx(%d)", + device_get_nameunit(adapter->pdev), i); + snprintf(rxr->mtx_name, nitems(rxr->mtx_name), "%s:rx(%d)", + device_get_nameunit(adapter->pdev), i); + + mtx_init(&txr->ring_mtx, txr->mtx_name, NULL, MTX_DEF); + } +} + +static void +ena_init_io_rings(struct ena_adapter *adapter) +{ + /* + * IO rings initialization can be divided into the 2 steps: + * 1. Initialize variables and fields with initial values and copy + * them from adapter/ena_dev (basic) + * 2. Allocate mutex, counters and buf_ring (advanced) + */ + ena_init_io_rings_basic(adapter); + ena_init_io_rings_advanced(adapter); +} + +static void +ena_free_io_ring_resources(struct ena_adapter *adapter, unsigned int qid) +{ + struct ena_ring *txr = &adapter->tx_ring[qid]; + struct ena_ring *rxr = &adapter->rx_ring[qid]; + + ena_free_counters((counter_u64_t *)&txr->tx_stats, + sizeof(txr->tx_stats)); + ena_free_counters((counter_u64_t *)&rxr->rx_stats, + sizeof(rxr->rx_stats)); + + ENA_RING_MTX_LOCK(txr); + drbr_free(txr->br, M_DEVBUF); + ENA_RING_MTX_UNLOCK(txr); + + mtx_destroy(&txr->ring_mtx); +} + +static void +ena_free_all_io_rings_resources(struct ena_adapter *adapter) +{ + int i; + + for (i = 0; i < adapter->num_io_queues; i++) + ena_free_io_ring_resources(adapter, i); + +} + +static int +ena_setup_tx_dma_tag(struct ena_adapter *adapter) +{ + int ret; + + /* Create DMA tag for Tx buffers */ + ret = bus_dma_tag_create(bus_get_dma_tag(adapter->pdev), + 1, 0, /* alignment, bounds */ + ENA_DMA_BIT_MASK(adapter->dma_width), /* lowaddr of excl window */ + BUS_SPACE_MAXADDR, /* highaddr of excl window */ + NULL, NULL, /* filter, filterarg */ + ENA_TSO_MAXSIZE, /* maxsize */ + adapter->max_tx_sgl_size - 1, /* nsegments */ + ENA_TSO_MAXSIZE, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &adapter->tx_buf_tag); + + return (ret); +} + +static int +ena_free_tx_dma_tag(struct ena_adapter *adapter) +{ + int ret; + + ret = bus_dma_tag_destroy(adapter->tx_buf_tag); + + if (likely(ret == 0)) + adapter->tx_buf_tag = NULL; + + return (ret); +} + +static int +ena_setup_rx_dma_tag(struct ena_adapter *adapter) +{ + int ret; + + /* Create DMA tag for Rx buffers*/ + ret = bus_dma_tag_create(bus_get_dma_tag(adapter->pdev), /* parent */ + 1, 0, /* alignment, bounds */ + ENA_DMA_BIT_MASK(adapter->dma_width), /* lowaddr of excl window */ + BUS_SPACE_MAXADDR, /* highaddr of excl window */ + NULL, NULL, /* filter, filterarg */ + ena_mbuf_sz, /* maxsize */ + adapter->max_rx_sgl_size, /* nsegments */ + ena_mbuf_sz, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockarg */ + &adapter->rx_buf_tag); + + return (ret); +} + +static int +ena_free_rx_dma_tag(struct ena_adapter *adapter) +{ + int ret; + + ret = bus_dma_tag_destroy(adapter->rx_buf_tag); + + if (likely(ret == 0)) + adapter->rx_buf_tag = NULL; + + return (ret); +} + +static void +ena_release_all_tx_dmamap(struct ena_ring *tx_ring) +{ + struct ena_adapter *adapter = tx_ring->adapter; + struct ena_tx_buffer *tx_info; + bus_dma_tag_t tx_tag = adapter->tx_buf_tag;; + int i; +#ifdef DEV_NETMAP + struct ena_netmap_tx_info *nm_info; + int j; +#endif /* DEV_NETMAP */ + + for (i = 0; i < tx_ring->ring_size; ++i) { + tx_info = &tx_ring->tx_buffer_info[i]; +#ifdef DEV_NETMAP + if (adapter->ifp->if_capenable & IFCAP_NETMAP) { + nm_info = &tx_info->nm_info; + for (j = 0; j < ENA_PKT_MAX_BUFS; ++j) { + if (nm_info->map_seg[j] != NULL) { + bus_dmamap_destroy(tx_tag, + nm_info->map_seg[j]); + nm_info->map_seg[j] = NULL; + } + } + } +#endif /* DEV_NETMAP */ + if (tx_info->dmamap != NULL) { + bus_dmamap_destroy(tx_tag, tx_info->dmamap); + tx_info->dmamap = NULL; + } + } +} + +/** + * ena_setup_tx_resources - allocate Tx resources (Descriptors) + * @adapter: network interface device structure + * @qid: queue index + * + * Returns 0 on success, otherwise on failure. + **/ +static int +ena_setup_tx_resources(struct ena_adapter *adapter, int qid) +{ ++ device_t pdev = adapter->pdev; + struct ena_que *que = &adapter->que[qid]; + struct ena_ring *tx_ring = que->tx_ring; + int size, i, err; +#ifdef DEV_NETMAP + bus_dmamap_t *map; + int j; + + ena_netmap_reset_tx_ring(adapter, qid); +#endif /* DEV_NETMAP */ + + size = sizeof(struct ena_tx_buffer) * tx_ring->ring_size; + + tx_ring->tx_buffer_info = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); + if (unlikely(tx_ring->tx_buffer_info == NULL)) + return (ENOMEM); + + size = sizeof(uint16_t) * tx_ring->ring_size; + tx_ring->free_tx_ids = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); + if (unlikely(tx_ring->free_tx_ids == NULL)) + goto err_buf_info_free; + + size = tx_ring->tx_max_header_size; + tx_ring->push_buf_intermediate_buf = malloc(size, M_DEVBUF, + M_NOWAIT | M_ZERO); + if (unlikely(tx_ring->push_buf_intermediate_buf == NULL)) + goto err_tx_ids_free; + + /* Req id stack for TX OOO completions */ + for (i = 0; i < tx_ring->ring_size; i++) + tx_ring->free_tx_ids[i] = i; + + /* Reset TX statistics. */ + ena_reset_counters((counter_u64_t *)&tx_ring->tx_stats, + sizeof(tx_ring->tx_stats)); + + tx_ring->next_to_use = 0; + tx_ring->next_to_clean = 0; + tx_ring->acum_pkts = 0; + + /* Make sure that drbr is empty */ + ENA_RING_MTX_LOCK(tx_ring); + drbr_flush(adapter->ifp, tx_ring->br); + ENA_RING_MTX_UNLOCK(tx_ring); + + /* ... and create the buffer DMA maps */ + for (i = 0; i < tx_ring->ring_size; i++) { + err = bus_dmamap_create(adapter->tx_buf_tag, 0, + &tx_ring->tx_buffer_info[i].dmamap); + if (unlikely(err != 0)) { - ena_trace(NULL, ENA_ALERT, ++ ena_log(pdev, ERR, + "Unable to create Tx DMA map for buffer %d\n", + i); + goto err_map_release; + } + +#ifdef DEV_NETMAP + if (adapter->ifp->if_capenable & IFCAP_NETMAP) { + map = tx_ring->tx_buffer_info[i].nm_info.map_seg; + for (j = 0; j < ENA_PKT_MAX_BUFS; j++) { + err = bus_dmamap_create(adapter->tx_buf_tag, 0, + &map[j]); + if (unlikely(err != 0)) { - ena_trace(NULL, ENA_ALERT, "Unable to create " ++ ena_log(pdev, ERR, ++ "Unable to create " + "Tx DMA for buffer %d %d\n", i, j); + goto err_map_release; + } + } + } +#endif /* DEV_NETMAP */ + } + + /* Allocate taskqueues */ + TASK_INIT(&tx_ring->enqueue_task, 0, ena_deferred_mq_start, tx_ring); + tx_ring->enqueue_tq = taskqueue_create_fast("ena_tx_enque", M_NOWAIT, + taskqueue_thread_enqueue, &tx_ring->enqueue_tq); + if (unlikely(tx_ring->enqueue_tq == NULL)) { - ena_trace(NULL, ENA_ALERT, ++ ena_log(pdev, ERR, + "Unable to create taskqueue for enqueue task\n"); + i = tx_ring->ring_size; + goto err_map_release; + } + + tx_ring->running = true; + + taskqueue_start_threads(&tx_ring->enqueue_tq, 1, PI_NET, + "%s txeq %d", device_get_nameunit(adapter->pdev), que->cpu); + + return (0); + +err_map_release: + ena_release_all_tx_dmamap(tx_ring); +err_tx_ids_free: + free(tx_ring->free_tx_ids, M_DEVBUF); + tx_ring->free_tx_ids = NULL; +err_buf_info_free: + free(tx_ring->tx_buffer_info, M_DEVBUF); + tx_ring->tx_buffer_info = NULL; + + return (ENOMEM); +} + +/** + * ena_free_tx_resources - Free Tx Resources per Queue + * @adapter: network interface device structure + * @qid: queue index + * + * Free all transmit software resources + **/ +static void +ena_free_tx_resources(struct ena_adapter *adapter, int qid) +{ + struct ena_ring *tx_ring = &adapter->tx_ring[qid]; +#ifdef DEV_NETMAP + struct ena_netmap_tx_info *nm_info; + int j; +#endif /* DEV_NETMAP */ + + while (taskqueue_cancel(tx_ring->enqueue_tq, &tx_ring->enqueue_task, + NULL)) + taskqueue_drain(tx_ring->enqueue_tq, &tx_ring->enqueue_task); + + taskqueue_free(tx_ring->enqueue_tq); + + ENA_RING_MTX_LOCK(tx_ring); + /* Flush buffer ring, */ + drbr_flush(adapter->ifp, tx_ring->br); + + /* Free buffer DMA maps, */ + for (int i = 0; i < tx_ring->ring_size; i++) { + bus_dmamap_sync(adapter->tx_buf_tag, + tx_ring->tx_buffer_info[i].dmamap, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(adapter->tx_buf_tag, + tx_ring->tx_buffer_info[i].dmamap); + bus_dmamap_destroy(adapter->tx_buf_tag, + tx_ring->tx_buffer_info[i].dmamap); + +#ifdef DEV_NETMAP + if (adapter->ifp->if_capenable & IFCAP_NETMAP) { + nm_info = &tx_ring->tx_buffer_info[i].nm_info; + for (j = 0; j < ENA_PKT_MAX_BUFS; j++) { + if (nm_info->socket_buf_idx[j] != 0) { + bus_dmamap_sync(adapter->tx_buf_tag, + nm_info->map_seg[j], + BUS_DMASYNC_POSTWRITE); + ena_netmap_unload(adapter, + nm_info->map_seg[j]); + } + bus_dmamap_destroy(adapter->tx_buf_tag, + nm_info->map_seg[j]); + nm_info->socket_buf_idx[j] = 0; + } + } +#endif /* DEV_NETMAP */ + + m_freem(tx_ring->tx_buffer_info[i].mbuf); + tx_ring->tx_buffer_info[i].mbuf = NULL; + } + ENA_RING_MTX_UNLOCK(tx_ring); + + /* And free allocated memory. */ + free(tx_ring->tx_buffer_info, M_DEVBUF); + tx_ring->tx_buffer_info = NULL; + + free(tx_ring->free_tx_ids, M_DEVBUF); + tx_ring->free_tx_ids = NULL; + + free(tx_ring->push_buf_intermediate_buf, M_DEVBUF); + tx_ring->push_buf_intermediate_buf = NULL; +} + +/** + * ena_setup_all_tx_resources - allocate all queues Tx resources + * @adapter: network interface device structure + * + * Returns 0 on success, otherwise on failure. + **/ +static int +ena_setup_all_tx_resources(struct ena_adapter *adapter) +{ + int i, rc; + + for (i = 0; i < adapter->num_io_queues; i++) { + rc = ena_setup_tx_resources(adapter, i); + if (rc != 0) { - device_printf(adapter->pdev, ++ ena_log(adapter->pdev, ERR, + "Allocation for Tx Queue %u failed\n", i); + goto err_setup_tx; + } + } + + return (0); + +err_setup_tx: + /* Rewind the index freeing the rings as we go */ + while (i--) + ena_free_tx_resources(adapter, i); + return (rc); +} + +/** + * ena_free_all_tx_resources - Free Tx Resources for All Queues + * @adapter: network interface device structure + * + * Free all transmit software resources + **/ +static void +ena_free_all_tx_resources(struct ena_adapter *adapter) +{ + int i; + + for (i = 0; i < adapter->num_io_queues; i++) + ena_free_tx_resources(adapter, i); +} + +/** + * ena_setup_rx_resources - allocate Rx resources (Descriptors) + * @adapter: network interface device structure + * @qid: queue index + * + * Returns 0 on success, otherwise on failure. + **/ +static int +ena_setup_rx_resources(struct ena_adapter *adapter, unsigned int qid) +{ ++ device_t pdev = adapter->pdev; + struct ena_que *que = &adapter->que[qid]; + struct ena_ring *rx_ring = que->rx_ring; + int size, err, i; + + size = sizeof(struct ena_rx_buffer) * rx_ring->ring_size; + +#ifdef DEV_NETMAP + ena_netmap_reset_rx_ring(adapter, qid); + rx_ring->initialized = false; +#endif /* DEV_NETMAP */ + + /* + * Alloc extra element so in rx path + * we can always prefetch rx_info + 1 + */ + size += sizeof(struct ena_rx_buffer); + + rx_ring->rx_buffer_info = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); + + size = sizeof(uint16_t) * rx_ring->ring_size; + rx_ring->free_rx_ids = malloc(size, M_DEVBUF, M_WAITOK); + + for (i = 0; i < rx_ring->ring_size; i++) + rx_ring->free_rx_ids[i] = i; + + /* Reset RX statistics. */ + ena_reset_counters((counter_u64_t *)&rx_ring->rx_stats, + sizeof(rx_ring->rx_stats)); + + rx_ring->next_to_clean = 0; + rx_ring->next_to_use = 0; + + /* ... and create the buffer DMA maps */ + for (i = 0; i < rx_ring->ring_size; i++) { + err = bus_dmamap_create(adapter->rx_buf_tag, 0, + &(rx_ring->rx_buffer_info[i].map)); + if (err != 0) { - ena_trace(NULL, ENA_ALERT, ++ ena_log(pdev, ERR, + "Unable to create Rx DMA map for buffer %d\n", i); + goto err_buf_info_unmap; + } + } + + /* Create LRO for the ring */ + if ((adapter->ifp->if_capenable & IFCAP_LRO) != 0) { + int err = tcp_lro_init(&rx_ring->lro); + if (err != 0) { - device_printf(adapter->pdev, - "LRO[%d] Initialization failed!\n", qid); ++ ena_log(pdev, ERR, "LRO[%d] Initialization failed!\n", ++ qid); + } else { - ena_trace(NULL, ENA_INFO, - "RX Soft LRO[%d] Initialized\n", qid); ++ ena_log(pdev, DBG, "RX Soft LRO[%d] Initialized\n", ++ qid); + rx_ring->lro.ifp = adapter->ifp; + } + } + + return (0); + +err_buf_info_unmap: + while (i--) { + bus_dmamap_destroy(adapter->rx_buf_tag, + rx_ring->rx_buffer_info[i].map); + } + + free(rx_ring->free_rx_ids, M_DEVBUF); + rx_ring->free_rx_ids = NULL; + free(rx_ring->rx_buffer_info, M_DEVBUF); + rx_ring->rx_buffer_info = NULL; *** 6157 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Jun 24 14:35: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 2F67064D4F2; Thu, 24 Jun 2021 14:35: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 4G9jNk6zHrz4c86; Thu, 24 Jun 2021 14:35: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 D66B519BC1; Thu, 24 Jun 2021 14:35: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 15OEZoLN032491; Thu, 24 Jun 2021 14:35:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OEZoCD032490; Thu, 24 Jun 2021 14:35:50 GMT (envelope-from git) Date: Thu, 24 Jun 2021 14:35:50 GMT Message-Id: <202106241435.15OEZoCD032490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 0e7d31f63b9d - main - ena: hide sysctl nodes for unused ENA queues MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e7d31f63b9db869c91228d8ed1e984bdee2b931 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, 24 Jun 2021 14:35:51 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=0e7d31f63b9db869c91228d8ed1e984bdee2b931 commit 0e7d31f63b9db869c91228d8ed1e984bdee2b931 Author: Marcin Wojtas AuthorDate: 2021-06-14 08:57:54 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 14:02:39 +0000 ena: hide sysctl nodes for unused ENA queues IO queue related attributes are registered statically at driver attach with the rest of the ENA specific sysctl nodes. However, the number of queues can be changed at runtime via the `ena_sysctl_io_queues_nb` request, leading to a potential exposure of attributes for non-existing queues. Introduce a new `ena_sysctl_update_queue_node_nb` function, which updates the sysctl nodes after the number of queues is altered. This happens by either registering or unregistering node specific oids, based on a delta between the previous and current queue count. NOTE: All unregistered oids must be registered again before the driver detach, e.g. by another call to this function. Submitted by: Artur Rojek Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena.c | 4 ++++ sys/dev/ena/ena.h | 1 + sys/dev/ena/ena_sysctl.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- sys/dev/ena/ena_sysctl.h | 2 ++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index d7a68e94d361..fbe32a7a930e 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -3830,6 +3830,10 @@ ena_detach(device_t pdev) ena_destroy_device(adapter, true); ENA_LOCK_UNLOCK(adapter); + /* Restore unregistered sysctl queue nodes. */ + ena_sysctl_update_queue_node_nb(adapter, adapter->num_io_queues, + adapter->max_num_io_queues); + #ifdef DEV_NETMAP netmap_detach(adapter->ifp); #endif /* DEV_NETMAP */ diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index f3e92f31341a..a49ac70761ba 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -215,6 +215,7 @@ struct ena_que { uint32_t id; int cpu; + struct sysctl_oid *oid; }; struct ena_calc_queue_size_ctx { diff --git a/sys/dev/ena/ena_sysctl.c b/sys/dev/ena/ena_sysctl.c index 26fc79379e33..0726771e5adc 100644 --- a/sys/dev/ena/ena_sysctl.c +++ b/sys/dev/ena/ena_sysctl.c @@ -28,6 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include __FBSDID("$FreeBSD$"); #include "ena_sysctl.h" @@ -188,6 +189,8 @@ ena_sysctl_add_stats(struct ena_adapter *adapter) namebuf, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Queue Name"); queue_list = SYSCTL_CHILDREN(queue_node); + adapter->que[i].oid = queue_node; + /* TX specific stats */ tx_node = SYSCTL_ADD_NODE(ctx, queue_list, OID_AUTO, "tx_ring", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "TX ring"); @@ -396,6 +399,42 @@ ena_sysctl_add_tuneables(struct ena_adapter *adapter) } +/* + * ena_sysctl_update_queue_node_nb - Register/unregister sysctl queue nodes. + * + * Whether the nodes are registered or unregistered depends on a delta between + * the `old` and `new` parameters, representing the number of queues. + * + * This function is used to hide sysctl attributes for queue nodes which aren't + * currently used by the HW (e.g. after a call to `ena_sysctl_io_queues_nb`). + * + * NOTE: + * All unregistered nodes must be registered again at detach, i.e. by a call to + * this function. + */ +void +ena_sysctl_update_queue_node_nb(struct ena_adapter *adapter, int old, int new) +{ + device_t dev; + struct sysctl_oid *oid; + int min, max, i; + + dev = adapter->pdev; + min = MIN(old, new); + max = MIN(MAX(old, new), adapter->max_num_io_queues); + + for (i = min; i < max; ++i) { + oid = adapter->que[i].oid; + + sysctl_wlock(); + if (old > new) + sysctl_unregister_oid(oid); + else + sysctl_register_oid(oid); + sysctl_wunlock(); + } +} + static int ena_sysctl_buf_ring_size(SYSCTL_HANDLER_ARGS) { @@ -488,7 +527,7 @@ static int ena_sysctl_io_queues_nb(SYSCTL_HANDLER_ARGS) { struct ena_adapter *adapter = arg1; - uint32_t tmp = 0; + uint32_t old_num_queues, tmp = 0; int error; error = sysctl_wire_old_buffer(req, sizeof(tmp)); @@ -527,7 +566,12 @@ ena_sysctl_io_queues_nb(SYSCTL_HANDLER_ARGS) "Requested new number of IO queues: %u, current value: " "%u\n", tmp, adapter->num_io_queues); + old_num_queues = adapter->num_io_queues; error = ena_update_io_queue_nb(adapter, tmp); + if (error != 0) + return (error); + + ena_sysctl_update_queue_node_nb(adapter, old_num_queues, tmp); } return (error); diff --git a/sys/dev/ena/ena_sysctl.h b/sys/dev/ena/ena_sysctl.h index 360e32c3ad18..c6059c9cba36 100644 --- a/sys/dev/ena/ena_sysctl.h +++ b/sys/dev/ena/ena_sysctl.h @@ -40,6 +40,8 @@ #include "ena.h" void ena_sysctl_add_nodes(struct ena_adapter *adapter); +void ena_sysctl_update_queue_node_nb(struct ena_adapter *adapter, int old, + int new); extern int ena_enable_9k_mbufs; #define ena_mbuf_sz (ena_enable_9k_mbufs ? MJUM9BYTES : MJUMPAGESIZE) From owner-dev-commits-src-main@freebsd.org Thu Jun 24 14:35: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 A8EC364D547; Thu, 24 Jun 2021 14:35: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 4G9jNn45S1z4cHl; Thu, 24 Jun 2021 14:35: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 7296819BC3; Thu, 24 Jun 2021 14:35: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 15OEZrKx032541; Thu, 24 Jun 2021 14:35:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OEZrL5032540; Thu, 24 Jun 2021 14:35:53 GMT (envelope-from git) Date: Thu, 24 Jun 2021 14:35:53 GMT Message-Id: <202106241435.15OEZrL5032540@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: e34856a2c44a - main - Update ENA driver man page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e34856a2c44a45512463aed0d1794f34258c66ee 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, 24 Jun 2021 14:35:53 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=e34856a2c44a45512463aed0d1794f34258c66ee commit e34856a2c44a45512463aed0d1794f34258c66ee Author: Marcin Wojtas AuthorDate: 2021-06-14 09:00:30 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 14:35:37 +0000 Update ENA driver man page Bring the obsolete man page up to date: * update diagnostic error messages * add documentation of loader tunables * document netmap support * add a driver history section * update the contact information Submitted by: Artur Rojek Submitted by: Michal Krawczyk Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. --- share/man/man4/ena.4 | 271 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 236 insertions(+), 35 deletions(-) diff --git a/share/man/man4/ena.4 b/share/man/man4/ena.4 index e042ed0a2636..cd98fe2c84ba 100644 --- a/share/man/man4/ena.4 +++ b/share/man/man4/ena.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 16, 2017 +.Dd June 4, 2021 .Dt ENA 4 .Os .Sh NAME @@ -86,7 +86,13 @@ debug logs. .Pp Some of the ENA devices support a working mode called Low-latency Queue (LLQ), which saves several more microseconds. -This feature will be implemented for driver in future releases. +.Pp +Support for the +.Xr netmap 4 +framework is provided by the +.Nm +driver. +Kernel must be built with the DEV_NETMAP option to be able to use this feature. .Sh HARDWARE Supported PCI vendor ID/device IDs: .Pp @@ -100,8 +106,172 @@ Supported PCI vendor ID/device IDs: .It 1d0f:ec21 - ENA VF with LLQ support .El +.Sh LOADER TUNABLES +The +.Nm +driver's behavior can be changed using run-time or boot-time sysctl +arguments. +The boot-time arguments can be set at the +.Xr loader 8 +prompt before booting the kernel, or stored in the +.Xr loader.conf 5 . +The run-time arguments can be set using the +.Xr sysctl 8 +command. +.Pp +Boot-time tunables: +.Bl -tag -width indent +.It Va hw.ena.enable_9k_mbufs +Use 9k mbufs for the Rx descriptors. +The default is 0. +If the node value is set to 1, 9k mbufs will be used for the Rx buffers. +If set to 0, page size mbufs will be used instead. +.Pp +Using 9k buffers for Rx can improve Rx throughput, but in low memory conditions +it might increase allocation time, as the system has to look for 3 contiguous +pages. +This can further lead to OS instability, together with ENA driver reset and NVMe +timeouts. +If network performance is critical and memory capacity is sufficient, the 9k +mbufs can be used. +.It Va hw.ena.force_large_llq_headers +Force the driver to use large LLQ headers (224 bytes). +The default is 0. +If the node value is set to 0, the regular size LLQ header will be used, which +is 96B. +In some cases, the packet header can be bigger than this (for example - +IPv6 with multiple extensions). +In such a situation, the large LLQ headers should be used by setting this node +value to 1. +This will take effect only if the device supports both LLQ and large LLQ +headers. +Otherwise, it will fallback to the no LLQ mode or regular header size. +.Pp +Increasing LLQ header size reduces the size of the Tx queue by half, so it may +affect the number of dropped Tx packets. +.El +.Pp +Run-time tunables: +.Bl -tag -width indent +.It Va hw.ena.log_level +Controls extra logging verbosity of the driver. +The default is 2. +The higher the logging level, the more logs will be printed out. 0 means all +extra logs are disabled and only error logs will be printed out. +Default value (2) reports errors, warnings and is verbose about driver +operation. +.Pp +The possible flags are: +.Pp +.Bl -bullet -compact +.It +0 - ENA_ERR - Enable driver error messages and ena_com error logs. +.It +1 - ENA_WARN - Enable logs for non-critical errors. +.It +2 - ENA_INFO - Make the driver more verbose about its actions. +.It +3 - ENA_DBG - Enable debug logs. +.El +.Pp +NOTE: In order to enable logging on the Tx/Rx data path, driver must be compiled +with ENA_LOG_IO_ENABLE compilation flag. +.Pp +Example: +To enable logs for errors and warnings, the following command should be used: +.Bd -literal -offset indent +sysctl hw.ena.log_level=1 +.Ed +.It Va dev.ena.X.io_queues_nb +Number of the currently allocated and used IO queues. +The default is max_num_io_queues. +Controls the number of IO queue pairs (Tx/Rx). As this call has to reallocate +the queues, it will reset the interface and restart all the queues - this means +that everything, which was currently held in the queue, will be lost, leading to +potential packet drops. +.Pp +This call can fail if the system isn't able to provide the driver with enough +resources. +In that situation, the driver will try to revert the previous number of the IO +queues. +If this also fails, the device reset will be triggered. +.Pp +Example: +To use only 2 Tx and Rx queues for the device ena1, the following command should +be used: +.Bd -literal -offset indent +sysctl dev.ena.1.io_queues_nb=2 +.Ed +.It Va dev.ena.X.rx_queue_size +Size of the Rx queue. +The default is 1024. +Controls the number of IO descriptors for each Rx queue. +The user may want to increase the Rx queue size if they observe a high number of +Rx drops in the driver's statistics. +For performance reasons, the Rx queue size must be a power of 2. +.Pp +This call can fail if the system isn't able to provide the driver with enough +resources. +In that situation, the driver will try to revert to the previous number of the +descriptors. +If this also fails, the device reset will be triggered. +.Pp +Example: +To increase Rx ring size to 8K descriptors for the device ena0, the following +command should be used: +.Bd -literal -offset indent +sysctl dev.ena.0.rx_queue_size=8192 +.Ed +.It Va dev.ena.X.buf_ring_size +Size of the Tx buffer ring (drbr). +The default is 4096. +Input must be a power of 2. +Controls the number of mbufs that can be held in the Tx buffer ring. +The drbr is used as a multiple-producer, single-consumer lockless ring for +buffering extra mbufs coming from the stack in case the Tx procedure is busy +sending the packets, or the Tx ring is full. +Increasing the size of the buffer ring may reduce the number of Tx packets being +dropped in case of a big Tx burst, which cannot be handled by the IO queue +immediately. +Each Tx queue has its own drbr. +.Pp +It is recommended to keep the drbr with at least the default value, but in case +the system lacks the resources, it can be reduced. +This call can fail if the system is not able to provide the driver with enough +resources. +In that situation, the driver will try to revert to the previous number of the +drbr and trigger the device reset. +.Pp +Example: +To set drbr size for interface ena0 to 2048, the following command should +be used: +.Bd -literal -offset indent +sysctl dev.ena.0.buf_ring_size=2048 +.Ed +.It Va dev.ena.X.eni_metrics.sample_interval +Interval in seconds for updating ENI metrics. +The default is 0. +Determines how often (if ever) the ENI metrics should be updated. +The ENI metrics are being updated asynchronously in a timer service in order to +avoid admin queue overload by sysctl node reading. +The value in this node controls the interval between issuing admin commands to +the device, which will update the ENI metrics values. +.Pp +If some application is periodically monitoring the eni_metrics, then the ENI +metrics interval can be adjusted accordingly. +Value 0 turns off the update completely. +Value 1 is the minimum interval and is equal to 1 second. +The maximum allowed update interval is 1 hour. +.Pp +Example: +To update ENI metrics for the device ena1 every 10 seconds, the following +command should be used: +.Bd -literal -offset indent +sysctl dev.ena.1.eni_metrics.sample_interval=10 +.Ed +.El .Sh DIAGNOSTICS -.Ss Device initialization phase: +.Ss Device initialization phase .Bl -diag .It ena%d: failed to init mmio read less .Pp @@ -116,7 +286,7 @@ Device may not be responding or is already during reset. Version of the controller is too old and it is not supported by the driver. .It ena%d: Invalid dma width value %d .Pp -The controller is able to request dma transaction width. +The controller is unable to request dma transaction width. .br Device stopped responding or it demanded invalid value. .It ena%d: Can not initialize ena admin queue with device @@ -132,33 +302,30 @@ Failed to get attributes of the device from the controller. .Pp Errors occurred when trying to configure AENQ groups. .El -.Ss Driver initialisation/shutdown phase: +.Ss Driver initialization/shutdown phase .Bl -diag .It ena%d: PCI resource allocation failed! -.It ena%d: allocating ena_dev failed .It ena%d: failed to pmap registers bar -.It ena%d: Error while setting up bufring -.It ena%d: Error with initialization of IO rings .It ena%d: can not allocate ifnet structure .It ena%d: Error with network interface setup .It ena%d: Failed to enable and set the admin interrupts -.It ena%d: Failed to allocate %d, vectors %d +.It ena%d: Error, MSI-X is already enabled .It ena%d: Failed to enable MSIX, vectors %d rc %d +.It ena%d: Not enough number of MSI-X allocated: %d .It ena%d: Error with MSI-X enablement .It ena%d: could not allocate irq vector: %d -.It ena%d: Unable to allocate bus resource: registers +.It ena%d: unable to allocate bus resource: registers! +.It ena%d: unable to allocate bus resource: msix! .Pp Resource allocation failed when initializing the device. .br Driver will not be attached. .It ena%d: ENA device init failed (err: %d) +.It ena%d: Cannot initialize device .Pp Device initialization failed. .br Driver will not be attached. -.It ena%d: could not activate irq vector: %d -.Pp -Error occurred when trying to activate interrupt vectors for Admin Queue. .It ena%d: failed to register interrupt handler for irq %ju: %d .Pp Error occurred when trying to register Admin Queue interrupt handler. @@ -181,8 +348,7 @@ VLANs must be detached first and then detach routine have to be called again. .It ena%d: Unmapped TX DMA tag associations .Pp Error occurred when trying to destroy RX/TX DMA tag. -.It ena%d: Cannot init RSS -.It ena%d: Cannot fill indirect table +.It ena%d: Cannot init indirect table .It ena%d: Cannot fill indirect table .It ena%d: Cannot fill hash function .It ena%d: Cannot fill hash control @@ -192,20 +358,30 @@ Error occurred during initialization of one of RSS resources. .br The device will work with reduced performance because all RX packets will be passed to queue 0 and there will be no hash information. +.It ena%d: LLQ is not supported. Fallback to host mode policy. +.It ena%d: Failed to configure the device mode. Fallback to host mode policy. +.It ena%d: unable to allocate LLQ bar resource. Fallback to host mode policy. +.Pp +Error occured during Low-latency Queue mode setup. +.br +The device will work, but without the LLQ performance gain. +.It ena%d: failed to enable write combining. +.Pp +Error occured while setting the Write Combining mode, required for the LLQ. .It ena%d: failed to tear down irq: %d .It ena%d: dev has no parent while releasing res for irq: %d Release of the interrupts failed. .El -.Ss Additional diagnostic: +.Ss Additional diagnostic .Bl -diag -.It ena%d: Cannot get attribute for ena device -.Pp -This message appears when trying to change MTU and driver is unable to get -attributes from the device. -.It ena%d: Invalid MTU setting. new_mtu: %d +.It ena%d: Invalid MTU setting. new_mtu: %d max_mtu: %d min mtu: %d .Pp Requested MTU value is not supported and will not be set. -.It ena%d: keep alive watchdog timeout +.It ena%d: Failed to set MTU to %d +.Pp +This message appears when either MTU change feature is not supported, or device +communication error has occured. +.It ena%d: Keep alive watchdog timeout. .Pp Device stopped responding and will be reset. .It ena%d: Found a Tx that wasn't completed on time, qid %d, index %d. @@ -215,18 +391,35 @@ Packet was pushed to the NIC but not sent within given time limit. It may be caused by hang of the IO queue. .It ena%d: The number of lost tx completion is aboce the threshold (%d > %d). Reset the device .Pp -If too many Tx wasn't completed on time the device is going to be reset. +If too many Tx weren't completed on time the device is going to be reset. .br It may be caused by hanged queue or device. -.It ena%d: trigger reset is on +.It ena%d: Trigger reset is on .Pp Device will be reset. .br Reset is triggered either by watchdog or if too many TX packets were not completed on time. -.It ena%d: invalid value recvd +.It ena%d: device reset scheduled but trigger_reset is off +.Pp +Reset task has been triggered, but the driver did not request it. +.br +Device reset will not be performed. +.It ena%d: Device reset failed +.Pp +Error occured while trying to reset the device. +.It ena%d: Cannot initialize device +.It ena%d: Error, mac address are different +.It ena%d: Error, device max mtu is smaller than ifp MTU +.It ena%d: Validation of device parameters failed +.It ena%d: Enable MSI-X failed +.It ena%d: Failed to create I/O queues +.It ena%d: Reset attempt failed. Can not reset the device +.Pp +Error occured while trying to restore the device after reset. +.It ena%d: Device reset completed successfully, Driver info: %s .Pp -Link status received from the device in the AENQ handler is invalid. +Device has been correctly restored after reset and is ready to use. .It ena%d: Allocation for Tx Queue %u failed .It ena%d: Allocation for Rx Queue %u failed .It ena%d: Unable to create Rx DMA map for buffer %d @@ -234,7 +427,6 @@ Link status received from the device in the AENQ handler is invalid. .It ena%d: Failed to get TX queue handlers. TX queue num %d rc: %d .It ena%d: Failed to create io RX queue[%d] rc: %d .It ena%d: Failed to get RX queue handlers. RX queue num %d rc: %d -.It ena%d: failed to request irq .It ena%d: could not allocate irq vector: %d .It ena%d: failed to register interrupt handler for irq %ju: %d .Pp @@ -246,12 +438,20 @@ Interface will not be brought up. Initialization of the LRO for the RX ring failed. .It ena%d: failed to alloc buffer for rx queue .It ena%d: failed to add buffer for rx queue %d -.It ena%d: refilled rx queue %d with %d pages only +.It ena%d: refilled rx qid %d with only %d mbufs (from %d) .Pp Allocation of resources used on RX path failed. .br If happened during initialization of the IO queue, the interface will not be brought up. +.It ena%d: NULL mbuf in rx_info +.Pp +Error occured while assembling mbuf from descriptors. +.It ena%d: tx_info doesn't have valid mbuf +.It ena%d: Invalid req_id: %hu +.It ena%d: failed to prepare tx bufs +.Pp +Error occured while preparing a packet for transmission. .It ena%d: ioctl promisc/allmulti .Pp IOCTL request for the device to work in promiscuous/allmulti mode. @@ -259,22 +459,23 @@ IOCTL request for the device to work in promiscuous/allmulti mode. See .Xr ifconfig 8 for more details. -.It ena%d: too many fragments. Last fragment: %d! -.Pp -Packet with unsupported number of segments was queued for sending to the -device. -.br -Packet will be dropped. .El .Sh SUPPORT If an issue is identified with the released source code with a supported adapter, please email the specific information related to the issue to -.Aq Mt mk@semihalf.com +.Aq Mt mk@semihalf.com , +.Aq Mt ar@semihalf.com and .Aq Mt mw@semihalf.com . .Sh SEE ALSO +.Xr netmap 4 , .Xr vlan 4 , .Xr ifconfig 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 11.1 . .Sh AUTHORS The .Nm From owner-dev-commits-src-main@freebsd.org Thu Jun 24 14:35: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 824A364D5A1; Thu, 24 Jun 2021 14:35: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 4G9jNp6TYlz4cRt; Thu, 24 Jun 2021 14:35: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 99AF119BC4; Thu, 24 Jun 2021 14:35: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 15OEZsSx032571; Thu, 24 Jun 2021 14:35:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OEZsEd032570; Thu, 24 Jun 2021 14:35:54 GMT (envelope-from git) Date: Thu, 24 Jun 2021 14:35:54 GMT Message-Id: <202106241435.15OEZsEd032570@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 93f0df457bf1 - main - Update ENA version to v2.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93f0df457bf1d0e5f71839ab969c94d1f95813fb 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, 24 Jun 2021 14:35:55 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=93f0df457bf1d0e5f71839ab969c94d1f95813fb commit 93f0df457bf1d0e5f71839ab969c94d1f95813fb Author: Marcin Wojtas AuthorDate: 2021-06-24 14:32:52 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-24 14:35:40 +0000 Update ENA version to v2.4.0 Some of the changes in this release: * Large LLQ headers, * Bug/stability fixes, * Change of the README/Documentation. Submitted by: Michal Krawczyk Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. --- sys/dev/ena/ena.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index a49ac70761ba..1d06a3cb56de 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -40,8 +40,8 @@ #include "ena-com/ena_eth_com.h" #define DRV_MODULE_VER_MAJOR 2 -#define DRV_MODULE_VER_MINOR 3 -#define DRV_MODULE_VER_SUBMINOR 1 +#define DRV_MODULE_VER_MINOR 4 +#define DRV_MODULE_VER_SUBMINOR 0 #define DRV_MODULE_NAME "ena" From owner-dev-commits-src-main@freebsd.org Thu Jun 24 16:43: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 04575650CB7; Thu, 24 Jun 2021 16:43: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 4G9mDB6Ryjz4qV2; Thu, 24 Jun 2021 16:43: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 C51511B69E; Thu, 24 Jun 2021 16:43: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 15OGhc5k005375; Thu, 24 Jun 2021 16:43:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OGhcKs005374; Thu, 24 Jun 2021 16:43:38 GMT (envelope-from git) Date: Thu, 24 Jun 2021 16:43:38 GMT Message-Id: <202106241643.15OGhcKs005374@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: 779b70a2264f - main - bsd-family-tree: add DragonFly 6.0.0 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: 779b70a2264fa187beb232dad2f018d41c31e34a 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, 24 Jun 2021 16:43:39 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=779b70a2264fa187beb232dad2f018d41c31e34a commit 779b70a2264fa187beb232dad2f018d41c31e34a Author: Warner Losh AuthorDate: 2021-06-24 16:42:36 +0000 Commit: Warner Losh CommitDate: 2021-06-24 16:43:18 +0000 bsd-family-tree: add DragonFly 6.0.0 Tagged on May 8, 2021. Sponsored by: Netflix --- share/misc/bsd-family-tree | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/misc/bsd-family-tree b/share/misc/bsd-family-tree index ac69e94502e0..43715a00bb67 100644 --- a/share/misc/bsd-family-tree +++ b/share/misc/bsd-family-tree @@ -424,7 +424,7 @@ FreeBSD 5.2 | | | | | 12.2 | | | | | | | | | | | *--FreeBSD | | | | | - | 13.0 | | NetBSD 9.2 OpenBSD 6.9 | + | 13.0 | | NetBSD 9.2 OpenBSD 6.9 DragonFly 6.0.0 | | | | | FreeBSD 14 -current | NetBSD -current OpenBSD -current DragonFly -current | | | | | @@ -832,6 +832,7 @@ NetBSD 9.1 2020-10-18 [NBD] FreeBSD 12.2 2020-10-27 [FBD] FreeBSD 13.0 2021-04-13 [FBD] OpenBSD 6.9 2021-05-01 [OBD] +DragonFly 6.0 2021-05-08 [DFB] NetBSD 9.2 2021-05-12 [NBD] Bibliography From owner-dev-commits-src-main@freebsd.org Thu Jun 24 18:15: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 1DB516520B1; Thu, 24 Jun 2021 18:15: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 4G9pGY07VYz3GDB; Thu, 24 Jun 2021 18:15: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 E10511C741; Thu, 24 Jun 2021 18:15: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 15OIFmnn026416; Thu, 24 Jun 2021 18:15:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OIFmVm026415; Thu, 24 Jun 2021 18:15:48 GMT (envelope-from git) Date: Thu, 24 Jun 2021 18:15:48 GMT Message-Id: <202106241815.15OIFmVm026415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 6ba108e52d17 - main - rc.subr: use _pidcmd to determine pid for protect MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ba108e52d175b6833437c8627ae5d0546a4e102 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, 24 Jun 2021 18:15:49 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=6ba108e52d175b6833437c8627ae5d0546a4e102 commit 6ba108e52d175b6833437c8627ae5d0546a4e102 Author: Mariusz Zaborski AuthorDate: 2021-06-24 18:14:31 +0000 Commit: Mariusz Zaborski CommitDate: 2021-06-24 18:14:31 +0000 rc.subr: use _pidcmd to determine pid for protect This is a more reliable method that accounts for existing pidfiles, procname and interpreter settings. Current method of obtaining the pid for oomprotect="YES"|"ALL" processes in certain cases fails to find a unique pid. One such case are rc.d scripts defining command as: command="daemon" which results in all processes started via daemon being selected and passed to protect(1) which fails and prints usage: $ /etc/rc.d/exampled restart Stopping exampled. Starting exampled. usage: protect [-i] command protect [-cdi] -g pgrp | -p pid Running the same with -x reveals what happens: + pid='3051 4268 4390 4421 4427 4470 4588 4733 4740 4870 4949 4954 4979 5835 5866 55487 55583 56525 57643 57789 57882 58072 58167 99419' + /usr/bin/protect -p 3051 4268 4390 4421 4427 4470 4588 4733 4740 4870 4949 4954 4979 5835 5866 55487 55583 56525 57643 57789 57882 58072 58167 99419 usage: protect [-i] command protect [-cdi] -g pgrp | -p pid We have a more reliable way of obtaining pid already defined in rc.subr and available when protect(1) needs it. We can simply `eval $_pidcmd` which also invokes `check_process` but properly accounts for existing pidfile, procname and interpreter settings. With the change the pidfile is properly obtained. Submitted by: Adam Wolk Sponsored by: Fudo Security Differential Revision: https://reviews.freebsd.org/D30367 --- libexec/rc/rc.subr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index e859ae06962f..b027fa5facf4 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -1272,13 +1272,13 @@ $command $rc_flags $command_args" # We cannot use protect(1) inside jails. if [ -n "$_oomprotect" ] && [ -f "${PROTECT}" ] && [ "$(sysctl -n security.jail.jailed)" -eq 0 ]; then - pid=$(check_process $command) + [ -z "${rc_pid}" ] && eval $_pidcmd case $_oomprotect in [Aa][Ll][Ll]) - ${PROTECT} -i -p ${pid} + ${PROTECT} -i -p ${rc_pid} ;; [Yy][Ee][Ss]) - ${PROTECT} -p ${pid} + ${PROTECT} -p ${rc_pid} ;; esac fi From owner-dev-commits-src-main@freebsd.org Thu Jun 24 18:44:08 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 7988065292D; Thu, 24 Jun 2021 18:44:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G9pvD33k9z3Hgy; Thu, 24 Jun 2021 18:44:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52EAF1D020; Thu, 24 Jun 2021 18:44:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15OIi8ev066010; Thu, 24 Jun 2021 18:44:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15OIi8tx066009; Thu, 24 Jun 2021 18:44:08 GMT (envelope-from git) Date: Thu, 24 Jun 2021 18:44:08 GMT Message-Id: <202106241844.15OIi8tx066009@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 66aec14a5391 - main - tcp: Rack not being very friendly with V6:4 socket and having a connection from V4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66aec14a5391bda1e9a20f5e4381626797c3e0fb 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, 24 Jun 2021 18:44:08 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=66aec14a5391bda1e9a20f5e4381626797c3e0fb commit 66aec14a5391bda1e9a20f5e4381626797c3e0fb Author: Randall Stewart AuthorDate: 2021-06-24 18:42:21 +0000 Commit: Randall Stewart CommitDate: 2021-06-24 18:42:21 +0000 tcp: Rack not being very friendly with V6:4 socket and having a connection from V4 There were two bugs that prevented V4 sockets from connecting to a rack server running a V4/V6 socket. As well as a bug that stops the mapped v4 in V6 address from working. Reviewed by: mtuexen Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30885 --- sys/netinet/tcp_stacks/rack.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index e37eedec460a..521fd6c625f5 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12491,6 +12491,9 @@ rack_fini(struct tcpcb *tp, int32_t tcb_is_purged) static void rack_set_state(struct tcpcb *tp, struct tcp_rack *rack) { + if ((rack->r_state == TCPS_CLOSED) && (tp->t_state != TCPS_CLOSED)) { + rack->r_is_v6 = (tp->t_inpcb->inp_vflag & INP_IPV6) != 0; + } switch (tp->t_state) { case TCPS_SYN_SENT: rack->r_state = TCPS_SYN_SENT; @@ -16215,7 +16218,7 @@ rack_output(struct tcpcb *tp) } idle = 0; } - if (rack_use_fsb && (rack->r_fsb_inited == 0)) + if (rack_use_fsb && (rack->r_fsb_inited == 0) && (rack->r_state != TCPS_CLOSED)) rack_init_fsb_block(tp, rack); again: /* From owner-dev-commits-src-main@freebsd.org Thu Jun 24 23:33: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 2DDE9655774; Thu, 24 Jun 2021 23:33: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 4G9xKV0f3cz4Wvg; Thu, 24 Jun 2021 23:33: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 F2EC420BBB; Thu, 24 Jun 2021 23:33: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 15ONXnnY051782; Thu, 24 Jun 2021 23:33:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15ONXneI051781; Thu, 24 Jun 2021 23:33:49 GMT (envelope-from git) Date: Thu, 24 Jun 2021 23:33:49 GMT Message-Id: <202106242333.15ONXneI051781@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: c94249decd16 - main - arm64: make it possible to define PV_STATS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c94249decd16de71a00d837ee132954d9f259e49 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, 24 Jun 2021 23:33:50 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=c94249decd16de71a00d837ee132954d9f259e49 commit c94249decd16de71a00d837ee132954d9f259e49 Author: Alan Cox AuthorDate: 2021-06-24 23:09:23 +0000 Commit: Alan Cox CommitDate: 2021-06-24 23:32:56 +0000 arm64: make it possible to define PV_STATS Remove an #if 0 that results in a compilation error if PV_STATS is defined. Aside from this #if 0, there is nothing wrong with the PV_STATS code. MFC after: 1 week --- sys/arm64/arm64/pmap.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index bc3d4fd6446b..a6f716370810 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -2226,7 +2226,6 @@ pv_to_chunk(pv_entry_t pv) static const uint64_t pc_freemask[_NPCM] = { PC_FREE0, PC_FREE1, PC_FREE2 }; -#if 0 #ifdef PV_STATS static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail; @@ -2251,7 +2250,6 @@ SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0, "Current number of spare pv entries"); #endif -#endif /* 0 */ /* * We are in a serious low memory condition. Resort to From owner-dev-commits-src-main@freebsd.org Fri Jun 25 01:55: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 57166657D7A; Fri, 25 Jun 2021 01:55: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 4GB0TF1l2Sz4hn4; Fri, 25 Jun 2021 01:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2495D22A94; Fri, 25 Jun 2021 01:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15P1tjJo036875; Fri, 25 Jun 2021 01:55:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15P1tjAA036874; Fri, 25 Jun 2021 01:55:45 GMT (envelope-from git) Date: Fri, 25 Jun 2021 01:55:45 GMT Message-Id: <202106250155.15P1tjAA036874@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: a145cf3f73c7 - main - nfscl: Change the default minor version for NFSv4 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: a145cf3f73c7d0f6071a6bddbe8a50a280285900 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, 25 Jun 2021 01:55:45 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a145cf3f73c7d0f6071a6bddbe8a50a280285900 commit a145cf3f73c7d0f6071a6bddbe8a50a280285900 Author: Rick Macklem AuthorDate: 2021-06-25 01:52:23 +0000 Commit: Rick Macklem CommitDate: 2021-06-25 01:52:23 +0000 nfscl: Change the default minor version for NFSv4 mounts When NFSv4.1 support was added to the client, the implementation was still experimental and, as such, the default minor version was set to 0. Since the NFSv4.1 client implementation is now believed to be solid and the NFSv4.1/4.2 protocol is significantly better than NFSv4.0, I beieve that NFSv4.1/4.2 should be used where possible. This patch changes the default minor version for NFSv4 to be the highest minor version supported by the NFSv4 server. If a specific minor version is desired, the "minorversion" mount option can be used to override this default. This is compatible with the Linux NFSv4 client behaviour. This was discussed on freebsd-current@ in mid-May 2021 under the subject "changing the default NFSv4 minor version" and the consensus seemed to be support for this change. It also appeared that changing this for FreeBSD 13.1 was not considered a POLA violation, so long as UPDATING and RELNOTES entries were made for it. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 9 ++++++++- sys/fs/nfsclient/nfs_clvfsops.c | 14 ++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index fb90c80c69e7..8ea5d77d2053 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -959,11 +959,18 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, error == NFSERR_BADSESSION || error == NFSERR_CLIDINUSE) { (void) nfs_catnap(PZERO, error, "nfs_setcl"); + } else if (error == NFSERR_MINORVERMISMATCH && + tryminvers) { + if (nmp->nm_minorvers > 0) + nmp->nm_minorvers--; + else + tryminvers = false; } } while (((error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION || error == NFSERR_STALEDONTRECOVER) && --trystalecnt > 0) || - (error == NFSERR_CLIDINUSE && --clidinusedelay > 0)); + (error == NFSERR_CLIDINUSE && --clidinusedelay > 0) || + (error == NFSERR_MINORVERMISMATCH && tryminvers)); if (error) { NFSLOCKCLSTATE(); nfsv4_unlock(&clp->nfsc_lock, 0); diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 9b81777177b3..931f37d4ef67 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -897,7 +897,7 @@ nfs_mount(struct mount *mp) char *cp, *opt, *name, *secname, *tlscertname; int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; - int minvers = 0; + int minvers = -1; int dirlen, has_nfs_args_opt, has_nfs_from_opt, krbnamelen, srvkrbnamelen; size_t hstlen; @@ -1419,6 +1419,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, struct nfsclclient *clp; struct nfsclds *dsp, *tdsp; uint32_t lease; + bool tryminvers; static u_int64_t clval = 0; #ifdef KERN_TLS u_int maxlen; @@ -1523,9 +1524,14 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, nmp->nm_wcommitsize *= 2; nmp->nm_wcommitsize *= 256; - if ((argp->flags & NFSMNT_NFSV4) != 0) + tryminvers = false; + if ((argp->flags & NFSMNT_NFSV4) != 0) { + if (minvers < 0) { + tryminvers = true; + minvers = NFSV42_MINORVERSION; + } nmp->nm_minorvers = minvers; - else + } else nmp->nm_minorvers = 0; nfs_decode_args(mp, nmp, argp, hst, cred, td); @@ -1576,7 +1582,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, /* For NFSv4, get the clientid now. */ if ((argp->flags & NFSMNT_NFSV4) != 0) { NFSCL_DEBUG(3, "at getcl\n"); - error = nfscl_getcl(mp, cred, td, false, &clp); + error = nfscl_getcl(mp, cred, td, tryminvers, &clp); NFSCL_DEBUG(3, "aft getcl=%d\n", error); if (error != 0) goto bad; From owner-dev-commits-src-main@freebsd.org Fri Jun 25 02:13: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 883D7658418; Fri, 25 Jun 2021 02:13: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 4GB0t13BtDz4jF2; Fri, 25 Jun 2021 02:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56BAA22F70; Fri, 25 Jun 2021 02:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15P2DjWD063414; Fri, 25 Jun 2021 02:13:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15P2DjmV063413; Fri, 25 Jun 2021 02:13:45 GMT (envelope-from git) Date: Fri, 25 Jun 2021 02:13:45 GMT Message-Id: <202106250213.15P2DjmV063413@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: b49ba74deeb7 - main - nfscl: Add entries to UPDATING and RELNOTES for commit a145cf3f73c7 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: b49ba74deeb74bac6cc7b93b22a4b0419d23dce7 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, 25 Jun 2021 02:13:45 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b49ba74deeb74bac6cc7b93b22a4b0419d23dce7 commit b49ba74deeb74bac6cc7b93b22a4b0419d23dce7 Author: Rick Macklem AuthorDate: 2021-06-25 02:10:36 +0000 Commit: Rick Macklem CommitDate: 2021-06-25 02:10:36 +0000 nfscl: Add entries to UPDATING and RELNOTES for commit a145cf3f73c7 --- RELNOTES | 6 ++++++ UPDATING | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/RELNOTES b/RELNOTES index 478864776e08..2ed1e14f67a1 100644 --- a/RELNOTES +++ b/RELNOTES @@ -17,3 +17,9 @@ d575e81fbcfa 76681661be28 Remove support for asymmetric cryptographic operations from the kernel open cryptographic framework (OCF). + +a145cf3f73c7 + The NFSv4 client now uses the highest minor version of NFSv4 + supported by the NFSv4 server by default instead of minor version 0, + for NFSv4 mounts. + The "minorversion" mount option may be used to override this default. diff --git a/UPDATING b/UPDATING index cf8b5fa287a4..dbedcd058585 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,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".) +20210624: + The NFSv4 client now uses the highest minor version of NFSv4 + supported by the NFSv4 server by default instead of minor version 0, + for NFSv4 mounts. + The "minorversion" mount option may be used to override this default. + 20210618: Bump __FreeBSD_version to 1400024 for LinuxKPI changes. Most notably netdev.h can change now as the (last) dependencies From owner-dev-commits-src-main@freebsd.org Fri Jun 25 07:02: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 646AB65A1E9; Fri, 25 Jun 2021 07:02: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 4GB7Gy2Clfz3KxR; Fri, 25 Jun 2021 07:02: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 33C272656B; Fri, 25 Jun 2021 07:02: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 15P72I5D048756; Fri, 25 Jun 2021 07:02:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15P72IH6048755; Fri, 25 Jun 2021 07:02:18 GMT (envelope-from git) Date: Fri, 25 Jun 2021 07:02:18 GMT Message-Id: <202106250702.15P72IH6048755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 884fc5527a3f - main - sbin/md5: add tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 884fc5527a3ffd9830b941cbec328de1623044cc 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, 25 Jun 2021 07:02:18 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=884fc5527a3ffd9830b941cbec328de1623044cc commit 884fc5527a3ffd9830b941cbec328de1623044cc Author: Stefan Eßer AuthorDate: 2021-06-25 06:51:40 +0000 Commit: Stefan Eßer CommitDate: 2021-06-25 06:51:40 +0000 sbin/md5: add tests While the correctness of the supported hash algorithms can be tested with the built-in self-test feature, these test cases are meant to detect changes in the output format. A follow-up commit will improve the compatibility with the coreutils versions of the hash programs, and these tests should detect any unintended side-effects of such a change on existing functionality. --- sbin/md5/Makefile | 5 ++++ sbin/md5/tests/1.inp | 0 sbin/md5/tests/1.sha512-p.chk | 1 + sbin/md5/tests/1.sha512sum-p.chk | 1 + sbin/md5/tests/2.inp | 1 + sbin/md5/tests/2.sha512-p.chk | 1 + sbin/md5/tests/2.sha512sum-p.chk | 1 + sbin/md5/tests/3.inp | 1 + sbin/md5/tests/3.sha512-p.chk | 1 + sbin/md5/tests/3.sha512sum-p.chk | 1 + sbin/md5/tests/4.inp | 1 + sbin/md5/tests/4.sha512-p.chk | 1 + sbin/md5/tests/4.sha512sum-p.chk | 1 + sbin/md5/tests/5.inp | 1 + sbin/md5/tests/5.sha512-p.chk | 1 + sbin/md5/tests/5.sha512sum-p.chk | 1 + sbin/md5/tests/6.inp | 1 + sbin/md5/tests/6.sha512-p.chk | 1 + sbin/md5/tests/6.sha512sum-p.chk | 1 + sbin/md5/tests/7.inp | 1 + sbin/md5/tests/7.sha512-p.chk | 1 + sbin/md5/tests/7.sha512sum-p.chk | 1 + sbin/md5/tests/8.inp | 1 + sbin/md5/tests/8.sha512-p.chk | 1 + sbin/md5/tests/8.sha512sum-p.chk | 1 + sbin/md5/tests/Makefile | 41 +++++++++++++++++++++++++++++++++ sbin/md5/tests/algorithms.txt | 11 +++++++++ sbin/md5/tests/bsd-c-test.SH | 23 ++++++++++++++++++ sbin/md5/tests/bsd-p-test.SH | 24 +++++++++++++++++++ sbin/md5/tests/bsd-s-test.SH | 30 ++++++++++++++++++++++++ sbin/md5/tests/md5.digest | 8 +++++++ sbin/md5/tests/md5sum.digest | 8 +++++++ sbin/md5/tests/rmd160.digest | 8 +++++++ sbin/md5/tests/rmd160sum.digest | 8 +++++++ sbin/md5/tests/self-test.SH | 8 +++++++ sbin/md5/tests/self-test.md5.chk | 9 ++++++++ sbin/md5/tests/self-test.rmd160.chk | 9 ++++++++ sbin/md5/tests/self-test.sh_inp | 8 +++++++ sbin/md5/tests/self-test.sha1.chk | 9 ++++++++ sbin/md5/tests/self-test.sha224.chk | 9 ++++++++ sbin/md5/tests/self-test.sha256.chk | 9 ++++++++ sbin/md5/tests/self-test.sha384.chk | 9 ++++++++ sbin/md5/tests/self-test.sha512.chk | 9 ++++++++ sbin/md5/tests/self-test.sha512t256.chk | 9 ++++++++ sbin/md5/tests/self-test.skein1024.chk | 9 ++++++++ sbin/md5/tests/self-test.skein256.chk | 9 ++++++++ sbin/md5/tests/self-test.skein512.chk | 9 ++++++++ sbin/md5/tests/sha1.digest | 8 +++++++ sbin/md5/tests/sha1sum.digest | 8 +++++++ sbin/md5/tests/sha224.digest | 8 +++++++ sbin/md5/tests/sha224sum.digest | 8 +++++++ sbin/md5/tests/sha256.digest | 8 +++++++ sbin/md5/tests/sha256sum.digest | 8 +++++++ sbin/md5/tests/sha384.digest | 8 +++++++ sbin/md5/tests/sha384sum.digest | 8 +++++++ sbin/md5/tests/sha512.digest | 8 +++++++ sbin/md5/tests/sha512sum.digest | 8 +++++++ sbin/md5/tests/sha512t256.digest | 8 +++++++ sbin/md5/tests/sha512t256sum.digest | 8 +++++++ sbin/md5/tests/skein1024.digest | 8 +++++++ sbin/md5/tests/skein1024sum.digest | 8 +++++++ sbin/md5/tests/skein256.digest | 8 +++++++ sbin/md5/tests/skein256sum.digest | 8 +++++++ sbin/md5/tests/skein512.digest | 8 +++++++ sbin/md5/tests/skein512sum.digest | 8 +++++++ 65 files changed, 448 insertions(+) diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile index b1e40713c219..e499967d23d5 100644 --- a/sbin/md5/Makefile +++ b/sbin/md5/Makefile @@ -58,4 +58,9 @@ LIBADD= md CFLAGS+=-DHAVE_CAPSICUM .endif +.include + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include diff --git a/sbin/md5/tests/1.inp b/sbin/md5/tests/1.inp new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sbin/md5/tests/1.sha512-p.chk b/sbin/md5/tests/1.sha512-p.chk new file mode 100644 index 000000000000..c2f1924ca315 --- /dev/null +++ b/sbin/md5/tests/1.sha512-p.chk @@ -0,0 +1 @@ +cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e diff --git a/sbin/md5/tests/1.sha512sum-p.chk b/sbin/md5/tests/1.sha512sum-p.chk new file mode 100644 index 000000000000..c2f1924ca315 --- /dev/null +++ b/sbin/md5/tests/1.sha512sum-p.chk @@ -0,0 +1 @@ +cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e diff --git a/sbin/md5/tests/2.inp b/sbin/md5/tests/2.inp new file mode 100644 index 000000000000..2e65efe2a145 --- /dev/null +++ b/sbin/md5/tests/2.inp @@ -0,0 +1 @@ +a \ No newline at end of file diff --git a/sbin/md5/tests/2.sha512-p.chk b/sbin/md5/tests/2.sha512-p.chk new file mode 100644 index 000000000000..be4d8addd112 --- /dev/null +++ b/sbin/md5/tests/2.sha512-p.chk @@ -0,0 +1 @@ +a1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 diff --git a/sbin/md5/tests/2.sha512sum-p.chk b/sbin/md5/tests/2.sha512sum-p.chk new file mode 100644 index 000000000000..be4d8addd112 --- /dev/null +++ b/sbin/md5/tests/2.sha512sum-p.chk @@ -0,0 +1 @@ +a1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 diff --git a/sbin/md5/tests/3.inp b/sbin/md5/tests/3.inp new file mode 100644 index 000000000000..f2ba8f84ab5c --- /dev/null +++ b/sbin/md5/tests/3.inp @@ -0,0 +1 @@ +abc \ No newline at end of file diff --git a/sbin/md5/tests/3.sha512-p.chk b/sbin/md5/tests/3.sha512-p.chk new file mode 100644 index 000000000000..3971db2fddea --- /dev/null +++ b/sbin/md5/tests/3.sha512-p.chk @@ -0,0 +1 @@ +abcddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f diff --git a/sbin/md5/tests/3.sha512sum-p.chk b/sbin/md5/tests/3.sha512sum-p.chk new file mode 100644 index 000000000000..3971db2fddea --- /dev/null +++ b/sbin/md5/tests/3.sha512sum-p.chk @@ -0,0 +1 @@ +abcddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f diff --git a/sbin/md5/tests/4.inp b/sbin/md5/tests/4.inp new file mode 100644 index 000000000000..e407fe0e6143 --- /dev/null +++ b/sbin/md5/tests/4.inp @@ -0,0 +1 @@ +message digest \ No newline at end of file diff --git a/sbin/md5/tests/4.sha512-p.chk b/sbin/md5/tests/4.sha512-p.chk new file mode 100644 index 000000000000..cd5bad00b50d --- /dev/null +++ b/sbin/md5/tests/4.sha512-p.chk @@ -0,0 +1 @@ +message digest107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c diff --git a/sbin/md5/tests/4.sha512sum-p.chk b/sbin/md5/tests/4.sha512sum-p.chk new file mode 100644 index 000000000000..cd5bad00b50d --- /dev/null +++ b/sbin/md5/tests/4.sha512sum-p.chk @@ -0,0 +1 @@ +message digest107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c diff --git a/sbin/md5/tests/5.inp b/sbin/md5/tests/5.inp new file mode 100644 index 000000000000..e85d5b45283a --- /dev/null +++ b/sbin/md5/tests/5.inp @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwxyz \ No newline at end of file diff --git a/sbin/md5/tests/5.sha512-p.chk b/sbin/md5/tests/5.sha512-p.chk new file mode 100644 index 000000000000..77f97a5a0117 --- /dev/null +++ b/sbin/md5/tests/5.sha512-p.chk @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwxyz4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 diff --git a/sbin/md5/tests/5.sha512sum-p.chk b/sbin/md5/tests/5.sha512sum-p.chk new file mode 100644 index 000000000000..77f97a5a0117 --- /dev/null +++ b/sbin/md5/tests/5.sha512sum-p.chk @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwxyz4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 diff --git a/sbin/md5/tests/6.inp b/sbin/md5/tests/6.inp new file mode 100644 index 000000000000..9f75c3756298 --- /dev/null +++ b/sbin/md5/tests/6.inp @@ -0,0 +1 @@ +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 \ No newline at end of file diff --git a/sbin/md5/tests/6.sha512-p.chk b/sbin/md5/tests/6.sha512-p.chk new file mode 100644 index 000000000000..d14aad405215 --- /dev/null +++ b/sbin/md5/tests/6.sha512-p.chk @@ -0,0 +1 @@ +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567891e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 diff --git a/sbin/md5/tests/6.sha512sum-p.chk b/sbin/md5/tests/6.sha512sum-p.chk new file mode 100644 index 000000000000..d14aad405215 --- /dev/null +++ b/sbin/md5/tests/6.sha512sum-p.chk @@ -0,0 +1 @@ +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567891e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 diff --git a/sbin/md5/tests/7.inp b/sbin/md5/tests/7.inp new file mode 100644 index 000000000000..15e0acf537d8 --- /dev/null +++ b/sbin/md5/tests/7.inp @@ -0,0 +1 @@ +12345678901234567890123456789012345678901234567890123456789012345678901234567890 \ No newline at end of file diff --git a/sbin/md5/tests/7.sha512-p.chk b/sbin/md5/tests/7.sha512-p.chk new file mode 100644 index 000000000000..efd5828f95ff --- /dev/null +++ b/sbin/md5/tests/7.sha512-p.chk @@ -0,0 +1 @@ +1234567890123456789012345678901234567890123456789012345678901234567890123456789072ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 diff --git a/sbin/md5/tests/7.sha512sum-p.chk b/sbin/md5/tests/7.sha512sum-p.chk new file mode 100644 index 000000000000..efd5828f95ff --- /dev/null +++ b/sbin/md5/tests/7.sha512sum-p.chk @@ -0,0 +1 @@ +1234567890123456789012345678901234567890123456789012345678901234567890123456789072ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 diff --git a/sbin/md5/tests/8.inp b/sbin/md5/tests/8.inp new file mode 100644 index 000000000000..689a689eceea --- /dev/null +++ b/sbin/md5/tests/8.inp @@ -0,0 +1 @@ +MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt \ No newline at end of file diff --git a/sbin/md5/tests/8.sha512-p.chk b/sbin/md5/tests/8.sha512-p.chk new file mode 100644 index 000000000000..d53bfc56d752 --- /dev/null +++ b/sbin/md5/tests/8.sha512-p.chk @@ -0,0 +1 @@ +MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubte8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 diff --git a/sbin/md5/tests/8.sha512sum-p.chk b/sbin/md5/tests/8.sha512sum-p.chk new file mode 100644 index 000000000000..d53bfc56d752 --- /dev/null +++ b/sbin/md5/tests/8.sha512sum-p.chk @@ -0,0 +1 @@ +MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubte8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 diff --git a/sbin/md5/tests/Makefile b/sbin/md5/tests/Makefile new file mode 100644 index 000000000000..b37332aa9894 --- /dev/null +++ b/sbin/md5/tests/Makefile @@ -0,0 +1,41 @@ +# $FreeBSD$ + +.include + +PACKAGE= tests + +TEST_DIR= ${SRCTOP}/sbin/md5/tests + +.PATH: ${TEST_DIR} + +FILESGROUPS+= FILESinputs +FILESinputsPACKAGE= ${PACKAGE} +FILESinputsDIR= ${TESTSDIR} +FILESinputs!= echo ${TEST_DIR}/*.inp + +FILESGROUPS+= FILESchkfiles +FILESchkfilesPACKAGE= ${PACKAGE} +FILESchkfilesDIR= ${TESTSDIR} +FILESchkfiles!= echo ${TEST_DIR}/*.chk + +FILESGROUPS+= FILESdigests +FILESdigestsPACKAGE= ${PACKAGE} +FILESdigestsDIR= ${TESTSDIR} +FILESdigests!= echo ${TEST_DIR}/*.digest + +FILESGROUPS+= FILESparam +FILESparamPACKAGE= ${PACKAGE} +FILESparamDIR= ${TESTSDIR} +FILESparam!= echo ${TEST_DIR}/*.txt + +PLAIN_TESTS_SH+= self-test +PLAIN_TESTS_SH+= bsd-c-test +PLAIN_TESTS_SH+= bsd-p-test +PLAIN_TESTS_SH+= bsd-s-test + +.SUFFIXES: .SH + +.SH.sh: + sed 's|%%TESTSBASE%%|${TESTSBASE}|g' ${.ALLSRC} > ${.TARGET} + +.include diff --git a/sbin/md5/tests/algorithms.txt b/sbin/md5/tests/algorithms.txt new file mode 100644 index 000000000000..88f0ff5b783a --- /dev/null +++ b/sbin/md5/tests/algorithms.txt @@ -0,0 +1,11 @@ +md5 +rmd160 +sha1 +sha224 +sha256 +sha384 +sha512 +sha512t256 +skein1024 +skein256 +skein512 diff --git a/sbin/md5/tests/bsd-c-test.SH b/sbin/md5/tests/bsd-c-test.SH new file mode 100644 index 000000000000..0327b95f0c0e --- /dev/null +++ b/sbin/md5/tests/bsd-c-test.SH @@ -0,0 +1,23 @@ +#!/bin/sh + +exitcode=0 + +testloop () { + opt=$1 + + while read algorithm; do + n=0 + for f in %%TESTSBASE%%/sbin/md5/*.inp; do + n=$((n + 1)) + expected=$(head -$n %%TESTSBASE%%/sbin/md5/$algorithm.digest | tail -1 | cut -w -f4) + hash=$($algorithm $opt -c "$expected" $f) || exitcode=1 + done + done < %%TESTSBASE%%/sbin/md5/algorithms.txt +} + +testloop "" +testloop -q +testloop -r +testloop -qr + +exit $exitcode diff --git a/sbin/md5/tests/bsd-p-test.SH b/sbin/md5/tests/bsd-p-test.SH new file mode 100644 index 000000000000..3677a34b335a --- /dev/null +++ b/sbin/md5/tests/bsd-p-test.SH @@ -0,0 +1,24 @@ +#!/bin/sh + +exitcode=0 + +testloop () { + opt=$1 + sum=$2 + + for algorithm in sha512; do + for f in %%TESTSBASE%%/sbin/md5/*.inp; do + outbase=%%TESTSBASE%%/sbin/md5/$(basename $f .inp) + $algorithm$sum $opt -p < $f > $outbase.out + diff $outbase.$algorithm$sum-p.chk $outbase.out || exitcode=1 + done + done +} + +testloop "" "" +testloop -q "" +testloop -qr "" +testloop "" sum +testloop -q sum + +exit $exitcode diff --git a/sbin/md5/tests/bsd-s-test.SH b/sbin/md5/tests/bsd-s-test.SH new file mode 100644 index 000000000000..83267711137f --- /dev/null +++ b/sbin/md5/tests/bsd-s-test.SH @@ -0,0 +1,30 @@ +#!/bin/sh + +exitcode=0 + +testloop () { + opt=$1 + sum=$2 + field=$3 + + while read algorithm; do + n=0 + for f in %%TESTSBASE%%/sbin/md5/*.inp; do + n=$((n + 1)) + read text < $f + hash=$($algorithm$sum $opt -s "$text" | cut -d= -f$field) + hash=$(echo $hash | cut -w -f1) + expected=$(head -$n %%TESTSBASE%%/sbin/md5/$algorithm.digest | tail -1 | cut -w -f4) + [ "$hash" = "$expected" ] || exitcode=1 + done + done < %%TESTSBASE%%/sbin/md5/algorithms.txt +} + +testloop "" "" 2 +testloop -q "" 1 +testloop -r "" 1 +testloop -qr "" 1 +testloop "" sum 1 +testloop -q sum 1 + +exit $exitcode diff --git a/sbin/md5/tests/md5.digest b/sbin/md5/tests/md5.digest new file mode 100644 index 000000000000..38b8dcb6e705 --- /dev/null +++ b/sbin/md5/tests/md5.digest @@ -0,0 +1,8 @@ +MD5 (1.inp) = d41d8cd98f00b204e9800998ecf8427e +MD5 (2.inp) = 0cc175b9c0f1b6a831c399e269772661 +MD5 (3.inp) = 900150983cd24fb0d6963f7d28e17f72 +MD5 (4.inp) = f96b697d7cb7938d525a2f31aaf161d0 +MD5 (5.inp) = c3fcd3d76192e4007dfb496cca67e13b +MD5 (6.inp) = d174ab98d277d9f5a5611c2c9f419d9f +MD5 (7.inp) = 57edf4a22be3c955ac49da2e2107b67a +MD5 (8.inp) = b50663f41d44d92171cb9976bc118538 diff --git a/sbin/md5/tests/md5sum.digest b/sbin/md5/tests/md5sum.digest new file mode 100644 index 000000000000..c560afa0d7f0 --- /dev/null +++ b/sbin/md5/tests/md5sum.digest @@ -0,0 +1,8 @@ +d41d8cd98f00b204e9800998ecf8427e 1.inp +0cc175b9c0f1b6a831c399e269772661 2.inp +900150983cd24fb0d6963f7d28e17f72 3.inp +f96b697d7cb7938d525a2f31aaf161d0 4.inp +c3fcd3d76192e4007dfb496cca67e13b 5.inp +d174ab98d277d9f5a5611c2c9f419d9f 6.inp +57edf4a22be3c955ac49da2e2107b67a 7.inp +b50663f41d44d92171cb9976bc118538 8.inp diff --git a/sbin/md5/tests/rmd160.digest b/sbin/md5/tests/rmd160.digest new file mode 100644 index 000000000000..b2ffd3c0ce45 --- /dev/null +++ b/sbin/md5/tests/rmd160.digest @@ -0,0 +1,8 @@ +RMD160 (1.inp) = 9c1185a5c5e9fc54612808977ee8f548b2258d31 +RMD160 (2.inp) = 0bdc9d2d256b3ee9daae347be6f4dc835a467ffe +RMD160 (3.inp) = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc +RMD160 (4.inp) = 5d0689ef49d2fae572b881b123a85ffa21595f36 +RMD160 (5.inp) = f71c27109c692c1b56bbdceb5b9d2865b3708dbc +RMD160 (6.inp) = b0e20b6e3116640286ed3a87a5713079b21f5189 +RMD160 (7.inp) = 9b752e45573d4b39f4dbd3323cab82bf63326bfb +RMD160 (8.inp) = 5feb69c6bf7c29d95715ad55f57d8ac5b2b7dd32 diff --git a/sbin/md5/tests/rmd160sum.digest b/sbin/md5/tests/rmd160sum.digest new file mode 100644 index 000000000000..4864ff39e050 --- /dev/null +++ b/sbin/md5/tests/rmd160sum.digest @@ -0,0 +1,8 @@ +9c1185a5c5e9fc54612808977ee8f548b2258d31 1.inp +0bdc9d2d256b3ee9daae347be6f4dc835a467ffe 2.inp +8eb208f7e05d987a9b044a8e98c6b087f15a0bfc 3.inp +5d0689ef49d2fae572b881b123a85ffa21595f36 4.inp +f71c27109c692c1b56bbdceb5b9d2865b3708dbc 5.inp +b0e20b6e3116640286ed3a87a5713079b21f5189 6.inp +9b752e45573d4b39f4dbd3323cab82bf63326bfb 7.inp +5feb69c6bf7c29d95715ad55f57d8ac5b2b7dd32 8.inp diff --git a/sbin/md5/tests/self-test.SH b/sbin/md5/tests/self-test.SH new file mode 100644 index 000000000000..33bd5569c23c --- /dev/null +++ b/sbin/md5/tests/self-test.SH @@ -0,0 +1,8 @@ +#!/bin/sh + +while read algorithm; do + $algorithm -x > self-test.$algorithm.out || exitcode=$? + diff %%TESTSBASE%%/sbin/md5/self-test.$algorithm.chk self-test.$algorithm.out +done < %%TESTSBASE%%/sbin/md5/algorithms.txt + +exit $exitcode diff --git a/sbin/md5/tests/self-test.md5.chk b/sbin/md5/tests/self-test.md5.chk new file mode 100644 index 000000000000..d4eb05560b53 --- /dev/null +++ b/sbin/md5/tests/self-test.md5.chk @@ -0,0 +1,9 @@ +MD5 test suite: +MD5 ("") = d41d8cd98f00b204e9800998ecf8427e - verified correct +MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661 - verified correct +MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 - verified correct +MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0 - verified correct +MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b - verified correct +MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = d174ab98d277d9f5a5611c2c9f419d9f - verified correct +MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 57edf4a22be3c955ac49da2e2107b67a - verified correct +MD5 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = b50663f41d44d92171cb9976bc118538 - verified correct diff --git a/sbin/md5/tests/self-test.rmd160.chk b/sbin/md5/tests/self-test.rmd160.chk new file mode 100644 index 000000000000..a0680ac7f647 --- /dev/null +++ b/sbin/md5/tests/self-test.rmd160.chk @@ -0,0 +1,9 @@ +RMD160 test suite: +RMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31 - verified correct +RMD160 ("a") = 0bdc9d2d256b3ee9daae347be6f4dc835a467ffe - verified correct +RMD160 ("abc") = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc - verified correct +RMD160 ("message digest") = 5d0689ef49d2fae572b881b123a85ffa21595f36 - verified correct +RMD160 ("abcdefghijklmnopqrstuvwxyz") = f71c27109c692c1b56bbdceb5b9d2865b3708dbc - verified correct +RMD160 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = b0e20b6e3116640286ed3a87a5713079b21f5189 - verified correct +RMD160 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 9b752e45573d4b39f4dbd3323cab82bf63326bfb - verified correct +RMD160 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 5feb69c6bf7c29d95715ad55f57d8ac5b2b7dd32 - verified correct diff --git a/sbin/md5/tests/self-test.sh_inp b/sbin/md5/tests/self-test.sh_inp new file mode 100644 index 000000000000..33bd5569c23c --- /dev/null +++ b/sbin/md5/tests/self-test.sh_inp @@ -0,0 +1,8 @@ +#!/bin/sh + +while read algorithm; do + $algorithm -x > self-test.$algorithm.out || exitcode=$? + diff %%TESTSBASE%%/sbin/md5/self-test.$algorithm.chk self-test.$algorithm.out +done < %%TESTSBASE%%/sbin/md5/algorithms.txt + +exit $exitcode diff --git a/sbin/md5/tests/self-test.sha1.chk b/sbin/md5/tests/self-test.sha1.chk new file mode 100644 index 000000000000..e463947feb36 --- /dev/null +++ b/sbin/md5/tests/self-test.sha1.chk @@ -0,0 +1,9 @@ +SHA1 test suite: +SHA1 ("") = da39a3ee5e6b4b0d3255bfef95601890afd80709 - verified correct +SHA1 ("a") = 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 - verified correct +SHA1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d - verified correct +SHA1 ("message digest") = c12252ceda8be8994d5fa0290a47231c1d16aae3 - verified correct +SHA1 ("abcdefghijklmnopqrstuvwxyz") = 32d10c7b8cf96570ca04ce37f2a19d84240d3a89 - verified correct +SHA1 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 761c457bf73b14d27e9e9265c46f4b4dda11f940 - verified correct +SHA1 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 50abf5706a150990a08b2c5ea40fa0e585554732 - verified correct +SHA1 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 18eca4333979c4181199b7b4fab8786d16cf2846 - verified correct diff --git a/sbin/md5/tests/self-test.sha224.chk b/sbin/md5/tests/self-test.sha224.chk new file mode 100644 index 000000000000..e74cccafa6d7 --- /dev/null +++ b/sbin/md5/tests/self-test.sha224.chk @@ -0,0 +1,9 @@ +SHA224 test suite: +SHA224 ("") = d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f - verified correct +SHA224 ("a") = abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5 - verified correct +SHA224 ("abc") = 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 - verified correct +SHA224 ("message digest") = 2cb21c83ae2f004de7e81c3c7019cbcb65b71ab656b22d6d0c39b8eb - verified correct +SHA224 ("abcdefghijklmnopqrstuvwxyz") = 45a5f72c39c5cff2522eb3429799e49e5f44b356ef926bcf390dccc2 - verified correct +SHA224 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = bff72b4fcb7d75e5632900ac5f90d219e05e97a7bde72e740db393d9 - verified correct +SHA224 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e - verified correct +SHA224 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 5ae55f3779c8a1204210d7ed7689f661fbe140f96f272ab79e19d470 - verified correct diff --git a/sbin/md5/tests/self-test.sha256.chk b/sbin/md5/tests/self-test.sha256.chk new file mode 100644 index 000000000000..ba640b6a9217 --- /dev/null +++ b/sbin/md5/tests/self-test.sha256.chk @@ -0,0 +1,9 @@ +SHA256 test suite: +SHA256 ("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - verified correct +SHA256 ("a") = ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb - verified correct +SHA256 ("abc") = ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad - verified correct +SHA256 ("message digest") = f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650 - verified correct +SHA256 ("abcdefghijklmnopqrstuvwxyz") = 71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73 - verified correct +SHA256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0 - verified correct +SHA256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e - verified correct +SHA256 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f - verified correct diff --git a/sbin/md5/tests/self-test.sha384.chk b/sbin/md5/tests/self-test.sha384.chk new file mode 100644 index 000000000000..a493cadc1964 --- /dev/null +++ b/sbin/md5/tests/self-test.sha384.chk @@ -0,0 +1,9 @@ +SHA384 test suite: +SHA384 ("") = 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b - verified correct +SHA384 ("a") = 54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 - verified correct +SHA384 ("abc") = cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 - verified correct +SHA384 ("message digest") = 473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5 - verified correct +SHA384 ("abcdefghijklmnopqrstuvwxyz") = feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4 - verified correct +SHA384 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84 - verified correct +SHA384 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026 - verified correct +SHA384 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 99428d401bf4abcd4ee0695248c9858b7503853acfae21a9cffa7855f46d1395ef38596fcd06d5a8c32d41a839cc5dfb - verified correct diff --git a/sbin/md5/tests/self-test.sha512.chk b/sbin/md5/tests/self-test.sha512.chk new file mode 100644 index 000000000000..f36e455cdaa5 --- /dev/null +++ b/sbin/md5/tests/self-test.sha512.chk @@ -0,0 +1,9 @@ +SHA512 test suite: +SHA512 ("") = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e - verified correct +SHA512 ("a") = 1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 - verified correct +SHA512 ("abc") = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f - verified correct +SHA512 ("message digest") = 107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c - verified correct +SHA512 ("abcdefghijklmnopqrstuvwxyz") = 4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 - verified correct +SHA512 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 - verified correct +SHA512 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 - verified correct +SHA512 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 - verified correct diff --git a/sbin/md5/tests/self-test.sha512t256.chk b/sbin/md5/tests/self-test.sha512t256.chk new file mode 100644 index 000000000000..25612ace484a --- /dev/null +++ b/sbin/md5/tests/self-test.sha512t256.chk @@ -0,0 +1,9 @@ +SHA512t256 test suite: +SHA512t256 ("") = c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a - verified correct +SHA512t256 ("a") = 455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8 - verified correct +SHA512t256 ("abc") = 53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23 - verified correct +SHA512t256 ("message digest") = 0cf471fd17ed69d990daf3433c89b16d63dec1bb9cb42a6094604ee5d7b4e9fb - verified correct +SHA512t256 ("abcdefghijklmnopqrstuvwxyz") = fc3189443f9c268f626aea08a756abe7b726b05f701cb08222312ccfd6710a26 - verified correct +SHA512t256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = cdf1cc0effe26ecc0c13758f7b4a48e000615df241284185c39eb05d355bb9c8 - verified correct +SHA512t256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 2c9fdbc0c90bdd87612ee8455474f9044850241dc105b1e8b94b8ddf5fac9148 - verified correct +SHA512t256 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = dd095fc859b336c30a52548b3dc59fcc0d1be8616ebcf3368fad23107db2d736 - verified correct diff --git a/sbin/md5/tests/self-test.skein1024.chk b/sbin/md5/tests/self-test.skein1024.chk new file mode 100644 index 000000000000..8cfc5997afde --- /dev/null +++ b/sbin/md5/tests/self-test.skein1024.chk @@ -0,0 +1,9 @@ +Skein1024 test suite: +Skein1024 ("") = 0fff9563bb3279289227ac77d319b6fff8d7e9f09da1247b72a0a265cd6d2a62645ad547ed8193db48cff847c06494a03f55666d3b47eb4c20456c9373c86297d630d5578ebd34cb40991578f9f52b18003efa35d3da6553ff35db91b81ab890bec1b189b7f52cb2a783ebb7d823d725b0b4a71f6824e88f68f982eefc6d19c6 - verified correct +Skein1024 ("a") = 6ab4c4ba9814a3d976ec8bffa7fcc638ceba0544a97b3c98411323ffd2dc936315d13dc93c13c4e88cda6f5bac6f2558b2d8694d3b6143e40d644ae43ca940685cb37f809d3d0550c56cba8036dee729a4f8fb960732e59e64d57f7f7710f8670963cdcdc95b41daab4855fcf8b6762a64b173ee61343a2c7689af1d293eba97 - verified correct +Skein1024 ("abc") = 35a599a0f91abcdb4cb73c19b8cb8d947742d82c309137a7caed29e8e0a2ca7a9ff9a90c34c1908cc7e7fd99bb15032fb86e76df21b72628399b5f7c3cc209d7bb31c99cd4e19465622a049afbb87c03b5ce3888d17e6e667279ec0aa9b3e2712624c01b5f5bbe1a564220bdcf6990af0c2539019f313fdd7406cca3892a1f1f - verified correct +Skein1024 ("message digest") = ea891f5268acd0fac97467fc1aa89d1ce8681a9992a42540e53babee861483110c2d16f49e73bac27653ff173003e40cfb08516cd34262e6af95a5d8645c9c1abb3e813604d508b8511b30f9a5c1b352aa0791c7d2f27b2706dccea54bc7de6555b5202351751c3299f97c09cf89c40f67187e2521c0fad82b30edbb224f0458 - verified correct +Skein1024 ("abcdefghijklmnopqrstuvwxyz") = f23d95c2a25fbcd0e797cd058fec39d3c52d2b5afd7a9af1df934e63257d1d3dcf3246e7329c0f1104c1e51e3d22e300507b0c3b9f985bb1f645ef49835080536becf83788e17fed09c9982ba65c3cb7ffe6a5f745b911c506962adf226e435c42f6f6bc08d288f9c810e807e3216ef444f3db22744441deefa4900982a1371f - verified correct +Skein1024 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = cf3889e8a8d11bfd3938055d7d061437962bc5eac8ae83b1b71c94be201b8cf657fdbfc38674997a008c0c903f56a23feb3ae30e012377f1cfa080a9ca7fe8b96138662653fb3335c7d06595bf8baf65e215307532094cfdfa056bd8052ab792a3944a2adaa47b30335b8badb8fe9eb94fe329cdca04e58bbc530f0af709f469 - verified correct +Skein1024 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = cf21a613620e6c119eca31fdfaad449a8e02f95ca256c21d2a105f8e4157048f9fe1e897893ea18b64e0e37cb07d5ac947f27ba544caf7cbc1ad094e675aed77a366270f7eb7f46543bccfa61c526fd628408058ed00ed566ac35a9761d002e629c4fb0d430b2f4ad016fcc49c44d2981c4002da0eecc42144160e2eaea4855a - verified correct +Skein1024 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = e6799b78db54085a2be7ff4c8007f147fa88d326abab30be0560b953396d8802feee9a15419b48a467574e9283be15685ca8a079ee52b27166b64dd70b124b1d4e4f6aca37224c3f2685e67e67baef9f94b905698adc794a09672aba977a61b20966912acdb08c21a2c37001785355dc884751a21f848ab36e590331ff938138 - verified correct diff --git a/sbin/md5/tests/self-test.skein256.chk b/sbin/md5/tests/self-test.skein256.chk new file mode 100644 index 000000000000..41d1fdcb8cc8 --- /dev/null +++ b/sbin/md5/tests/self-test.skein256.chk @@ -0,0 +1,9 @@ +Skein256 test suite: +Skein256 ("") = c8877087da56e072870daa843f176e9453115929094c3a40c463a196c29bf7ba - verified correct +Skein256 ("a") = 7fba44ff1a31d71a0c1f82e6e82fb5e9ac6c92a39c9185b9951fed82d82fe635 - verified correct +Skein256 ("abc") = 258bdec343b9fde1639221a5ae0144a96e552e5288753c5fec76c05fc2fc1870 - verified correct +Skein256 ("message digest") = 4d2ce0062b5eb3a4db95bc1117dd8aa014f6cd50fdc8e64f31f7d41f9231e488 - verified correct +Skein256 ("abcdefghijklmnopqrstuvwxyz") = 46d8440685461b00e3ddb891b2ecc6855287d2bd8834a95fb1c1708b00ea5e82 - verified correct +Skein256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 7c5eb606389556b33d34eb2536459528dc0af97adbcd0ce273aeb650f598d4b2 - verified correct +Skein256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 4def7a7e5464a140ae9c3a80279fbebce4bd00f9faad819ab7e001512f67a10d - verified correct +Skein256 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = d9c017dbe355f318d036469eb9b5fbe129fc2b5786a9dc6746a516eab6fe0126 - verified correct diff --git a/sbin/md5/tests/self-test.skein512.chk b/sbin/md5/tests/self-test.skein512.chk new file mode 100644 index 000000000000..437220e17adb --- /dev/null +++ b/sbin/md5/tests/self-test.skein512.chk @@ -0,0 +1,9 @@ +Skein512 test suite: +Skein512 ("") = bc5b4c50925519c290cc634277ae3d6257212395cba733bbad37a4af0fa06af41fca7903d06564fea7a2d3730dbdb80c1f85562dfcc070334ea4d1d9e72cba7a - verified correct +Skein512 ("a") = b1cd8d33f61b3737adfd59bb13ad82f4a9548e92f22956a8976cca3fdb7fee4fe91698146c4197cec85d38b83c5d93bdba92c01fd9a53870d0c7f967bc62bdce - verified correct +Skein512 ("abc") = 8f5dd9ec798152668e35129496b029a960c9a9b88662f7f9482f110b31f9f93893ecfb25c009baad9e46737197d5630379816a886aa05526d3a70df272d96e75 - verified correct +Skein512 ("message digest") = 15b73c158ffb875fed4d72801ded0794c720b121c0c78edf45f900937e6933d9e21a3a984206933d504b5dbb2368000411477ee1b204c986068df77886542fcc - verified correct +Skein512 ("abcdefghijklmnopqrstuvwxyz") = 23793ad900ef12f9165c8080da6fdfd2c8354a2929b8aadf83aa82a3c6470342f57cf8c035ec0d97429b626c4d94f28632c8f5134fd367dca5cf293d2ec13f8c - verified correct +Skein512 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 0c6bed927e022f5ddcf81877d42e5f75798a9f8fd3ede3d83baac0a2f364b082e036c11af35fe478745459dd8f5c0b73efe3c56ba5bb2009208d5a29cc6e469c - verified correct +Skein512 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 2ca9fcffb3456f297d1b5f407014ecb856f0baac8eb540f534b1f187196f21e88f31103128c2f03fcc9857d7a58eb66f9525e2302d88833ee069295537a434ce - verified correct +Skein512 ("MD5 has not yet (2001-09-03) been broken, but sufficient attacks have been made that its security is in some doubt") = 1131f2aaa0e97126c9314f9f968cc827259bbfabced2943bb8c9274448998fb3b78738b4580dd500c76105fd3c03e465e1414f2c29664286b1f79d3e51128125 - verified correct diff --git a/sbin/md5/tests/sha1.digest b/sbin/md5/tests/sha1.digest new file mode 100644 index 000000000000..10ce642c0883 --- /dev/null +++ b/sbin/md5/tests/sha1.digest @@ -0,0 +1,8 @@ +SHA1 (1.inp) = da39a3ee5e6b4b0d3255bfef95601890afd80709 +SHA1 (2.inp) = 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 +SHA1 (3.inp) = a9993e364706816aba3e25717850c26c9cd0d89d +SHA1 (4.inp) = c12252ceda8be8994d5fa0290a47231c1d16aae3 +SHA1 (5.inp) = 32d10c7b8cf96570ca04ce37f2a19d84240d3a89 +SHA1 (6.inp) = 761c457bf73b14d27e9e9265c46f4b4dda11f940 +SHA1 (7.inp) = 50abf5706a150990a08b2c5ea40fa0e585554732 +SHA1 (8.inp) = 18eca4333979c4181199b7b4fab8786d16cf2846 diff --git a/sbin/md5/tests/sha1sum.digest b/sbin/md5/tests/sha1sum.digest new file mode 100644 index 000000000000..d82d2889ff5d --- /dev/null +++ b/sbin/md5/tests/sha1sum.digest @@ -0,0 +1,8 @@ +da39a3ee5e6b4b0d3255bfef95601890afd80709 1.inp +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 2.inp +a9993e364706816aba3e25717850c26c9cd0d89d 3.inp +c12252ceda8be8994d5fa0290a47231c1d16aae3 4.inp +32d10c7b8cf96570ca04ce37f2a19d84240d3a89 5.inp +761c457bf73b14d27e9e9265c46f4b4dda11f940 6.inp +50abf5706a150990a08b2c5ea40fa0e585554732 7.inp +18eca4333979c4181199b7b4fab8786d16cf2846 8.inp diff --git a/sbin/md5/tests/sha224.digest b/sbin/md5/tests/sha224.digest new file mode 100644 index 000000000000..a1007511a978 --- /dev/null +++ b/sbin/md5/tests/sha224.digest @@ -0,0 +1,8 @@ +SHA224 (1.inp) = d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f +SHA224 (2.inp) = abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5 +SHA224 (3.inp) = 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 +SHA224 (4.inp) = 2cb21c83ae2f004de7e81c3c7019cbcb65b71ab656b22d6d0c39b8eb +SHA224 (5.inp) = 45a5f72c39c5cff2522eb3429799e49e5f44b356ef926bcf390dccc2 +SHA224 (6.inp) = bff72b4fcb7d75e5632900ac5f90d219e05e97a7bde72e740db393d9 +SHA224 (7.inp) = b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e +SHA224 (8.inp) = 5ae55f3779c8a1204210d7ed7689f661fbe140f96f272ab79e19d470 diff --git a/sbin/md5/tests/sha224sum.digest b/sbin/md5/tests/sha224sum.digest new file mode 100644 index 000000000000..37fd833032fb --- /dev/null +++ b/sbin/md5/tests/sha224sum.digest @@ -0,0 +1,8 @@ +d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f 1.inp +abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5 2.inp +23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 3.inp +2cb21c83ae2f004de7e81c3c7019cbcb65b71ab656b22d6d0c39b8eb 4.inp +45a5f72c39c5cff2522eb3429799e49e5f44b356ef926bcf390dccc2 5.inp +bff72b4fcb7d75e5632900ac5f90d219e05e97a7bde72e740db393d9 6.inp +b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e 7.inp +5ae55f3779c8a1204210d7ed7689f661fbe140f96f272ab79e19d470 8.inp diff --git a/sbin/md5/tests/sha256.digest b/sbin/md5/tests/sha256.digest new file mode 100644 index 000000000000..b6c4411261a8 --- /dev/null +++ b/sbin/md5/tests/sha256.digest @@ -0,0 +1,8 @@ +SHA256 (1.inp) = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 +SHA256 (2.inp) = ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb +SHA256 (3.inp) = ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad +SHA256 (4.inp) = f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650 +SHA256 (5.inp) = 71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73 +SHA256 (6.inp) = db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0 +SHA256 (7.inp) = f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e +SHA256 (8.inp) = e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f diff --git a/sbin/md5/tests/sha256sum.digest b/sbin/md5/tests/sha256sum.digest new file mode 100644 index 000000000000..35ce99a0c6c1 --- /dev/null +++ b/sbin/md5/tests/sha256sum.digest @@ -0,0 +1,8 @@ +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 1.inp +ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb 2.inp +ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad 3.inp +f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650 4.inp +71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73 5.inp +db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0 6.inp +f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e 7.inp +e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f 8.inp diff --git a/sbin/md5/tests/sha384.digest b/sbin/md5/tests/sha384.digest new file mode 100644 index 000000000000..b56ef8b708e4 --- /dev/null +++ b/sbin/md5/tests/sha384.digest @@ -0,0 +1,8 @@ +SHA384 (1.inp) = 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b +SHA384 (2.inp) = 54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 +SHA384 (3.inp) = cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 +SHA384 (4.inp) = 473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5 +SHA384 (5.inp) = feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4 +SHA384 (6.inp) = 1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84 +SHA384 (7.inp) = b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026 +SHA384 (8.inp) = 99428d401bf4abcd4ee0695248c9858b7503853acfae21a9cffa7855f46d1395ef38596fcd06d5a8c32d41a839cc5dfb diff --git a/sbin/md5/tests/sha384sum.digest b/sbin/md5/tests/sha384sum.digest new file mode 100644 index 000000000000..7d669e0dda08 --- /dev/null +++ b/sbin/md5/tests/sha384sum.digest @@ -0,0 +1,8 @@ +38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b 1.inp +54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 2.inp +cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 3.inp +473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5 4.inp +feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4 5.inp +1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84 6.inp +b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026 7.inp +99428d401bf4abcd4ee0695248c9858b7503853acfae21a9cffa7855f46d1395ef38596fcd06d5a8c32d41a839cc5dfb 8.inp diff --git a/sbin/md5/tests/sha512.digest b/sbin/md5/tests/sha512.digest new file mode 100644 index 000000000000..dd82845b8131 --- /dev/null +++ b/sbin/md5/tests/sha512.digest @@ -0,0 +1,8 @@ +SHA512 (1.inp) = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e +SHA512 (2.inp) = 1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 +SHA512 (3.inp) = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f +SHA512 (4.inp) = 107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c +SHA512 (5.inp) = 4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 +SHA512 (6.inp) = 1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 +SHA512 (7.inp) = 72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 +SHA512 (8.inp) = e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 diff --git a/sbin/md5/tests/sha512sum.digest b/sbin/md5/tests/sha512sum.digest new file mode 100644 index 000000000000..55bbd509e4df --- /dev/null +++ b/sbin/md5/tests/sha512sum.digest @@ -0,0 +1,8 @@ +cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 1.inp +1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 2.inp +ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f 3.inp +107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c 4.inp +4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1 5.inp +1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894 6.inp +72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843 7.inp +e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3 8.inp diff --git a/sbin/md5/tests/sha512t256.digest b/sbin/md5/tests/sha512t256.digest new file mode 100644 index 000000000000..3e7df9eb98db --- /dev/null +++ b/sbin/md5/tests/sha512t256.digest @@ -0,0 +1,8 @@ +SHA512t256 (1.inp) = c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a +SHA512t256 (2.inp) = 455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8 +SHA512t256 (3.inp) = 53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23 +SHA512t256 (4.inp) = 0cf471fd17ed69d990daf3433c89b16d63dec1bb9cb42a6094604ee5d7b4e9fb +SHA512t256 (5.inp) = fc3189443f9c268f626aea08a756abe7b726b05f701cb08222312ccfd6710a26 +SHA512t256 (6.inp) = cdf1cc0effe26ecc0c13758f7b4a48e000615df241284185c39eb05d355bb9c8 +SHA512t256 (7.inp) = 2c9fdbc0c90bdd87612ee8455474f9044850241dc105b1e8b94b8ddf5fac9148 +SHA512t256 (8.inp) = dd095fc859b336c30a52548b3dc59fcc0d1be8616ebcf3368fad23107db2d736 diff --git a/sbin/md5/tests/sha512t256sum.digest b/sbin/md5/tests/sha512t256sum.digest new file mode 100644 index 000000000000..425e31006d6e --- /dev/null +++ b/sbin/md5/tests/sha512t256sum.digest @@ -0,0 +1,8 @@ +c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a 1.inp +455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8 2.inp +53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23 3.inp +0cf471fd17ed69d990daf3433c89b16d63dec1bb9cb42a6094604ee5d7b4e9fb 4.inp +fc3189443f9c268f626aea08a756abe7b726b05f701cb08222312ccfd6710a26 5.inp +cdf1cc0effe26ecc0c13758f7b4a48e000615df241284185c39eb05d355bb9c8 6.inp +2c9fdbc0c90bdd87612ee8455474f9044850241dc105b1e8b94b8ddf5fac9148 7.inp +dd095fc859b336c30a52548b3dc59fcc0d1be8616ebcf3368fad23107db2d736 8.inp diff --git a/sbin/md5/tests/skein1024.digest b/sbin/md5/tests/skein1024.digest new file mode 100644 index 000000000000..dea354221b26 --- /dev/null +++ b/sbin/md5/tests/skein1024.digest @@ -0,0 +1,8 @@ +Skein1024 (1.inp) = 0fff9563bb3279289227ac77d319b6fff8d7e9f09da1247b72a0a265cd6d2a62645ad547ed8193db48cff847c06494a03f55666d3b47eb4c20456c9373c86297d630d5578ebd34cb40991578f9f52b18003efa35d3da6553ff35db91b81ab890bec1b189b7f52cb2a783ebb7d823d725b0b4a71f6824e88f68f982eefc6d19c6 +Skein1024 (2.inp) = 6ab4c4ba9814a3d976ec8bffa7fcc638ceba0544a97b3c98411323ffd2dc936315d13dc93c13c4e88cda6f5bac6f2558b2d8694d3b6143e40d644ae43ca940685cb37f809d3d0550c56cba8036dee729a4f8fb960732e59e64d57f7f7710f8670963cdcdc95b41daab4855fcf8b6762a64b173ee61343a2c7689af1d293eba97 +Skein1024 (3.inp) = 35a599a0f91abcdb4cb73c19b8cb8d947742d82c309137a7caed29e8e0a2ca7a9ff9a90c34c1908cc7e7fd99bb15032fb86e76df21b72628399b5f7c3cc209d7bb31c99cd4e19465622a049afbb87c03b5ce3888d17e6e667279ec0aa9b3e2712624c01b5f5bbe1a564220bdcf6990af0c2539019f313fdd7406cca3892a1f1f +Skein1024 (4.inp) = ea891f5268acd0fac97467fc1aa89d1ce8681a9992a42540e53babee861483110c2d16f49e73bac27653ff173003e40cfb08516cd34262e6af95a5d8645c9c1abb3e813604d508b8511b30f9a5c1b352aa0791c7d2f27b2706dccea54bc7de6555b5202351751c3299f97c09cf89c40f67187e2521c0fad82b30edbb224f0458 +Skein1024 (5.inp) = f23d95c2a25fbcd0e797cd058fec39d3c52d2b5afd7a9af1df934e63257d1d3dcf3246e7329c0f1104c1e51e3d22e300507b0c3b9f985bb1f645ef49835080536becf83788e17fed09c9982ba65c3cb7ffe6a5f745b911c506962adf226e435c42f6f6bc08d288f9c810e807e3216ef444f3db22744441deefa4900982a1371f +Skein1024 (6.inp) = cf3889e8a8d11bfd3938055d7d061437962bc5eac8ae83b1b71c94be201b8cf657fdbfc38674997a008c0c903f56a23feb3ae30e012377f1cfa080a9ca7fe8b96138662653fb3335c7d06595bf8baf65e215307532094cfdfa056bd8052ab792a3944a2adaa47b30335b8badb8fe9eb94fe329cdca04e58bbc530f0af709f469 +Skein1024 (7.inp) = cf21a613620e6c119eca31fdfaad449a8e02f95ca256c21d2a105f8e4157048f9fe1e897893ea18b64e0e37cb07d5ac947f27ba544caf7cbc1ad094e675aed77a366270f7eb7f46543bccfa61c526fd628408058ed00ed566ac35a9761d002e629c4fb0d430b2f4ad016fcc49c44d2981c4002da0eecc42144160e2eaea4855a +Skein1024 (8.inp) = e6799b78db54085a2be7ff4c8007f147fa88d326abab30be0560b953396d8802feee9a15419b48a467574e9283be15685ca8a079ee52b27166b64dd70b124b1d4e4f6aca37224c3f2685e67e67baef9f94b905698adc794a09672aba977a61b20966912acdb08c21a2c37001785355dc884751a21f848ab36e590331ff938138 diff --git a/sbin/md5/tests/skein1024sum.digest b/sbin/md5/tests/skein1024sum.digest new file mode 100644 index 000000000000..dca058ab55b7 --- /dev/null +++ b/sbin/md5/tests/skein1024sum.digest @@ -0,0 +1,8 @@ +0fff9563bb3279289227ac77d319b6fff8d7e9f09da1247b72a0a265cd6d2a62645ad547ed8193db48cff847c06494a03f55666d3b47eb4c20456c9373c86297d630d5578ebd34cb40991578f9f52b18003efa35d3da6553ff35db91b81ab890bec1b189b7f52cb2a783ebb7d823d725b0b4a71f6824e88f68f982eefc6d19c6 1.inp +6ab4c4ba9814a3d976ec8bffa7fcc638ceba0544a97b3c98411323ffd2dc936315d13dc93c13c4e88cda6f5bac6f2558b2d8694d3b6143e40d644ae43ca940685cb37f809d3d0550c56cba8036dee729a4f8fb960732e59e64d57f7f7710f8670963cdcdc95b41daab4855fcf8b6762a64b173ee61343a2c7689af1d293eba97 2.inp +35a599a0f91abcdb4cb73c19b8cb8d947742d82c309137a7caed29e8e0a2ca7a9ff9a90c34c1908cc7e7fd99bb15032fb86e76df21b72628399b5f7c3cc209d7bb31c99cd4e19465622a049afbb87c03b5ce3888d17e6e667279ec0aa9b3e2712624c01b5f5bbe1a564220bdcf6990af0c2539019f313fdd7406cca3892a1f1f 3.inp +ea891f5268acd0fac97467fc1aa89d1ce8681a9992a42540e53babee861483110c2d16f49e73bac27653ff173003e40cfb08516cd34262e6af95a5d8645c9c1abb3e813604d508b8511b30f9a5c1b352aa0791c7d2f27b2706dccea54bc7de6555b5202351751c3299f97c09cf89c40f67187e2521c0fad82b30edbb224f0458 4.inp +f23d95c2a25fbcd0e797cd058fec39d3c52d2b5afd7a9af1df934e63257d1d3dcf3246e7329c0f1104c1e51e3d22e300507b0c3b9f985bb1f645ef49835080536becf83788e17fed09c9982ba65c3cb7ffe6a5f745b911c506962adf226e435c42f6f6bc08d288f9c810e807e3216ef444f3db22744441deefa4900982a1371f 5.inp +cf3889e8a8d11bfd3938055d7d061437962bc5eac8ae83b1b71c94be201b8cf657fdbfc38674997a008c0c903f56a23feb3ae30e012377f1cfa080a9ca7fe8b96138662653fb3335c7d06595bf8baf65e215307532094cfdfa056bd8052ab792a3944a2adaa47b30335b8badb8fe9eb94fe329cdca04e58bbc530f0af709f469 6.inp +cf21a613620e6c119eca31fdfaad449a8e02f95ca256c21d2a105f8e4157048f9fe1e897893ea18b64e0e37cb07d5ac947f27ba544caf7cbc1ad094e675aed77a366270f7eb7f46543bccfa61c526fd628408058ed00ed566ac35a9761d002e629c4fb0d430b2f4ad016fcc49c44d2981c4002da0eecc42144160e2eaea4855a 7.inp +e6799b78db54085a2be7ff4c8007f147fa88d326abab30be0560b953396d8802feee9a15419b48a467574e9283be15685ca8a079ee52b27166b64dd70b124b1d4e4f6aca37224c3f2685e67e67baef9f94b905698adc794a09672aba977a61b20966912acdb08c21a2c37001785355dc884751a21f848ab36e590331ff938138 8.inp diff --git a/sbin/md5/tests/skein256.digest b/sbin/md5/tests/skein256.digest new file mode 100644 index 000000000000..ee17f8df1532 --- /dev/null +++ b/sbin/md5/tests/skein256.digest @@ -0,0 +1,8 @@ +Skein256 (1.inp) = c8877087da56e072870daa843f176e9453115929094c3a40c463a196c29bf7ba +Skein256 (2.inp) = 7fba44ff1a31d71a0c1f82e6e82fb5e9ac6c92a39c9185b9951fed82d82fe635 +Skein256 (3.inp) = 258bdec343b9fde1639221a5ae0144a96e552e5288753c5fec76c05fc2fc1870 +Skein256 (4.inp) = 4d2ce0062b5eb3a4db95bc1117dd8aa014f6cd50fdc8e64f31f7d41f9231e488 +Skein256 (5.inp) = 46d8440685461b00e3ddb891b2ecc6855287d2bd8834a95fb1c1708b00ea5e82 +Skein256 (6.inp) = 7c5eb606389556b33d34eb2536459528dc0af97adbcd0ce273aeb650f598d4b2 +Skein256 (7.inp) = 4def7a7e5464a140ae9c3a80279fbebce4bd00f9faad819ab7e001512f67a10d +Skein256 (8.inp) = d9c017dbe355f318d036469eb9b5fbe129fc2b5786a9dc6746a516eab6fe0126 diff --git a/sbin/md5/tests/skein256sum.digest b/sbin/md5/tests/skein256sum.digest new file mode 100644 index 000000000000..2e1c8d1bc60d --- /dev/null +++ b/sbin/md5/tests/skein256sum.digest @@ -0,0 +1,8 @@ +c8877087da56e072870daa843f176e9453115929094c3a40c463a196c29bf7ba 1.inp +7fba44ff1a31d71a0c1f82e6e82fb5e9ac6c92a39c9185b9951fed82d82fe635 2.inp +258bdec343b9fde1639221a5ae0144a96e552e5288753c5fec76c05fc2fc1870 3.inp +4d2ce0062b5eb3a4db95bc1117dd8aa014f6cd50fdc8e64f31f7d41f9231e488 4.inp +46d8440685461b00e3ddb891b2ecc6855287d2bd8834a95fb1c1708b00ea5e82 5.inp +7c5eb606389556b33d34eb2536459528dc0af97adbcd0ce273aeb650f598d4b2 6.inp +4def7a7e5464a140ae9c3a80279fbebce4bd00f9faad819ab7e001512f67a10d 7.inp +d9c017dbe355f318d036469eb9b5fbe129fc2b5786a9dc6746a516eab6fe0126 8.inp diff --git a/sbin/md5/tests/skein512.digest b/sbin/md5/tests/skein512.digest new file mode 100644 index 000000000000..6b2e9ad0f723 --- /dev/null +++ b/sbin/md5/tests/skein512.digest @@ -0,0 +1,8 @@ +Skein512 (1.inp) = bc5b4c50925519c290cc634277ae3d6257212395cba733bbad37a4af0fa06af41fca7903d06564fea7a2d3730dbdb80c1f85562dfcc070334ea4d1d9e72cba7a +Skein512 (2.inp) = b1cd8d33f61b3737adfd59bb13ad82f4a9548e92f22956a8976cca3fdb7fee4fe91698146c4197cec85d38b83c5d93bdba92c01fd9a53870d0c7f967bc62bdce +Skein512 (3.inp) = 8f5dd9ec798152668e35129496b029a960c9a9b88662f7f9482f110b31f9f93893ecfb25c009baad9e46737197d5630379816a886aa05526d3a70df272d96e75 +Skein512 (4.inp) = 15b73c158ffb875fed4d72801ded0794c720b121c0c78edf45f900937e6933d9e21a3a984206933d504b5dbb2368000411477ee1b204c986068df77886542fcc +Skein512 (5.inp) = 23793ad900ef12f9165c8080da6fdfd2c8354a2929b8aadf83aa82a3c6470342f57cf8c035ec0d97429b626c4d94f28632c8f5134fd367dca5cf293d2ec13f8c +Skein512 (6.inp) = 0c6bed927e022f5ddcf81877d42e5f75798a9f8fd3ede3d83baac0a2f364b082e036c11af35fe478745459dd8f5c0b73efe3c56ba5bb2009208d5a29cc6e469c +Skein512 (7.inp) = 2ca9fcffb3456f297d1b5f407014ecb856f0baac8eb540f534b1f187196f21e88f31103128c2f03fcc9857d7a58eb66f9525e2302d88833ee069295537a434ce +Skein512 (8.inp) = 1131f2aaa0e97126c9314f9f968cc827259bbfabced2943bb8c9274448998fb3b78738b4580dd500c76105fd3c03e465e1414f2c29664286b1f79d3e51128125 diff --git a/sbin/md5/tests/skein512sum.digest b/sbin/md5/tests/skein512sum.digest new file mode 100644 index 000000000000..3ee9b67038ad --- /dev/null +++ b/sbin/md5/tests/skein512sum.digest @@ -0,0 +1,8 @@ +bc5b4c50925519c290cc634277ae3d6257212395cba733bbad37a4af0fa06af41fca7903d06564fea7a2d3730dbdb80c1f85562dfcc070334ea4d1d9e72cba7a 1.inp +b1cd8d33f61b3737adfd59bb13ad82f4a9548e92f22956a8976cca3fdb7fee4fe91698146c4197cec85d38b83c5d93bdba92c01fd9a53870d0c7f967bc62bdce 2.inp +8f5dd9ec798152668e35129496b029a960c9a9b88662f7f9482f110b31f9f93893ecfb25c009baad9e46737197d5630379816a886aa05526d3a70df272d96e75 3.inp +15b73c158ffb875fed4d72801ded0794c720b121c0c78edf45f900937e6933d9e21a3a984206933d504b5dbb2368000411477ee1b204c986068df77886542fcc 4.inp +23793ad900ef12f9165c8080da6fdfd2c8354a2929b8aadf83aa82a3c6470342f57cf8c035ec0d97429b626c4d94f28632c8f5134fd367dca5cf293d2ec13f8c 5.inp +0c6bed927e022f5ddcf81877d42e5f75798a9f8fd3ede3d83baac0a2f364b082e036c11af35fe478745459dd8f5c0b73efe3c56ba5bb2009208d5a29cc6e469c 6.inp +2ca9fcffb3456f297d1b5f407014ecb856f0baac8eb540f534b1f187196f21e88f31103128c2f03fcc9857d7a58eb66f9525e2302d88833ee069295537a434ce 7.inp +1131f2aaa0e97126c9314f9f968cc827259bbfabced2943bb8c9274448998fb3b78738b4580dd500c76105fd3c03e465e1414f2c29664286b1f79d3e51128125 8.inp From owner-dev-commits-src-main@freebsd.org Fri Jun 25 07:02: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 8126A65A1EA; Fri, 25 Jun 2021 07:02: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 4GB7Gz3F08z3L5d; Fri, 25 Jun 2021 07:02: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 573F4267E0; Fri, 25 Jun 2021 07:02: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 15P72Jxt048784; Fri, 25 Jun 2021 07:02:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15P72Juo048783; Fri, 25 Jun 2021 07:02:19 GMT (envelope-from git) Date: Fri, 25 Jun 2021 07:02:19 GMT Message-Id: <202106250702.15P72Juo048783@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: c2870e576bd2 - main - sbin/md5: improve compatibility with coreutils -c option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2870e576bd20872ed227375a862e0330ef90ad8 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, 25 Jun 2021 07:02:19 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=c2870e576bd20872ed227375a862e0330ef90ad8 commit c2870e576bd20872ed227375a862e0330ef90ad8 Author: Stefan Eßer AuthorDate: 2021-06-25 06:54:36 +0000 Commit: Stefan Eßer CommitDate: 2021-06-25 06:54:36 +0000 sbin/md5: improve compatibility with coreutils -c option The -c option expects a digest file in either BSD or coreutils format. The output for matched and mismatched files is identical to that of the coreutils version. The review of these changes included test cases that have already been committed for the functionality that existed before. Another test script is added to cover the coreutils compatible extension implemented by this patch. This commit contains a tests/Makefile that has been cleaned up compared to the review version, using an implicit rule to apply the TESTBASE path at build time (and the scripts have been renamed to have an extension of .SH instead of .sh to trigger this rule). Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30812 --- sbin/md5/md5.1 | 59 +++++++++++--- sbin/md5/md5.c | 162 ++++++++++++++++++++++++++++++++----- sbin/md5/tests/Makefile | 1 + sbin/md5/tests/coreutils-c-test.SH | 21 +++++ 4 files changed, 209 insertions(+), 34 deletions(-) diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 index 04f13339e533..da034d1298c5 100644 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd June 19, 2021 +.Dd June 24, 2021 .Dt MD5 1 .Os .Sh NAME @@ -14,6 +14,7 @@ .Op Fl c Ar string .Op Fl s Ar string .Op Ar +.Pp .Nm md5sum .Op Fl pqrtx .Op Fl c Ar file @@ -80,13 +81,28 @@ Ignored for compatibility with the coreutils .Nm -sum programs. .It Fl c Ar string -Compare the digest of the file against this string. +If the program was called with a name that does not end in +.Nm sum , +compare the digest of the file against this string. .Pq Note that this option is not yet useful if multiple files are specified. -This option causes an error in for the -.Nm -sum -programs because it check the checksums listed in a file for the coreutils -.Nm -sum -programs that is not yet implemented. +.It Fl c Ar file +If the program was called with a name that does end in +.Nm sum , +the file passed as argument must contain digest lines generated by the same digest algorithm +with or without the +.Fl r +option +.Pq i.e. in either classical BSD format or in GNU coreutils format . +A line with file name followed by +.Dq : +and either OK or FAILED is written for each well-formed line in the digest file. +If applicable, the number of failed comparisons and the number of lines that were +skipped since they were not well-formed are printed at the end. +The +.Fl q +option can be used to quiesce the output unless there are mismatched entries in +the digest. +.Pp .It Fl s Ar string Print a checksum of the given .Ar string . @@ -141,8 +157,8 @@ $ echo -n Hello | md5 Calculate the checksum of multiple files reversing the output: .Bd -literal -offset indent $ md5 -r /boot/loader.conf /etc/rc.conf -ada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf -d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf +ada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf +d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf .Ed .Pp Write the digest for @@ -165,6 +181,27 @@ which results in a failure. $ md5 -c randomstring /boot/loader.conf MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 [ Failed ] .Ed +.Pp +If invoked with a name ending in +.Nm -sum +the +.Fl c +option does not compare against a hash string passed as parameter. +Instead, it expects a digest file, as created under the name +.Pa digest +for +.Pa /boot/loader.conf +in the example above. +.Bd -literal -offset indent +$ md5 -c digest /boot/loader.conf +/boot/loader.conf: OK +.Ed +.Pp +The digest file may contain any number of lines in the format generated with or without the +.Fl r +option +.Pq i.e. in either classical BSD format or in GNU coreutils format . +If a hash value does not match the file, FAILED is printed instead of OK. .Sh SEE ALSO .Xr cksum 1 , .Xr md5 3 , @@ -203,9 +240,7 @@ The RIPEMD-160 page: All of the utilities that end in .Sq sum are intended to be compatible with the GNU coreutils programs. -However, the long arguments and the -.Fl -check -functionality are not provided. +However, the long option functionality is not provided. .Sh ACKNOWLEDGMENTS This program is placed in the public domain for free general use by RSA Data Security. diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index e553d4c56e85..d4245d2aad4b 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #define TEST_BLOCK_COUNT 100000 #define MDTESTCOUNT 8 +static int cflag; static int pflag; static int qflag; static int rflag; @@ -152,12 +153,93 @@ static const struct Algorithm_t Algorithm[] = { (DIGEST_End*)&SKEIN1024_End, &SKEIN1024_Data, &SKEIN1024_Fd } }; +static unsigned digest; +static unsigned malformed; +static bool gnu_emu = false; + static void MD5_Update(MD5_CTX *c, const unsigned char *data, size_t len) { MD5Update(c, data, len); } +struct chksumrec { + char *filename; + char *chksum; + struct chksumrec *next; +}; + +static struct chksumrec *head = NULL; +static struct chksumrec **next = &head; + +#define PADDING 7 /* extra padding for "SHA512t256 (...) = ...\n" style */ +#define CHKFILELINELEN (HEX_DIGEST_LENGTH + MAXPATHLEN + PADDING) + +static int gnu_check(const char *checksumsfile) +{ + FILE *inp; + char linebuf[CHKFILELINELEN]; + int linelen; + int lineno; + char *filename; + char *hashstr; + struct chksumrec *rec; + const char *digestname; + int digestnamelen; + int hashstrlen; + + if ((inp = fopen(checksumsfile, "r")) == NULL) + err(1, "%s", checksumsfile); + digestname = Algorithm[digest].name; + digestnamelen = strlen(digestname); + hashstrlen = strlen(*(Algorithm[digest].TestOutput[0])); + lineno = 1; + while (fgets(linebuf, sizeof(linebuf), inp) != NULL) { + linelen = strlen(linebuf) - 1; + if (linelen <= 0) + break; + if (linebuf[linelen] != '\n') + errx(1, "malformed input line %d (len=%d)", lineno, linelen); + linebuf[linelen] = '\0'; + filename = linebuf + digestnamelen + 2; + hashstr = linebuf + linelen - hashstrlen; + /* + * supported formats: + * BSD: (): + * GNU: [ *] + */ + if (linelen >= digestnamelen + hashstrlen + 6 && + strncmp(linebuf, digestname, digestnamelen) == 0 && + strncmp(filename - 2, " (", 2) == 0 && + strncmp(hashstr - 4, ") = ", 4) == 0) { + *(hashstr - 4) = '\0'; + } else if (linelen >= hashstrlen + 3 && + linebuf[hashstrlen] == ' ') { + linebuf[hashstrlen] = '\0'; + hashstr = linebuf; + filename = linebuf + hashstrlen + 1; + if (*filename == ' ' || *filename == '*') + filename++; + } else { + malformed++; + continue; + } + rec = malloc(sizeof (*rec)); + if (rec == NULL) + errx(1, "malloc failed"); + rec->chksum = strdup(hashstr); + rec->filename = strdup(filename); + if (rec->chksum == NULL || rec->filename == NULL) + errx(1, "malloc failed"); + rec->next = NULL; + *next = rec; + next = &rec->next; + lineno++; + } + fclose(inp); + return (lineno - 1); +} + /* Main driver. Arguments (may be any combination): @@ -177,9 +259,9 @@ main(int argc, char *argv[]) char *p, *string; char buf[HEX_DIGEST_LENGTH]; size_t len; - unsigned digest; char *progname; - bool gnu_emu = false; + struct chksumrec *rec; + int numrecs; if ((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; @@ -199,13 +281,13 @@ main(int argc, char *argv[]) */ len = strlen(progname); if (len > 3 && strcmp(progname + len - 3, "sum") == 0) { - progname[len - 3] = '\0'; + len -= 3; rflag = 1; gnu_emu = true; } for (digest = 0; digest < sizeof(Algorithm)/sizeof(*Algorithm); digest++) - if (strcasecmp(Algorithm[digest].progname, progname) == 0) + if (strncasecmp(Algorithm[digest].progname, progname, len) == 0) break; if (digest == sizeof(Algorithm)/sizeof(*Algorithm)) @@ -220,9 +302,11 @@ main(int argc, char *argv[]) case 'b': break; case 'c': + cflag = 1; if (gnu_emu) - errx(1, "-c check option not supported"); - checkAgainst = optarg; + numrecs = gnu_check(optarg); + else + checkAgainst = optarg; break; case 'p': pflag = 1; @@ -258,6 +342,20 @@ main(int argc, char *argv[]) err(1, "unable to limit rights for stdio"); #endif + if (cflag && gnu_emu) { + /* + * Replace argv by an array of filenames from the digest file + */ + argc = 0; + argv = (char**)calloc(sizeof(char *), numrecs + 1); + for (rec = head; rec != NULL; rec = rec->next) { + argv[argc] = rec->filename; + argc++; + } + argv[argc] = NULL; + rec = head; + } + if (*argv) { do { if ((fd = open(*argv, O_RDONLY)) < 0) { @@ -279,11 +377,15 @@ main(int argc, char *argv[]) err(1, "capsicum"); #endif } + if (cflag && gnu_emu) { + checkAgainst = rec->chksum; + rec = rec->next; + } p = Algorithm[digest].Fd(fd, buf); (void)close(fd); MDOutput(&Algorithm[digest], p, argv); } while (*++argv); - } else if (!sflag && !skip) { + } else if (!cflag && !sflag && !skip) { #ifdef HAVE_CAPSICUM if (caph_limit_stdin() < 0 || caph_enter() < 0) err(1, "capsicum"); @@ -295,7 +397,12 @@ main(int argc, char *argv[]) p = Algorithm[digest].Data(string, len, buf); MDOutput(&Algorithm[digest], p, &string); } - + if (gnu_emu) { + if (malformed > 0) + warnx("WARNING: %d lines are improperly formatted", malformed); + if (checksFailed > 0) + warnx("WARNING: %d computed checksums did NOT match", checksFailed); + } if (failed != 0) return (1); if (checksFailed != 0) @@ -310,6 +417,8 @@ main(int argc, char *argv[]) static void MDOutput(const Algorithm_t *alg, char *p, char *argv[]) { + bool checkfailed = false; + if (p == NULL) { warn("%s", *argv); failed++; @@ -318,21 +427,27 @@ MDOutput(const Algorithm_t *alg, char *p, char *argv[]) * If argv is NULL we are reading from stdin, where the output * format has always been just the hash. */ - if (qflag || argv == NULL) - printf("%s", p); - else if (rflag) - printf("%s %s", p, *argv); - else - printf("%s (%s) = %s", - alg->name, *argv, p); - if (checkAgainst && strcasecmp(checkAgainst, p) != 0) - { - checksFailed++; - if (!qflag) - printf(" [ Failed ]"); + if (cflag && gnu_emu) { + checkfailed = strcasecmp(checkAgainst, p) != 0; + if (!qflag || checkfailed) + printf("%s: %s\n", *argv, checkfailed ? "FAILED" : "OK"); + } else if (qflag || argv == NULL) { + printf("%s\n", p); + } else { + if (rflag) + printf("%s %s", p, *argv); + else + printf("%s (%s) = %s", alg->name, *argv, p); + if (checkAgainst) { + checkfailed = strcasecmp(checkAgainst, p) != 0; + if (!qflag && checkfailed) + printf(" [ Failed ]"); + } + printf("\n"); } - printf("\n"); } + if (checkfailed) + checksFailed++; } /* @@ -559,6 +674,9 @@ static void usage(const Algorithm_t *alg) { - fprintf(stderr, "usage: %s [-pqrtx] [-c string] [-s string] [files ...]\n", alg->progname); + if (gnu_emu) + fprintf(stderr, "usage: %ssum [-pqrtx] [-c file] [-s string] [files ...]\n", alg->progname); + else + fprintf(stderr, "usage: %s [-pqrtx] [-c string] [-s string] [files ...]\n", alg->progname); exit(1); } diff --git a/sbin/md5/tests/Makefile b/sbin/md5/tests/Makefile index b37332aa9894..93f3913c687d 100644 --- a/sbin/md5/tests/Makefile +++ b/sbin/md5/tests/Makefile @@ -32,6 +32,7 @@ PLAIN_TESTS_SH+= self-test PLAIN_TESTS_SH+= bsd-c-test PLAIN_TESTS_SH+= bsd-p-test PLAIN_TESTS_SH+= bsd-s-test +PLAIN_TESTS_SH+= coreutils-c-test .SUFFIXES: .SH diff --git a/sbin/md5/tests/coreutils-c-test.SH b/sbin/md5/tests/coreutils-c-test.SH new file mode 100644 index 000000000000..5996e533c627 --- /dev/null +++ b/sbin/md5/tests/coreutils-c-test.SH @@ -0,0 +1,21 @@ +#!/bin/sh + +/bin/cp %%TESTSBASE%%/sbin/md5/*.inp . || exit 127 + +exitcode=0 + +testloop () { + opt=$1 + + while read algorithm; do + ${algorithm}sum -c %%TESTSBASE%%/sbin/md5/${algorithm}.digest || exitcode=1 + ${algorithm}sum -c %%TESTSBASE%%/sbin/md5/${algorithm}sum.digest || exitcode=1 + done < %%TESTSBASE%%/sbin/md5/algorithms.txt +} + +testloop "" +testloop -q +testloop -r +testloop -qr + +exit $exitcode From owner-dev-commits-src-main@freebsd.org Fri Jun 25 08:40: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 3AF5465C0F5; Fri, 25 Jun 2021 08:40: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 4GB9Rn0wB8z3QbK; Fri, 25 Jun 2021 08:40: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 03CDB27CBD; Fri, 25 Jun 2021 08:40:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15P8e40r073247; Fri, 25 Jun 2021 08:40:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15P8e4Th073244; Fri, 25 Jun 2021 08:40:04 GMT (envelope-from git) Date: Fri, 25 Jun 2021 08:40:04 GMT Message-Id: <202106250840.15P8e4Th073244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 95d3044bbdad - main - sbin/md5: fix test case to not write outside temp directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95d3044bbdadfca6120a3e7c61c9ebb9a476f369 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, 25 Jun 2021 08:40:05 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=95d3044bbdadfca6120a3e7c61c9ebb9a476f369 commit 95d3044bbdadfca6120a3e7c61c9ebb9a476f369 Author: Stefan Eßer AuthorDate: 2021-06-25 08:37:51 +0000 Commit: Stefan Eßer CommitDate: 2021-06-25 08:37:51 +0000 sbin/md5: fix test case to not write outside temp directory The bsd-p-test did create files 1.out .. 8.out in the test directory. This has been fixed and the temporary output files are now written to the temporary directory. MFC after: 3 days --- sbin/md5/tests/bsd-p-test.SH | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/md5/tests/bsd-p-test.SH b/sbin/md5/tests/bsd-p-test.SH index 3677a34b335a..77a725377e2c 100644 --- a/sbin/md5/tests/bsd-p-test.SH +++ b/sbin/md5/tests/bsd-p-test.SH @@ -8,9 +8,9 @@ testloop () { for algorithm in sha512; do for f in %%TESTSBASE%%/sbin/md5/*.inp; do - outbase=%%TESTSBASE%%/sbin/md5/$(basename $f .inp) + outbase=$(basename $f .inp) $algorithm$sum $opt -p < $f > $outbase.out - diff $outbase.$algorithm$sum-p.chk $outbase.out || exitcode=1 + diff %%TESTSBASE%%/sbin/md5/$outbase.$algorithm$sum-p.chk $outbase.out || exitcode=1 done done } From owner-dev-commits-src-main@freebsd.org Fri Jun 25 10:17: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 3674065D656; Fri, 25 Jun 2021 10:17: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 4GBCcJ0tBCz3mk3; Fri, 25 Jun 2021 10:17: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 02A7410C2; Fri, 25 Jun 2021 10:17: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 15PAHZ1X004289; Fri, 25 Jun 2021 10:17:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PAHZEX004288; Fri, 25 Jun 2021 10:17:35 GMT (envelope-from git) Date: Fri, 25 Jun 2021 10:17:35 GMT Message-Id: <202106251017.15PAHZEX004288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 3268f407cac4 - main - sbin/md5: disable tests due to build failures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3268f407cac47a3ee1ff15490d6b873bd3a61a5e 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, 25 Jun 2021 10:17:36 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=3268f407cac47a3ee1ff15490d6b873bd3a61a5e commit 3268f407cac47a3ee1ff15490d6b873bd3a61a5e Author: Stefan Eßer AuthorDate: 2021-06-25 10:14:25 +0000 Commit: Stefan Eßer CommitDate: 2021-06-25 10:14:25 +0000 sbin/md5: disable tests due to build failures Testing with buildworld/installworld had succeeded, but it appears that a path is not correctly set for the distribute target in the tests directory. Commenting out HAS_TESTS should make the build succeed again and give time to resolve the "make distribute" issue. The tests have been locally run to verify that the recent changes to add a coreutils compatible -c option does not lead to any regressions. --- sbin/md5/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile index e499967d23d5..610ffe096385 100644 --- a/sbin/md5/Makefile +++ b/sbin/md5/Makefile @@ -58,9 +58,9 @@ LIBADD= md CFLAGS+=-DHAVE_CAPSICUM .endif -.include - -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests +#.include +# +#HAS_TESTS= +#SUBDIR.${MK_TESTS}+= tests .include From owner-dev-commits-src-main@freebsd.org Fri Jun 25 10:31: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 A272065D34F; Fri, 25 Jun 2021 10:31: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 4GBCwX46MVz3n9R; Fri, 25 Jun 2021 10:31: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 7629917A3; Fri, 25 Jun 2021 10:31: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 15PAVeBJ025822; Fri, 25 Jun 2021 10:31:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PAVe2h025821; Fri, 25 Jun 2021 10:31:40 GMT (envelope-from git) Date: Fri, 25 Jun 2021 10:31:40 GMT Message-Id: <202106251031.15PAVe2h025821@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: cb194afef50d - main - sbin/md5: Create /usr/tests/sbin/md5 directory for placing tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb194afef50dc4e1473413a69462aaf03cfe0ce4 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, 25 Jun 2021 10:31:40 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=cb194afef50dc4e1473413a69462aaf03cfe0ce4 commit cb194afef50dc4e1473413a69462aaf03cfe0ce4 Author: Li-Wen Hsu AuthorDate: 2021-06-25 10:29:46 +0000 Commit: Li-Wen Hsu CommitDate: 2021-06-25 10:29:46 +0000 sbin/md5: Create /usr/tests/sbin/md5 directory for placing tests Sponsored by: The FreeBSD Foundation --- etc/mtree/BSD.tests.dist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 1dc756aecbc5..60cdca439887 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -438,6 +438,8 @@ .. ifconfig .. + md5 + .. mdconfig .. nvmecontrol From owner-dev-commits-src-main@freebsd.org Fri Jun 25 10:44: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 C270065DD3C; Fri, 25 Jun 2021 10:44: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 4GBDCs4ttVz3nr1; Fri, 25 Jun 2021 10:44: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 8FECE1A26; Fri, 25 Jun 2021 10:44: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 15PAivPa043694; Fri, 25 Jun 2021 10:44:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PAivRj043693; Fri, 25 Jun 2021 10:44:57 GMT (envelope-from git) Date: Fri, 25 Jun 2021 10:44:57 GMT Message-Id: <202106251044.15PAivRj043693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 1b4ac9066541 - main - sbin/md5: re-enable tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b4ac9066541372479ef8bd071ee205217a7e222 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, 25 Jun 2021 10:44:57 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=1b4ac9066541372479ef8bd071ee205217a7e222 commit 1b4ac9066541372479ef8bd071ee205217a7e222 Author: Stefan Eßer AuthorDate: 2021-06-25 10:41:14 +0000 Commit: Stefan Eßer CommitDate: 2021-06-25 10:41:14 +0000 sbin/md5: re-enable tests The directory for the tests was missing in BSD.tests.dist, causing build failures in "make distribute". Li-Wen Hsu fixed this issue in commit cb194afef50dc, allowing me to re-enable installation of the tests. MFC after: 3 days --- sbin/md5/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile index 610ffe096385..e499967d23d5 100644 --- a/sbin/md5/Makefile +++ b/sbin/md5/Makefile @@ -58,9 +58,9 @@ LIBADD= md CFLAGS+=-DHAVE_CAPSICUM .endif -#.include -# -#HAS_TESTS= -#SUBDIR.${MK_TESTS}+= tests +.include + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include From owner-dev-commits-src-main@freebsd.org Fri Jun 25 13:32: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 D90716614AC; Fri, 25 Jun 2021 13:32: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 4GBHx85qhTz4TBs; Fri, 25 Jun 2021 13:32: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 B1F15411A; Fri, 25 Jun 2021 13:32: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 15PDWSdG068175; Fri, 25 Jun 2021 13:32:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PDWSrC068174; Fri, 25 Jun 2021 13:32:28 GMT (envelope-from git) Date: Fri, 25 Jun 2021 13:32:28 GMT Message-Id: <202106251332.15PDWSrC068174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 9e4d9e4c4d79 - main - tcp: Preparation for allowing hardware TLS to be able to kick a tcp connection that is retransmitting too much out of hardware and back to software. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e4d9e4c4d79db58740a05d67645351e640aa32c 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, 25 Jun 2021 13:32:28 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=9e4d9e4c4d79db58740a05d67645351e640aa32c commit 9e4d9e4c4d79db58740a05d67645351e640aa32c Author: Randall Stewart AuthorDate: 2021-06-25 13:30:54 +0000 Commit: Randall Stewart CommitDate: 2021-06-25 13:30:54 +0000 tcp: Preparation for allowing hardware TLS to be able to kick a tcp connection that is retransmitting too much out of hardware and back to software. Hardware TLS is now supported in some interface cards and it works well. Except that when we have connections that retransmit a lot we get into trouble with all the retransmits. This prep step makes way for change that Drew will be making so that we can "kick out" a session from hardware TLS. Reviewed by: mtuexen, gallatin Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30895 --- sys/netinet/tcp_output.c | 2 +- sys/netinet/tcp_stacks/bbr.c | 2 +- sys/netinet/tcp_stacks/rack.c | 68 +++++++++++++++++++++++++++++++-------- sys/netinet/tcp_stacks/tcp_rack.h | 6 ++-- sys/netinet/tcp_var.h | 6 ++-- 5 files changed, 63 insertions(+), 21 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 8d78e639636b..d0b56072e9af 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1560,7 +1560,7 @@ send: out: if (error == 0) - tcp_account_for_send(tp, len, (tp->snd_nxt != tp->snd_max), 0); + tcp_account_for_send(tp, len, (tp->snd_nxt != tp->snd_max), 0, hw_tls); /* * In transmit state, time the transmission and arrange for * the retransmit. In persist state, just set snd_max. diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 57abbbf694b6..f8cd0bec1c95 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -13750,7 +13750,7 @@ out: * retransmit. In persist state, just set snd_max. */ if (error == 0) { - tcp_account_for_send(tp, len, (rsm != NULL), doing_tlp); + tcp_account_for_send(tp, len, (rsm != NULL), doing_tlp, hw_tls); if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 521fd6c625f5..6678ca92738b 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ipsec.h" #include "opt_tcpdebug.h" #include "opt_ratelimit.h" +#include "opt_kern_tls.h" #include #include #include @@ -483,7 +484,7 @@ rack_log_ack(struct tcpcb *tp, struct tcpopt *to, static void rack_log_output(struct tcpcb *tp, struct tcpopt *to, int32_t len, uint32_t seq_out, uint8_t th_flags, int32_t err, uint64_t ts, - struct rack_sendmap *hintrsm, uint16_t add_flags, struct mbuf *s_mb, uint32_t s_moff); + struct rack_sendmap *hintrsm, uint16_t add_flags, struct mbuf *s_mb, uint32_t s_moff, int hw_tls); static void rack_log_sack_passed(struct tcpcb *tp, struct tcp_rack *rack, @@ -6061,7 +6062,8 @@ rack_clone_rsm(struct tcp_rack *rack, struct rack_sendmap *nrsm, /* Push bit must go to the right edge as well */ if (rsm->r_flags & RACK_HAD_PUSH) rsm->r_flags &= ~RACK_HAD_PUSH; - + /* Clone over the state of the hw_tls flag */ + nrsm->r_hw_tls = rsm->r_hw_tls; /* * Now we need to find nrsm's new location in the mbuf chain * we basically calculate a new offset, which is soff + @@ -7191,7 +7193,7 @@ rack_update_entry(struct tcpcb *tp, struct tcp_rack *rack, static void rack_log_output(struct tcpcb *tp, struct tcpopt *to, int32_t len, uint32_t seq_out, uint8_t th_flags, int32_t err, uint64_t cts, - struct rack_sendmap *hintrsm, uint16_t add_flag, struct mbuf *s_mb, uint32_t s_moff) + struct rack_sendmap *hintrsm, uint16_t add_flag, struct mbuf *s_mb, uint32_t s_moff, int hw_tls) { struct tcp_rack *rack; struct rack_sendmap *rsm, *nrsm, *insret, fe; @@ -7295,6 +7297,8 @@ again: } else { rsm->r_flags = add_flag; } + if (hw_tls) + rsm->r_hw_tls = 1; rsm->r_tim_lastsent[0] = cts; rsm->r_rtr_cnt = 1; rsm->r_rtr_bytes = 0; @@ -14875,7 +14879,7 @@ rack_log_fsb(struct tcp_rack *rack, struct tcpcb *tp, struct socket *so, uint32_ static struct mbuf * rack_fo_base_copym(struct mbuf *the_m, uint32_t the_off, int32_t *plen, struct rack_fast_send_blk *fsb, - int32_t seglimit, int32_t segsize) + int32_t seglimit, int32_t segsize, int hw_tls) { #ifdef KERN_TLS struct ktls_session *tls, *ntls; @@ -15059,7 +15063,7 @@ rack_fo_m_copym(struct tcp_rack *rack, int32_t *plen, *s_mb = rack->r_ctl.fsb.m; n = rack_fo_base_copym(m, soff, plen, &rack->r_ctl.fsb, - seglimit, segsize); + seglimit, segsize, rack->r_ctl.fsb.hw_tls); return (n); } @@ -15243,7 +15247,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma /* Fix up the orig_m_len and possibly the mbuf offset */ rack_adjust_orig_mlen(rsm); } - m->m_next = rack_fo_base_copym(rsm->m, rsm->soff, &len, NULL, if_hw_tsomaxsegcount, if_hw_tsomaxsegsize); + m->m_next = rack_fo_base_copym(rsm->m, rsm->soff, &len, NULL, if_hw_tsomaxsegcount, if_hw_tsomaxsegsize, rsm->r_hw_tls); if (len <= segsiz) { /* * Must have ran out of mbufs for the copy @@ -15405,13 +15409,13 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma goto failed; } rack_log_output(tp, &to, len, rsm->r_start, flags, error, rack_to_usec_ts(tv), - rsm, RACK_SENT_FP, rsm->m, rsm->soff); + rsm, RACK_SENT_FP, rsm->m, rsm->soff, rsm->r_hw_tls); if (doing_tlp && (rack->fast_rsm_hack == 0)) { rack->rc_tlp_in_progress = 1; rack->r_ctl.rc_tlp_cnt_out++; } if (error == 0) - tcp_account_for_send(tp, len, 1, doing_tlp); + tcp_account_for_send(tp, len, 1, doing_tlp, rsm->r_hw_tls); tp->t_flags &= ~(TF_ACKNOW | TF_DELACK); rack->forced_ack = 0; /* If we send something zap the FA flag */ if (IN_FASTRECOVERY(tp->t_flags) && rsm) @@ -15688,7 +15692,8 @@ again: goto failed; /* s_mb and s_soff are saved for rack_log_output */ - m->m_next = rack_fo_m_copym(rack, &len, if_hw_tsomaxsegcount, if_hw_tsomaxsegsize, &s_mb, &s_soff); + m->m_next = rack_fo_m_copym(rack, &len, if_hw_tsomaxsegcount, if_hw_tsomaxsegsize, + &s_mb, &s_soff); if (len <= segsiz) { /* * Must have ran out of mbufs for the copy @@ -15883,7 +15888,7 @@ again: goto failed; } rack_log_output(tp, &to, len, tp->snd_max, flags, error, rack_to_usec_ts(tv), - NULL, add_flag, s_mb, s_soff); + NULL, add_flag, s_mb, s_soff, rack->r_ctl.fsb.hw_tls); m = NULL; if (tp->snd_una == tp->snd_max) { rack->r_ctl.rc_tlp_rxt_last_time = cts; @@ -15891,7 +15896,7 @@ again: tp->t_acktime = ticks; } if (error == 0) - tcp_account_for_send(tp, len, 0, 0); + tcp_account_for_send(tp, len, 0, 0, rack->r_ctl.fsb.hw_tls); rack->forced_ack = 0; /* If we send something zap the FA flag */ tot_len += len; @@ -17030,6 +17035,10 @@ just_return_nolock: rack->r_ctl.fsb.o_m_len = rack->r_ctl.fsb.m->m_len; rack->r_ctl.fsb.tcp_flags = flags; rack->r_ctl.fsb.left_to_send = orig_len - len; + if (hw_tls) + rack->r_ctl.fsb.hw_tls = 1; + else + rack->r_ctl.fsb.hw_tls = 0; KASSERT((rack->r_ctl.fsb.left_to_send <= (sbavail(sb) - (tp->snd_max - tp->snd_una))), ("rack:%p left_to_send:%u sbavail:%u out:%u", rack, rack->r_ctl.fsb.left_to_send, sbavail(sb), @@ -18118,7 +18127,7 @@ out: * retransmit. In persist state, just set snd_max. */ if (error == 0) { - tcp_account_for_send(tp, len, (rsm != NULL), doing_tlp); + tcp_account_for_send(tp, len, (rsm != NULL), doing_tlp, hw_tls); rack->forced_ack = 0; /* If we send something zap the FA flag */ if (rsm && (doing_tlp == 0)) { /* Set we retransmitted */ @@ -18166,7 +18175,7 @@ out: } rack_log_output(tp, &to, len, rack_seq, (uint8_t) flags, error, rack_to_usec_ts(&tv), - rsm, add_flag, s_mb, s_moff); + rsm, add_flag, s_mb, s_moff, hw_tls); if ((error == 0) && @@ -18489,6 +18498,10 @@ enobufs: rack->r_ctl.fsb.o_m_len = rack->r_ctl.fsb.m->m_len; rack->r_ctl.fsb.tcp_flags = flags; rack->r_ctl.fsb.left_to_send = orig_len - len; + if (hw_tls) + rack->r_ctl.fsb.hw_tls = 1; + else + rack->r_ctl.fsb.hw_tls = 0; KASSERT((rack->r_ctl.fsb.left_to_send <= (sbavail(sb) - (tp->snd_max - tp->snd_una))), ("rack:%p left_to_send:%u sbavail:%u out:%u", rack, rack->r_ctl.fsb.left_to_send, sbavail(sb), @@ -18535,6 +18548,10 @@ enobufs: rack->r_ctl.fsb.o_m_len = rack->r_ctl.fsb.m->m_len; rack->r_ctl.fsb.tcp_flags = flags; rack->r_ctl.fsb.left_to_send = orig_len - len; + if (hw_tls) + rack->r_ctl.fsb.hw_tls = 1; + else + rack->r_ctl.fsb.hw_tls = 0; KASSERT((rack->r_ctl.fsb.left_to_send <= (sbavail(sb) - (tp->snd_max - tp->snd_una))), ("rack:%p left_to_send:%u sbavail:%u out:%u", rack, rack->r_ctl.fsb.left_to_send, sbavail(sb), @@ -19458,6 +19475,29 @@ rack_apply_deferred_options(struct tcp_rack *rack) } } +static void +rack_hw_tls_change(struct tcpcb *tp, int chg) +{ + /* + * HW tls state has changed.. fix all + * rsm's in flight. + */ + struct tcp_rack *rack; + struct rack_sendmap *rsm; + + rack = (struct tcp_rack *)tp->t_fb_ptr; + RB_FOREACH(rsm, rack_rb_tree_head, &rack->r_ctl.rc_mtree) { + if (chg) + rsm->r_hw_tls = 1; + else + rsm->r_hw_tls = 0; + } + if (chg) + rack->r_ctl.fsb.hw_tls = 1; + else + rack->r_ctl.fsb.hw_tls = 0; +} + static int rack_pru_options(struct tcpcb *tp, int flags) { @@ -19483,7 +19523,7 @@ static struct tcp_function_block __tcp_rack = { .tfb_tcp_handoff_ok = rack_handoff_ok, .tfb_tcp_mtu_chg = rack_mtu_change, .tfb_pru_options = rack_pru_options, - + .tfb_hwtls_change = rack_hw_tls_change, }; /* diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index 349f6daec2f4..54582d4fd9c5 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -68,7 +68,8 @@ struct rack_sendmap { uint8_t r_just_ret : 1, /* After sending, the next pkt was just returned, i.e. limited */ r_one_out_nr : 1, /* Special case 1 outstanding and not in recovery */ r_no_rtt_allowed : 1, /* No rtt measurement allowed */ - r_avail : 5; + r_hw_tls : 1, + r_avail : 4; uint64_t r_tim_lastsent[RACK_NUM_OF_RETRANS]; uint64_t r_ack_arrival; /* This is the time of ack-arrival (if SACK'd) */ RB_ENTRY(rack_sendmap) r_next; /* RB Tree next */ @@ -330,7 +331,8 @@ struct rack_fast_send_blk { struct mbuf *m; uint32_t o_m_len; uint32_t rfo_apply_push : 1, - unused : 31; + hw_tls : 1, + unused : 30; }; struct rack_control { diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 553abaf6b334..dd30f89896d2 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -367,6 +367,7 @@ struct tcp_function_block { int (*tfb_tcp_handoff_ok)(struct tcpcb *); void (*tfb_tcp_mtu_chg)(struct tcpcb *); int (*tfb_pru_options)(struct tcpcb *, int); + void (*tfb_hwtls_change)(struct tcpcb *, int); volatile uint32_t tfb_refcnt; uint32_t tfb_flags; uint8_t tfb_id; @@ -1137,7 +1138,8 @@ tcp_fields_to_net(struct tcphdr *th) } static inline void -tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, uint8_t is_tlp) +tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, + uint8_t is_tlp, int hw_tls __unused) { if (is_tlp) { tp->t_sndtlppack++; @@ -1148,9 +1150,7 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, uint8_t is_ tp->t_snd_rxt_bytes += len; else tp->t_sndbytes += len; - } - #endif /* _KERNEL */ #endif /* _NETINET_TCP_VAR_H_ */ From owner-dev-commits-src-main@freebsd.org Fri Jun 25 14:23: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 CE96A664E50; Fri, 25 Jun 2021 14:23: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 4GBK4R5XDrz4cL1; Fri, 25 Jun 2021 14:23: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 A60534E23; Fri, 25 Jun 2021 14:23: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 15PENp3n043807; Fri, 25 Jun 2021 14:23:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PENp0f043806; Fri, 25 Jun 2021 14:23:51 GMT (envelope-from git) Date: Fri, 25 Jun 2021 14:23:51 GMT Message-Id: <202106251423.15PENp0f043806@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Kubaj Subject: git: aa033e0b14f2 - main - Enable OPENMP on riscv64* by default. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa033e0b14f20b39991a8aea9418fa712a4df1bf 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, 25 Jun 2021 14:23:51 -0000 The branch main has been updated by pkubaj (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=aa033e0b14f20b39991a8aea9418fa712a4df1bf commit aa033e0b14f20b39991a8aea9418fa712a4df1bf Author: Piotr Kubaj AuthorDate: 2021-06-25 14:22:50 +0000 Commit: Piotr Kubaj CommitDate: 2021-06-25 14:22:50 +0000 Enable OPENMP on riscv64* by default. Differential revision: https://reviews.freebsd.org/D30862 Approved by: mhorne --- share/mk/src.opts.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 5cdc8d63f954..db2625a80c52 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -355,7 +355,7 @@ BROKEN_OPTIONS+=NVME .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ - ${__T:Mpowerpc64*} != "" + ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != "" __DEFAULT_YES_OPTIONS+=OPENMP .else __DEFAULT_NO_OPTIONS+=OPENMP From owner-dev-commits-src-main@freebsd.org Fri Jun 25 15:15:23 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 EFDFB665921; Fri, 25 Jun 2021 15:15:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GBLCv6NVcz4fyW; Fri, 25 Jun 2021 15:15:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2BB2583E; Fri, 25 Jun 2021 15:15:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15PFFNhL010436; Fri, 25 Jun 2021 15:15:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PFFNWi010435; Fri, 25 Jun 2021 15:15:23 GMT (envelope-from git) Date: Fri, 25 Jun 2021 15:15:23 GMT Message-Id: <202106251515.15PFFNWi010435@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Tuffli Subject: git: a11ca79cd9d0 - main - bhyve: fix NVMe MDTS comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a11ca79cd9d00b102c7bf8a0b683fd85079a6346 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, 25 Jun 2021 15:15:24 -0000 The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=a11ca79cd9d00b102c7bf8a0b683fd85079a6346 commit a11ca79cd9d00b102c7bf8a0b683fd85079a6346 Author: Chuck Tuffli AuthorDate: 2021-06-24 16:54:05 +0000 Commit: Chuck Tuffli CommitDate: 2021-06-25 15:02:28 +0000 bhyve: fix NVMe MDTS comment Removes an obsolete comment and adds parenthesis around the macro while in the area. No functional change. --- usr.sbin/bhyve/pci_nvme.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 7d472830a40e..414edabc2b7c 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -198,13 +198,11 @@ struct pci_nvme_blockstore { * Calculate the number of additional page descriptors for guest IO requests * based on the advertised Max Data Transfer (MDTS) and given the number of * default iovec's in a struct blockif_req. - * - * Note the + 1 allows for the initial descriptor to not be page aligned. */ #define MDTS_PAD_SIZE \ - NVME_MAX_IOVEC > BLOCKIF_IOV_MAX ? \ - NVME_MAX_IOVEC - BLOCKIF_IOV_MAX : \ - 0 + ( NVME_MAX_IOVEC > BLOCKIF_IOV_MAX ? \ + NVME_MAX_IOVEC - BLOCKIF_IOV_MAX : \ + 0 ) struct pci_nvme_ioreq { struct pci_nvme_softc *sc; From owner-dev-commits-src-main@freebsd.org Fri Jun 25 15:41: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 667DF665D69; Fri, 25 Jun 2021 15:41: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 4GBLpD28V7z4hhv; Fri, 25 Jun 2021 15:41: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 337A55AD5; Fri, 25 Jun 2021 15:41: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 15PFfe43046257; Fri, 25 Jun 2021 15:41:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PFfelQ046256; Fri, 25 Jun 2021 15:41:40 GMT (envelope-from git) Date: Fri, 25 Jun 2021 15:41:40 GMT Message-Id: <202106251541.15PFfelQ046256@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: 4aae133469c6 - main - linux(4): Make vDSO defines private. 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: 4aae133469c6bc4ace55bc54eee552971e37e1c4 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, 25 Jun 2021 15:41:40 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=4aae133469c6bc4ace55bc54eee552971e37e1c4 commit 4aae133469c6bc4ace55bc54eee552971e37e1c4 Author: Dmitry Chagin AuthorDate: 2021-06-25 15:41:04 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-25 15:41:04 +0000 linux(4): Make vDSO defines private. Hide the vDSO defines to the linux32_sysvec as they are not intended to be used outside of it. Fix LINUX32_PS_STRINGS, use the size of struct linux32_ps_strings instead of a numeric constant. MFC after: 2 weeks --- sys/amd64/linux32/linux.h | 6 ------ sys/amd64/linux32/linux32_sysvec.c | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index a95545619640..8d7a36eedee9 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -44,12 +44,6 @@ #define LINUX_DTRACE linuxulator32 -#define LINUX32_MAXUSER ((1ul << 32) - PAGE_SIZE) -#define LINUX32_SHAREDPAGE (LINUX32_MAXUSER - PAGE_SIZE) -#define LINUX32_USRSTACK LINUX32_SHAREDPAGE - -/* XXX 16 = sizeof(linux32_ps_strings) */ -#define LINUX32_PS_STRINGS (LINUX32_USRSTACK - 16) #define LINUX32_MAXDSIZ (512 * 1024 * 1024) /* 512MB */ #define LINUX32_MAXSSIZ (64 * 1024 * 1024) /* 64MB */ #define LINUX32_MAXVMEM 0 /* Unlimited */ diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index d534d52392b6..8e3e728161ce 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -90,6 +90,10 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux, 1); +#define LINUX32_MAXUSER ((1ul << 32) - PAGE_SIZE) +#define LINUX32_SHAREDPAGE (LINUX32_MAXUSER - PAGE_SIZE) +#define LINUX32_USRSTACK LINUX32_SHAREDPAGE + static int linux_szsigcode; static vm_object_t linux_shared_page_obj; static char *linux_shared_page_mapping; @@ -158,6 +162,8 @@ struct linux32_ps_strings { u_int32_t ps_envstr; /* first of 0 or more environment strings */ u_int ps_nenvstr; /* the number of environment strings */ }; +#define LINUX32_PS_STRINGS (LINUX32_USRSTACK - \ + sizeof(struct linux32_ps_strings)) LINUX_VDSO_SYM_INTPTR(linux32_sigcode); LINUX_VDSO_SYM_INTPTR(linux32_rt_sigcode); From owner-dev-commits-src-main@freebsd.org Fri Jun 25 16:13: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 CBEA8665DD0; Fri, 25 Jun 2021 16:13: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 4GBMVg5Fb8z4kY2; Fri, 25 Jun 2021 16:13: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 9C7D06535; Fri, 25 Jun 2021 16: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 15PGDFrR090029; Fri, 25 Jun 2021 16: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 15PGDFhc090028; Fri, 25 Jun 2021 16:13:15 GMT (envelope-from git) Date: Fri, 25 Jun 2021 16:13:15 GMT Message-Id: <202106251613.15PGDFhc090028@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Gmelin Subject: git: e349cc19cf1c - main - shm_open(2): Cross-reference posixshmcontrol(1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grembo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e349cc19cf1c3a2315f0e5254a44de01d9ac61bf 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, 25 Jun 2021 16:13:15 -0000 The branch main has been updated by grembo (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e349cc19cf1c3a2315f0e5254a44de01d9ac61bf commit e349cc19cf1c3a2315f0e5254a44de01d9ac61bf Author: Michael Gmelin AuthorDate: 2021-06-25 14:04:37 +0000 Commit: Michael Gmelin CommitDate: 2021-06-25 16:12:05 +0000 shm_open(2): Cross-reference posixshmcontrol(1) When debugging POSIX shared memory issues, it's really useful to learn that there is a command line tool now to manipulate shared memory segments. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30896 --- lib/libc/sys/shm_open.2 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libc/sys/shm_open.2 b/lib/libc/sys/shm_open.2 index e231115613cf..edf5440d44c4 100644 --- a/lib/libc/sys/shm_open.2 +++ b/lib/libc/sys/shm_open.2 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 26, 2019 +.Dd June 25, 2021 .Dt SHM_OPEN 2 .Os .Sh NAME @@ -52,7 +52,7 @@ The .Fn shm_open system call opens (or optionally creates) a -.Tn POSIX +POSIX shared memory object named .Fa path . The @@ -258,7 +258,7 @@ and .Dv O_TRUNC flags may be used in portable programs. .Pp -.Tn POSIX +POSIX specifications state that the result of using .Xr open 2 , .Xr read 2 , @@ -421,6 +421,7 @@ The required permissions are denied. requires write permission to the shared memory object. .El .Sh SEE ALSO +.Xr posixshmcontrol 1 , .Xr close 2 , .Xr fstat 2 , .Xr ftruncate 2 , From owner-dev-commits-src-main@freebsd.org Fri Jun 25 17:21: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 C43F56671C7; Fri, 25 Jun 2021 17:21: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 4GBP1t5FtHz4qRH; Fri, 25 Jun 2021 17:21: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 9C9D271FD; Fri, 25 Jun 2021 17:21: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 15PHLs1I083023; Fri, 25 Jun 2021 17:21:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PHLsHR083022; Fri, 25 Jun 2021 17:21:54 GMT (envelope-from git) Date: Fri, 25 Jun 2021 17:21:54 GMT Message-Id: <202106251721.15PHLsHR083022@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric Joyner Subject: git: 538ef055b7ea - main - ice_ddp: Update to 1.3.24.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 538ef055b7ea11326ba22197537e617587a0d677 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, 25 Jun 2021 17:21:54 -0000 The branch main has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=538ef055b7ea11326ba22197537e617587a0d677 commit 538ef055b7ea11326ba22197537e617587a0d677 Author: Eric Joyner AuthorDate: 2021-06-25 17:20:24 +0000 Commit: Eric Joyner CommitDate: 2021-06-25 17:21:39 +0000 ice_ddp: Update to 1.3.24.0 This version is intended to be used with the 0.29.4 version of the ice(4) driver, which will be be committed afterwards. Signed-off-by: Eric Joyner Reviewed by: stallamr_netapp.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D30887 --- sys/conf/files.amd64 | 6 +++--- sys/conf/files.arm64 | 6 +++--- .../dev/ice/{ice-1.3.19.0.pkg => ice-1.3.24.0.pkg} | Bin 614660 -> 622852 bytes sys/modules/ice_ddp/Makefile | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 0a2e0f1d9f72..2bc68f6ac9b9 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -169,7 +169,7 @@ dev/ice/ice_switch.c optional ice pci \ dev/ice/ice_vlan_mode.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031800 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -178,8 +178,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.19.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.19.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.24.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.24.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/ioat/ioat.c optional ioat pci diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index a1664cc9d299..94530ee4d3b0 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -222,7 +222,7 @@ dev/ice/ice_switch.c optional ice pci \ dev/ice/ice_vlan_mode.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031800 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -231,8 +231,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.19.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.19.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.24.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.24.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" diff --git a/sys/contrib/dev/ice/ice-1.3.19.0.pkg b/sys/contrib/dev/ice/ice-1.3.24.0.pkg old mode 100644 new mode 100755 similarity index 82% rename from sys/contrib/dev/ice/ice-1.3.19.0.pkg rename to sys/contrib/dev/ice/ice-1.3.24.0.pkg index 32e2603bc131..db2520cbe9aa Binary files a/sys/contrib/dev/ice/ice-1.3.19.0.pkg and b/sys/contrib/dev/ice/ice-1.3.24.0.pkg differ diff --git a/sys/modules/ice_ddp/Makefile b/sys/modules/ice_ddp/Makefile index 38337a106368..563655349bb8 100644 --- a/sys/modules/ice_ddp/Makefile +++ b/sys/modules/ice_ddp/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ KMOD= ice_ddp -FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.19.0.pkg:ice_ddp:0x01031300 +FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.24.0.pkg:ice_ddp:0x01031800 .include From owner-dev-commits-src-main@freebsd.org Fri Jun 25 17:30: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 2D1CB66771C; Fri, 25 Jun 2021 17:30: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 4GBPCR0bqMz4qTq; Fri, 25 Jun 2021 17:30: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 ED0997323; Fri, 25 Jun 2021 17:30: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 15PHUAYN088800; Fri, 25 Jun 2021 17:30:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PHUAT3088796; Fri, 25 Jun 2021 17:30:10 GMT (envelope-from git) Date: Fri, 25 Jun 2021 17:30:10 GMT Message-Id: <202106251730.15PHUAT3088796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric Joyner Subject: git: 070f7812da16 - main - ice_ddp: Revert mode back to 0644 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 070f7812da16b692d4e65fdfd418654fdb42729d 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, 25 Jun 2021 17:30:11 -0000 The branch main has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=070f7812da16b692d4e65fdfd418654fdb42729d commit 070f7812da16b692d4e65fdfd418654fdb42729d Author: Eric Joyner AuthorDate: 2021-06-25 17:28:28 +0000 Commit: Eric Joyner CommitDate: 2021-06-25 17:28:28 +0000 ice_ddp: Revert mode back to 0644 The last commit (538ef055b7ea11326ba22197537e617587a0d677) accidentally set the executable bits for this file. This is not intended to be executed at all. (Would that even work?) Sponsored by: Intel Corporation --- sys/contrib/dev/ice/ice-1.3.24.0.pkg | Bin 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/sys/contrib/dev/ice/ice-1.3.24.0.pkg b/sys/contrib/dev/ice/ice-1.3.24.0.pkg old mode 100755 new mode 100644 From owner-dev-commits-src-main@freebsd.org Fri Jun 25 17:30: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 51FCF6671E7; Fri, 25 Jun 2021 17:30: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 4GBPDG1PL8z4qdw; Fri, 25 Jun 2021 17:30: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 175F672E7; Fri, 25 Jun 2021 17:30: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 15PHUrsi093905; Fri, 25 Jun 2021 17:30:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PHUrIs093904; Fri, 25 Jun 2021 17:30:53 GMT (envelope-from git) Date: Fri, 25 Jun 2021 17:30:53 GMT Message-Id: <202106251730.15PHUrIs093904@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: 520a2401a65f - main - bsd-family-tree: Add 2.8BSD relationship to Research 7th edition 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: 520a2401a65f94a2a6766d3a253baa2a1af0e54b 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, 25 Jun 2021 17:30:54 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=520a2401a65f94a2a6766d3a253baa2a1af0e54b commit 520a2401a65f94a2a6766d3a253baa2a1af0e54b Author: Warner Losh AuthorDate: 2021-06-25 17:03:17 +0000 Commit: Warner Losh CommitDate: 2021-06-25 17:30:12 +0000 bsd-family-tree: Add 2.8BSD relationship to Research 7th edition In the 2BSD line, the 2.8BSD tapes were the first ones to include a kernel, both source and a bootable tape. This was an AT&T V7 kernel, with a number of bug fixes; new features in use at Berkeley; performance enhancements that were circulating to V7 in the licensee community; and build system changes. Based on the TUHS archives, it contains none of the V32 changes, however. In addition to the source code analysis, Mike Karels relates the story of how his group lost a customizes to V6 on a PDP-11/40 due to a disk crash. Since V7 just came out and Bill Jolitz had just brought that up elsewhere, they replaced their customized V6 with a V7 system, and that base would eventually become 2.8BSD. (Quarter Century of Unix) Given both lines of evidence, add a direct line from V7 Unix to 2.8BSD. Also confirmed that the V6 line to 1BSD and 2BSD was appropriate. 1BSD and 2BSD included ashell(1) and ex(1). ashell(1) was derived from v6 hell. ex(1) was an enhanced v6 ed. 2.8BSD included process control and user-land utilities from 4.1BSD Discussed with: Clem Cole, Diomidis Spinellis (dds) Differential Revision: https://reviews.freebsd.org/D30883 --- share/misc/bsd-family-tree | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/share/misc/bsd-family-tree b/share/misc/bsd-family-tree index 43715a00bb67..8e2ac27f945f 100644 --- a/share/misc/bsd-family-tree +++ b/share/misc/bsd-family-tree @@ -15,19 +15,19 @@ Sixth Edition (V6) -----* \ | \ | \ | -Seventh Edition (V7) | - \ | - \ 1BSD - 32V | - \ 2BSD---------------* - \ / | - \ / | - \/ | - 3BSD | - | | - 4.0BSD 2.79BSD - | | - 4.1BSD --------------> 2.8BSD +Seventh Edition (V7)----|----------------------* + \ | | + \ 1BSD | + 32V | | + \ 2BSD---------------* | + \ / | | + \ / | | + \/ | | + 3BSD | | + | | | + 4.0BSD 2.79BSD | + | | | + 4.1BSD --------------> 2.8BSD <-* | | 4.1aBSD -----------\ | | \ | @@ -498,7 +498,8 @@ Tenth Edition 1989-10-xx [QCU] 75 2BSD tapes shipped 2.79BSD 1980-04-xx [TUHS] 2.8BSD 1981-07-xx [KSJ] - + First 2BSD with bootable V7 kernel plus + community fixes. 2.8.1BSD 1982-01-xx [QCU] set of performance improvements 2.9BSD 1983-07-xx [KSJ] From owner-dev-commits-src-main@freebsd.org Fri Jun 25 17:35: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 6A5A8667F9D for ; Fri, 25 Jun 2021 17:35:48 +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 4GBPKw2SBbz4s0x for ; Fri, 25 Jun 2021 17:35:48 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f45.google.com with SMTP id w13so6755233wmc.3 for ; Fri, 25 Jun 2021 10:35:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=2QNsLCOAPA5xzum1vxbqyHX/2p8NdGD95eSvhYoo88A=; b=jUZgpMvwq4bI54mdq7grsmofFE8Hm9FBe078Ss1Y7T8LoAKkWu8qpOT9xdyLCOlGo1 9v9T8fkwJcOZG3ohu0YcjO2QMe803xEoNw4Exxg0VKZvyaUzTLZgZ91ZsaQhxJHvO04/ J1ZklI38rXk3g3Rb5M6i7KsIfbBUBVLb97mZj3i75JuBl58RTwiz7SeYkwBokolRyZ+M oEfMHv+wx75yytd/tTWMa24YzcKdzlHjRhlW/7L97I/RKjvOoeSY1o1eQRKYib+Gf9Tw aI3pYFcHCGZFo0ZgNp7gCz59vfbGz6vkB2pTxJNu7BKFEbu4VbWzUvD0MEEGy5BmsfFn FgFQ== X-Gm-Message-State: AOAM530Man5KH/PfoNIKnVW6sISajKFvXO3ZLLc+qmIaWl9Y4VSj3T7f 7C7xbNaKQ5qH73ekeQExtXE6997gZAq0ahbw X-Google-Smtp-Source: ABdhPJy8NZiAkN/HlfQV1tzqjAWPRHs7ITY0aCQnen1zojA9vBeCP/J6eocCUFuv3Pb2Gbgqbs2JRQ== X-Received: by 2002:a1c:4e03:: with SMTP id g3mr12230117wmh.122.1624642546871; Fri, 25 Jun 2021 10:35:46 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id 2sm6367674wrz.87.2021.06.25.10.35.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jun 2021 10:35:46 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: aa033e0b14f2 - main - Enable OPENMP on riscv64* by default. From: Jessica Clarke In-Reply-To: <202106251423.15PENp0f043806@gitrepo.freebsd.org> Date: Fri, 25 Jun 2021 18:35:45 +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: References: <202106251423.15PENp0f043806@gitrepo.freebsd.org> To: Piotr Kubaj X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GBPKw2SBbz4s0x 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: Fri, 25 Jun 2021 17:35:48 -0000 On 25 Jun 2021, at 15:23, Piotr Kubaj wrote: >=20 > The branch main has been updated by pkubaj (ports committer): >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Daa033e0b14f20b39991a8aea9418fa71= 2a4df1bf >=20 > commit aa033e0b14f20b39991a8aea9418fa712a4df1bf > Author: Piotr Kubaj > AuthorDate: 2021-06-25 14:22:50 +0000 > Commit: Piotr Kubaj > CommitDate: 2021-06-25 14:22:50 +0000 >=20 > Enable OPENMP on riscv64* by default. >=20 > Differential revision: https://reviews.freebsd.org/D30862 > Approved by: mhorne > --- > share/mk/src.opts.mk | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk > index 5cdc8d63f954..db2625a80c52 100644 > --- a/share/mk/src.opts.mk > +++ b/share/mk/src.opts.mk > @@ -355,7 +355,7 @@ BROKEN_OPTIONS+=3DNVME > .endif >=20 > .if ${__T} =3D=3D "aarch64" || ${__T} =3D=3D "amd64" || ${__T} =3D=3D = "i386" || \ > - ${__T:Mpowerpc64*} !=3D "" > + ${__T:Mpowerpc64*} !=3D "" || ${__T:Mriscv64*} !=3D "" At this point should the default just be flipped so it=E2=80=99s = opt-out? Then it=E2=80=99d just be mips*, powerpc and arm. Jess From owner-dev-commits-src-main@freebsd.org Fri Jun 25 18:12: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 E31C16405E3; Fri, 25 Jun 2021 18:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GBQ8G635Jz4tZW; Fri, 25 Jun 2021 18:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADF0F7E77; Fri, 25 Jun 2021 18:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15PICUMD053127; Fri, 25 Jun 2021 18:12:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PICUbF053117; Fri, 25 Jun 2021 18:12:30 GMT (envelope-from git) Date: Fri, 25 Jun 2021 18:12:30 GMT Message-Id: <202106251812.15PICUbF053117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 6df35af4d85c - main - Allow sleepq_signal() to drop the lock. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6df35af4d85c6311d8e762521580e7176b69394e 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, 25 Jun 2021 18:12:31 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6df35af4d85c6311d8e762521580e7176b69394e commit 6df35af4d85c6311d8e762521580e7176b69394e Author: Alexander Motin AuthorDate: 2021-06-25 17:52:58 +0000 Commit: Alexander Motin CommitDate: 2021-06-25 18:12:21 +0000 Allow sleepq_signal() to drop the lock. Introduce SLEEPQ_DROP sleepq_signal() flag, allowing one to drop the sleep queue chain lock before returning. Reduced lock scope allows significantly reduce lock contention inside taskqueue_enqueue() for ZFS worker threads doing ~350K disk reads/s on 40-thread system. MFC after: 2 weeks Sponsored by: iXsystems, Inc. --- sys/kern/kern_synch.c | 8 +++----- sys/kern/subr_sleepqueue.c | 8 ++++++-- sys/sys/sleepqueue.h | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index dcca67326264..793c5309a30b 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -366,8 +366,7 @@ wakeup_one(const void *ident) int wakeup_swapper; sleepq_lock(ident); - wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP, 0, 0); - sleepq_release(ident); + wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP | SLEEPQ_DROP, 0, 0); if (wakeup_swapper) kick_proc0(); } @@ -378,9 +377,8 @@ wakeup_any(const void *ident) int wakeup_swapper; sleepq_lock(ident); - wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP | SLEEPQ_UNFAIR, - 0, 0); - sleepq_release(ident); + wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP | SLEEPQ_UNFAIR | + SLEEPQ_DROP, 0, 0); if (wakeup_swapper) kick_proc0(); } diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 0718f01fa48a..b146a978a60c 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -927,8 +927,11 @@ sleepq_signal(const void *wchan, int flags, int pri, int queue) KASSERT(wchan != NULL, ("%s: invalid NULL wait channel", __func__)); MPASS((queue >= 0) && (queue < NR_SLEEPQS)); sq = sleepq_lookup(wchan); - if (sq == NULL) + if (sq == NULL) { + if (flags & SLEEPQ_DROP) + sleepq_release(wchan); return (0); + } KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), ("%s: mismatch between sleep/wakeup and cv_*", __func__)); @@ -961,7 +964,8 @@ sleepq_signal(const void *wchan, int flags, int pri, int queue) } } MPASS(besttd != NULL); - wakeup_swapper = sleepq_resume_thread(sq, besttd, pri, SRQ_HOLD); + wakeup_swapper = sleepq_resume_thread(sq, besttd, pri, + (flags & SLEEPQ_DROP) ? 0 : SRQ_HOLD); return (wakeup_swapper); } diff --git a/sys/sys/sleepqueue.h b/sys/sys/sleepqueue.h index 18c7568777b6..6715894ed1f3 100644 --- a/sys/sys/sleepqueue.h +++ b/sys/sys/sleepqueue.h @@ -85,6 +85,7 @@ struct thread; #define SLEEPQ_LK 0x04 /* Used by a lockmgr. */ #define SLEEPQ_INTERRUPTIBLE 0x100 /* Sleep is interruptible. */ #define SLEEPQ_UNFAIR 0x200 /* Unfair wakeup order. */ +#define SLEEPQ_DROP 0x400 /* Return without lock held. */ void init_sleepqueues(void); int sleepq_abort(struct thread *td, int intrval); From owner-dev-commits-src-main@freebsd.org Fri Jun 25 18:40: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 8F9766408F2; Fri, 25 Jun 2021 18:40:30 +0000 (UTC) (envelope-from pkubaj@anongoth.pl) Received: from mail.anongoth.pl (mail.anongoth.pl [46.248.190.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X448 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "anongoth.pl", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GBQmZ2p86z4vfp; Fri, 25 Jun 2021 18:40:29 +0000 (UTC) (envelope-from pkubaj@anongoth.pl) Received: from anongoth.pl (unknown [192.168.1.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: pkubaj@anongoth.pl) by mail.anongoth.pl (Postfix) with ESMTPSA id 7154256EC2; Fri, 25 Jun 2021 20:40:26 +0200 (CEST) Date: Fri, 25 Jun 2021 20:40:25 +0200 From: Piotr Kubaj To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: aa033e0b14f2 - main - Enable OPENMP on riscv64* by default. Message-ID: References: <202106251423.15PENp0f043806@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fYGj5Zd3cIdoeUA6" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4GBQmZ2p86z4vfp X-Spamd-Bar: ---- 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: Fri, 25 Jun 2021 18:40:30 -0000 --fYGj5Zd3cIdoeUA6 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 21-06-25 18:35:45, Jessica Clarke wrote: > On 25 Jun 2021, at 15:23, Piotr Kubaj wrote: > >=20 > > The branch main has been updated by pkubaj (ports committer): > >=20 > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Daa033e0b14f20b39991a8aea= 9418fa712a4df1bf > >=20 > > commit aa033e0b14f20b39991a8aea9418fa712a4df1bf > > Author: Piotr Kubaj > > AuthorDate: 2021-06-25 14:22:50 +0000 > > Commit: Piotr Kubaj > > CommitDate: 2021-06-25 14:22:50 +0000 > >=20 > > Enable OPENMP on riscv64* by default. > >=20 > > Differential revision: https://reviews.freebsd.org/D30862 > > Approved by: mhorne > > --- > > share/mk/src.opts.mk | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > >=20 > > diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk > > index 5cdc8d63f954..db2625a80c52 100644 > > --- a/share/mk/src.opts.mk > > +++ b/share/mk/src.opts.mk > > @@ -355,7 +355,7 @@ BROKEN_OPTIONS+=3DNVME > > .endif > >=20 > > .if ${__T} =3D=3D "aarch64" || ${__T} =3D=3D "amd64" || ${__T} =3D=3D "= i386" || \ > > - ${__T:Mpowerpc64*} !=3D "" > > + ${__T:Mpowerpc64*} !=3D "" || ${__T:Mriscv64*} !=3D "" >=20 > At this point should the default just be flipped so it=E2=80=99s opt-out?= Then > it=E2=80=99d just be mips*, powerpc and arm. >=20 > Jess >=20 And probably powerpcspe as well. --fYGj5Zd3cIdoeUA6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEycyIeNkkgohzsoorelmbhSCDnJ0FAmDWIxkACgkQelmbhSCD nJ2CvQ//XABV4M0bJZuFYLSKGkMiZ858+6dXxGETiDSwpNPnQRnJL4FMmzfUMip9 JvubBL9svx5XwYxJR9w2eMM8NYLLdg1mvkYnS4dtKri7EnDMpzePLMVyvcZL/83V hNqesJliQgLZ9q4w4H+2LoVj+IH8FJp8eZfikAqEp00RYWnrprhlZHDXl9VPsX63 Ye7IMCdxUC+ZjivtPeBTsjUpr9+91SNEidQRg81P/aNtsFiYpbjnAGoKPKrYpKq0 wloCKIMXlv7KCNzCjw9902rE00KaRrl1/PUH93XAZAtIFDovvvdYP/6dlUTwbux1 m59JKH4T7y2Vo8Xl7loLiNXkdk78jdGYImjh/PlQur8w5vmkhxq005FhaLEmc7jw QrLKFgbfMxF3fX8sl0eJl5wv4L8ZOJCHDQbXsPpvPkFCOjH4/QBfytfBFLLT8NZy LOu5FE4EKEwRjsxyLkLymZwu+LD+Y+7AALXIQj2PbZxGziN0zi0bb6Sr0KKNI2QJ 84hRoh/xmj9MCHPNYO7iZ2ZGK2IWU+lxKsu4sMH+C7BkwC6LfTKUtE86zRmDdUvv niIlzdOLbWqie+p9WkNPog/K34c5ThPoeOm8H0lXedKvG3MrXzAS7US1wlGVUEWz XSMvFvh6FcQ8bQzuXq61Uq/y2sZuxLjDy2Moce3BuNiRjkTr64o= =c3ua -----END PGP SIGNATURE----- --fYGj5Zd3cIdoeUA6-- From owner-dev-commits-src-main@freebsd.org Fri Jun 25 18:43: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 9710E641013; Fri, 25 Jun 2021 18:43: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 4GBQr83q6Bz4vmk; Fri, 25 Jun 2021 18:43: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 6B38410990; Fri, 25 Jun 2021 18:43: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 15PIhabg092918; Fri, 25 Jun 2021 18:43:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PIhavF092917; Fri, 25 Jun 2021 18:43:36 GMT (envelope-from git) Date: Fri, 25 Jun 2021 18:43:36 GMT Message-Id: <202106251843.15PIhavF092917@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 0bcd49c13ada - main - Work around bogus old gcc "initializer element is not constant" error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0bcd49c13ada1461bcea85e0466811ddcb290b5e 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, 25 Jun 2021 18:43:36 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=0bcd49c13ada1461bcea85e0466811ddcb290b5e commit 0bcd49c13ada1461bcea85e0466811ddcb290b5e Author: Dimitry Andric AuthorDate: 2021-06-25 18:42:38 +0000 Commit: Dimitry Andric CommitDate: 2021-06-25 18:43:20 +0000 Work around bogus old gcc "initializer element is not constant" error After df3b437c1e073eb83e9a93af1c417f3ee8d0de3b, older gcc's such as 4.2.1 (still used on earlier branches for e.g. mips and powerpc) and 6.3.0 (still used for some cross-builds) started throwing bogus errors like: In file included from /workspace/src/lib/msun/src/s_llround.c:11:0: /workspace/src/lib/msun/src/s_lround.c:54:31: error: initializer element is not constant static const type dtype_min = type_min - 0.5; ^~~~~~~~ /workspace/src/lib/msun/src/s_lround.c:55:31: error: initializer element is not constant static const type dtype_max = type_max + 0.5; ^~~~~~~~ Since 'type_min' and 'type_max' are constants declared just above these lines this error is nonsensical, but older gcc's are not smart enough. Work around the error by reusing the (type)DTYPE_MIN and (type)DTYPE_MAX macros, so I can MFC this right away, unbreaking a few stable builds. MFC after: immediately --- lib/msun/src/s_lround.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/msun/src/s_lround.c b/lib/msun/src/s_lround.c index c4d305401ac8..1dd8e697f703 100644 --- a/lib/msun/src/s_lround.c +++ b/lib/msun/src/s_lround.c @@ -51,8 +51,8 @@ __FBSDID("$FreeBSD$"); */ static const type type_min = (type)DTYPE_MIN; static const type type_max = (type)DTYPE_MAX; -static const type dtype_min = type_min - 0.5; -static const type dtype_max = type_max + 0.5; +static const type dtype_min = (type)DTYPE_MIN - 0.5; +static const type dtype_max = (type)DTYPE_MAX + 0.5; #define INRANGE(x) (dtype_max - type_max != 0.5 || \ ((x) > dtype_min && (x) < dtype_max)) From owner-dev-commits-src-main@freebsd.org Fri Jun 25 21:00: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 569B4643900; Fri, 25 Jun 2021 21:00: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 4GBTsq21Jzz3L61; Fri, 25 Jun 2021 21:00: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 2CF5A1227A; Fri, 25 Jun 2021 21:00: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 15PL0Fv6073308; Fri, 25 Jun 2021 21:00:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PL0FZO073302; Fri, 25 Jun 2021 21:00:15 GMT (envelope-from git) Date: Fri, 25 Jun 2021 21:00:15 GMT Message-Id: <202106252100.15PL0FZO073302@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: cab31e0e216c - main - md5: Fix cross-build after c2870e576bd2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cab31e0e216c7defefd4aba14693ba2252ea7308 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, 25 Jun 2021 21:00:15 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=cab31e0e216c7defefd4aba14693ba2252ea7308 commit cab31e0e216c7defefd4aba14693ba2252ea7308 Author: Jessica Clarke AuthorDate: 2021-06-25 21:00:11 +0000 Commit: Jessica Clarke CommitDate: 2021-06-25 21:00:11 +0000 md5: Fix cross-build after c2870e576bd2 On macOS and Linux the current set of headers do not end up pulling in sys/param.h, causing MAXPATHLEN to not be defined and the build to fail. --- sbin/md5/md5.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c index d4245d2aad4b..43a76227a9d2 100644 --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -21,6 +21,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include From owner-dev-commits-src-main@freebsd.org Fri Jun 25 23:01: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 9B82E6451B6; Fri, 25 Jun 2021 23:01: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 4GBXZB3kWSz3jYN; Fri, 25 Jun 2021 23:01: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 6835613F12; Fri, 25 Jun 2021 23:01: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 15PN1s31041012; Fri, 25 Jun 2021 23:01:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PN1sla041011; Fri, 25 Jun 2021 23:01:54 GMT (envelope-from git) Date: Fri, 25 Jun 2021 23:01:54 GMT Message-Id: <202106252301.15PN1sla041011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: b0c40a00a67f - main - Merge commit 'ee914ef902ae018bd4f67192832120f9bf05651f' into new_merge MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0c40a00a67f611868fc0f10bde6b28eb75931be 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, 25 Jun 2021 23:01:54 -0000 The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b0c40a00a67f611868fc0f10bde6b28eb75931be commit b0c40a00a67f611868fc0f10bde6b28eb75931be Merge: cab31e0e216c ee914ef902ae Author: Simon J. Gerraty AuthorDate: 2021-06-25 21:31:14 +0000 Commit: Simon J. Gerraty CommitDate: 2021-06-25 21:31:14 +0000 Merge commit 'ee914ef902ae018bd4f67192832120f9bf05651f' into new_merge contrib/bmake/ChangeLog | 113 + contrib/bmake/FILES | 13 + contrib/bmake/VERSION | 2 +- contrib/bmake/arch.c | 104 +- contrib/bmake/buf.h | 4 +- contrib/bmake/compat.c | 42 +- contrib/bmake/cond.c | 279 +- contrib/bmake/dir.c | 62 +- contrib/bmake/dir.h | 6 +- contrib/bmake/enum.h | 62 +- contrib/bmake/for.c | 46 +- contrib/bmake/hash.c | 68 +- contrib/bmake/hash.h | 14 +- contrib/bmake/import.sh | 17 +- contrib/bmake/job.c | 423 +-- contrib/bmake/job.h | 20 +- contrib/bmake/lst.c | 10 +- contrib/bmake/lst.h | 12 +- contrib/bmake/main.c | 250 +- contrib/bmake/make.c | 91 +- contrib/bmake/make.h | 129 +- contrib/bmake/meta.c | 194 +- contrib/bmake/meta.h | 8 +- contrib/bmake/metachar.h | 4 +- contrib/bmake/mk/ChangeLog | 35 + contrib/bmake/mk/dirdeps.mk | 76 +- contrib/bmake/mk/dpadd.mk | 7 +- contrib/bmake/mk/install-mk | 4 +- contrib/bmake/mk/meta.autodep.mk | 6 +- contrib/bmake/mk/meta2deps.py | 54 +- contrib/bmake/mk/rst2htm.mk | 6 +- contrib/bmake/nonints.h | 153 +- contrib/bmake/parse.c | 512 ++-- contrib/bmake/str.c | 101 +- contrib/bmake/str.h | 366 +++ contrib/bmake/suff.c | 71 +- contrib/bmake/targ.c | 14 +- contrib/bmake/unit-tests/Makefile | 28 +- contrib/bmake/unit-tests/archive.mk | 6 +- contrib/bmake/unit-tests/cmd-errors-jobs.exp | 2 +- contrib/bmake/unit-tests/cmd-errors-lint.exp | 2 +- contrib/bmake/unit-tests/cmd-errors.exp | 2 +- contrib/bmake/unit-tests/cond-func-empty.mk | 10 +- contrib/bmake/unit-tests/cond-func-make-main.mk | 6 +- contrib/bmake/unit-tests/cond-late.exp | 2 +- contrib/bmake/unit-tests/cond-short.mk | 14 +- contrib/bmake/unit-tests/cond-token-string.exp | 2 +- contrib/bmake/unit-tests/cond-token-var.mk | 23 +- contrib/bmake/unit-tests/cond1.exp | 2 +- contrib/bmake/unit-tests/counter-append.mk | 4 +- contrib/bmake/unit-tests/counter.mk | 4 +- contrib/bmake/unit-tests/dep-var.mk | 4 +- contrib/bmake/unit-tests/deptgt-makeflags.exp | 10 +- contrib/bmake/unit-tests/deptgt-order.exp | 3 + contrib/bmake/unit-tests/deptgt-order.mk | 18 +- contrib/bmake/unit-tests/deptgt.exp | 8 +- contrib/bmake/unit-tests/deptgt.mk | 4 +- contrib/bmake/unit-tests/directive-export-impl.exp | 88 +- contrib/bmake/unit-tests/directive-export-impl.mk | 23 +- contrib/bmake/unit-tests/directive-export.mk | 15 +- contrib/bmake/unit-tests/directive-for-errors.exp | 2 +- contrib/bmake/unit-tests/directive-for-errors.mk | 6 +- contrib/bmake/unit-tests/directive-for-escape.exp | 32 +- contrib/bmake/unit-tests/directive-for-escape.mk | 21 +- contrib/bmake/unit-tests/directive-for.exp | 2 +- contrib/bmake/unit-tests/directive-undef.exp | 3 +- contrib/bmake/unit-tests/directive-undef.mk | 21 +- .../bmake/unit-tests/directive-unexport-env.exp | 20 +- contrib/bmake/unit-tests/directive.exp | 8 +- contrib/bmake/unit-tests/include-main.exp | 2 +- contrib/bmake/unit-tests/job-output-null.exp | 4 + contrib/bmake/unit-tests/job-output-null.mk | 32 + .../bmake/unit-tests/jobs-empty-commands-error.exp | 5 + .../bmake/unit-tests/jobs-empty-commands-error.mk | 19 + contrib/bmake/unit-tests/moderrs.exp | 97 +- contrib/bmake/unit-tests/moderrs.mk | 25 +- contrib/bmake/unit-tests/modts.exp | 4 +- contrib/bmake/unit-tests/modword.exp | 24 +- contrib/bmake/unit-tests/modword.mk | 3 +- contrib/bmake/unit-tests/opt-chdir.mk | 6 +- contrib/bmake/unit-tests/opt-debug-errors-jobs.exp | 48 + contrib/bmake/unit-tests/opt-debug-errors-jobs.mk | 36 + contrib/bmake/unit-tests/opt-debug-lint.exp | 2 +- contrib/bmake/unit-tests/opt-debug-lint.mk | 20 +- contrib/bmake/unit-tests/opt-debug.exp | 6 +- contrib/bmake/unit-tests/opt-file.mk | 6 +- contrib/bmake/unit-tests/opt-jobs-no-action.mk | 4 +- contrib/bmake/unit-tests/recursive.mk | 7 +- contrib/bmake/unit-tests/sh-jobs.mk | 8 +- contrib/bmake/unit-tests/shell-csh.mk | 4 +- contrib/bmake/unit-tests/suff-incomplete.exp | 10 +- contrib/bmake/unit-tests/suff-main-several.exp | 24 +- contrib/bmake/unit-tests/suff-rebuild.exp | 14 +- contrib/bmake/unit-tests/var-class-cmdline.exp | 3 + contrib/bmake/unit-tests/var-class-cmdline.mk | 80 +- contrib/bmake/unit-tests/var-eval-short.exp | 29 + contrib/bmake/unit-tests/var-eval-short.mk | 163 ++ contrib/bmake/unit-tests/var-op-append.exp | 12 +- contrib/bmake/unit-tests/var-op-append.mk | 4 +- contrib/bmake/unit-tests/var-op-assign.mk | 4 +- contrib/bmake/unit-tests/var-op-sunsh.mk | 12 +- contrib/bmake/unit-tests/varcmd.mk | 14 +- contrib/bmake/unit-tests/vardebug.exp | 119 +- contrib/bmake/unit-tests/varmisc.exp | 2 +- contrib/bmake/unit-tests/varmod-assign.exp | 22 +- contrib/bmake/unit-tests/varmod-assign.mk | 39 +- contrib/bmake/unit-tests/varmod-defined.exp | 34 +- contrib/bmake/unit-tests/varmod-defined.mk | 6 +- contrib/bmake/unit-tests/varmod-edge.exp | 12 +- contrib/bmake/unit-tests/varmod-edge.mk | 26 +- contrib/bmake/unit-tests/varmod-hash.exp | 6 +- contrib/bmake/unit-tests/varmod-ifelse.exp | 22 +- contrib/bmake/unit-tests/varmod-ifelse.mk | 64 +- contrib/bmake/unit-tests/varmod-indirect.exp | 84 +- contrib/bmake/unit-tests/varmod-indirect.mk | 100 +- contrib/bmake/unit-tests/varmod-loop-varname.exp | 11 + contrib/bmake/unit-tests/varmod-loop-varname.mk | 127 + contrib/bmake/unit-tests/varmod-loop.exp | 19 +- contrib/bmake/unit-tests/varmod-loop.mk | 156 +- contrib/bmake/unit-tests/varmod-match-escape.exp | 74 +- contrib/bmake/unit-tests/varmod-match-escape.mk | 8 +- contrib/bmake/unit-tests/varmod-order.exp | 4 +- contrib/bmake/unit-tests/varmod-range.exp | 10 +- contrib/bmake/unit-tests/varmod-remember.exp | 2 - contrib/bmake/unit-tests/varmod-remember.mk | 29 +- contrib/bmake/unit-tests/varmod-shell.mk | 9 +- contrib/bmake/unit-tests/varmod-subst-regex.exp | 25 +- contrib/bmake/unit-tests/varmod-subst-regex.mk | 54 +- contrib/bmake/unit-tests/varmod-subst.exp | 2 +- contrib/bmake/unit-tests/varmod-subst.mk | 10 +- contrib/bmake/unit-tests/varmod-sun-shell.exp | 2 + contrib/bmake/unit-tests/varmod-sun-shell.mk | 21 + contrib/bmake/unit-tests/varmod-sysv.exp | 147 +- contrib/bmake/unit-tests/varmod-sysv.mk | 57 +- contrib/bmake/unit-tests/varmod-to-separator.exp | 12 +- contrib/bmake/unit-tests/varmod-unique.mk | 12 +- contrib/bmake/unit-tests/varname-dot-shell.exp | 32 +- contrib/bmake/unit-tests/varname-empty.exp | 60 +- contrib/bmake/unit-tests/varname-empty.mk | 4 +- contrib/bmake/unit-tests/varname.exp | 33 +- contrib/bmake/unit-tests/varparse-dynamic.mk | 6 +- contrib/bmake/unit-tests/varparse-errors.exp | 4 +- contrib/bmake/unit-tests/varparse-errors.mk | 4 +- contrib/bmake/var.c | 3073 +++++++++++--------- 144 files changed, 5499 insertions(+), 3548 deletions(-) diff --cc contrib/bmake/job.c index eb5454cde574,000000000000..c27c47d0b054 mode 100644,000000..100644 --- a/contrib/bmake/job.c +++ b/contrib/bmake/job.c @@@ -1,3012 -1,0 +1,3049 @@@ - /* $NetBSD: job.c,v 1.420 2021/02/05 22:15:44 sjg Exp $ */ ++/* $NetBSD: job.c,v 1.435 2021/06/16 09:47:51 rillig Exp $ */ + +/* + * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Adam de Boor. + * + * 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. + */ + +/* + * Copyright (c) 1988, 1989 by Adam de Boor + * Copyright (c) 1989 by Berkeley Softworks + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Adam de Boor. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. 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. + */ + +/* + * job.c -- + * handle the creation etc. of our child processes. + * + * Interface: + * Job_Init Called to initialize this module. In addition, + * the .BEGIN target is made including all of its + * dependencies before this function returns. + * Hence, the makefiles must have been parsed + * before this function is called. + * + * Job_End Clean up any memory used. + * + * Job_Make Start the creation of the given target. + * + * Job_CatchChildren + * Check for and handle the termination of any + * children. This must be called reasonably + * frequently to keep the whole make going at + * a decent clip, since job table entries aren't + * removed until their process is caught this way. + * + * Job_CatchOutput + * Print any output our children have produced. + * Should also be called fairly frequently to + * keep the user informed of what's going on. + * If no output is waiting, it will block for + * a time given by the SEL_* constants, below, + * or until output is ready. + * + * Job_ParseShell Given a special dependency line with target '.SHELL', + * define the shell that is used for the creation + * commands in jobs mode. + * + * Job_Finish Perform any final processing which needs doing. + * This includes the execution of any commands + * which have been/were attached to the .END + * target. It should only be called when the + * job table is empty. + * + * Job_AbortAll Abort all currently running jobs. Do not handle + * output or do anything for the jobs, just kill them. + * Should only be called in an emergency. + * + * Job_CheckCommands + * Verify that the commands for a target are + * ok. Provide them if necessary and possible. + * + * Job_Touch Update a target without really updating it. + * + * Job_Wait Wait for all currently-running jobs to finish. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include +#include +#include "wait.h" + +#include +#if !defined(USE_SELECT) && defined(HAVE_POLL_H) +#include +#else +#ifndef USE_SELECT /* no poll.h */ +# define USE_SELECT +#endif +#if defined(HAVE_SYS_SELECT_H) +# include +#endif +#endif +#include +#include +#if defined(HAVE_SYS_SOCKET_H) +# include +#endif + +#include "make.h" +#include "dir.h" +#include "job.h" +#include "pathnames.h" +#include "trace.h" + +/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ - MAKE_RCSID("$NetBSD: job.c,v 1.420 2021/02/05 22:15:44 sjg Exp $"); ++MAKE_RCSID("$NetBSD: job.c,v 1.435 2021/06/16 09:47:51 rillig Exp $"); + +/* + * A shell defines how the commands are run. All commands for a target are + * written into a single file, which is then given to the shell to execute + * the commands from it. The commands are written to the file using a few + * templates for echo control and error control. + * + * The name of the shell is the basename for the predefined shells, such as + * "sh", "csh", "bash". For custom shells, it is the full pathname, and its + * basename is used to select the type of shell; the longest match wins. + * So /usr/pkg/bin/bash has type sh, /usr/local/bin/tcsh has type csh. + * + * The echoing of command lines is controlled using hasEchoCtl, echoOff, + * echoOn, noPrint and noPrintLen. When echoOff is executed by the shell, it + * still outputs something, but this something is not interesting, therefore + * it is filtered out using noPrint and noPrintLen. + * + * The error checking for individual commands is controlled using hasErrCtl, + * errOn, errOff and runChkTmpl. + * + * In case a shell doesn't have error control, echoTmpl is a printf template + * for echoing the command, should echoing be on; runIgnTmpl is another + * printf template for executing the command while ignoring the return + * status. Finally runChkTmpl is a printf template for running the command and + * causing the shell to exit on error. If any of these strings are empty when - * hasErrCtl is FALSE, the command will be executed anyway as is, and if it ++ * hasErrCtl is false, the command will be executed anyway as is, and if it + * causes an error, so be it. Any templates set up to echo the command will + * escape any '$ ` \ "' characters in the command string to avoid unwanted + * shell code injection, the escaped command is safe to use in double quotes. + * + * The command-line flags "echo" and "exit" also control the behavior. The + * "echo" flag causes the shell to start echoing commands right away. The + * "exit" flag causes the shell to exit when an error is detected in one of + * the commands. + */ +typedef struct Shell { + + /* + * The name of the shell. For Bourne and C shells, this is used only + * to find the shell description when used as the single source of a + * .SHELL target. For user-defined shells, this is the full path of + * the shell. + */ + const char *name; + - Boolean hasEchoCtl; /* whether both echoOff and echoOn are there */ ++ bool hasEchoCtl; /* whether both echoOff and echoOn are there */ + const char *echoOff; /* command to turn echoing off */ + const char *echoOn; /* command to turn echoing back on */ + const char *noPrint; /* text to skip when printing output from the + * shell. This is usually the same as echoOff */ + size_t noPrintLen; /* length of noPrint command */ + - Boolean hasErrCtl; /* whether error checking can be controlled ++ bool hasErrCtl; /* whether error checking can be controlled + * for individual commands */ + const char *errOn; /* command to turn on error checking */ + const char *errOff; /* command to turn off error checking */ + + const char *echoTmpl; /* template to echo a command */ + const char *runIgnTmpl; /* template to run a command + * without error checking */ + const char *runChkTmpl; /* template to run a command + * with error checking */ + + /* string literal that results in a newline character when it appears + * outside of any 'quote' or "quote" characters */ + const char *newline; + char commentChar; /* character used by shell for comment lines */ + + const char *echoFlag; /* shell flag to echo commands */ + const char *errFlag; /* shell flag to exit on error */ +} Shell; + +typedef struct CommandFlags { + /* Whether to echo the command before or instead of running it. */ - Boolean echo; ++ bool echo; + + /* Run the command even in -n or -N mode. */ - Boolean always; ++ bool always; + + /* - * true if we turned error checking off before printing the command - * and need to turn it back on ++ * true if we turned error checking off before writing the command to ++ * the commands file and need to turn it back on + */ - Boolean ignerr; ++ bool ignerr; +} CommandFlags; + +/* + * Write shell commands to a file. + * + * TODO: keep track of whether commands are echoed. + * TODO: keep track of whether error checking is active. + */ +typedef struct ShellWriter { + FILE *f; + + /* we've sent 'set -x' */ - Boolean xtraced; ++ bool xtraced; + +} ShellWriter; + +/* + * FreeBSD: traditionally .MAKE is not required to + * pass jobs queue to sub-makes. + * Use .MAKE.ALWAYS_PASS_JOB_QUEUE=no to disable. + */ +#define MAKE_ALWAYS_PASS_JOB_QUEUE ".MAKE.ALWAYS_PASS_JOB_QUEUE" +static int Always_pass_job_queue = TRUE; +/* + * FreeBSD: aborting entire parallel make isn't always + * desired. When doing tinderbox for example, failure of + * one architecture should not stop all. + * We still want to bail on interrupt though. + */ +#define MAKE_JOB_ERROR_TOKEN "MAKE_JOB_ERROR_TOKEN" +static int Job_error_token = TRUE; + +/* + * error handling variables + */ +static int job_errors = 0; /* number of errors reported */ - typedef enum AbortReason { /* why is the make aborting? */ ++static enum { /* Why is the make aborting? */ + ABORT_NONE, - ABORT_ERROR, /* Because of an error */ - ABORT_INTERRUPT, /* Because it was interrupted */ ++ ABORT_ERROR, /* Aborted because of an error */ ++ ABORT_INTERRUPT, /* Aborted because it was interrupted */ + ABORT_WAIT /* Waiting for jobs to finish */ - /* XXX: "WAIT" is not a _reason_ for aborting, it's rather a status. */ - } AbortReason; - static AbortReason aborting = ABORT_NONE; ++} aborting = ABORT_NONE; +#define JOB_TOKENS "+EI+" /* Token to requeue for each abort state */ + +/* + * this tracks the number of tokens currently "out" to build jobs. + */ +int jobTokensRunning = 0; + +typedef enum JobStartResult { + JOB_RUNNING, /* Job is running */ + JOB_ERROR, /* Error in starting the job */ + JOB_FINISHED /* The job is already finished */ +} JobStartResult; + +/* + * Descriptions for various shells. + * + * The build environment may set DEFSHELL_INDEX to one of + * DEFSHELL_INDEX_SH, DEFSHELL_INDEX_KSH, or DEFSHELL_INDEX_CSH, to + * select one of the predefined shells as the default shell. + * + * Alternatively, the build environment may set DEFSHELL_CUSTOM to the + * name or the full path of a sh-compatible shell, which will be used as + * the default shell. + * + * ".SHELL" lines in Makefiles can choose the default shell from the + * set defined here, or add additional shells. + */ + +#ifdef DEFSHELL_CUSTOM +#define DEFSHELL_INDEX_CUSTOM 0 +#define DEFSHELL_INDEX_SH 1 +#define DEFSHELL_INDEX_KSH 2 +#define DEFSHELL_INDEX_CSH 3 +#else /* !DEFSHELL_CUSTOM */ +#define DEFSHELL_INDEX_SH 0 +#define DEFSHELL_INDEX_KSH 1 +#define DEFSHELL_INDEX_CSH 2 +#endif /* !DEFSHELL_CUSTOM */ + +#ifndef DEFSHELL_INDEX +#define DEFSHELL_INDEX 0 /* DEFSHELL_INDEX_CUSTOM or DEFSHELL_INDEX_SH */ +#endif /* !DEFSHELL_INDEX */ + +static Shell shells[] = { +#ifdef DEFSHELL_CUSTOM + /* + * An sh-compatible shell with a non-standard name. + * + * Keep this in sync with the "sh" description below, but avoid + * non-portable features that might not be supplied by all + * sh-compatible shells. + */ + { + DEFSHELL_CUSTOM, /* .name */ - FALSE, /* .hasEchoCtl */ ++ false, /* .hasEchoCtl */ + "", /* .echoOff */ + "", /* .echoOn */ + "", /* .noPrint */ + 0, /* .noPrintLen */ - FALSE, /* .hasErrCtl */ ++ false, /* .hasErrCtl */ + "", /* .errOn */ + "", /* .errOff */ + "echo \"%s\"\n", /* .echoTmpl */ + "%s\n", /* .runIgnTmpl */ + "{ %s \n} || exit $?\n", /* .runChkTmpl */ + "'\n'", /* .newline */ + '#', /* .commentChar */ + "", /* .echoFlag */ + "", /* .errFlag */ + }, +#endif /* DEFSHELL_CUSTOM */ + /* + * SH description. Echo control is also possible and, under + * sun UNIX anyway, one can even control error checking. + */ + { + "sh", /* .name */ - FALSE, /* .hasEchoCtl */ ++ false, /* .hasEchoCtl */ + "", /* .echoOff */ + "", /* .echoOn */ + "", /* .noPrint */ + 0, /* .noPrintLen */ - FALSE, /* .hasErrCtl */ ++ false, /* .hasErrCtl */ + "", /* .errOn */ + "", /* .errOff */ + "echo \"%s\"\n", /* .echoTmpl */ + "%s\n", /* .runIgnTmpl */ + "{ %s \n} || exit $?\n", /* .runChkTmpl */ + "'\n'", /* .newline */ + '#', /* .commentChar*/ +#if defined(MAKE_NATIVE) && defined(__NetBSD__) + /* XXX: -q is not really echoFlag, it's more like noEchoInSysFlag. */ + "q", /* .echoFlag */ +#else + "", /* .echoFlag */ +#endif + "", /* .errFlag */ + }, + /* + * KSH description. + */ + { + "ksh", /* .name */ - TRUE, /* .hasEchoCtl */ ++ true, /* .hasEchoCtl */ + "set +v", /* .echoOff */ + "set -v", /* .echoOn */ + "set +v", /* .noPrint */ + 6, /* .noPrintLen */ - FALSE, /* .hasErrCtl */ ++ false, /* .hasErrCtl */ + "", /* .errOn */ + "", /* .errOff */ + "echo \"%s\"\n", /* .echoTmpl */ + "%s\n", /* .runIgnTmpl */ + "{ %s \n} || exit $?\n", /* .runChkTmpl */ + "'\n'", /* .newline */ + '#', /* .commentChar */ + "v", /* .echoFlag */ + "", /* .errFlag */ + }, + /* + * CSH description. The csh can do echo control by playing + * with the setting of the 'echo' shell variable. Sadly, + * however, it is unable to do error control nicely. + */ + { + "csh", /* .name */ - TRUE, /* .hasEchoCtl */ ++ true, /* .hasEchoCtl */ + "unset verbose", /* .echoOff */ + "set verbose", /* .echoOn */ + "unset verbose", /* .noPrint */ + 13, /* .noPrintLen */ - FALSE, /* .hasErrCtl */ ++ false, /* .hasErrCtl */ + "", /* .errOn */ + "", /* .errOff */ + "echo \"%s\"\n", /* .echoTmpl */ + "csh -c \"%s || exit 0\"\n", /* .runIgnTmpl */ + "", /* .runChkTmpl */ + "'\\\n'", /* .newline */ + '#', /* .commentChar */ + "v", /* .echoFlag */ + "e", /* .errFlag */ + } +}; + +/* + * This is the shell to which we pass all commands in the Makefile. + * It is set by the Job_ParseShell function. + */ +static Shell *shell = &shells[DEFSHELL_INDEX]; +const char *shellPath = NULL; /* full pathname of executable image */ +const char *shellName = NULL; /* last component of shellPath */ +char *shellErrFlag = NULL; +static char *shell_freeIt = NULL; /* Allocated memory for custom .SHELL */ + + +static Job *job_table; /* The structures that describe them */ +static Job *job_table_end; /* job_table + maxJobs */ +static unsigned int wantToken; /* we want a token */ - static Boolean lurking_children = FALSE; - static Boolean make_suspended = FALSE; /* Whether we've seen a SIGTSTP (etc) */ ++static bool lurking_children = false; ++static bool make_suspended = false; /* Whether we've seen a SIGTSTP (etc) */ + +/* + * Set of descriptors of pipes connected to + * the output channels of children + */ +static struct pollfd *fds = NULL; +static Job **jobByFdIndex = NULL; +static nfds_t fdsLen = 0; +static void watchfd(Job *); +static void clearfd(Job *); - static Boolean readyfd(Job *); ++static bool readyfd(Job *); + +static char *targPrefix = NULL; /* To identify a job change in the output. */ +static Job tokenWaitJob; /* token wait pseudo-job */ + +static Job childExitJob; /* child exit pseudo-job */ +#define CHILD_EXIT "." +#define DO_JOB_RESUME "R" + +enum { + npseudojobs = 2 /* number of pseudo-jobs */ +}; + +static sigset_t caught_signals; /* Set of signals we handle */ +static volatile sig_atomic_t caught_sigchld; + - static void JobDoOutput(Job *, Boolean); - static void JobInterrupt(Boolean, int) MAKE_ATTR_DEAD; ++static void CollectOutput(Job *, bool); ++static void JobInterrupt(bool, int) MAKE_ATTR_DEAD; +static void JobRestartJobs(void); +static void JobSigReset(void); + +static void +SwitchOutputTo(GNode *gn) +{ + /* The node for which output was most recently produced. */ + static GNode *lastNode = NULL; + + if (gn == lastNode) + return; + lastNode = gn; + + if (opts.maxJobs != 1 && targPrefix != NULL && targPrefix[0] != '\0') + (void)fprintf(stdout, "%s %s ---\n", targPrefix, gn->name); +} + +static unsigned +nfds_per_job(void) +{ +#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV) + if (useMeta) + return 2; +#endif + return 1; +} + +void +Job_FlagsToString(const Job *job, char *buf, size_t bufsize) +{ + snprintf(buf, bufsize, "%c%c%c", + job->ignerr ? 'i' : '-', + !job->echo ? 's' : '-', + job->special ? 'S' : '-'); +} + +static void - job_table_dump(const char *where) ++DumpJobs(const char *where) +{ + Job *job; + char flags[4]; + + debug_printf("job table @ %s\n", where); + for (job = job_table; job < job_table_end; job++) { + Job_FlagsToString(job, flags, sizeof flags); + debug_printf("job %d, status %d, flags %s, pid %d\n", + (int)(job - job_table), job->status, flags, job->pid); + } +} + +/* + * Delete the target of a failed, interrupted, or otherwise + * unsuccessful job unless inhibited by .PRECIOUS. + */ +static void +JobDeleteTarget(GNode *gn) +{ + const char *file; + + if (gn->type & OP_JOIN) + return; + if (gn->type & OP_PHONY) + return; + if (Targ_Precious(gn)) + return; + if (opts.noExecute) + return; + + file = GNode_Path(gn); + if (eunlink(file) != -1) + Error("*** %s removed", file); +} + +/* + * JobSigLock/JobSigUnlock + * + * Signal lock routines to get exclusive access. Currently used to + * protect `jobs' and `stoppedJobs' list manipulations. + */ +static void +JobSigLock(sigset_t *omaskp) +{ + if (sigprocmask(SIG_BLOCK, &caught_signals, omaskp) != 0) { + Punt("JobSigLock: sigprocmask: %s", strerror(errno)); + sigemptyset(omaskp); + } +} + +static void +JobSigUnlock(sigset_t *omaskp) +{ + (void)sigprocmask(SIG_SETMASK, omaskp, NULL); +} + +static void +JobCreatePipe(Job *job, int minfd) +{ + int i, fd, flags; + int pipe_fds[2]; + + if (pipe(pipe_fds) == -1) + Punt("Cannot create pipe: %s", strerror(errno)); + + for (i = 0; i < 2; i++) { + /* Avoid using low numbered fds */ + fd = fcntl(pipe_fds[i], F_DUPFD, minfd); + if (fd != -1) { + close(pipe_fds[i]); + pipe_fds[i] = fd; + } + } + + job->inPipe = pipe_fds[0]; + job->outPipe = pipe_fds[1]; + + /* Set close-on-exec flag for both */ + if (fcntl(job->inPipe, F_SETFD, FD_CLOEXEC) == -1) + Punt("Cannot set close-on-exec: %s", strerror(errno)); + if (fcntl(job->outPipe, F_SETFD, FD_CLOEXEC) == -1) + Punt("Cannot set close-on-exec: %s", strerror(errno)); + + /* + * We mark the input side of the pipe non-blocking; we poll(2) the + * pipe when we're waiting for a job token, but we might lose the + * race for the token when a new one becomes available, so the read + * from the pipe should not block. + */ + flags = fcntl(job->inPipe, F_GETFL, 0); + if (flags == -1) + Punt("Cannot get flags: %s", strerror(errno)); + flags |= O_NONBLOCK; + if (fcntl(job->inPipe, F_SETFL, flags) == -1) + Punt("Cannot set flags: %s", strerror(errno)); +} + +/* Pass the signal to each running job. */ +static void +JobCondPassSig(int signo) +{ + Job *job; + + DEBUG1(JOB, "JobCondPassSig(%d) called.\n", signo); + + for (job = job_table; job < job_table_end; job++) { + if (job->status != JOB_ST_RUNNING) + continue; + DEBUG2(JOB, "JobCondPassSig passing signal %d to child %d.\n", + signo, job->pid); + KILLPG(job->pid, signo); + } +} + +/* + * SIGCHLD handler. + * + * Sends a token on the child exit pipe to wake us up from select()/poll(). + */ +/*ARGSUSED*/ +static void +JobChildSig(int signo MAKE_ATTR_UNUSED) +{ + caught_sigchld = 1; + while (write(childExitJob.outPipe, CHILD_EXIT, 1) == -1 && + errno == EAGAIN) + continue; +} + + +/* Resume all stopped jobs. */ +/*ARGSUSED*/ +static void +JobContinueSig(int signo MAKE_ATTR_UNUSED) +{ + /* + * Defer sending SIGCONT to our stopped children until we return + * from the signal handler. + */ + while (write(childExitJob.outPipe, DO_JOB_RESUME, 1) == -1 && + errno == EAGAIN) + continue; +} + +/* + * Pass a signal on to all jobs, then resend to ourselves. + * We die by the same signal. + */ +MAKE_ATTR_DEAD static void +JobPassSig_int(int signo) +{ + /* Run .INTERRUPT target then exit */ - JobInterrupt(TRUE, signo); ++ JobInterrupt(true, signo); +} + +/* + * Pass a signal on to all jobs, then resend to ourselves. + * We die by the same signal. + */ +MAKE_ATTR_DEAD static void +JobPassSig_term(int signo) +{ + /* Dont run .INTERRUPT target then exit */ - JobInterrupt(FALSE, signo); ++ JobInterrupt(false, signo); +} + +static void +JobPassSig_suspend(int signo) +{ + sigset_t nmask, omask; + struct sigaction act; + + /* Suppress job started/continued messages */ - make_suspended = TRUE; ++ make_suspended = true; + + /* Pass the signal onto every job */ + JobCondPassSig(signo); + + /* + * Send ourselves the signal now we've given the message to everyone + * else. Note we block everything else possible while we're getting + * the signal. This ensures that all our jobs get continued when we + * wake up before we take any other signal. + */ + sigfillset(&nmask); + sigdelset(&nmask, signo); + (void)sigprocmask(SIG_SETMASK, &nmask, &omask); + + act.sa_handler = SIG_DFL; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + (void)sigaction(signo, &act, NULL); + + DEBUG1(JOB, "JobPassSig passing signal %d to self.\n", signo); + + (void)kill(getpid(), signo); + + /* + * We've been continued. + * + * A whole host of signals continue to happen! + * SIGCHLD for any processes that actually suspended themselves. + * SIGCHLD for any processes that exited while we were alseep. + * The SIGCONT that actually caused us to wakeup. + * + * Since we defer passing the SIGCONT on to our children until + * the main processing loop, we can be sure that all the SIGCHLD + * events will have happened by then - and that the waitpid() will + * collect the child 'suspended' events. + * For correct sequencing we just need to ensure we process the + * waitpid() before passing on the SIGCONT. + * + * In any case nothing else is needed here. + */ + + /* Restore handler and signal mask */ + act.sa_handler = JobPassSig_suspend; + (void)sigaction(signo, &act, NULL); + (void)sigprocmask(SIG_SETMASK, &omask, NULL); +} + +static Job * - JobFindPid(int pid, JobStatus status, Boolean isJobs) ++JobFindPid(int pid, JobStatus status, bool isJobs) +{ + Job *job; + + for (job = job_table; job < job_table_end; job++) { + if (job->status == status && job->pid == pid) + return job; + } + if (DEBUG(JOB) && isJobs) - job_table_dump("no pid"); ++ DumpJobs("no pid"); + return NULL; +} + +/* Parse leading '@', '-' and '+', which control the exact execution mode. */ +static void +ParseCommandFlags(char **pp, CommandFlags *out_cmdFlags) +{ + char *p = *pp; - out_cmdFlags->echo = TRUE; - out_cmdFlags->ignerr = FALSE; - out_cmdFlags->always = FALSE; ++ out_cmdFlags->echo = true; ++ out_cmdFlags->ignerr = false; ++ out_cmdFlags->always = false; + + for (;;) { + if (*p == '@') + out_cmdFlags->echo = DEBUG(LOUD); + else if (*p == '-') - out_cmdFlags->ignerr = TRUE; ++ out_cmdFlags->ignerr = true; + else if (*p == '+') - out_cmdFlags->always = TRUE; ++ out_cmdFlags->always = true; + else + break; + p++; + } + + pp_skip_whitespace(&p); + + *pp = p; +} + +/* Escape a string for a double-quoted string literal in sh, csh and ksh. */ +static char * +EscapeShellDblQuot(const char *cmd) +{ + size_t i, j; + + /* Worst that could happen is every char needs escaping. */ + char *esc = bmake_malloc(strlen(cmd) * 2 + 1); + for (i = 0, j = 0; cmd[i] != '\0'; i++, j++) { + if (cmd[i] == '$' || cmd[i] == '`' || cmd[i] == '\\' || *** 2485 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri Jun 25 23:03: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 1AEA464567A; Fri, 25 Jun 2021 23:03: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 4GBXbf0DbBz3jqd; Fri, 25 Jun 2021 23:03: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 E443514020; Fri, 25 Jun 2021 23:03: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 15PN399i041209; Fri, 25 Jun 2021 23:03:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PN39DZ041208; Fri, 25 Jun 2021 23:03:09 GMT (envelope-from git) Date: Fri, 25 Jun 2021 23:03:09 GMT Message-Id: <202106252303.15PN39DZ041208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: 68c4481aac28 - main - Update to bmake-20210621 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68c4481aac28f5a088553b9c31579f6fbc8500fd 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, 25 Jun 2021 23:03:10 -0000 The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=68c4481aac28f5a088553b9c31579f6fbc8500fd commit 68c4481aac28f5a088553b9c31579f6fbc8500fd Author: Simon J. Gerraty AuthorDate: 2021-06-25 21:26:16 +0000 Commit: Simon J. Gerraty CommitDate: 2021-06-25 23:02:40 +0000 Update to bmake-20210621 MFC after: 1 week --- contrib/bmake/job.c | 9 +++++---- usr.bin/bmake/Makefile.config | 2 +- usr.bin/bmake/unit-tests/Makefile | 28 +++++++++++++++++++++------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/contrib/bmake/job.c b/contrib/bmake/job.c index c27c47d0b054..ba2e5c827b0c 100644 --- a/contrib/bmake/job.c +++ b/contrib/bmake/job.c @@ -262,7 +262,7 @@ typedef struct ShellWriter { * Use .MAKE.ALWAYS_PASS_JOB_QUEUE=no to disable. */ #define MAKE_ALWAYS_PASS_JOB_QUEUE ".MAKE.ALWAYS_PASS_JOB_QUEUE" -static int Always_pass_job_queue = TRUE; +static bool Always_pass_job_queue = true; /* * FreeBSD: aborting entire parallel make isn't always * desired. When doing tinderbox for example, failure of @@ -270,7 +270,7 @@ static int Always_pass_job_queue = TRUE; * We still want to bail on interrupt though. */ #define MAKE_JOB_ERROR_TOKEN "MAKE_JOB_ERROR_TOKEN" -static int Job_error_token = TRUE; +static bool Job_error_token = true; /* * error handling variables @@ -2265,10 +2265,11 @@ Job_Init(void) aborting = ABORT_NONE; job_errors = 0; - Always_pass_job_queue = GetBooleanVar(MAKE_ALWAYS_PASS_JOB_QUEUE, + Always_pass_job_queue = GetBooleanExpr(MAKE_ALWAYS_PASS_JOB_QUEUE, Always_pass_job_queue); - Job_error_token = GetBooleanVar(MAKE_JOB_ERROR_TOKEN, Job_error_token); + Job_error_token = GetBooleanExpr(MAKE_JOB_ERROR_TOKEN, Job_error_token); + /* * There is a non-zero chance that we already have children. diff --git a/usr.bin/bmake/Makefile.config b/usr.bin/bmake/Makefile.config index 75d1ad6e6e65..36b1664be099 100644 --- a/usr.bin/bmake/Makefile.config +++ b/usr.bin/bmake/Makefile.config @@ -7,7 +7,7 @@ SRCTOP?= ${.CURDIR:H:H} # things set by configure -_MAKE_VERSION?=20210206 +_MAKE_VERSION?=20210621 prefix?= /usr srcdir= ${SRCTOP}/contrib/bmake diff --git a/usr.bin/bmake/unit-tests/Makefile b/usr.bin/bmake/unit-tests/Makefile index 7bcda5c151ac..d2efc5cce5b2 100644 --- a/usr.bin/bmake/unit-tests/Makefile +++ b/usr.bin/bmake/unit-tests/Makefile @@ -2,9 +2,9 @@ # See contrib/bmake/bsd.after-import.mk # # $FreeBSD$ -# $Id: Makefile,v 1.143 2021/02/06 18:31:30 sjg Exp $ +# $Id: Makefile,v 1.148 2021/06/16 19:18:56 sjg Exp $ # -# $NetBSD: Makefile,v 1.269 2021/02/06 18:26:03 sjg Exp $ +# $NetBSD: Makefile,v 1.279 2021/06/16 09:39:48 rillig Exp $ # # Unit tests for make(1) # @@ -207,7 +207,9 @@ TESTS+= impsrc TESTS+= include-main TESTS+= job-flags #TESTS+= job-output-long-lines +TESTS+= job-output-null TESTS+= jobs-empty-commands +TESTS+= jobs-empty-commands-error TESTS+= jobs-error-indirect TESTS+= jobs-error-nested TESTS+= jobs-error-nested-make @@ -232,6 +234,7 @@ TESTS+= opt-debug-curdir TESTS+= opt-debug-cond TESTS+= opt-debug-dir TESTS+= opt-debug-errors +TESTS+= opt-debug-errors-jobs TESTS+= opt-debug-file TESTS+= opt-debug-for TESTS+= opt-debug-graph1 @@ -325,6 +328,7 @@ TESTS+= var-class-env TESTS+= var-class-global TESTS+= var-class-local TESTS+= var-class-local-legacy +TESTS+= var-eval-short TESTS+= var-op TESTS+= var-op-append TESTS+= var-op-assign @@ -351,6 +355,7 @@ TESTS+= varmod-indirect TESTS+= varmod-l-name-to-value TESTS+= varmod-localtime TESTS+= varmod-loop +TESTS+= varmod-loop-varname TESTS+= varmod-match TESTS+= varmod-match-escape TESTS+= varmod-no-match @@ -367,6 +372,7 @@ TESTS+= varmod-select-words TESTS+= varmod-shell TESTS+= varmod-subst TESTS+= varmod-subst-regex +TESTS+= varmod-sun-shell TESTS+= varmod-sysv TESTS+= varmod-tail TESTS+= varmod-to-abs @@ -488,6 +494,7 @@ SED_CMDS.job-output-long-lines= \ ${:D marker should always be at the beginning of the line. } \ -e '/^aa*--- job-b ---$$/d' \ -e '/^bb*--- job-a ---$$/d' +SED_CMDS.opt-chdir= -e 's,\(nonexistent\).[1-9][0-9]*,\1,' SED_CMDS.opt-debug-graph1= ${STD_SED_CMDS.dg1} SED_CMDS.opt-debug-graph2= ${STD_SED_CMDS.dg2} SED_CMDS.opt-debug-graph3= ${STD_SED_CMDS.dg3} @@ -498,11 +505,12 @@ SED_CMDS.opt-debug-jobs+= -e 's,JobFinish: [0-9][0-9]*,JobFinish: ,' SED_CMDS.opt-debug-jobs+= -e 's,Command: ${.SHELL:T},Command: ,' # The "-q" may be there or not, see jobs.c, variable shells. SED_CMDS.opt-debug-jobs+= -e 's,^\(.Command: \) -q,\1,' +SED_CMDS.opt-debug-lint+= ${STD_SED_CMDS.regex} SED_CMDS.opt-jobs-no-action= ${STD_SED_CMDS.hide-from-output} SED_CMDS.opt-no-action-runflags= ${STD_SED_CMDS.hide-from-output} -# For Compat_RunCommand, useShell == FALSE. +# For Compat_RunCommand, useShell == false. SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,,' -# For Compat_RunCommand, useShell == TRUE. +# For Compat_RunCommand, useShell == true. SED_CMDS.sh-dots+= -e 's,^make: exec(\(.*\)) failed (.*)$$,,' SED_CMDS.sh-dots+= -e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1,' SED_CMDS.sh-errctl= ${STD_SED_CMDS.dj} @@ -513,8 +521,7 @@ SED_CMDS.suff-transform-debug+= ${STD_SED_CMDS.dg1} SED_CMDS.var-op-shell+= ${STD_SED_CMDS.shell} SED_CMDS.var-op-shell+= -e '/command/s,No such.*,not found,' SED_CMDS.vardebug+= -e 's,${.SHELL},,' -SED_CMDS.varmod-subst-regex+= \ - -e 's,\(Regex compilation error:\).*,\1 (details omitted),' +SED_CMDS.varmod-subst-regex+= ${STD_SED_CMDS.regex} SED_CMDS.varname-dot-parsedir= -e '/in some cases/ s,^make: "[^"]*,make: ",' SED_CMDS.varname-dot-parsefile= -e '/in some cases/ s,^make: "[^"]*,make: ",' SED_CMDS.varname-dot-shell= -e 's, = /[^ ]*, = (details omitted),g' @@ -594,6 +601,11 @@ STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: line [0-9][0-9]*: ,,' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: [0-9][0-9]*: ,,' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: ,,' +# The actual error messages for a failed regcomp or regexec differ between the +# implementations. +STD_SED_CMDS.regex= \ + -e 's,\(Regex compilation error:\).*,\1 (details omitted),' + # End of the configuration helpers section. .sinclude "Makefile.inc" @@ -643,8 +655,10 @@ _MKMSG_TEST= : .if ${.OBJDIR} != ${.CURDIR} # easy TMPDIR:= ${.OBJDIR}/tmp +.elif defined(TMPDIR) +TMPDIR:= ${TMPDIR}/uid${.MAKE.UID} .else -TMPDIR:= ${TMPDIR:U/tmp}/uid${.MAKE.UID} +TMPDIR:= /tmp/uid${.MAKE.UID} .endif # make sure it exists .if !exist(${TMPDIR}) From owner-dev-commits-src-main@freebsd.org Fri Jun 25 23:10: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 5DA26645A5D; Fri, 25 Jun 2021 23:10: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 4GBXmC28N6z3jxM; Fri, 25 Jun 2021 23:10: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 32C5B14022; Fri, 25 Jun 2021 23:10: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 15PNAZfW049992; Fri, 25 Jun 2021 23:10:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PNAZmT049991; Fri, 25 Jun 2021 23:10:35 GMT (envelope-from git) Date: Fri, 25 Jun 2021 23:10:35 GMT Message-Id: <202106252310.15PNAZmT049991@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: 6beb67c7e0ad - main - cxgbe(4): Get the number of usable traffic classes from the firmware. 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: 6beb67c7e0ad4c3f8277ed1122ef5efcde0a269c 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, 25 Jun 2021 23:10:35 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=6beb67c7e0ad4c3f8277ed1122ef5efcde0a269c commit 6beb67c7e0ad4c3f8277ed1122ef5efcde0a269c Author: Navdeep Parhar AuthorDate: 2021-06-22 05:07:56 +0000 Commit: Navdeep Parhar CommitDate: 2021-06-25 23:04:09 +0000 cxgbe(4): Get the number of usable traffic classes from the firmware. Recent firmwares are able to utilize the traffic classes of tx channels that were previously unused. This effectively doubles the number of traffic classes available per port for 2 port cards. Stop using the raw per-channel value in the driver and ask the firmware for the number of usable traffic classes instead. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/common/common.h | 1 + sys/dev/cxgbe/t4_main.c | 12 ++++++++++-- sys/dev/cxgbe/t4_sched.c | 28 ++++++++++++++-------------- sys/dev/cxgbe/tom/t4_cpl_io.c | 4 ++-- sys/dev/cxgbe/tom/t4_tom.c | 11 +++++------ 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index b803a7106a0c..c132cb779204 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -408,6 +408,7 @@ struct adapter_params { bool dev_512sgl_mr; /* FW support for 512 SGL per FR MR */ bool viid_smt_extn_support; /* FW returns vin, vfvld & smt index? */ unsigned int max_pkts_per_eth_tx_pkts_wr; + uint8_t nsched_cls; /* # of usable sched classes per port */ }; #define CHELSIO_T4 0x4 diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index c5a3e6dd200e..4c69a152963a 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5236,6 +5236,14 @@ get_params__post_init(struct adapter *sc) else sc->params.max_pkts_per_eth_tx_pkts_wr = 15; + param[0] = FW_PARAM_DEV(NUM_TM_CLASS); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); + if (rc == 0) { + MPASS(val[0] > 0 && val[0] < 256); /* nsched_cls is 8b */ + sc->params.nsched_cls = val[0]; + } else + sc->params.nsched_cls = sc->chip_params->nsched_cls; + /* get capabilites */ bzero(&caps, sizeof(caps)); caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | @@ -7851,7 +7859,7 @@ cxgbe_sysctls(struct port_info *pi) SYSCTL_ADD_UINT(ctx, children2, OID_AUTO, "burstsize", CTLFLAG_RW, &pi->sched_params->burstsize, 0, "burstsize for per-flow cl-rl (0 means up to the driver)"); - for (i = 0; i < sc->chip_params->nsched_cls; i++) { + for (i = 0; i < sc->params.nsched_cls; i++) { struct tx_cl_rl_params *tc = &pi->sched_params->cl_rl[i]; snprintf(name, sizeof(name), "%d", i); @@ -11675,7 +11683,7 @@ error: if ((s->offload != 0 && s->offload != 1) || s->cong_algo < -1 || s->cong_algo > CONG_ALG_HIGHSPEED || s->sched_class < -1 || - s->sched_class >= sc->chip_params->nsched_cls) { + s->sched_class >= sc->params.nsched_cls) { rc = EINVAL; goto error; } diff --git a/sys/dev/cxgbe/t4_sched.c b/sys/dev/cxgbe/t4_sched.c index b320ff4a7c68..827add3c27ec 100644 --- a/sys/dev/cxgbe/t4_sched.c +++ b/sys/dev/cxgbe/t4_sched.c @@ -171,7 +171,7 @@ set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, */ if (p->cl < 0) return (EINVAL); - if (!in_range(p->cl, 0, sc->chip_params->nsched_cls - 1)) + if (!in_range(p->cl, 0, sc->params.nsched_cls - 1)) return (ERANGE); } @@ -243,7 +243,7 @@ update_tx_sched(void *context, int pending) struct port_info *pi; struct tx_cl_rl_params *tc; struct adapter *sc = context; - const int n = sc->chip_params->nsched_cls; + const int n = sc->params.nsched_cls; mtx_lock(&sc->tc_lock); for_each_port(sc, i) { @@ -373,7 +373,7 @@ bind_txq_to_traffic_class(struct adapter *sc, struct sge_txq *txq, int idx) txq->tc_idx = old_idx; } done: - MPASS(txq->tc_idx >= -1 && txq->tc_idx < sc->chip_params->nsched_cls); + MPASS(txq->tc_idx >= -1 && txq->tc_idx < sc->params.nsched_cls); mtx_unlock(&sc->tc_lock); return (rc); } @@ -402,7 +402,7 @@ t4_set_sched_queue(struct adapter *sc, struct t4_sched_queue *p) MPASS(vi->ntxq > 0); if (!in_range(p->queue, 0, vi->ntxq - 1) || - !in_range(p->cl, 0, sc->chip_params->nsched_cls - 1)) + !in_range(p->cl, 0, sc->params.nsched_cls - 1)) return (EINVAL); if (p->queue < 0) { @@ -431,7 +431,7 @@ int t4_init_tx_sched(struct adapter *sc) { int i, j; - const int n = sc->chip_params->nsched_cls; + const int n = sc->params.nsched_cls; struct port_info *pi; struct tx_cl_rl_params *tc; @@ -507,7 +507,7 @@ t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, update = false; mtx_lock(&sc->tc_lock); - for (i = 0; i < sc->chip_params->nsched_cls; i++, tc++) { + for (i = 0; i < sc->params.nsched_cls; i++, tc++) { if (fa < 0 && tc->refcount == 0 && !(tc->flags & CLRL_USER)) fa = i; /* first available */ @@ -526,7 +526,7 @@ t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, } } /* Not found */ - MPASS(i == sc->chip_params->nsched_cls); + MPASS(i == sc->params.nsched_cls); if (fa != -1) { tc = &pi->sched_params->cl_rl[fa]; tc->refcount = 1; @@ -557,7 +557,7 @@ t4_release_cl_rl(struct adapter *sc, int port_id, int tc_idx) struct tx_cl_rl_params *tc; MPASS(port_id >= 0 && port_id < sc->params.nports); - MPASS(tc_idx >= 0 && tc_idx < sc->chip_params->nsched_cls); + MPASS(tc_idx >= 0 && tc_idx < sc->params.nsched_cls); mtx_lock(&sc->tc_lock); tc = &sc->port[port_id]->sched_params->cl_rl[tc_idx]; @@ -584,7 +584,7 @@ sysctl_tc(SYSCTL_HANDLER_ARGS) if (sc->flags & IS_VF) return (EPERM); - if (!in_range(tc_idx, 0, sc->chip_params->nsched_cls - 1)) + if (!in_range(tc_idx, 0, sc->params.nsched_cls - 1)) return (EINVAL); return (bind_txq_to_traffic_class(sc, txq, tc_idx)); @@ -610,7 +610,7 @@ sysctl_tc_params(SYSCTL_HANDLER_ARGS) MPASS(port_id < sc->params.nports); MPASS(sc->port[port_id] != NULL); i = arg2 & 0xffff; - MPASS(i < sc->chip_params->nsched_cls); + MPASS(i < sc->params.nsched_cls); mtx_lock(&sc->tc_lock); tc = sc->port[port_id]->sched_params->cl_rl[i]; @@ -772,7 +772,7 @@ cxgbe_rate_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, (params->rate_limit.max_rate * 8ULL / 1000), &schedcl); if (rc != 0) return (rc); - MPASS(schedcl >= 0 && schedcl < sc->chip_params->nsched_cls); + MPASS(schedcl >= 0 && schedcl < sc->params.nsched_cls); cst = malloc(sizeof(*cst), M_CXGBE, M_ZERO | M_NOWAIT); if (cst == NULL) { @@ -823,7 +823,7 @@ cxgbe_rate_tag_modify(struct m_snd_tag *mst, struct adapter *sc = cst->adapter; /* XXX: is schedcl -1 ok here? */ - MPASS(cst->schedcl >= 0 && cst->schedcl < sc->chip_params->nsched_cls); + MPASS(cst->schedcl >= 0 && cst->schedcl < sc->params.nsched_cls); mtx_lock(&cst->lock); MPASS(cst->flags & EO_SND_TAG_REF); @@ -831,7 +831,7 @@ cxgbe_rate_tag_modify(struct m_snd_tag *mst, (params->rate_limit.max_rate * 8ULL / 1000), &schedcl); if (rc != 0) return (rc); - MPASS(schedcl >= 0 && schedcl < sc->chip_params->nsched_cls); + MPASS(schedcl >= 0 && schedcl < sc->params.nsched_cls); t4_release_cl_rl(sc, cst->port_id, cst->schedcl); cst->schedcl = schedcl; cst->max_rate = params->rate_limit.max_rate; @@ -919,7 +919,7 @@ cxgbe_ratelimit_query(struct ifnet *ifp, struct if_ratelimit_query_results *q) * the card's cclk. */ q->max_flows = sc->tids.netids; - q->number_of_rates = sc->chip_params->nsched_cls; + q->number_of_rates = sc->params.nsched_cls; q->min_segment_burst = 4; /* matches PKTSCHED_BURST in the firmware. */ #if 1 diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index a1bc88bdea7f..3af127c6a3a3 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -102,7 +102,7 @@ send_flowc_wr(struct toepcb *toep, struct tcpcb *tp) nparams++; if (toep->params.tc_idx != -1) { MPASS(toep->params.tc_idx >= 0 && - toep->params.tc_idx < sc->chip_params->nsched_cls); + toep->params.tc_idx < sc->params.nsched_cls); nparams++; } @@ -189,7 +189,7 @@ update_tx_rate_limit(struct adapter *sc, struct toepcb *toep, u_int Bps) rc = t4_reserve_cl_rl_kbps(sc, port_id, kbps, &tc_idx); if (rc != 0) return (rc); - MPASS(tc_idx >= 0 && tc_idx < sc->chip_params->nsched_cls); + MPASS(tc_idx >= 0 && tc_idx < sc->params.nsched_cls); } if (toep->params.tc_idx != tc_idx) { diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index f5c2c6804aa2..d6162ed457c8 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -168,7 +168,7 @@ init_toepcb(struct vi_info *vi, struct toepcb *toep) struct adapter *sc = pi->adapter; struct tx_cl_rl_params *tc; - if (cp->tc_idx >= 0 && cp->tc_idx < sc->chip_params->nsched_cls) { + if (cp->tc_idx >= 0 && cp->tc_idx < sc->params.nsched_cls) { tc = &pi->sched_params->cl_rl[cp->tc_idx]; mtx_lock(&sc->tc_lock); if (tc->flags & CLRL_ERR) { @@ -1314,11 +1314,10 @@ init_conn_params(struct vi_info *vi , struct offload_settings *s, } /* Tx traffic scheduling class. */ - if (s->sched_class >= 0 && - s->sched_class < sc->chip_params->nsched_cls) { - cp->tc_idx = s->sched_class; - } else - cp->tc_idx = -1; + if (s->sched_class >= 0 && s->sched_class < sc->params.nsched_cls) + cp->tc_idx = s->sched_class; + else + cp->tc_idx = -1; /* Nagle's algorithm. */ if (s->nagle >= 0) From owner-dev-commits-src-main@freebsd.org Fri Jun 25 23:10: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 804416454ED; Fri, 25 Jun 2021 23:10: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 4GBXmD34t2z3k0j; Fri, 25 Jun 2021 23:10: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 5196D139FB; Fri, 25 Jun 2021 23:10: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 15PNAa4X050016; Fri, 25 Jun 2021 23:10:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15PNAaeK050015; Fri, 25 Jun 2021 23:10:36 GMT (envelope-from git) Date: Fri, 25 Jun 2021 23:10:36 GMT Message-Id: <202106252310.15PNAaeK050015@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: ec8004dd419d - main - cxgbe(4): Do not configure traffic classes automatically on attach. 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: ec8004dd419d8c8acfc9025dd050f141c949d53a 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, 25 Jun 2021 23:10:36 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=ec8004dd419d8c8acfc9025dd050f141c949d53a commit ec8004dd419d8c8acfc9025dd050f141c949d53a Author: Navdeep Parhar AuthorDate: 2021-06-24 20:05:57 +0000 Commit: Navdeep Parhar CommitDate: 2021-06-25 23:04:09 +0000 cxgbe(4): Do not configure traffic classes automatically on attach. The driver used to configure all available classes with some default parameters on attach and the rest of t4_sched.c was written with the assumption that all traffic classes are always valid in the hardware. But this resulted in a lot of informational messages being logged in the firmware's circular log, crowding out other more useful messages. This change leaves the tx scheduler alone during attach to reduce the spam in the devlog. The state of every class is now tracked separately from its flags and there is support for an 'uninitialized' state. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 16 ++++-- sys/dev/cxgbe/t4_main.c | 4 +- sys/dev/cxgbe/t4_sched.c | 135 +++++++++++++++++++++++++++------------------ sys/dev/cxgbe/tom/t4_tom.c | 9 ++- 4 files changed, 101 insertions(+), 63 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index edcc6e3f5249..2adc902cc9ac 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -258,14 +258,22 @@ struct tx_ch_rl_params { uint32_t maxrate; }; +/* CLRL state */ +enum clrl_state { + CS_UNINITIALIZED = 0, + CS_PARAMS_SET, /* sw parameters have been set. */ + CS_HW_UPDATE_REQUESTED, /* async HW update requested. */ + CS_HW_UPDATE_IN_PROGRESS, /* sync hw update in progress. */ + CS_HW_CONFIGURED /* configured in the hardware. */ +}; + +/* CLRL flags */ enum { - CLRL_USER = (1 << 0), /* allocated manually. */ - CLRL_SYNC = (1 << 1), /* sync hw update in progress. */ - CLRL_ASYNC = (1 << 2), /* async hw update requested. */ - CLRL_ERR = (1 << 3), /* last hw setup ended in error. */ + CF_USER = (1 << 0), /* was configured by driver ioctl. */ }; struct tx_cl_rl_params { + enum clrl_state state; int refcount; uint8_t flags; enum fw_sched_params_rate ratemode; /* %port REL or ABS value */ diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 4c69a152963a..67500b0c44b9 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -7789,7 +7789,7 @@ cxgbe_sysctls(struct port_info *pi) struct adapter *sc = pi->adapter; int i; char name[16]; - static char *tc_flags = {"\20\1USER\2SYNC\3ASYNC\4ERR"}; + static char *tc_flags = {"\20\1USER"}; ctx = device_get_sysctl_ctx(pi->dev); @@ -7866,6 +7866,8 @@ cxgbe_sysctls(struct port_info *pi) children2 = SYSCTL_CHILDREN(SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "traffic class")); + SYSCTL_ADD_UINT(ctx, children2, OID_AUTO, "state", + CTLFLAG_RD, &tc->state, 0, "current state"); SYSCTL_ADD_PROC(ctx, children2, OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, tc_flags, (uintptr_t)&tc->flags, sysctl_bitfield_8b, "A", "flags"); diff --git a/sys/dev/cxgbe/t4_sched.c b/sys/dev/cxgbe/t4_sched.c index 827add3c27ec..b19e62474bbb 100644 --- a/sys/dev/cxgbe/t4_sched.c +++ b/sys/dev/cxgbe/t4_sched.c @@ -185,17 +185,19 @@ set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, if (p->level == SCHED_CLASS_LEVEL_CL_RL) { tc = &pi->sched_params->cl_rl[p->cl]; mtx_lock(&sc->tc_lock); - if (tc->refcount > 0 || tc->flags & (CLRL_SYNC | CLRL_ASYNC)) + if (tc->refcount > 0 || tc->state == CS_HW_UPDATE_IN_PROGRESS) rc = EBUSY; else { - tc->flags |= CLRL_SYNC | CLRL_USER; + old = *tc; + + tc->flags |= CF_USER; + tc->state = CS_HW_UPDATE_IN_PROGRESS; tc->ratemode = fw_ratemode; tc->rateunit = fw_rateunit; tc->mode = fw_mode; tc->maxrate = p->maxrate; tc->pktsize = p->pktsize; rc = 0; - old= *tc; } mtx_unlock(&sc->tc_lock); if (rc != 0) @@ -207,6 +209,9 @@ set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, if (rc != 0) { if (p->level == SCHED_CLASS_LEVEL_CL_RL) { mtx_lock(&sc->tc_lock); + MPASS(tc->refcount == 0); + MPASS(tc->flags & CF_USER); + MPASS(tc->state == CS_HW_UPDATE_IN_PROGRESS); *tc = old; mtx_unlock(&sc->tc_lock); } @@ -221,15 +226,23 @@ set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, if (p->level == SCHED_CLASS_LEVEL_CL_RL) { mtx_lock(&sc->tc_lock); - MPASS(tc->flags & CLRL_SYNC); - MPASS(tc->flags & CLRL_USER); MPASS(tc->refcount == 0); + MPASS(tc->flags & CF_USER); + MPASS(tc->state == CS_HW_UPDATE_IN_PROGRESS); - tc->flags &= ~CLRL_SYNC; if (rc == 0) - tc->flags &= ~CLRL_ERR; - else - tc->flags |= CLRL_ERR; + tc->state = CS_HW_CONFIGURED; + else { + /* parameters failed so we don't park at params_set */ + tc->state = CS_UNINITIALIZED; + tc->flags &= ~CF_USER; + CH_ERR(pi, "failed to configure traffic class %d: %d. " + "params: mode %d, rateunit %d, ratemode %d, " + "channel %d, minrate %d, maxrate %d, pktsize %d, " + "burstsize %d\n", p->cl, rc, fw_mode, fw_rateunit, + fw_ratemode, p->channel, p->minrate, p->maxrate, + p->pktsize, 0); + } mtx_unlock(&sc->tc_lock); } @@ -251,7 +264,7 @@ update_tx_sched(void *context, int pending) tc = &pi->sched_params->cl_rl[0]; for (j = 0; j < n; j++, tc++) { MPASS(mtx_owned(&sc->tc_lock)); - if ((tc->flags & CLRL_ASYNC) == 0) + if (tc->state != CS_HW_UPDATE_REQUESTED) continue; mtx_unlock(&sc->tc_lock); @@ -267,12 +280,22 @@ update_tx_sched(void *context, int pending) end_synchronized_op(sc, 0); mtx_lock(&sc->tc_lock); - MPASS(tc->flags & CLRL_ASYNC); - tc->flags &= ~CLRL_ASYNC; - if (rc == 0) - tc->flags &= ~CLRL_ERR; + MPASS(tc->state == CS_HW_UPDATE_REQUESTED); + if (rc == 0) { + tc->state = CS_HW_CONFIGURED; + continue; + } + /* parameters failed so we try to avoid params_set */ + if (tc->refcount > 0) + tc->state = CS_PARAMS_SET; else - tc->flags |= CLRL_ERR; + tc->state = CS_UNINITIALIZED; + CH_ERR(pi, "failed to configure traffic class %d: %d. " + "params: mode %d, rateunit %d, ratemode %d, " + "channel %d, minrate %d, maxrate %d, pktsize %d, " + "burstsize %d\n", j, rc, tc->mode, tc->rateunit, + tc->ratemode, pi->tx_chan, 0, tc->maxrate, + tc->pktsize, tc->burstsize); } } mtx_unlock(&sc->tc_lock); @@ -320,7 +343,7 @@ bind_txq_to_traffic_class(struct adapter *sc, struct sge_txq *txq, int idx) * Bind to a different class at index idx. */ tc = &tc0[idx]; - if (tc->flags & CLRL_ERR) { + if (tc->state != CS_HW_CONFIGURED) { rc = ENXIO; goto done; } else { @@ -338,14 +361,15 @@ bind_txq_to_traffic_class(struct adapter *sc, struct sge_txq *txq, int idx) mtx_unlock(&sc->tc_lock); rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4btxq"); - if (rc != 0) - return (rc); - fw_mnem = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | - V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH) | - V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); - fw_class = idx < 0 ? 0xffffffff : idx; - rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_mnem, &fw_class); - end_synchronized_op(sc, 0); + if (rc == 0) { + fw_mnem = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH) | + V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); + fw_class = idx < 0 ? 0xffffffff : idx; + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_mnem, + &fw_class); + end_synchronized_op(sc, 0); + } mtx_lock(&sc->tc_lock); MPASS(txq->tc_idx == -2); @@ -430,29 +454,16 @@ t4_set_sched_queue(struct adapter *sc, struct t4_sched_queue *p) int t4_init_tx_sched(struct adapter *sc) { - int i, j; + int i; const int n = sc->params.nsched_cls; struct port_info *pi; - struct tx_cl_rl_params *tc; mtx_init(&sc->tc_lock, "tx_sched lock", NULL, MTX_DEF); TASK_INIT(&sc->tc_task, 0, update_tx_sched, sc); for_each_port(sc, i) { pi = sc->port[i]; pi->sched_params = malloc(sizeof(*pi->sched_params) + - n * sizeof(*tc), M_CXGBE, M_ZERO | M_WAITOK); - tc = &pi->sched_params->cl_rl[0]; - for (j = 0; j < n; j++, tc++) { - tc->refcount = 0; - tc->ratemode = FW_SCHED_PARAMS_RATE_ABS; - tc->rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; - tc->mode = FW_SCHED_PARAMS_MODE_CLASS; - tc->maxrate = 1000 * 1000; /* 1 Gbps. Arbitrary */ - - if (t4_sched_params_cl_rl_kbps(sc, pi->tx_chan, j, - tc->mode, tc->maxrate, tc->pktsize, 1) != 0) - tc->flags = CLRL_ERR; - } + n * sizeof(struct tx_cl_rl_params), M_CXGBE, M_ZERO | M_WAITOK); } return (0); @@ -487,7 +498,7 @@ int t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, int *tc_idx) { - int rc = 0, fa = -1, i, pktsize, burstsize; + int rc = 0, fa, fa2, i, pktsize, burstsize; bool update; struct tx_cl_rl_params *tc; struct port_info *pi; @@ -506,30 +517,47 @@ t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, tc = &pi->sched_params->cl_rl[0]; update = false; + fa = fa2 = -1; mtx_lock(&sc->tc_lock); for (i = 0; i < sc->params.nsched_cls; i++, tc++) { - if (fa < 0 && tc->refcount == 0 && !(tc->flags & CLRL_USER)) - fa = i; /* first available */ - - if (tc->ratemode == FW_SCHED_PARAMS_RATE_ABS && + if (tc->state >= CS_PARAMS_SET && + tc->ratemode == FW_SCHED_PARAMS_RATE_ABS && tc->rateunit == FW_SCHED_PARAMS_UNIT_BITRATE && tc->mode == FW_SCHED_PARAMS_MODE_FLOW && tc->maxrate == maxrate && tc->pktsize == pktsize && tc->burstsize == burstsize) { tc->refcount++; *tc_idx = i; - if ((tc->flags & (CLRL_ERR | CLRL_ASYNC | CLRL_SYNC)) == - CLRL_ERR) { + if (tc->state == CS_PARAMS_SET) { + tc->state = CS_HW_UPDATE_REQUESTED; update = true; } goto done; } + + if (fa < 0 && tc->state == CS_UNINITIALIZED) { + MPASS(tc->refcount == 0); + fa = i; /* first available, never used. */ + } + if (fa2 < 0 && tc->refcount == 0 && !(tc->flags & CF_USER)) { + fa2 = i; /* first available, used previously. */ + } } /* Not found */ MPASS(i == sc->params.nsched_cls); - if (fa != -1) { + if (fa == -1) + fa = fa2; + if (fa == -1) { + *tc_idx = -1; + rc = ENOSPC; + } else { + MPASS(fa >= 0 && fa < sc->params.nsched_cls); tc = &pi->sched_params->cl_rl[fa]; + MPASS(!(tc->flags & CF_USER)); + MPASS(tc->refcount == 0); + tc->refcount = 1; + tc->state = CS_HW_UPDATE_REQUESTED; tc->ratemode = FW_SCHED_PARAMS_RATE_ABS; tc->rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; tc->mode = FW_SCHED_PARAMS_MODE_FLOW; @@ -538,16 +566,11 @@ t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, tc->burstsize = burstsize; *tc_idx = fa; update = true; - } else { - *tc_idx = -1; - rc = ENOSPC; } done: mtx_unlock(&sc->tc_lock); - if (update) { - tc->flags |= CLRL_ASYNC; + if (update) t4_update_tx_sched(sc); - } return (rc); } @@ -616,6 +639,11 @@ sysctl_tc_params(SYSCTL_HANDLER_ARGS) tc = sc->port[port_id]->sched_params->cl_rl[i]; mtx_unlock(&sc->tc_lock); + if (tc.state < CS_PARAMS_SET) { + sbuf_printf(sb, "uninitialized"); + goto done; + } + switch (tc.rateunit) { case SCHED_CLASS_RATEUNIT_BITS: switch (tc.ratemode) { @@ -649,6 +677,7 @@ sysctl_tc_params(SYSCTL_HANDLER_ARGS) switch (tc.mode) { case SCHED_CLASS_MODE_CLASS: + /* Note that pktsize and burstsize are not used in this mode. */ sbuf_printf(sb, " aggregate"); break; case SCHED_CLASS_MODE_FLOW: diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index d6162ed457c8..1d065ade77c4 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -171,11 +171,10 @@ init_toepcb(struct vi_info *vi, struct toepcb *toep) if (cp->tc_idx >= 0 && cp->tc_idx < sc->params.nsched_cls) { tc = &pi->sched_params->cl_rl[cp->tc_idx]; mtx_lock(&sc->tc_lock); - if (tc->flags & CLRL_ERR) { - log(LOG_ERR, - "%s: failed to associate traffic class %u with tid %u\n", - device_get_nameunit(vi->dev), cp->tc_idx, - toep->tid); + if (tc->state != CS_HW_CONFIGURED) { + CH_ERR(vi, "tid %d cannot be bound to traffic class %d " + "because it is not configured (its state is %d)\n", + toep->tid, cp->tc_idx, tc->state); cp->tc_idx = -1; } else { tc->refcount++; From owner-dev-commits-src-main@freebsd.org Sat Jun 26 00:27: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 E1BCA646D2B; Sat, 26 Jun 2021 00:27: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 4GBZSg5llJz3nqD; Sat, 26 Jun 2021 00:27: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 AE3F915285; Sat, 26 Jun 2021 00:27: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 15Q0RFuQ049877; Sat, 26 Jun 2021 00:27:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15Q0RFM2049876; Sat, 26 Jun 2021 00:27:15 GMT (envelope-from git) Date: Sat, 26 Jun 2021 00:27:15 GMT Message-Id: <202106260027.15Q0RFM2049876@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 33b8c039a960 - main - zfs: merge openzfs/zfs@5e2c8338b (master) into main MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33b8c039a960bcff3471baf5929558c4d1500727 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, 26 Jun 2021 00:27:15 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=33b8c039a960bcff3471baf5929558c4d1500727 commit 33b8c039a960bcff3471baf5929558c4d1500727 Merge: ec8004dd419d 5e2c8338bf17 Author: Martin Matuska AuthorDate: 2021-06-26 00:21:11 +0000 Commit: Martin Matuska CommitDate: 2021-06-26 00:21:11 +0000 zfs: merge openzfs/zfs@5e2c8338b (master) into main Notable upstream pull request merges: #12183 Optimize small random numbers generation #12227 Revert Consolidate arc_buf allocation checks #12266 Fix flag copying in resume case #12273 zfs_metaslab_mem_limit should be 25 instead of 75 #12276 Update cache file when setting compatibility property #12280 Help compiller optimize out abd_verify() #12282 FreeBSD: fix compilation of FreeBSD world after 29274c9f6 Obtained from: OpenZFS OpenZFS commit: 5e2c8338bf17d31b44eb1dbbb3c9b6a0f64e96ee .../openzfs/.github/ISSUE_TEMPLATE/config.yml | 2 +- sys/contrib/openzfs/META | 2 +- sys/contrib/openzfs/cmd/ztest/ztest.c | 4 +- .../openzfs/contrib/pam_zfs_key/pam_zfs_key.c | 12 +- .../openzfs/include/os/freebsd/spl/sys/random.h | 22 ++++ .../openzfs/include/os/linux/spl/sys/random.h | 15 +++ sys/contrib/openzfs/include/sys/crypto/api.h | 2 +- sys/contrib/openzfs/include/sys/dnode.h | 6 +- sys/contrib/openzfs/include/sys/spa.h | 1 - sys/contrib/openzfs/include/sys/zfs_context.h | 15 +++ sys/contrib/openzfs/include/sys/zfs_debug.h | 2 +- sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c | 4 + sys/contrib/openzfs/lib/libzpool/kernel.c | 2 +- .../openzfs/module/os/freebsd/zfs/zfs_debug.c | 2 +- .../openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 9 +- sys/contrib/openzfs/module/os/linux/zfs/arc_os.c | 4 +- .../openzfs/module/os/linux/zfs/zfs_debug.c | 3 +- .../openzfs/module/os/linux/zfs/zio_crypt.c | 20 ++-- sys/contrib/openzfs/module/zfs/abd.c | 4 +- sys/contrib/openzfs/module/zfs/arc.c | 26 +++-- sys/contrib/openzfs/module/zfs/dbuf.c | 124 +++++++++++++-------- sys/contrib/openzfs/module/zfs/dmu_objset.c | 2 +- sys/contrib/openzfs/module/zfs/dmu_recv.c | 44 +++++--- sys/contrib/openzfs/module/zfs/dmu_tx.c | 3 +- sys/contrib/openzfs/module/zfs/dnode.c | 8 +- sys/contrib/openzfs/module/zfs/dnode_sync.c | 5 +- sys/contrib/openzfs/module/zfs/dsl_dataset.c | 4 +- sys/contrib/openzfs/module/zfs/dsl_destroy.c | 2 +- sys/contrib/openzfs/module/zfs/dsl_dir.c | 11 +- sys/contrib/openzfs/module/zfs/metaslab.c | 71 ++++++------ sys/contrib/openzfs/module/zfs/mmp.c | 23 ++-- sys/contrib/openzfs/module/zfs/multilist.c | 5 +- sys/contrib/openzfs/module/zfs/range_tree.c | 3 +- sys/contrib/openzfs/module/zfs/sa.c | 2 +- sys/contrib/openzfs/module/zfs/spa.c | 71 +++++++----- sys/contrib/openzfs/module/zfs/spa_checkpoint.c | 13 ++- sys/contrib/openzfs/module/zfs/spa_history.c | 9 +- sys/contrib/openzfs/module/zfs/spa_misc.c | 32 ++---- sys/contrib/openzfs/module/zfs/space_map.c | 10 +- sys/contrib/openzfs/module/zfs/txg.c | 23 ++-- sys/contrib/openzfs/module/zfs/vdev.c | 5 +- sys/contrib/openzfs/module/zfs/vdev_indirect.c | 11 +- sys/contrib/openzfs/module/zfs/vdev_mirror.c | 2 +- sys/contrib/openzfs/module/zfs/vdev_removal.c | 21 ++-- sys/contrib/openzfs/module/zfs/zap.c | 8 +- sys/contrib/openzfs/module/zfs/zap_micro.c | 9 +- sys/contrib/openzfs/module/zfs/zcp.c | 3 +- sys/contrib/openzfs/module/zfs/zil.c | 11 +- sys/contrib/openzfs/module/zfs/zio.c | 40 ++++--- sys/contrib/openzfs/module/zfs/zio_compress.c | 2 +- sys/contrib/openzfs/module/zfs/zio_inject.c | 8 +- sys/contrib/openzfs/tests/runfiles/common.run | 3 +- .../openzfs/tests/test-runner/bin/zts-report.py.in | 3 + .../openzfs/tests/zfs-tests/include/commands.cfg | 1 - .../functional/cli_root/zpool_create/Makefile.am | 1 + .../zpool_create/zpool_create_features_009_pos.ksh | 92 +++++++++++++++ .../functional/redacted_send/redacted_embedded.ksh | 4 +- .../zfs-tests/tests/functional/rsend/rsend.kshlib | 12 +- .../functional/rsend/send-c_embedded_blocks.ksh | 10 +- .../tests/functional/rsend/send-c_zstreamdump.ksh | 12 +- .../functional/rsend/send-cpL_varied_recsize.ksh | 2 +- sys/modules/zfs/zfs_config.h | 6 +- 62 files changed, 585 insertions(+), 303 deletions(-) diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_009_pos.ksh index 000000000000,052c18dcee2b..052c18dcee2b mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_009_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_009_pos.ksh diff --cc sys/modules/zfs/zfs_config.h index 1e9bdef25a1c,000000000000..ae32a588b104 mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,774 -1,0 +1,774 @@@ +/* + * $FreeBSD$ + */ + +/* zfs_config.h. Generated from zfs_config.h.in by configure. */ +/* zfs_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* bio_end_io_t wants 1 arg */ +/* #undef HAVE_1ARG_BIO_END_IO_T */ + +/* lookup_bdev() wants 1 arg */ +/* #undef HAVE_1ARG_LOOKUP_BDEV */ + +/* submit_bio() wants 1 arg */ +/* #undef HAVE_1ARG_SUBMIT_BIO */ + +/* bdi_setup_and_register() wants 2 args */ +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 2 args */ +/* #undef HAVE_2ARGS_VFS_GETATTR */ + +/* zlib_deflate_workspacesize() wants 2 args */ +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ + +/* bdi_setup_and_register() wants 3 args */ +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 3 args */ +/* #undef HAVE_3ARGS_VFS_GETATTR */ + +/* vfs_getattr wants 4 args */ +/* #undef HAVE_4ARGS_VFS_GETATTR */ + +/* kernel has access_ok with 'type' parameter */ +/* #undef HAVE_ACCESS_OK_TYPE */ + +/* posix_acl has refcount_t */ +/* #undef HAVE_ACL_REFCOUNT */ + +/* Define if host toolchain supports AES */ +#define HAVE_AES 1 + +#ifdef __amd64__ +#ifndef RESCUE +/* Define if host toolchain supports AVX */ +#define HAVE_AVX 1 +#endif + +/* Define if host toolchain supports AVX2 */ +#define HAVE_AVX2 1 + +/* Define if host toolchain supports AVX512BW */ +#define HAVE_AVX512BW 1 + +/* Define if host toolchain supports AVX512CD */ +#define HAVE_AVX512CD 1 + +/* Define if host toolchain supports AVX512DQ */ +#define HAVE_AVX512DQ 1 + +/* Define if host toolchain supports AVX512ER */ +#define HAVE_AVX512ER 1 + +/* Define if host toolchain supports AVX512F */ +#define HAVE_AVX512F 1 + +/* Define if host toolchain supports AVX512IFMA */ +#define HAVE_AVX512IFMA 1 + +/* Define if host toolchain supports AVX512PF */ +#define HAVE_AVX512PF 1 + +/* Define if host toolchain supports AVX512VBMI */ +#define HAVE_AVX512VBMI 1 + +/* Define if host toolchain supports AVX512VL */ +#define HAVE_AVX512VL 1 +#endif + +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + +/* bio->bi_opf is defined */ +/* #undef HAVE_BIO_BI_OPF */ + +/* bio->bi_status exists */ +/* #undef HAVE_BIO_BI_STATUS */ + +/* bio has bi_iter */ +/* #undef HAVE_BIO_BVEC_ITER */ + +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + +/* bio_set_dev() is available */ +/* #undef HAVE_BIO_SET_DEV */ + +/* bio_set_dev() GPL-only */ +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */ + +/* bio_set_op_attrs is available */ +/* #undef HAVE_BIO_SET_OP_ATTRS */ + +/* blkdev_reread_part() exists */ +/* #undef HAVE_BLKDEV_REREAD_PART */ + +/* blkg_tryget() is available */ +/* #undef HAVE_BLKG_TRYGET */ + +/* blkg_tryget() GPL-only */ +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */ + +/* blk_alloc_queue() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ + +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + +/* blk queue backing_dev_info is dynamic */ +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ + +/* blk_queue_flag_clear() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */ + +/* blk_queue_flag_set() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_SET */ + +/* blk_queue_flush() is available */ +/* #undef HAVE_BLK_QUEUE_FLUSH */ + +/* blk_queue_flush() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */ + +/* blk_queue_secdiscard() is available */ +/* #undef HAVE_BLK_QUEUE_SECDISCARD */ + +/* blk_queue_secure_erase() is available */ +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */ + +/* blk_queue_write_cache() exists */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */ + +/* blk_queue_write_cache() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + +/* clear_inode() is available */ +/* #undef HAVE_CLEAR_INODE */ + +/* dentry uses const struct dentry_operations */ +/* #undef HAVE_CONST_DENTRY_OPERATIONS */ + +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + +/* current_time() exists */ +/* #undef HAVE_CURRENT_TIME */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* DECLARE_EVENT_CLASS() is available */ +/* #undef HAVE_DECLARE_EVENT_CLASS */ + +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + +/* sops->dirty_inode() wants flags */ +/* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* d_make_root() is available */ +/* #undef HAVE_D_MAKE_ROOT */ + +/* d_prune_aliases() is available */ +/* #undef HAVE_D_PRUNE_ALIASES */ + +/* dops->d_revalidate() operation takes nameidata */ +/* #undef HAVE_D_REVALIDATE_NAMEIDATA */ + +/* eops->encode_fh() wants child and parent inodes */ +/* #undef HAVE_ENCODE_FH_WITH_INODE */ + +/* sops->evict_inode() exists */ +/* #undef HAVE_EVICT_INODE */ + +/* fops->aio_fsync() exists */ +/* #undef HAVE_FILE_AIO_FSYNC */ + +/* file_dentry() is available */ +/* #undef HAVE_FILE_DENTRY */ + +/* file_inode() is available */ +/* #undef HAVE_FILE_INODE */ + +/* iops->follow_link() cookie */ +/* #undef HAVE_FOLLOW_LINK_COOKIE */ + +/* iops->follow_link() nameidata */ +/* #undef HAVE_FOLLOW_LINK_NAMEIDATA */ + +/* fops->fsync() with range */ +/* #undef HAVE_FSYNC_RANGE */ + +/* fops->fsync() without dentry */ +/* #undef HAVE_FSYNC_WITHOUT_DENTRY */ + +/* generic_*_io_acct() 3 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_3ARG */ + +/* generic_*_io_acct() 4 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_4ARG */ + +/* generic_readlink is global */ +/* #undef HAVE_GENERIC_READLINK */ + +/* generic_setxattr() exists */ +/* #undef HAVE_GENERIC_SETXATTR */ + +/* generic_write_checks() takes kiocb */ +/* #undef HAVE_GENERIC_WRITE_CHECKS_KIOCB */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* iops->get_link() cookie */ +/* #undef HAVE_GET_LINK_COOKIE */ + +/* iops->get_link() delayed */ +/* #undef HAVE_GET_LINK_DELAYED */ + +/* group_info->gid exists */ +/* #undef HAVE_GROUP_INFO_GID */ + +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* yes */ +/* #undef HAVE_INODE_LOCK_SHARED */ + +/* inode_set_flags() exists */ +/* #undef HAVE_INODE_SET_FLAGS */ + +/* inode_set_iversion() exists */ +/* #undef HAVE_INODE_SET_IVERSION */ + +/* inode->i_*time's are timespec64 */ +/* #undef HAVE_INODE_TIMESPEC64_TIMES */ + +/* timestamp_truncate() exists */ +/* #undef HAVE_INODE_TIMESTAMP_TRUNCATE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* in_compat_syscall() is available */ +/* #undef HAVE_IN_COMPAT_SYSCALL */ + +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT_LEGACY */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + +/* yes */ +/* #undef HAVE_IO_SCHEDULE_TIMEOUT */ + +/* Define to 1 if you have the `issetugid' function. */ +#define HAVE_ISSETUGID 1 + +/* kernel has kernel_fpu_* functions */ +/* #undef HAVE_KERNEL_FPU */ + +/* kernel has asm/fpu/api.h */ +/* #undef HAVE_KERNEL_FPU_API_HEADER */ + +/* kernel fpu internal */ +/* #undef HAVE_KERNEL_FPU_INTERNAL */ + +/* uncached_acl_sentinel() exists */ +/* #undef HAVE_KERNEL_GET_ACL_HANDLE_CACHE */ + +/* kernel does stack verification */ +/* #undef HAVE_KERNEL_OBJTOOL */ + +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + +/* kernel_read() take loff_t pointer */ +/* #undef HAVE_KERNEL_READ_PPOS */ + +/* timer_list.function gets a timer_list */ +/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */ + +/* struct timer_list has a flags member */ +/* #undef HAVE_KERNEL_TIMER_LIST_FLAGS */ + +/* timer_setup() is available */ +/* #undef HAVE_KERNEL_TIMER_SETUP */ + +/* kernel_write() take loff_t pointer */ +/* #undef HAVE_KERNEL_WRITE_PPOS */ + +/* kmem_cache_create_usercopy() exists */ +/* #undef HAVE_KMEM_CACHE_CREATE_USERCOPY */ + +/* kstrtoul() exists */ +/* #undef HAVE_KSTRTOUL */ + +/* ktime_get_coarse_real_ts64() exists */ +/* #undef HAVE_KTIME_GET_COARSE_REAL_TS64 */ + +/* ktime_get_raw_ts64() exists */ +/* #undef HAVE_KTIME_GET_RAW_TS64 */ + +/* kvmalloc exists */ +/* #undef HAVE_KVMALLOC */ + +/* kernel has large stacks */ +/* #undef HAVE_LARGE_STACKS */ + +/* Define if you have [aio] */ +/* #undef HAVE_LIBAIO */ + +/* Define if you have [blkid] */ +/* #undef HAVE_LIBBLKID */ + +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have [tirpc] */ +/* #undef HAVE_LIBTIRPC */ + +/* Define if you have [udev] */ +/* #undef HAVE_LIBUDEV */ + +/* Define if you have [uuid] */ +/* #undef HAVE_LIBUUID */ + +/* lseek_execute() is available */ +/* #undef HAVE_LSEEK_EXECUTE */ + +/* makedev() is declared in sys/mkdev.h */ +/* #undef HAVE_MAKEDEV_IN_MKDEV */ + +/* makedev() is declared in sys/sysmacros.h */ +/* #undef HAVE_MAKEDEV_IN_SYSMACROS */ + +/* Noting that make_request_fn() returns blk_qc_t */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_QC */ + +/* Noting that make_request_fn() returns void */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_VOID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* iops->create()/mkdir()/mknod() take umode_t */ +/* #undef HAVE_MKDIR_UMODE_T */ + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + +/* Define if host toolchain supports MOVBE */ +#define HAVE_MOVBE 1 + +/* new_sync_read()/new_sync_write() are available */ +/* #undef HAVE_NEW_SYNC_READ */ + +/* iops->getattr() takes a path */ +/* #undef HAVE_PATH_IOPS_GETATTR */ + +/* Define if host toolchain supports PCLMULQDQ */ +#define HAVE_PCLMULQDQ 1 + +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + +/* posix_acl_chmod() exists */ +/* #undef HAVE_POSIX_ACL_CHMOD */ + +/* posix_acl_from_xattr() needs user_ns */ +/* #undef HAVE_POSIX_ACL_FROM_XATTR_USERNS */ + +/* posix_acl_release() is available */ +/* #undef HAVE_POSIX_ACL_RELEASE */ + +/* posix_acl_release() is GPL-only */ +/* #undef HAVE_POSIX_ACL_RELEASE_GPL_ONLY */ + +/* posix_acl_valid() wants user namespace */ +/* #undef HAVE_POSIX_ACL_VALID_WITH_NS */ + +/* proc_ops structure exists */ +/* #undef HAVE_PROC_OPS_STRUCT */ + +/* iops->put_link() cookie */ +/* #undef HAVE_PUT_LINK_COOKIE */ + +/* iops->put_link() delayed */ +/* #undef HAVE_PUT_LINK_DELAYED */ + +/* iops->put_link() nameidata */ +/* #undef HAVE_PUT_LINK_NAMEIDATA */ + +/* If available, contains the Python version number currently in use. */ +#define HAVE_PYTHON "3.7" + +/* qat is enabled and existed */ +/* #undef HAVE_QAT */ + +/* iops->rename() wants flags */ +/* #undef HAVE_RENAME_WANTS_FLAGS */ + +/* REQ_DISCARD is defined */ +/* #undef HAVE_REQ_DISCARD */ + +/* REQ_FLUSH is defined */ +/* #undef HAVE_REQ_FLUSH */ + +/* REQ_OP_DISCARD is defined */ +/* #undef HAVE_REQ_OP_DISCARD */ + +/* REQ_OP_FLUSH is defined */ +/* #undef HAVE_REQ_OP_FLUSH */ + +/* REQ_OP_SECURE_ERASE is defined */ +/* #undef HAVE_REQ_OP_SECURE_ERASE */ + +/* REQ_PREFLUSH is defined */ +/* #undef HAVE_REQ_PREFLUSH */ + +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + +/* struct rw_semaphore has member activity */ +/* #undef HAVE_RWSEM_ACTIVITY */ + +/* struct rw_semaphore has atomic_long_t member count */ +/* #undef HAVE_RWSEM_ATOMIC_LONG_COUNT */ + +/* linux/sched/signal.h exists */ +/* #undef HAVE_SCHED_SIGNAL_HEADER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* setattr_prepare() is available */ +/* #undef HAVE_SETATTR_PREPARE */ + +/* iops->set_acl() exists */ +/* #undef HAVE_SET_ACL */ + +/* set_cached_acl() is usable */ +/* #undef HAVE_SET_CACHED_ACL_USABLE */ + +/* struct shrink_control exists */ +/* #undef HAVE_SHRINK_CONTROL_STRUCT */ + +/* new shrinker callback wants 2 args */ +/* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ + +/* ->count_objects exists */ +/* #undef HAVE_SPLIT_SHRINKER_CALLBACK */ + +#if defined(__amd64__) || defined(__i386__) +/* Define if host toolchain supports SSE */ +#define HAVE_SSE 1 + +/* Define if host toolchain supports SSE2 */ +#define HAVE_SSE2 1 + +/* Define if host toolchain supports SSE3 */ +#define HAVE_SSE3 1 + +/* Define if host toolchain supports SSE4.1 */ +#define HAVE_SSE4_1 1 + +/* Define if host toolchain supports SSE4.2 */ +#define HAVE_SSE4_2 1 + +/* Define if host toolchain supports SSSE3 */ +#define HAVE_SSSE3 1 +#endif + +/* STACK_FRAME_NON_STANDARD is defined */ +/* #undef HAVE_STACK_FRAME_NON_STANDARD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + +/* super_setup_bdi_name() exits */ +/* #undef HAVE_SUPER_SETUP_BDI_NAME */ + +/* super_block->s_user_ns exists */ +/* #undef HAVE_SUPER_USER_NS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* i_op->tmpfile() exists */ +/* #undef HAVE_TMPFILE */ + +/* totalhigh_pages() exists */ +/* #undef HAVE_TOTALHIGH_PAGES */ + +/* kernel has totalram_pages() */ +/* #undef HAVE_TOTALRAM_PAGES_FUNC */ + +/* Define to 1 if you have the `udev_device_get_is_initialized' function. */ +/* #undef HAVE_UDEV_DEVICE_GET_IS_INITIALIZED */ + +/* kernel has __kernel_fpu_* functions */ +/* #undef HAVE_UNDERSCORE_KERNEL_FPU */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* iops->getattr() takes a vfsmount */ +/* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ + +/* aops->direct_IO() uses iovec */ +/* #undef HAVE_VFS_DIRECT_IO_IOVEC */ + +/* aops->direct_IO() uses iov_iter without rw */ +/* #undef HAVE_VFS_DIRECT_IO_ITER */ + +/* aops->direct_IO() uses iov_iter with offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_OFFSET */ + +/* aops->direct_IO() uses iov_iter with rw and offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET */ + +/* All required iov_iter interfaces are available */ +/* #undef HAVE_VFS_IOV_ITER */ + +/* fops->iterate() is available */ +/* #undef HAVE_VFS_ITERATE */ + +/* fops->iterate_shared() is available */ +/* #undef HAVE_VFS_ITERATE_SHARED */ + +/* fops->readdir() is available */ +/* #undef HAVE_VFS_READDIR */ + +/* fops->read/write_iter() are available */ +/* #undef HAVE_VFS_RW_ITERATE */ + +/* __vmalloc page flags exists */ +/* #undef HAVE_VMALLOC_PAGE_KERNEL */ + +/* yes */ +/* #undef HAVE_WAIT_ON_BIT_ACTION */ + +/* wait_queue_entry_t exists */ +/* #undef HAVE_WAIT_QUEUE_ENTRY_T */ + +/* wq_head->head and wq_entry->entry exist */ +/* #undef HAVE_WAIT_QUEUE_HEAD_ENTRY */ + +/* xattr_handler->get() wants dentry */ +/* #undef HAVE_XATTR_GET_DENTRY */ + +/* xattr_handler->get() wants both dentry and inode */ +/* #undef HAVE_XATTR_GET_DENTRY_INODE */ + +/* xattr_handler->get() wants xattr_handler */ +/* #undef HAVE_XATTR_GET_HANDLER */ + +/* xattr_handler has name */ +/* #undef HAVE_XATTR_HANDLER_NAME */ + +/* xattr_handler->list() wants dentry */ +/* #undef HAVE_XATTR_LIST_DENTRY */ + +/* xattr_handler->list() wants xattr_handler */ +/* #undef HAVE_XATTR_LIST_HANDLER */ + +/* xattr_handler->list() wants simple */ +/* #undef HAVE_XATTR_LIST_SIMPLE */ + +/* xattr_handler->set() wants dentry */ +/* #undef HAVE_XATTR_SET_DENTRY */ + +/* xattr_handler->set() wants both dentry and inode */ +/* #undef HAVE_XATTR_SET_DENTRY_INODE */ + +/* xattr_handler->set() wants xattr_handler */ +/* #undef HAVE_XATTR_SET_HANDLER */ + +/* Define if you have [z] */ +#define HAVE_ZLIB 1 + +/* __posix_acl_chmod() exists */ +/* #undef HAVE___POSIX_ACL_CHMOD */ + +/* kernel exports FPU functions */ +/* #undef KERNEL_EXPORTS_X86_FPU */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* make_request_fn() return type */ +/* #undef MAKE_REQUEST_FN_RET */ + +/* hardened module_param_call */ +/* #undef MODULE_PARAM_CALL_CONST */ + +/* struct shrink_control has nid */ +/* #undef SHRINK_CONTROL_HAS_NID */ + +/* Defined for legacy compatibility. */ +#define SPL_META_ALIAS ZFS_META_ALIAS + +/* Defined for legacy compatibility. */ +#define SPL_META_RELEASE ZFS_META_RELEASE + +/* Defined for legacy compatibility. */ +#define SPL_META_VERSION ZFS_META_VERSION + +/* True if ZFS is to be compiled for a FreeBSD system */ +#define SYSTEM_FREEBSD 1 + +/* True if ZFS is to be compiled for a Linux system */ +/* #undef SYSTEM_LINUX */ + +/* zfs debugging enabled */ +/* #undef ZFS_DEBUG */ + +/* /dev/zfs minor */ +/* #undef ZFS_DEVICE_MINOR */ + +/* enum node_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum node_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum node_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* enum zone_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum zone_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum zone_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* global_node_page_state() exists */ +/* #undef ZFS_GLOBAL_NODE_PAGE_STATE */ + +/* global_zone_page_state() exists */ +/* #undef ZFS_GLOBAL_ZONE_PAGE_STATE */ + +/* Define to 1 if GPL-only symbols can be used */ +/* #undef ZFS_IS_GPL_COMPATIBLE */ + +/* Define the project alias string. */ - #define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_gc4c162c1e" ++#define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_g5e2c8338b" + +/* Define the project author. */ +#define ZFS_META_AUTHOR "OpenZFS" + +/* Define the project release date. */ +/* #undef ZFS_META_DATA */ + +/* Define the maximum compatible kernel version. */ - #define ZFS_META_KVER_MAX "5.11" ++#define ZFS_META_KVER_MAX "5.12" + +/* Define the minimum compatible kernel version. */ +#define ZFS_META_KVER_MIN "3.10" + +/* Define the project license. */ +#define ZFS_META_LICENSE "CDDL" + +/* Define the libtool library 'age' version information. */ +/* #undef ZFS_META_LT_AGE */ + +/* Define the libtool library 'current' version information. */ +/* #undef ZFS_META_LT_CURRENT */ + +/* Define the libtool library 'revision' version information. */ +/* #undef ZFS_META_LT_REVISION */ + +/* Define the project name. */ +#define ZFS_META_NAME "zfs" + +/* Define the project release. */ - #define ZFS_META_RELEASE "FreeBSD_gc4c162c1e" ++#define ZFS_META_RELEASE "FreeBSD_g5e2c8338b" + +/* Define the project version. */ +#define ZFS_META_VERSION "2.1.99" + +/* count is located in percpu_ref.data */ +/* #undef ZFS_PERCPU_REF_COUNT_IN_DATA */ + From owner-dev-commits-src-main@freebsd.org Sat Jun 26 00:57: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 684506471F0; Sat, 26 Jun 2021 00:57: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 4GBb7d2FQdz3rBF; Sat, 26 Jun 2021 00:57: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 30E33157A3; Sat, 26 Jun 2021 00:57: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 15Q0vXCW089884; Sat, 26 Jun 2021 00:57:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15Q0vXf4089883; Sat, 26 Jun 2021 00:57:33 GMT (envelope-from git) Date: Sat, 26 Jun 2021 00:57:33 GMT Message-Id: <202106260057.15Q0vXf4089883@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John-Mark Gurney Subject: git: b43d600c839a - main - Add support for link status, media and VLAN MTU (if supported) to if_cdce... MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jmg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b43d600c839a9a4d66139c93506e26128370ed7c 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, 26 Jun 2021 00:57:33 -0000 The branch main has been updated by jmg: URL: https://cgit.FreeBSD.org/src/commit/?id=b43d600c839a9a4d66139c93506e26128370ed7c commit b43d600c839a9a4d66139c93506e26128370ed7c Author: John-Mark Gurney AuthorDate: 2021-06-26 00:47:02 +0000 Commit: John-Mark Gurney CommitDate: 2021-06-26 00:57:04 +0000 Add support for link status, media and VLAN MTU (if supported) to if_cdce... This makes it more usable in that dhclient will autolaunch from devd now when cdce devices are plugged in.. It also sets the baudrate, but this isn't exported via tools, and CDCE doesn't have a good way to specify the media type, so there isn't a good way to tell userland what the speed is currently... Reviewed by: hps Relnotes: yes Differential Revision: https://reviews.freebsd.org/D30625 --- sys/dev/usb/net/if_cdce.c | 152 +++++++++++++++++++++++++++++++++++++++++-- sys/dev/usb/net/if_cdcereg.h | 3 + 2 files changed, 150 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index 96df8b73f8ce..64c31896d417 100644 --- a/sys/dev/usb/net/if_cdce.c +++ b/sys/dev/usb/net/if_cdce.c @@ -111,6 +111,10 @@ static uether_fn_t cdce_stop; static uether_fn_t cdce_start; static uether_fn_t cdce_setmulti; static uether_fn_t cdce_setpromisc; +static int cdce_attach_post_sub(struct usb_ether *); +static int cdce_ioctl(struct ifnet *, u_long, caddr_t); +static int cdce_media_change_cb(struct ifnet *); +static void cdce_media_status_cb(struct ifnet *, struct ifmediareq *); static uint32_t cdce_m_crc32(struct mbuf *, uint32_t, uint32_t); @@ -124,6 +128,8 @@ SYSCTL_INT(_hw_usb_cdce, OID_AUTO, debug, CTLFLAG_RWTUN, &cdce_debug, 0, "Debug level"); SYSCTL_INT(_hw_usb_cdce, OID_AUTO, interval, CTLFLAG_RWTUN, &cdce_tx_interval, 0, "NCM transmit interval in ms"); +#else +#define cdce_debug 0 #endif static const struct usb_config cdce_config[CDCE_N_TRANSFER] = { @@ -307,6 +313,7 @@ USB_PNP_DUAL_INFO(cdce_dual_devs); static const struct usb_ether_methods cdce_ue_methods = { .ue_attach_post = cdce_attach_post, + .ue_attach_post_sub = cdce_attach_post_sub, .ue_start = cdce_start, .ue_init = cdce_init, .ue_stop = cdce_stop, @@ -560,6 +567,36 @@ cdce_attach_post(struct usb_ether *ue) return; } +static int +cdce_attach_post_sub(struct usb_ether *ue) +{ + struct cdce_softc *sc = uether_getsc(ue); + struct ifnet *ifp = uether_getifp(ue); + + /* mostly copied from usb_ethernet.c */ + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_start = uether_start; + ifp->if_ioctl = cdce_ioctl; + ifp->if_init = uether_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + if ((sc->sc_flags & CDCE_FLAG_VLAN) == CDCE_FLAG_VLAN) + if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU, 0); + + if_setcapabilitiesbit(ifp, IFCAP_LINKSTATE, 0); + if_setcapenable(ifp, if_getcapabilities(ifp)); + + ifmedia_init(&sc->sc_media, IFM_IMASK, cdce_media_change_cb, + cdce_media_status_cb); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); + sc->sc_media.ifm_media = sc->sc_media.ifm_cur->ifm_media; + + return 0; +} + static int cdce_attach(device_t dev) { @@ -676,6 +713,14 @@ alloc_transfers: eaddr_str, sizeof(eaddr_str), ued->iMacAddress); } + /* + * ECM 1.2 doesn't say it excludes the CRC, but states that it's + * normally 1514, which excludes the CRC. + */ + DPRINTF("max segsize: %d\n", UGETW(ued->wMaxSegmentSize)); + if (UGETW(ued->wMaxSegmentSize) >= (ETHER_MAX_LEN - ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN)) + sc->sc_flags |= CDCE_FLAG_VLAN; + if (error) { /* fake MAC address */ @@ -742,6 +787,8 @@ cdce_detach(device_t dev) uether_ifdetach(ue); mtx_destroy(&sc->sc_mtx); + ifmedia_removeall(&sc->sc_media); + return (0); } @@ -757,6 +804,29 @@ cdce_start(struct usb_ether *ue) usbd_transfer_start(sc->sc_xfer[CDCE_BULK_RX]); } +static int +cdce_ioctl(struct ifnet *ifp, u_long command, caddr_t data) +{ + struct usb_ether *ue = ifp->if_softc; + struct cdce_softc *sc = uether_getsc(ue); + struct ifreq *ifr = (struct ifreq *)data; + int error; + + error = 0; + + switch(command) { + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, command); + break; + default: + error = uether_ioctl(ifp, command, data); + break; + } + + return (error); +} + static void cdce_free_queue(struct mbuf **ppm, uint8_t n) { @@ -769,6 +839,26 @@ cdce_free_queue(struct mbuf **ppm, uint8_t n) } } +static int +cdce_media_change_cb(struct ifnet *ifp) +{ + + return (EOPNOTSUPP); +} + +static void +cdce_media_status_cb(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + + if ((if_getflags(ifp) & IFF_UP) == 0) + return; + + ifmr->ifm_active = IFM_ETHER; + ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_status |= + ifp->if_link_state == LINK_STATE_UP ? IFM_ACTIVE : 0; +} + static void cdce_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { @@ -1043,17 +1133,69 @@ tr_stall: static void cdce_intr_read_callback(struct usb_xfer *xfer, usb_error_t error) { - struct cdce_softc *sc = usbd_xfer_softc(xfer); - int actlen; + u_char buf[CDCE_IND_SIZE_MAX]; + struct usb_cdc_notification ucn; + struct cdce_softc *sc; + struct ifnet *ifp; + struct usb_page_cache *pc; + int off, actlen; + uint32_t downrate, uprate; + + sc = usbd_xfer_softc(xfer); + ifp = uether_getifp(&sc->sc_ue); + pc = usbd_xfer_get_frame(xfer, 0); usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: + if (USB_DEBUG_VAR) + usbd_copy_out(pc, 0, buf, MIN(actlen, sizeof buf)); + DPRINTF("Received %d bytes: %*D\n", actlen, + (int)MIN(actlen, sizeof buf), buf, ""); + + off = 0; + while (actlen - off >= UCDC_NOTIFICATION_LENGTH) { + usbd_copy_out(pc, off, &ucn, UCDC_NOTIFICATION_LENGTH); + + do { + if (ucn.bmRequestType != 0xa1) + break; + + switch (ucn.bNotification) { + case UCDC_N_NETWORK_CONNECTION: + DPRINTF("changing link state: %d\n", + UGETW(ucn.wValue)); + if_link_state_change(ifp, + UGETW(ucn.wValue) ? LINK_STATE_UP : + LINK_STATE_DOWN); + break; + + case UCDC_N_CONNECTION_SPEED_CHANGE: + if (UGETW(ucn.wLength) != 8) + break; + + usbd_copy_out(pc, off + + UCDC_NOTIFICATION_LENGTH, + &ucn.data, UGETW(ucn.wLength)); + downrate = UGETDW(ucn.data); + uprate = UGETDW(ucn.data); + if (downrate != uprate) + break; + + /* set rate */ + DPRINTF("changing baudrate: %u\n", + downrate); + if_setbaudrate(ifp, downrate); + break; + + default: + break; + } + } while (0); - DPRINTF("Received %d bytes\n", actlen); - - /* TODO: decode some indications */ + off += UCDC_NOTIFICATION_LENGTH + UGETW(ucn.wLength); + } /* FALLTHROUGH */ case USB_ST_SETUP: diff --git a/sys/dev/usb/net/if_cdcereg.h b/sys/dev/usb/net/if_cdcereg.h index 26d037c593b8..724aa0b9b017 100644 --- a/sys/dev/usb/net/if_cdcereg.h +++ b/sys/dev/usb/net/if_cdcereg.h @@ -88,10 +88,13 @@ struct cdce_softc { struct mbuf *sc_rx_buf[CDCE_FRAMES_MAX]; struct mbuf *sc_tx_buf[CDCE_FRAMES_MAX]; + struct ifmedia sc_media; + int sc_flags; #define CDCE_FLAG_ZAURUS 0x0001 #define CDCE_FLAG_NO_UNION 0x0002 #define CDCE_FLAG_RX_DATA 0x0010 +#define CDCE_FLAG_VLAN 0x0020 uint8_t sc_eaddr_str_index; uint8_t sc_ifaces_index[2]; From owner-dev-commits-src-main@freebsd.org Sat Jun 26 02:40:52 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 EFE04648B42; Sat, 26 Jun 2021 02:40:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GBdQr4XDcz4Z64; Sat, 26 Jun 2021 02:40:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82ACE16E85; Sat, 26 Jun 2021 02:40:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15Q2eqvZ032554; Sat, 26 Jun 2021 02:40:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15Q2eqDr032553; Sat, 26 Jun 2021 02:40:52 GMT (envelope-from git) Date: Sat, 26 Jun 2021 02:40:52 GMT Message-Id: <202106260240.15Q2eqDr032553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 18b19f8c6e04 - main - fusefs: correctly set lock owner during FUSE_SETLK MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 18b19f8c6e04935a63a951afe0e540674bc94455 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, 26 Jun 2021 02:40:53 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=18b19f8c6e04935a63a951afe0e540674bc94455 commit 18b19f8c6e04935a63a951afe0e540674bc94455 Author: Alan Somers AuthorDate: 2021-05-20 01:10:15 +0000 Commit: Alan Somers CommitDate: 2021-06-26 02:40:08 +0000 fusefs: correctly set lock owner during FUSE_SETLK During FUSE_SETLK, the owner field should uniquely identify the calling process. The fusefs module now sets it to the process's pid. Previously, it expected the calling process to set it directly, which was wrong. libfuse also apparently expects the owner field to be set during FUSE_GETLK, though I'm not sure why. PR: 256005 Reported by: Agata MFC after: 2 weeks Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30622 --- sys/fs/fuse/fuse_vnops.c | 4 ++-- tests/sys/fs/fusefs/locks.cc | 50 ++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index c79d8d5b5223..adb297b6aacb 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -466,14 +466,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) fdisp_make_vp(&fdi, op, vp, td, cred); fli = fdi.indata; fli->fh = fufh->fh_id; - fli->owner = fl->l_pid; + fli->owner = td->td_proc->p_pid; fli->lk.start = fl->l_start; if (fl->l_len != 0) fli->lk.end = fl->l_start + fl->l_len - 1; else fli->lk.end = INT64_MAX; fli->lk.type = fl->l_type; - fli->lk.pid = fl->l_pid; + fli->lk.pid = td->td_proc->p_pid; err = fdisp_wait_answ(&fdi); fdisp_destroy(&fdi); diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc index 49f495412259..cace779e981a 100644 --- a/tests/sys/fs/fusefs/locks.cc +++ b/tests/sys/fs/fusefs/locks.cc @@ -228,7 +228,7 @@ TEST_F(GetlkFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -247,7 +247,7 @@ TEST_F(Getlk, no_locks) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -256,11 +256,16 @@ TEST_F(Getlk, no_locks) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in, auto& out) { @@ -273,7 +278,7 @@ TEST_F(Getlk, no_locks) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -290,7 +295,7 @@ TEST_F(Getlk, lock_exists) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); pid_t pid2 = 1235; expect_lookup(RELPATH, ino); @@ -300,11 +305,16 @@ TEST_F(Getlk, lock_exists) return (in.header.opcode == FUSE_GETLK && in.header.nodeid == ino && in.body.getlk.fh == FH && + /* + * Though it seems useless, libfuse expects the + * owner and pid fields to be set during + * FUSE_GETLK. + */ in.body.getlk.owner == (uint32_t)pid && + in.body.getlk.lk.pid == (uint64_t)pid && in.body.getlk.lk.start == 10 && in.body.getlk.lk.end == 1009 && - in.body.getlk.lk.type == F_RDLCK && - in.body.getlk.lk.pid == (uint64_t)pid); + in.body.getlk.lk.type == F_RDLCK); }, Eq(true)), _) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { @@ -319,7 +329,7 @@ TEST_F(Getlk, lock_exists) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -368,7 +378,7 @@ TEST_F(Setlk, clear) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -378,7 +388,7 @@ TEST_F(Setlk, clear) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_UNLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -394,7 +404,7 @@ TEST_F(Setlk, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -404,7 +414,7 @@ TEST_F(Setlk, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -420,7 +430,7 @@ TEST_F(Setlk, set_eof) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -430,7 +440,7 @@ TEST_F(Setlk, set_eof) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 0; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -446,7 +456,7 @@ TEST_F(Setlk, eagain) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -456,7 +466,7 @@ TEST_F(Setlk, eagain) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -484,7 +494,7 @@ TEST_F(SetlkwFallback, local) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = getpid(); + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; @@ -504,7 +514,7 @@ TEST_F(Setlkw, set) uint64_t ino = 42; struct flock fl; int fd; - pid_t pid = 1234; + pid_t pid = getpid(); expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); @@ -514,7 +524,7 @@ TEST_F(Setlkw, set) ASSERT_LE(0, fd) << strerror(errno); fl.l_start = 10; fl.l_len = 1000; - fl.l_pid = pid; + fl.l_pid = 0; fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; From owner-dev-commits-src-main@freebsd.org Sat Jun 26 04:04: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 AB82A64AF84; Sat, 26 Jun 2021 04:04: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 4GBgGn4Bpzz4pNk; Sat, 26 Jun 2021 04:04: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 7849B181AE; Sat, 26 Jun 2021 04:04: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 15Q441Sh042480; Sat, 26 Jun 2021 04:04:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15Q441e2042479; Sat, 26 Jun 2021 04:04:01 GMT (envelope-from git) Date: Sat, 26 Jun 2021 04:04:01 GMT Message-Id: <202106260404.15Q441e2042479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 5dd84e315a9f - main - arm64: fix a potential KVA leak in pmap_demote_l1() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5dd84e315a9f777772017f9f628aa67f08a6493a 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, 26 Jun 2021 04:04:01 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=5dd84e315a9f777772017f9f628aa67f08a6493a commit 5dd84e315a9f777772017f9f628aa67f08a6493a Author: Alan Cox AuthorDate: 2021-06-26 03:29:38 +0000 Commit: Alan Cox CommitDate: 2021-06-26 04:01:32 +0000 arm64: fix a potential KVA leak in pmap_demote_l1() In the unlikely event that the 1 GB page mapping being demoted is used to access the L1 page table page containing the 1 GB page mapping and the vm_page_alloc() to allocate a new L2 page table page fails, we would leak a page of kernel virtual address space. Fix this leak. MFC after: 1 week --- sys/arm64/arm64/pmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index a6f716370810..76ca8eab70ff 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -6010,7 +6010,8 @@ pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va) VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { CTR2(KTR_PMAP, "pmap_demote_l1: failure for va %#lx" " in pmap %p", va, pmap); - return (NULL); + l2 = NULL; + goto fail; } l2phys = VM_PAGE_TO_PHYS(ml2); @@ -6039,6 +6040,7 @@ pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va) pmap_update_entry(pmap, l1, l2phys | L1_TABLE, va, PAGE_SIZE); +fail: if (tmpl1 != 0) { pmap_kremove(tmpl1); kva_free(tmpl1, PAGE_SIZE); From owner-dev-commits-src-main@freebsd.org Sat Jun 26 16:06: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 91045655CE5; Sat, 26 Jun 2021 16:06: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 4GBzHt3mK8z4tW9; Sat, 26 Jun 2021 16:06: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 6979421D8C; Sat, 26 Jun 2021 16:06: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 15QG62pa007822; Sat, 26 Jun 2021 16:06:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15QG62p7007821; Sat, 26 Jun 2021 16:06:02 GMT (envelope-from git) Date: Sat, 26 Jun 2021 16:06:02 GMT Message-Id: <202106261606.15QG62p7007821@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mike Karels Subject: git: 184291b0a56a - main - genet: pullup minimum header amount for IPv4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 184291b0a56a68f2c0dc4388419b0f7d85a08cf4 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, 26 Jun 2021 16:06:02 -0000 The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=184291b0a56a68f2c0dc4388419b0f7d85a08cf4 commit 184291b0a56a68f2c0dc4388419b0f7d85a08cf4 Author: Mike Karels AuthorDate: 2021-06-20 17:50:31 +0000 Commit: Mike Karels CommitDate: 2021-06-26 16:04:02 +0000 genet: pullup minimum header amount for IPv4 The genet driver (RPi4 Ethernet) had code to pull headers into the first mbuf if there was only an Ethernet header there. This was originally needed for ICMPv6 replies, then for forwarded IPv6/TCP. Now a situation has been found where it is needed for IPv4, when using NAT with IPFW. Generalize to do this for all protocols. Rather than using an IPv6-related definition for the length, move the length to a variable that can be set with sysctl (hw.genet.tx_hdr_min). Move an old tunable to a new RDTUN variable with a better name. PR: 25607 MFC after: 3 days Reviewers: emaste Differential Revision: https://reviews.freebsd.org/D30831 --- sys/arm64/broadcom/genet/if_genet.c | 53 +++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index 5d70c7075c3a..31fab0f9cf09 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -97,9 +98,27 @@ __FBSDID("$FreeBSD$"); #define TX_MAX_SEGS 20 -/* Maximum number of mbufs to send to if_input */ +static SYSCTL_NODE(_hw, OID_AUTO, genet, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "genet driver parameters"); + +/* Maximum number of mbufs to pass per call to if_input */ static int gen_rx_batch = 16 /* RX_BATCH_DEFAULT */; -TUNABLE_INT("hw.gen.rx_batch", &gen_rx_batch); +SYSCTL_INT(_hw_genet, OID_AUTO, rx_batch, CTLFLAG_RDTUN, + &gen_rx_batch, 0, "max mbufs per call to if_input"); + +TUNABLE_INT("hw.gen.rx_batch", &gen_rx_batch); /* old name/interface */ + +/* + * Transmitting packets with only an Ethernet header in the first mbuf + * fails. Examples include reflected ICMPv6 packets, e.g. echo replies; + * forwarded IPv6/TCP packets; and forwarded IPv4/TCP packets that use NAT + * with IPFW. Pulling up the sizes of ether_header + ip6_hdr + icmp6_hdr + * seems to work for both ICMPv6 and TCP over IPv6, as well as the IPv4/TCP + * case. + */ +static int gen_tx_hdr_min = 56; /* ether_header + ip6_hdr + icmp6_hdr */ +SYSCTL_INT(_hw_genet, OID_AUTO, tx_hdr_min, CTLFLAG_RW, + &gen_tx_hdr_min, 0, "header to add to packets with ether header only"); static struct ofw_compat_data compat_data[] = { { "brcm,genet-v1", 1 }, @@ -995,31 +1014,19 @@ gen_encap(struct gen_softc *sc, struct mbuf **mp) m = *mp; /* - * Reflected ICMPv6 packets, e.g. echo replies, tend to get laid - * out with only the Ethernet header in the first mbuf, and this - * doesn't seem to work. Forwarded TCP packets over IPv6 also - * fail if laid out with only the Ethernet header in the first mbuf. - * For now, pull up any IPv6 packet with that layout. Maybe IPv4 - * needs it but we haven't run into it. Pulling up the sizes of - * ether_header + ip6_header + icmp6_hdr seems to work for both - * ICMPv6 and TCP over IPv6. + * Don't attempt to send packets with only an Ethernet header in + * first mbuf; see comment above with gen_tx_hdr_min. */ -#define IP6_PULLUP_LEN (sizeof(struct ether_header) + \ - sizeof(struct ip6_hdr) + 8) if (m->m_len == sizeof(struct ether_header)) { - int ether_type = mtod(m, struct ether_header *)->ether_type; - if (ntohs(ether_type) == ETHERTYPE_IPV6) { - m = m_pullup(m, MIN(m->m_pkthdr.len, IP6_PULLUP_LEN)); - if (m == NULL) { - if (sc->ifp->if_flags & IFF_DEBUG) - device_printf(sc->dev, - "IPV6 pullup fail\n"); - *mp = NULL; - return (ENOMEM); - } + m = m_pullup(m, MIN(m->m_pkthdr.len, gen_tx_hdr_min)); + if (m == NULL) { + if (sc->ifp->if_flags & IFF_DEBUG) + device_printf(sc->dev, + "header pullup fail\n"); + *mp = NULL; + return (ENOMEM); } } -#undef IP6_PULLUP_LEN if ((if_getcapenable(sc->ifp) & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) != 0) { From owner-dev-commits-src-main@freebsd.org Sat Jun 26 16:25: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 57085655C52; Sat, 26 Jun 2021 16:25: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 4GBzjy1jtRz3ClT; Sat, 26 Jun 2021 16:25: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 2035221FCC; Sat, 26 Jun 2021 16:25: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 15QGPAuj034663; Sat, 26 Jun 2021 16:25:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15QGPA2s034662; Sat, 26 Jun 2021 16:25:10 GMT (envelope-from git) Date: Sat, 26 Jun 2021 16:25:10 GMT Message-Id: <202106261625.15QGPA2s034662@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: 9a8e4527f07d - main - amd64: typo fix: memcmpy -> memcmp in a comment 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: 9a8e4527f07dbb356bb1942efc09888f957df056 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, 26 Jun 2021 16:25:10 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=9a8e4527f07dbb356bb1942efc09888f957df056 commit 9a8e4527f07dbb356bb1942efc09888f957df056 Author: Mateusz Guzik AuthorDate: 2021-06-26 03:57:47 +0000 Commit: Mateusz Guzik CommitDate: 2021-06-26 16:24:46 +0000 amd64: typo fix: memcmpy -> memcmp in a comment Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/amd64/amd64/support.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index d511fe265996..e21374233c84 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -82,7 +82,7 @@ ENTRY(pagecopy) END(pagecopy) /* - * memcmpy(b1, b2, len) + * memcmp(b1, b2, len) * rdi,rsi,rdx */ ENTRY(memcmp) From owner-dev-commits-src-main@freebsd.org Sat Jun 26 18:23: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 36736657F62; Sat, 26 Jun 2021 18:23: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 4GC2LV0tNcz3L19; Sat, 26 Jun 2021 18:23: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 0643C23B05; Sat, 26 Jun 2021 18:23: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 15QINT6m094277; Sat, 26 Jun 2021 18:23:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15QINT11094276; Sat, 26 Jun 2021 18:23:29 GMT (envelope-from git) Date: Sat, 26 Jun 2021 18:23:29 GMT Message-Id: <202106261823.15QINT11094276@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: 7d9794b34bcd - main - CI: use amd64 EDK II firmware included with QEMU 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: 7d9794b34bcd465a380f05b02ccfea469dd0a48e 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, 26 Jun 2021 18:23:30 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7d9794b34bcd465a380f05b02ccfea469dd0a48e commit 7d9794b34bcd465a380f05b02ccfea469dd0a48e Author: Ed Maste AuthorDate: 2021-06-26 00:10:34 +0000 Commit: Ed Maste CommitDate: 2021-06-26 18:22:48 +0000 CI: use amd64 EDK II firmware included with QEMU QEMU (now) includes a prebuilt EDK II firmare in edk2-x86_64-code.fd. Use that instead of requring a standalone uefi-edk2-qemu-x86_64 package. Reviewed by: imp MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30915 --- .cirrus.yml | 2 +- tools/boot/ci-qemu-test.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index db0e4e4c0543..575f882b8b48 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,7 +14,7 @@ task: name: World and kernel amd64 build and boot smoke test timeout_in: 120m install_script: - - sh .cirrus-ci/pkg-install.sh qemu uefi-edk2-qemu-x86_64 llvm12 + - sh .cirrus-ci/pkg-install.sh qemu llvm12 setup_script: - uname -a - df -m diff --git a/tools/boot/ci-qemu-test.sh b/tools/boot/ci-qemu-test.sh index c68531550dbc..acd905b7ece8 100755 --- a/tools/boot/ci-qemu-test.sh +++ b/tools/boot/ci-qemu-test.sh @@ -78,9 +78,8 @@ if [ -z "${OBJTOP}" ]; then fi # Locate the uefi firmware file used by qemu. -: ${OVMF:=/usr/local/share/uefi-edk2-qemu/QEMU_UEFI_CODE-x86_64.fd} +: ${OVMF:=/usr/local/share/qemu/edk2-x86_64-code.fd} if [ ! -r "${OVMF}" ]; then - echo "NOTE: UEFI firmware available in the uefi-edk2-qemu-x86_64 package" >&2 die "Cannot read UEFI firmware file ${OVMF}" fi From owner-dev-commits-src-main@freebsd.org Sat Jun 26 20:15: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 5C8EC65934E; Sat, 26 Jun 2021 20:15: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 4GC4ql29s0z3k9t; Sat, 26 Jun 2021 20:15: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 3350D24EA5; Sat, 26 Jun 2021 20:15: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 15QKFVaj041175; Sat, 26 Jun 2021 20:15:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15QKFVbG041174; Sat, 26 Jun 2021 20:15:31 GMT (envelope-from git) Date: Sat, 26 Jun 2021 20:15:31 GMT Message-Id: <202106262015.15QKFVbG041174@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: bba96bb143bb - main - CI: add arm64 support to ci-qemu-test.sh 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: bba96bb143bb803968036543b76e062445cc9834 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, 26 Jun 2021 20:15:31 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=bba96bb143bb803968036543b76e062445cc9834 commit bba96bb143bb803968036543b76e062445cc9834 Author: Ed Maste AuthorDate: 2021-06-23 19:24:23 +0000 Commit: Ed Maste CommitDate: 2021-06-26 18:26:41 +0000 CI: add arm64 support to ci-qemu-test.sh Reviewed by: imp (earlier) MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30907 --- tools/boot/ci-qemu-test.sh | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/tools/boot/ci-qemu-test.sh b/tools/boot/ci-qemu-test.sh index acd905b7ece8..e6481c794af5 100755 --- a/tools/boot/ci-qemu-test.sh +++ b/tools/boot/ci-qemu-test.sh @@ -44,11 +44,11 @@ EOF FreeBSD-clibs FreeBSD-runtime # Put loader in standard EFI location. - mv ${ROOTDIR}/boot/loader.efi ${ROOTDIR}/efi/boot/BOOTx64.EFI + mv ${ROOTDIR}/boot/loader.efi ${ROOTDIR}/efi/boot/$EFIBOOT # Configuration files. cat > ${ROOTDIR}/boot/loader.conf <&1 | tee ${BOOTLOG} From owner-dev-commits-src-main@freebsd.org Sat Jun 26 21:12: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 F2D0C659C1A; Sat, 26 Jun 2021 21:12: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 4GC65d6S1Lz3mft; Sat, 26 Jun 2021 21:12: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 BBDC025ED7; Sat, 26 Jun 2021 21:12: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 15QLCbRM021083; Sat, 26 Jun 2021 21:12:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15QLCbFA021082; Sat, 26 Jun 2021 21:12:37 GMT (envelope-from git) Date: Sat, 26 Jun 2021 21:12:37 GMT Message-Id: <202106262112.15QLCbFA021082@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: b413b03597db - main - mount_nfs.8: Update the man page for commit a145cf3f73c7 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: b413b03597db10dbee514141b10f7c7ef236abe6 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, 26 Jun 2021 21:12:38 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b413b03597db10dbee514141b10f7c7ef236abe6 commit b413b03597db10dbee514141b10f7c7ef236abe6 Author: Rick Macklem AuthorDate: 2021-06-26 21:09:28 +0000 Commit: Rick Macklem CommitDate: 2021-06-26 21:09:28 +0000 mount_nfs.8: Update the man page for commit a145cf3f73c7 The NFSv4 client now uses the highest minor version of NFSv4 by default instead of minor version 0, for NFSv4 mounts. The "minorversion" mount option may be used to override this default. This patch updates the man page to reflect this change. While here, fix nfsstat(8) to be nfsstat(1). Reviewed by: otis MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30768 --- sbin/mount_nfs/mount_nfs.8 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index 76e009817d8b..36a3c180b1e3 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd January 17, 2021 +.Dd June 26, 2021 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -206,9 +206,15 @@ Use the NFS Version 3 protocol. Use the NFS Version 4 protocol. This option will force the mount to use TCP transport. +By default, the highest minor version of NFS Version 4 that is +supported by the NFS Version 4 server will be used. +See the +.Cm minorversion +option. .It Cm minorversion Ns = Ns Aq Ar value -Override the default of 0 for the minor version of the NFS Version 4 protocol. -The minor versions other than 0 currently supported are 1 and 2. +Use the specified minor version for a NFS Version 4 mount, +overriding the default. +The minor versions supported are 0, 1, and 2. This option is only meaningful when used with the .Cm nfsv4 option. @@ -221,7 +227,7 @@ It may be required when an accumulation of NFS version 4 Opens occurs, as indicated by the .Dq Opens count displayed by -.Xr nfsstat 8 +.Xr nfsstat 1 with the .Fl c and @@ -231,22 +237,16 @@ A common case for an accumulation of Opens is a shared library within the NFS mount that is used by several processes, where at least one of these processes is always running. This option cannot be used for an NFS Version 4, minor version 0 mount. -As such, this option requires the -.Cm minorversion -option be specified with a value of 1 for AmazonEFS, because AmazonEFS does -not support minor version 2 at this time. It may not work correctly when Delegations are being issued by a server, but note that the AmazonEFS server does not issued delegations at this time. This option is only meaningful when used with the .Cm nfsv4 -and -.Cm minorversion -options. +option. .It Cm pnfs Enable support for parallel NFS (pNFS) for minor version 1 or 2 of the NFS Version 4 protocol. This option is only meaningful when used with the -.Cm minorversion +.Cm nfsv4 option. .It Cm noac Disable attribute caching. From owner-dev-commits-src-main@freebsd.org Sun Jun 27 00:59: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 C148765CBE8; Sun, 27 Jun 2021 00:59: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 4GCC7t4qSqz4YSn; Sun, 27 Jun 2021 00:59: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 8DA90A36; Sun, 27 Jun 2021 00:59: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 15R0xsqD015460; Sun, 27 Jun 2021 00:59:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15R0xsau015459; Sun, 27 Jun 2021 00:59:54 GMT (envelope-from git) Date: Sun, 27 Jun 2021 00:59:54 GMT Message-Id: <202106270059.15R0xsau015459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 2be4a7d508b0 - main - ObsoleteFiles.inc: fixup after zpool-features.7.gz got re-introduced MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2be4a7d508b02a980904378ca7c798fdf8c300d5 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, 27 Jun 2021 00:59:54 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=2be4a7d508b02a980904378ca7c798fdf8c300d5 commit 2be4a7d508b02a980904378ca7c798fdf8c300d5 Author: Martin Matuska AuthorDate: 2021-06-27 00:53:51 +0000 Commit: Martin Matuska CommitDate: 2021-06-27 00:58:15 +0000 ObsoleteFiles.inc: fixup after zpool-features.7.gz got re-introduced PR: 256852 MFC after: 3 days --- ObsoleteFiles.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index a2a423fafc9c..38cbbd7807ca 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -4052,7 +4052,7 @@ OLD_FILES+=boot/lua/logo-orbbw.lua OLD_LIBS+=lib/libzfs.so.3 OLD_LIBS+=usr/lib32/libzfs.so.3 OLD_FILES+=usr/share/man/man1/zstreamdump.1.gz -OLD_FILES+=usr/share/man/man7/zpool-features.7.gz +#OLD_FILES+=usr/share/man/man7/zpool-features.7.gz # 20200923: memfd_test moved to /usr/tests/sys/posixshm OLD_FILES+=usr/tests/sys/kern/memfd_test From owner-dev-commits-src-main@freebsd.org Sun Jun 27 06:46: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 5AAEF6615BE; Sun, 27 Jun 2021 06:46: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 4GCLqq27pqz3HkX; Sun, 27 Jun 2021 06:46: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 31A17567E; Sun, 27 Jun 2021 06:46: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 15R6kVxW081928; Sun, 27 Jun 2021 06:46:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15R6kV8I081927; Sun, 27 Jun 2021 06:46:31 GMT (envelope-from git) Date: Sun, 27 Jun 2021 06:46:31 GMT Message-Id: <202106270646.15R6kV8I081927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 19c288b3a664 - main - arm64: eliminate a duplicated #define MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19c288b3a6640742ab45200031661fe5be710d7f 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, 27 Jun 2021 06:46:31 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=19c288b3a6640742ab45200031661fe5be710d7f commit 19c288b3a6640742ab45200031661fe5be710d7f Author: Alan Cox AuthorDate: 2021-06-27 06:40:23 +0000 Commit: Alan Cox CommitDate: 2021-06-27 06:44:58 +0000 arm64: eliminate a duplicated #define --- sys/arm64/include/pte.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/arm64/include/pte.h b/sys/arm64/include/pte.h index 16a72be65fd0..5d4412d2c141 100644 --- a/sys/arm64/include/pte.h +++ b/sys/arm64/include/pte.h @@ -131,7 +131,6 @@ typedef uint64_t pt_entry_t; /* page table entry */ #define L3_SHIFT 12 #define L3_SIZE (1 << L3_SHIFT) #define L3_OFFSET (L3_SIZE - 1) -#define L3_SHIFT 12 #define L3_INVAL 0x0 /* 0x1 is reserved */ /* 0x2 also marks an invalid address */ From owner-dev-commits-src-main@freebsd.org Sun Jun 27 14:05: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 8C305641705; Sun, 27 Jun 2021 14:05: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 4GCXYt3Cj3z4Rmc; Sun, 27 Jun 2021 14:05: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 5682513A03; Sun, 27 Jun 2021 14:05: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 15RE567X066747; Sun, 27 Jun 2021 14:05:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15RE5610066746; Sun, 27 Jun 2021 14:05:06 GMT (envelope-from git) Date: Sun, 27 Jun 2021 14:05:06 GMT Message-Id: <202106271405.15RE5610066746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 870af3f4dc57 - main - tcp: tolerate missing timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 870af3f4dc57a6bbfc03f6a49ca0d5b7ff1b975a 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, 27 Jun 2021 14:05:06 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=870af3f4dc57a6bbfc03f6a49ca0d5b7ff1b975a commit 870af3f4dc57a6bbfc03f6a49ca0d5b7ff1b975a Author: Michael Tuexen AuthorDate: 2021-06-11 18:14:34 +0000 Commit: Michael Tuexen CommitDate: 2021-06-27 14:03:57 +0000 tcp: tolerate missing timestamps Some TCP stacks negotiate TS support, but do not send TS at all or not for keep-alive segments. Since this includes modern widely deployed stacks, tolerate the violation of RFC 7323 per default. Reviewed by: rgrimes, rrs, rscheff MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30740 Sponsored by: Netflix, Inc. --- share/man/man4/tcp.4 | 6 ++++-- sys/netinet/tcp_subr.c | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index 93d1e075e92d..1ff1ee28420f 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 24, 2021 +.Dd June 27, 2021 .Dt TCP 4 .Os .Sh NAME @@ -382,7 +382,9 @@ segments belonging to connections for which support of .Tn TCP timestamps has been negotiated. -(default is 0, i.e., the missing of timestamps is not tolerated). +As of June 2021, several TCP stacks are known to violate RFC 7323, including +modern widely deployed ones. +Therefore the default is 1, i.e., the missing of timestamps is tolerated. .It Dv TCPCTL_MSSDFLT .Pq Va mssdflt The default value used for the maximum segment size diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index a1531ea8d2f3..fbd84e763c0f 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -268,7 +268,14 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc1323), 0, "Enable rfc1323 (high performance TCP) extensions"); -VNET_DEFINE(int, tcp_tolerate_missing_ts) = 0; +/* + * As of June 2021, several TCP stacks violate RFC 7323 from September 2014. + * Some stacks negotiate TS, but never send them after connection setup. Some + * stacks negotiate TS, but don't send them when sending keep-alive segments. + * These include modern widely deployed TCP stacks. + * Therefore tolerating violations for now... + */ +VNET_DEFINE(int, tcp_tolerate_missing_ts) = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, tolerate_missing_ts, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_tolerate_missing_ts), 0, "Tolerate missing TCP timestamps"); From owner-dev-commits-src-main@freebsd.org Sun Jun 27 14:12: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 B87FA641745; Sun, 27 Jun 2021 14:12: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 4GCXkG4ppRz4ScH; Sun, 27 Jun 2021 14:12: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 8E32C13C0D; Sun, 27 Jun 2021 14:12: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 15RECMjQ079577; Sun, 27 Jun 2021 14:12:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15RECMYX079576; Sun, 27 Jun 2021 14:12:22 GMT (envelope-from git) Date: Sun, 27 Jun 2021 14:12:22 GMT Message-Id: <202106271412.15RECMYX079576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 6587a2bd1e88 - main - sctp: Fix length check for ECNE chunks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6587a2bd1e88b5b99aea114e3d20b0d4c48c95df 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, 27 Jun 2021 14:12:22 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6587a2bd1e88b5b99aea114e3d20b0d4c48c95df commit 6587a2bd1e88b5b99aea114e3d20b0d4c48c95df Author: Michael Tuexen AuthorDate: 2021-06-27 14:10:39 +0000 Commit: Michael Tuexen CommitDate: 2021-06-27 14:10:39 +0000 sctp: Fix length check for ECNE chunks MFC after: 3 days --- sys/netinet/sctp_input.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 442e58afd0ff..b822c9eae2ca 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -2887,10 +2887,6 @@ sctp_handle_ecn_echo(struct sctp_ecne_chunk *cp, unsigned int pkt_cnt; len = ntohs(cp->ch.chunk_length); - if ((len != sizeof(struct sctp_ecne_chunk)) && - (len != sizeof(struct old_sctp_ecne_chunk))) { - return; - } if (len == sizeof(struct old_sctp_ecne_chunk)) { /* Its the old format */ memcpy(&bkup, cp, sizeof(struct old_sctp_ecne_chunk)); @@ -5022,7 +5018,8 @@ process_control_chunks: if (stcb->asoc.ecn_supported == 0) { goto unknown_chunk; } - if (chk_length != sizeof(struct sctp_ecne_chunk)) { + if ((chk_length != sizeof(struct sctp_ecne_chunk)) && + (chk_length != sizeof(struct old_sctp_ecne_chunk))) { break; } sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch, stcb); From owner-dev-commits-src-main@freebsd.org Sun Jun 27 16:41: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 9099E645CA7; Sun, 27 Jun 2021 16:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GCc2F3c3Nz4d7R; Sun, 27 Jun 2021 16:41: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 6326215A91; Sun, 27 Jun 2021 16:41: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 15RGfPjG074352; Sun, 27 Jun 2021 16:41:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15RGfP6o074351; Sun, 27 Jun 2021 16:41:25 GMT (envelope-from git) Date: Sun, 27 Jun 2021 16:41:25 GMT Message-Id: <202106271641.15RGfP6o074351@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: 61b4c6271809 - main - imgact_elf.c: style, remove unnecessary casts 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: 61b4c62718093fc3a30041bb7fa4d31c7b6c31b2 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, 27 Jun 2021 16:41:25 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=61b4c62718093fc3a30041bb7fa4d31c7b6c31b2 commit 61b4c62718093fc3a30041bb7fa4d31c7b6c31b2 Author: Edward Tomasz Napierala AuthorDate: 2021-06-22 12:18:49 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-06-27 16:05:59 +0000 imgact_elf.c: style, remove unnecessary casts Remove unnecessary type casts and redundant brackets. No functional changes. Suggested By: kib Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30841 --- sys/kern/imgact_elf.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index d114070fc903..4a649664c917 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1776,7 +1776,7 @@ __elfN(prepare_notes)(struct thread *td, struct note_info_list *list, size += register_note(list, -1, __elfN(note_threadmd), thr); - thr = (thr == td) ? TAILQ_FIRST(&p->p_threads) : + thr = thr == td ? TAILQ_FIRST(&p->p_threads) : TAILQ_NEXT(thr, td_plist); if (thr == td) thr = TAILQ_NEXT(thr, td_plist); @@ -2048,7 +2048,7 @@ __elfN(note_prpsinfo)(void *arg, struct sbuf *sb, size_t *sizep) elf_prpsinfo_t *psinfo; int error; - p = (struct proc *)arg; + p = arg; if (sb != NULL) { KASSERT(*sizep == sizeof(*psinfo), ("invalid size")); psinfo = malloc(sizeof(*psinfo), M_TEMP, M_ZERO | M_WAITOK); @@ -2105,7 +2105,7 @@ __elfN(note_prstatus)(void *arg, struct sbuf *sb, size_t *sizep) struct thread *td; elf_prstatus_t *status; - td = (struct thread *)arg; + td = arg; if (sb != NULL) { KASSERT(*sizep == sizeof(*status), ("invalid size")); status = malloc(sizeof(*status), M_TEMP, M_ZERO | M_WAITOK); @@ -2133,7 +2133,7 @@ __elfN(note_fpregset)(void *arg, struct sbuf *sb, size_t *sizep) struct thread *td; elf_prfpregset_t *fpregset; - td = (struct thread *)arg; + td = arg; if (sb != NULL) { KASSERT(*sizep == sizeof(*fpregset), ("invalid size")); fpregset = malloc(sizeof(*fpregset), M_TEMP, M_ZERO | M_WAITOK); @@ -2154,7 +2154,7 @@ __elfN(note_thrmisc)(void *arg, struct sbuf *sb, size_t *sizep) struct thread *td; elf_thrmisc_t thrmisc; - td = (struct thread *)arg; + td = arg; if (sb != NULL) { KASSERT(*sizep == sizeof(thrmisc), ("invalid size")); bzero(&thrmisc, sizeof(thrmisc)); @@ -2176,7 +2176,7 @@ __elfN(note_ptlwpinfo)(void *arg, struct sbuf *sb, size_t *sizep) struct ptrace_lwpinfo pl; #endif - td = (struct thread *)arg; + td = arg; size = sizeof(structsize) + sizeof(pl); if (sb != NULL) { KASSERT(*sizep == size, ("invalid size")); @@ -2240,7 +2240,7 @@ __elfN(note_procstat_proc)(void *arg, struct sbuf *sb, size_t *sizep) size_t size; int structsize; - p = (struct proc *)arg; + p = arg; size = sizeof(structsize) + p->p_numthreads * sizeof(elf_kinfo_proc_t); @@ -2273,7 +2273,7 @@ note_procstat_files(void *arg, struct sbuf *sb, size_t *sizep) else filedesc_flags = 0; - p = (struct proc *)arg; + p = arg; structsize = sizeof(struct kinfo_file); if (sb == NULL) { size = 0; @@ -2324,7 +2324,7 @@ note_procstat_vmmap(void *arg, struct sbuf *sb, size_t *sizep) else vmmap_flags = 0; - p = (struct proc *)arg; + p = arg; structsize = sizeof(struct kinfo_vmentry); if (sb == NULL) { size = 0; @@ -2351,7 +2351,7 @@ note_procstat_groups(void *arg, struct sbuf *sb, size_t *sizep) size_t size; int structsize; - p = (struct proc *)arg; + p = arg; size = sizeof(structsize) + p->p_ucred->cr_ngroups * sizeof(gid_t); if (sb != NULL) { KASSERT(*sizep == size, ("invalid size")); @@ -2370,7 +2370,7 @@ note_procstat_umask(void *arg, struct sbuf *sb, size_t *sizep) size_t size; int structsize; - p = (struct proc *)arg; + p = arg; size = sizeof(structsize) + sizeof(p->p_pd->pd_cmask); if (sb != NULL) { KASSERT(*sizep == size, ("invalid size")); @@ -2389,7 +2389,7 @@ note_procstat_rlimit(void *arg, struct sbuf *sb, size_t *sizep) size_t size; int structsize, i; - p = (struct proc *)arg; + p = arg; size = sizeof(structsize) + sizeof(rlim); if (sb != NULL) { KASSERT(*sizep == size, ("invalid size")); @@ -2411,7 +2411,7 @@ note_procstat_osrel(void *arg, struct sbuf *sb, size_t *sizep) size_t size; int structsize; - p = (struct proc *)arg; + p = arg; size = sizeof(structsize) + sizeof(p->p_osrel); if (sb != NULL) { KASSERT(*sizep == size, ("invalid size")); @@ -2430,7 +2430,7 @@ __elfN(note_procstat_psstrings)(void *arg, struct sbuf *sb, size_t *sizep) size_t size; int structsize; - p = (struct proc *)arg; + p = arg; size = sizeof(structsize) + sizeof(ps_strings); if (sb != NULL) { KASSERT(*sizep == size, ("invalid size")); @@ -2453,7 +2453,7 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, size_t *sizep) size_t size; int structsize; - p = (struct proc *)arg; + p = arg; if (sb == NULL) { size = 0; sb = sbuf_new(NULL, NULL, AT_COUNT * sizeof(Elf_Auxinfo), From owner-dev-commits-src-main@freebsd.org Sun Jun 27 17:12: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 D69426458FC; Sun, 27 Jun 2021 17:12: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 4GCckV5Zgbz4fnS; Sun, 27 Jun 2021 17:12: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 A7E8615E64; Sun, 27 Jun 2021 17:12: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 15RHCoJ4019043; Sun, 27 Jun 2021 17:12:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15RHConb019042; Sun, 27 Jun 2021 17:12:50 GMT (envelope-from git) Date: Sun, 27 Jun 2021 17:12:50 GMT Message-Id: <202106271712.15RHConb019042@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: b762974cf4b9 - main - clang: stop linking _p libs for -pg as of FreeBSD 14 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: b762974cf4b9ea77f1decf4a6d829372f0a97f75 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, 27 Jun 2021 17:12:50 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b762974cf4b9ea77f1decf4a6d829372f0a97f75 commit b762974cf4b9ea77f1decf4a6d829372f0a97f75 Author: Ed Maste AuthorDate: 2021-06-26 23:58:16 +0000 Commit: Ed Maste CommitDate: 2021-06-27 17:12:12 +0000 clang: stop linking _p libs for -pg as of FreeBSD 14 In FreeBSD 14 we will stop providing _p libraries (compiled with -pg). Reviewed by: dim (upstream) Obtained from: LLVM 699d47472c3f MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30861 --- .../clang/lib/Driver/ToolChains/FreeBSD.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp index 37c0a68234ed..652e5c4cb9e6 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -293,6 +293,8 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); + bool Profiling = Args.hasArg(options::OPT_pg) && + ToolChain.getTriple().getOSMajorVersion() < 14; if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { // Use the static OpenMP runtime with -static-openmp bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && @@ -302,7 +304,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (D.CCCIsCXX()) { if (ToolChain.ShouldLinkCXXStdlib(Args)) ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); - if (Args.hasArg(options::OPT_pg)) + if (Profiling) CmdArgs.push_back("-lm_p"); else CmdArgs.push_back("-lm"); @@ -313,13 +315,13 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, linkXRayRuntimeDeps(ToolChain, CmdArgs); // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding // the default system libraries. Just mimic this for now. - if (Args.hasArg(options::OPT_pg)) + if (Profiling) CmdArgs.push_back("-lgcc_p"); else CmdArgs.push_back("-lgcc"); if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-lgcc_eh"); - } else if (Args.hasArg(options::OPT_pg)) { + } else if (Profiling) { CmdArgs.push_back("-lgcc_eh_p"); } else { CmdArgs.push_back("--as-needed"); @@ -328,13 +330,13 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, } if (Args.hasArg(options::OPT_pthread)) { - if (Args.hasArg(options::OPT_pg)) + if (Profiling) CmdArgs.push_back("-lpthread_p"); else CmdArgs.push_back("-lpthread"); } - if (Args.hasArg(options::OPT_pg)) { + if (Profiling) { if (Args.hasArg(options::OPT_shared)) CmdArgs.push_back("-lc"); else @@ -347,7 +349,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-lgcc_eh"); - } else if (Args.hasArg(options::OPT_pg)) { + } else if (Profiling) { CmdArgs.push_back("-lgcc_eh_p"); } else { CmdArgs.push_back("--as-needed"); @@ -416,7 +418,8 @@ void FreeBSD::addLibStdCxxIncludePaths( void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const { CXXStdlibType Type = GetCXXStdlibType(Args); - bool Profiling = Args.hasArg(options::OPT_pg); + bool Profiling = + Args.hasArg(options::OPT_pg) && getTriple().getOSMajorVersion() < 14; switch (Type) { case ToolChain::CST_Libcxx: From owner-dev-commits-src-main@freebsd.org Sun Jun 27 17:30: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 12231646647; Sun, 27 Jun 2021 17:30: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 4GCd6z6vjYz4gZ5; Sun, 27 Jun 2021 17:30: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 D60BC164BE; Sun, 27 Jun 2021 17:30: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 15RHUZAD040822; Sun, 27 Jun 2021 17:30:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15RHUZbn040821; Sun, 27 Jun 2021 17:30:35 GMT (envelope-from git) Date: Sun, 27 Jun 2021 17:30:35 GMT Message-Id: <202106271730.15RHUZbn040821@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: 914b6a0122c3 - main - src.conf.5: regen after RISC-V OPENMP (aa033e0b14f2) 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: 914b6a0122c3032c2c2ae3a44bdeaf69e37efd61 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, 27 Jun 2021 17:30:36 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=914b6a0122c3032c2c2ae3a44bdeaf69e37efd61 commit 914b6a0122c3032c2c2ae3a44bdeaf69e37efd61 Author: Ed Maste AuthorDate: 2021-06-27 17:29:32 +0000 Commit: Ed Maste CommitDate: 2021-06-27 17:30:08 +0000 src.conf.5: regen after RISC-V OPENMP (aa033e0b14f2) Sponsored by: The FreeBSD Foundation --- share/man/man5/src.conf.5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 0bcadfb5751d..342c9f92b234 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd June 11, 2021 +.Dd June 27, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1257,12 +1257,12 @@ Enable building LDAP support for kerberos using an openldap client from ports. Do not build LLVM's OpenMP runtime. .Pp This is a default setting on -arm/armv6, arm/armv7, mips/mips, mips/mips64, powerpc/powerpc, riscv/riscv64 and riscv/riscv64sf. +arm/armv6, arm/armv7, mips/mips, mips/mips64 and powerpc/powerpc. .It Va WITH_OPENMP Build LLVM's OpenMP runtime. .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386 and powerpc/powerpc64. +amd64/amd64, arm64/aarch64, i386/i386, powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf. .It Va WITHOUT_OPENSSH Do not build OpenSSH. .It Va WITHOUT_OPENSSL From owner-dev-commits-src-main@freebsd.org Sun Jun 27 19:13: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 90E8A64797A; Sun, 27 Jun 2021 19:13: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 4GCgPK3MMbz4lxF; Sun, 27 Jun 2021 19:13: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 5BBA317C05; Sun, 27 Jun 2021 19:13: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 15RJD97t077823; Sun, 27 Jun 2021 19:13:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15RJD91U077822; Sun, 27 Jun 2021 19:13:09 GMT (envelope-from git) Date: Sun, 27 Jun 2021 19:13:09 GMT Message-Id: <202106271913.15RJD91U077822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: c7f048ab3532 - main - sctp: initialize sequence numbers for ECN correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7f048ab3532a9f081addd6da0adf96f25271de8 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, 27 Jun 2021 19:13:09 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=c7f048ab3532a9f081addd6da0adf96f25271de8 commit c7f048ab3532a9f081addd6da0adf96f25271de8 Author: Michael Tuexen AuthorDate: 2021-06-27 18:14:48 +0000 Commit: Michael Tuexen CommitDate: 2021-06-27 18:14:48 +0000 sctp: initialize sequence numbers for ECN correctly MFC after: 3 days Reported by: Junseok Yang (for the userland stack) --- sys/netinet/sctp_input.c | 11 ++--------- sys/netinet/sctp_output.c | 2 +- sys/netinet/sctp_pcb.c | 6 +++--- sys/netinet/sctp_pcb.h | 4 ++-- sys/netinet/sctp_usrreq.c | 4 ++-- sys/netinet/sctputil.c | 22 ++++++++++++++-------- sys/netinet/sctputil.h | 2 +- sys/netinet6/sctp6_usrreq.c | 2 +- 8 files changed, 26 insertions(+), 27 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index b822c9eae2ca..6a0b5d41052a 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -2053,7 +2053,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, * getting a cookie, we cannot be unbound. */ stcb = sctp_aloc_assoc(inp, init_src, &error, - ntohl(initack_cp->init.initiate_tag), vrf_id, + ntohl(initack_cp->init.initiate_tag), + ntohl(initack_cp->init.initial_tsn), vrf_id, ntohs(initack_cp->init.num_outbound_streams), port, (struct thread *)NULL, @@ -2097,15 +2098,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, return (NULL); } /* process the INIT-ACK info (my info) */ - asoc->my_vtag = ntohl(initack_cp->init.initiate_tag); asoc->my_rwnd = ntohl(initack_cp->init.a_rwnd); - asoc->init_seq_number = ntohl(initack_cp->init.initial_tsn); - asoc->sending_seq = asoc->asconf_seq_out = asoc->str_reset_seq_out = asoc->init_seq_number; - asoc->asconf_seq_out_acked = asoc->asconf_seq_out - 1; - asoc->asconf_seq_in = asoc->last_acked_seq = asoc->init_seq_number - 1; - asoc->str_reset_seq_in = asoc->init_seq_number; - - asoc->advanced_peer_ack_point = asoc->last_acked_seq; /* process the INIT info (peer's info) */ if (sctp_process_init(init_cp, stcb) < 0) { diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 0f7ade931e61..c69db88f7d7d 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12703,7 +12703,7 @@ sctp_lower_sosend(struct socket *so, panic("Error, should hold create lock and I don't?"); } #endif - stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, + stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, p, diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 08acccbf9185..ce4850469144 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4154,8 +4154,8 @@ try_again: */ struct sctp_tcb * sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, - int *error, uint32_t override_tag, uint32_t vrf_id, - uint16_t o_streams, uint16_t port, + int *error, uint32_t override_tag, uint32_t initial_tsn, + uint32_t vrf_id, uint16_t o_streams, uint16_t port, struct thread *p, int initialize_auth_params) { @@ -4312,7 +4312,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, /* setup back pointer's */ stcb->sctp_ep = inp; stcb->sctp_socket = inp->sctp_socket; - if ((err = sctp_init_asoc(inp, stcb, override_tag, vrf_id, o_streams))) { + if ((err = sctp_init_asoc(inp, stcb, override_tag, initial_tsn, vrf_id, o_streams))) { /* failed */ SCTP_TCB_LOCK_DESTROY(stcb); SCTP_TCB_SEND_LOCK_DESTROY(stcb); diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index 08ca30a45803..c978e8c72b42 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -573,8 +573,8 @@ void sctp_inpcb_free(struct sctp_inpcb *, int, int); struct sctp_tcb * sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *, - int *, uint32_t, uint32_t, uint16_t, uint16_t, struct thread *, - int); + int *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, + struct thread *, int); int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 238c20c0e368..6308cabf5d63 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -1425,7 +1425,7 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval, vrf_id = inp->def_vrf_id; /* We are GOOD to go */ - stcb = sctp_aloc_assoc(inp, sa, &error, 0, vrf_id, + stcb = sctp_aloc_assoc(inp, sa, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, (struct thread *)p, @@ -7076,7 +7076,7 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p) vrf_id = inp->def_vrf_id; /* We are GOOD to go */ - stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, + stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, p, SCTP_INITIALIZE_AUTH_PARAMS); diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 82fc38b39ff7..aec2298e26b2 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1112,7 +1112,8 @@ sctp_map_assoc_state(int kernel_state) int sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - uint32_t override_tag, uint32_t vrf_id, uint16_t o_strms) + uint32_t override_tag, uint32_t initial_tsn, uint32_t vrf_id, + uint16_t o_strms) { struct sctp_association *asoc; @@ -1190,9 +1191,15 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, #endif asoc->refcnt = 0; asoc->assoc_up_sent = 0; - asoc->asconf_seq_out = asoc->str_reset_seq_out = asoc->init_seq_number = asoc->sending_seq = - sctp_select_initial_TSN(&inp->sctp_ep); - asoc->asconf_seq_out_acked = asoc->asconf_seq_out - 1; + if (override_tag) { + asoc->init_seq_number = initial_tsn; + } else { + asoc->init_seq_number = sctp_select_initial_TSN(&inp->sctp_ep); + } + asoc->asconf_seq_out = asoc->init_seq_number; + asoc->str_reset_seq_out = asoc->init_seq_number; + asoc->sending_seq = asoc->init_seq_number; + asoc->asconf_seq_out_acked = asoc->init_seq_number - 1; /* we are optimisitic here */ asoc->peer_supports_nat = 0; asoc->sent_queue_retran_cnt = 0; @@ -1200,13 +1207,12 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, /* for CMT */ asoc->last_net_cmt_send_started = NULL; - /* This will need to be adjusted */ asoc->last_acked_seq = asoc->init_seq_number - 1; - asoc->advanced_peer_ack_point = asoc->last_acked_seq; - asoc->asconf_seq_in = asoc->last_acked_seq; + asoc->advanced_peer_ack_point = asoc->init_seq_number - 1; + asoc->asconf_seq_in = asoc->init_seq_number - 1; /* here we are different, we hold the next one we expect */ - asoc->str_reset_seq_in = asoc->last_acked_seq + 1; + asoc->str_reset_seq_in = asoc->init_seq_number; asoc->initial_init_rto_max = inp->sctp_ep.initial_init_rto_max; asoc->initial_rto = inp->sctp_ep.initial_rto; diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h index 2e054c9d37e3..c81633223224 100644 --- a/sys/netinet/sctputil.h +++ b/sys/netinet/sctputil.h @@ -79,7 +79,7 @@ uint32_t sctp_select_initial_TSN(struct sctp_pcb *); uint32_t sctp_select_a_tag(struct sctp_inpcb *, uint16_t lport, uint16_t rport, int); -int sctp_init_asoc(struct sctp_inpcb *, struct sctp_tcb *, uint32_t, uint32_t, uint16_t); +int sctp_init_asoc(struct sctp_inpcb *, struct sctp_tcb *, uint32_t, uint32_t, uint32_t, uint16_t); void sctp_fill_random_store(struct sctp_pcb *); diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 3be7a3e25de8..09371ce249db 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -943,7 +943,7 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p) return (EALREADY); } /* We are GOOD to go */ - stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, + stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, p, SCTP_INITIALIZE_AUTH_PARAMS); From owner-dev-commits-src-main@freebsd.org Sun Jun 27 22:23: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 20E9664A169; Sun, 27 Jun 2021 22:23:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GClcW0Gm0z3JPj; Sun, 27 Jun 2021 22:23:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E640A19ECE; Sun, 27 Jun 2021 22:23: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 15RMN6L5030540; Sun, 27 Jun 2021 22:23:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15RMN69Q030539; Sun, 27 Jun 2021 22:23:06 GMT (envelope-from git) Date: Sun, 27 Jun 2021 22:23:06 GMT Message-Id: <202106272223.15RMN69Q030539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Tuffli Subject: git: 91064841d72b - main - bhyve: Fix NVMe iovec construction for large IOs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91064841d72b285a146a3f1c32cb447251e062ea 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, 27 Jun 2021 22:23:07 -0000 The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=91064841d72b285a146a3f1c32cb447251e062ea commit 91064841d72b285a146a3f1c32cb447251e062ea Author: Chuck Tuffli AuthorDate: 2021-06-27 22:14:52 +0000 Commit: Chuck Tuffli CommitDate: 2021-06-27 22:14:52 +0000 bhyve: Fix NVMe iovec construction for large IOs The UEFI driver included with Rocky Linux 8.4 uncovered an existing bug in the NVMe emulation's construction of iovec's. By default, NVMe data transfer operations use a scatter-gather list in which all entries point to a fixed size memory region. For example, if the Memory Page Size is 4KiB, a 2MiB IO requires 512 entries. Lists themselves are also fixed size (default is 512 entries). Because the list size is fixed, the last entry is special. If the IO requires more than 512 entries, the last entry in the list contains the address of the next list of entries. But if the IO requires exactly 512 entries, the last entry points to data. The NVMe emulation missed this logic and unconditionally treated the last entry as a pointer to the next list. Fix is to check if the remaining data is greater than the page size before using the last entry as a pointer to the next list. PR: 256422 Reported by: dave@syix.com Tested by: jason@tubnor.net MFC after: 5 days Relnotes: yes Reviewed by: imp, grehan Differential Revision: https://reviews.freebsd.org/D30897 --- usr.sbin/bhyve/pci_nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 414edabc2b7c..fa316fa285db 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -1976,7 +1976,7 @@ nvme_write_read_blockif(struct pci_nvme_softc *sc, /* PRP2 is pointer to a physical region page list */ while (bytes) { /* Last entry in list points to the next list */ - if (prp_list == last) { + if ((prp_list == last) && (bytes > PAGE_SIZE)) { uint64_t prp = *prp_list; prp_list = paddr_guest2host(vmctx, prp,