From owner-dev-commits-src-main@freebsd.org Mon Sep 20 04:37: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 AAD5F677820; Mon, 20 Sep 2021 04:37: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 4HCWxR4Bsmz3Phl; Mon, 20 Sep 2021 04:37: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 6C3AE1CB8; Mon, 20 Sep 2021 04:37: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 18K4bFWg054950; Mon, 20 Sep 2021 04:37:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K4bFeH054949; Mon, 20 Sep 2021 04:37:15 GMT (envelope-from git) Date: Mon, 20 Sep 2021 04:37:15 GMT Message-Id: <202109200437.18K4bFeH054949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: 2ac039f7be62 - main - [fib_algo][dxr] Merge adjacent empty range table chunks. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ac039f7be620f692a3a086f35a51f1a0b6b03d2 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, 20 Sep 2021 04:37:15 -0000 The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=2ac039f7be620f692a3a086f35a51f1a0b6b03d2 commit 2ac039f7be620f692a3a086f35a51f1a0b6b03d2 Author: Marko Zec AuthorDate: 2021-09-20 04:30:45 +0000 Commit: Marko Zec CommitDate: 2021-09-20 04:30:45 +0000 [fib_algo][dxr] Merge adjacent empty range table chunks. MFC after: 3 days --- sys/netinet/in_fib_dxr.c | 60 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index 3aa357cadedc..c4f42abdda27 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -418,14 +418,15 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) fdesc->base = cdp->cd_base; da->rtbl_top -= size; da->unused_chunks_cnt--; - if (cdp->cd_max_size > size + 1) { + if (cdp->cd_max_size > size) { /* Split the range in two, need a new descriptor */ empty_cdp = uma_zalloc(chunk_zone, M_NOWAIT); if (empty_cdp == NULL) return (1); + empty_cdp->cd_cur_size = 0; empty_cdp->cd_max_size = cdp->cd_max_size - size; empty_cdp->cd_base = cdp->cd_base + size; - LIST_INSERT_AFTER(cdp, empty_cdp, cd_all_le); + LIST_INSERT_BEFORE(cdp, empty_cdp, cd_all_le); LIST_INSERT_AFTER(cdp, empty_cdp, cd_hash_le); da->all_chunks_cnt++; da->unused_chunks_cnt++; @@ -433,7 +434,7 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) } LIST_REMOVE(cdp, cd_hash_le); } else { - /* Alloc a new descriptor */ + /* Alloc a new descriptor at the top of the heap*/ cdp = uma_zalloc(chunk_zone, M_NOWAIT); if (cdp == NULL) return (1); @@ -441,6 +442,8 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) cdp->cd_base = fdesc->base; LIST_INSERT_HEAD(&da->all_chunks, cdp, cd_all_le); da->all_chunks_cnt++; + KASSERT(cdp->cd_base + cdp->cd_max_size == da->rtbl_top, + ("dxr: %s %d", __FUNCTION__, __LINE__)); } cdp->cd_hash = hash; @@ -473,12 +476,12 @@ static void chunk_unref(struct dxr_aux *da, uint32_t chunk) { struct direct_entry *fdesc = &da->direct_tbl[chunk]; - struct chunk_desc *cdp; + struct chunk_desc *cdp, *cdp2; uint32_t base = fdesc->base; uint32_t size = chunk_size(da, fdesc); uint32_t hash = chunk_hash(da, fdesc); - /* Find an existing descriptor */ + /* Find the corresponding descriptor */ LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], cd_hash_le) if (cdp->cd_hash == hash && cdp->cd_cur_size == size && @@ -492,23 +495,50 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk) LIST_REMOVE(cdp, cd_hash_le); da->unused_chunks_cnt++; - if (cdp->cd_base + cdp->cd_max_size != da->rtbl_top) { - LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); - return; + cdp->cd_cur_size = 0; + + /* Attempt to merge with the preceding chunk, if empty */ + cdp2 = LIST_NEXT(cdp, cd_all_le); + if (cdp2 != NULL && cdp2->cd_cur_size == 0) { + KASSERT(cdp2->cd_base + cdp2->cd_max_size == cdp->cd_base, + ("dxr: %s %d", __FUNCTION__, __LINE__)); + LIST_REMOVE(cdp, cd_all_le); + da->all_chunks_cnt--; + LIST_REMOVE(cdp2, cd_hash_le); + da->unused_chunks_cnt--; + cdp2->cd_max_size += cdp->cd_max_size; + uma_zfree(chunk_zone, cdp); + cdp = cdp2; } - do { + /* Attempt to merge with the subsequent chunk, if empty */ + cdp2 = LIST_PREV(cdp, &da->all_chunks, chunk_desc, cd_all_le); + if (cdp2 != NULL && cdp2->cd_cur_size == 0) { + KASSERT(cdp->cd_base + cdp->cd_max_size == cdp2->cd_base, + ("dxr: %s %d", __FUNCTION__, __LINE__)); + LIST_REMOVE(cdp, cd_all_le); + da->all_chunks_cnt--; + LIST_REMOVE(cdp2, cd_hash_le); + da->unused_chunks_cnt--; + cdp2->cd_max_size += cdp->cd_max_size; + cdp2->cd_base = cdp->cd_base; + uma_zfree(chunk_zone, cdp); + cdp = cdp2; + } + + if (cdp->cd_base + cdp->cd_max_size == da->rtbl_top) { + /* Free the chunk on the top of the range heap, trim the heap */ + KASSERT(cdp == LIST_FIRST(&da->all_chunks), + ("dxr: %s %d", __FUNCTION__, __LINE__)); da->all_chunks_cnt--; da->unused_chunks_cnt--; da->rtbl_top -= cdp->cd_max_size; LIST_REMOVE(cdp, cd_all_le); uma_zfree(chunk_zone, cdp); - LIST_FOREACH(cdp, &da->unused_chunks, cd_hash_le) - if (cdp->cd_base + cdp->cd_max_size == da->rtbl_top) { - LIST_REMOVE(cdp, cd_hash_le); - break; - } - } while (cdp != NULL); + return; + } + + LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); } #ifdef DXR2 From owner-dev-commits-src-main@freebsd.org Mon Sep 20 05:26: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 ED247678658; Mon, 20 Sep 2021 05:26: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 4HCY1w63LYz3sL4; Mon, 20 Sep 2021 05:26: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 B05102AC4; Mon, 20 Sep 2021 05:26: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 18K5QC6H021731; Mon, 20 Sep 2021 05:26:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K5QCtn021730; Mon, 20 Sep 2021 05:26:12 GMT (envelope-from git) Date: Mon, 20 Sep 2021 05:26:12 GMT Message-Id: <202109200526.18K5QCtn021730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 6f62e3a719bd - main - The linux rc.d script mounts several filesystems related to Linux ABI compatibility layer. When /compat is located on a ZFS other than /, mount would fail because they were not mounted. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f62e3a719bdaba2a1ccdafe4e3a810217aea817 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, 20 Sep 2021 05:26:13 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=6f62e3a719bdaba2a1ccdafe4e3a810217aea817 commit 6f62e3a719bdaba2a1ccdafe4e3a810217aea817 Author: Xin LI AuthorDate: 2021-09-20 05:25:23 +0000 Commit: Xin LI CommitDate: 2021-09-20 05:25:26 +0000 The linux rc.d script mounts several filesystems related to Linux ABI compatibility layer. When /compat is located on a ZFS other than /, mount would fail because they were not mounted. Solve this by moving `linux` to depend on `zfs` which mounts all ZFS filesystems. Differential Revision: https://reviews.freebsd.org/D31848 MFC after: 2 weeks --- libexec/rc/rc.d/linux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index 23cb5acc6f99..fd3e3d902709 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -4,7 +4,7 @@ # # PROVIDE: linux -# REQUIRE: kldxref +# REQUIRE: kldxref zfs # KEYWORD: nojail . /etc/rc.subr From owner-dev-commits-src-main@freebsd.org Mon Sep 20 05:26: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 6B155678521; Mon, 20 Sep 2021 05:26: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 4HCY2M2YK3z3sVl; Mon, 20 Sep 2021 05:26: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 37D0828AE; Mon, 20 Sep 2021 05:26: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 18K5QZuB021870; Mon, 20 Sep 2021 05:26:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K5QZOL021869; Mon, 20 Sep 2021 05:26:35 GMT (envelope-from git) Date: Mon, 20 Sep 2021 05:26:35 GMT Message-Id: <202109200526.18K5QZOL021869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 7ba7bf48d5bd - main - Update leap-seconds to leap-seconds.3676924800. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f 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, 20 Sep 2021 05:26:35 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f commit 7ba7bf48d5bd6ca89f4e81579456b74ee7aa9e4f Author: Xin LI AuthorDate: 2021-09-20 05:26:22 +0000 Commit: Xin LI CommitDate: 2021-09-20 05:26:22 +0000 Update leap-seconds to leap-seconds.3676924800. Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800. MFC after: 3 days --- usr.sbin/ntp/ntpd/leap-seconds | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ntp/ntpd/leap-seconds b/usr.sbin/ntp/ntpd/leap-seconds index e897a867e164..cfda3e885e64 100644 --- a/usr.sbin/ntp/ntpd/leap-seconds +++ b/usr.sbin/ntp/ntpd/leap-seconds @@ -204,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C60 -# File expires on: 28 June 2021 +# Updated through IERS Bulletin C62 +# File expires on: 28 June 2022 # -#@ 3833827200 +#@ 3865363200 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -252,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 064356a8 39268b92 76e4d5ef 3e22fae1 0cca529c +#h 599d45bf accd4b4f 8b60e46 49b623 7d13b825 From owner-dev-commits-src-main@freebsd.org Mon Sep 20 07:39: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 21FF167A28E; Mon, 20 Sep 2021 07:39: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 4HCbzM0Bytz3F2g; Mon, 20 Sep 2021 07:39: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 DBC4848EC; Mon, 20 Sep 2021 07: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 18K7dAKQ094420; Mon, 20 Sep 2021 07: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 18K7dAPS094419; Mon, 20 Sep 2021 07:39:10 GMT (envelope-from git) Date: Mon, 20 Sep 2021 07:39:10 GMT Message-Id: <202109200739.18K7dAPS094419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 9ac518adf03e - main - stress2: Update test to ensure propper cleanup of fifo files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ac518adf03e371aa3e8499f84d995663bd4e0c1 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, 20 Sep 2021 07:39:11 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=9ac518adf03e371aa3e8499f84d995663bd4e0c1 commit 9ac518adf03e371aa3e8499f84d995663bd4e0c1 Author: Peter Holm AuthorDate: 2021-09-20 07:36:27 +0000 Commit: Peter Holm CommitDate: 2021-09-20 07:36:27 +0000 stress2: Update test to ensure propper cleanup of fifo files --- tools/test/stress2/testcases/mkfifo/mkfifo.c | 67 +++++++++++----------------- 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/tools/test/stress2/testcases/mkfifo/mkfifo.c b/tools/test/stress2/testcases/mkfifo/mkfifo.c index caeb5e45310b..fd4a68b7e0f2 100644 --- a/tools/test/stress2/testcases/mkfifo/mkfifo.c +++ b/tools/test/stress2/testcases/mkfifo/mkfifo.c @@ -26,82 +26,63 @@ */ #include -#include #include -#include +#include + +#include #include -#include -#include #include -#include +#include +#include #include -#include +#include #include "stress.h" static char path[MAXPATHLEN+1]; -#define NB (1 * 1024 * 1024) - -static int bufsize; -static int freespace; - -static void -handler2(int i __unused) -{ - _exit(0); -} +static int bufsize, freespace; static void reader(void) { - int fd; - int i, n, *buf; + fd_set set; + struct timeval tv; + int *buf, fd, n; setproctitle("reader"); - signal(SIGALRM, handler2); - alarm(60); - if ((fd = open(path, O_RDWR, 0600)) < 0) { - unlink(path); + if ((fd = open(path, O_RDONLY | O_NONBLOCK)) < 0) err(1, "open(%s)", path); - } if ((buf = malloc(bufsize)) == NULL) err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); - for (i = 0; i < NB; i+= bufsize) { + n = 0; + FD_ZERO(&set); + FD_SET(fd, &set); + tv.tv_sec = 10; + tv.tv_usec = 0; + if (select(fd + 1, &set, NULL, NULL, &tv) == 1) { if ((n = read(fd, buf, bufsize)) < 0) err(1, "read(), %s:%d", __FILE__, __LINE__); - if (n == 0) break; } close(fd); free(buf); - return; } static void writer(void) { - int i, *buf; - int fd; - - signal(SIGALRM, handler2); - alarm(60); + int *buf, fd; setproctitle("writer"); - if ((fd = open(path, O_RDWR, 0600)) < 0) { + if ((fd = open(path, O_WRONLY)) < 0) { unlink(path); err(1, "open(%s)", path); } if ((buf = malloc(bufsize)) == NULL) err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); - for (i = 0; i < bufsize / (int)sizeof(int); i++) - buf[i] = i; - - for (i = 0; i < NB; i+= bufsize) { - if (write(fd, buf, bufsize) < 0) { - err(1, "write(%d), %s:%d", fd, - __FILE__, __LINE__); - } - } + memset(buf, 0, bufsize); + + if (write(fd, buf, bufsize) < 0) + err(1, "write(%d), %s:%d", fd, __FILE__, __LINE__); close(fd); free(buf); - return; } int @@ -134,6 +115,7 @@ setup(int nb) if (!freespace) _exit(0); bufsize = 2 << random_int(2, 12); + return (0); } @@ -179,5 +161,6 @@ test(void) err(1, "fork(), %s:%d", __FILE__, __LINE__); unlink(path); + return (0); } From owner-dev-commits-src-main@freebsd.org Mon Sep 20 08:50: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 30A2A67B2E5; Mon, 20 Sep 2021 08:50:49 +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 4HCdZ00r9Fz3ndx; Mon, 20 Sep 2021 08:50:48 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ed1-f45.google.com with SMTP id c21so58005327edj.0; Mon, 20 Sep 2021 01:50:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+DFwDS4jml9xq16eCBzFV9n/VrCkyr1oass1Wl+BCBs=; b=PFiZt+BN02VTTup7VN5MUr28A0ATUiRCxBucl9Dg3vQFsCU9CAX0K16v31a9O33TYN 26tlGmfxeU2fEQMt6UWbCZZEE7eX7gLzLtJVY7QwzJ7FXR0nEZb2az9IHx+/CLQ1Okf3 rVxFAEnIAjRvc2D/jmq1GkCPaBvO0XOYloyGvOQLtfk+yG5WIwRN+2M30dn9dllJg2th slbJqAWNZaYbAoQSR+Af59l4iRvt2IA23Tzl/72n7Oy7vssnMBktUUcOZabGTFEEHVmo xrixr5VXcBSl/4kWyjaBPqDXetgdAeXmca8ebW7AziBGaRcqA0+6hZXJfudtkYq1DYLg yCvg== X-Gm-Message-State: AOAM5329ClY9LVluyXf1S8AKxMGIRw5tEwlsHPg3iS9KXfThvN5QZrsd HgQ856f2ix9GFDVr0I0L2Jef6aiblA6Ulg== X-Google-Smtp-Source: ABdhPJy9oCSfe6bjQXgS6t0mVSrnFQ1EhdnMI2AB4hNKG5TILNwH74EwoCpOMCJvTWXfQo0GOWMHTg== X-Received: by 2002:a05:6402:3c2:: with SMTP id t2mr27391637edw.261.1632127839177; Mon, 20 Sep 2021 01:50:39 -0700 (PDT) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com. [209.85.221.48]) by smtp.gmail.com with ESMTPSA id n10sm5793315ejk.86.2021.09.20.01.50.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Sep 2021 01:50:38 -0700 (PDT) Received: by mail-wr1-f48.google.com with SMTP id u18so25742608wrg.5; Mon, 20 Sep 2021 01:50:38 -0700 (PDT) X-Received: by 2002:a5d:510b:: with SMTP id s11mr26374585wrt.79.1632127838471; Mon, 20 Sep 2021 01:50:38 -0700 (PDT) MIME-Version: 1.0 References: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> <87sfy1rmj7.wl-herbert@gojira.at> In-Reply-To: <87sfy1rmj7.wl-herbert@gojira.at> From: Alexander Richardson Date: Mon, 20 Sep 2021 09:50:27 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain To: "Herbert J. Skuhra" Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HCdZ00r9Fz3ndx 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 [-3.00 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[209.85.208.45:from,209.85.221.48:received]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FORGED_SENDER(0.30)[arichardson@freebsd.org,arichardsonkde@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.208.45:from]; 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]; TAGGED_FROM(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 08:50:49 -0000 On Sun, 19 Sept 2021 at 09:37, Herbert J. Skuhra wrote: > > On Mon, 06 Sep 2021 11:24:02 +0200, Alex Richardson wrote: > > > > The branch main has been updated by arichardson: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=021385aba56279febcfdcc64d23673a0106ae45d > > > > commit 021385aba56279febcfdcc64d23673a0106ae45d > > Author: Alex Richardson > > AuthorDate: 2021-09-06 08:49:49 +0000 > > Commit: Alex Richardson > > CommitDate: 2021-09-06 08:49:49 +0000 > > > > Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain > > > > When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as > > ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. > > Having the LLVM binutils instead of the elftoolchain ones allows us to use > > features such as LTO that depend on binutils that understand LLVM IR. > > Another benefit will be an improved user-experience when compiling with > > AddressSanitizer, since ASAN does not symbolize backtraces correctly if > > addr2line is elftoolchain addr2line instead of llvm-symbolizer. > > See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html > > for more details. > > > > This is currently off by default but will be turned on by default at some > > point in the near future. > > > > Reviewed By: emaste > > > > Differential Revision: https://reviews.freebsd.org/D31060 > > --- > > Makefile.inc1 | 4 +++- > > lib/Makefile | 5 ++++- > > lib/clang/Makefile | 4 +++- > > lib/clang/libllvm/Makefile | 6 +++--- > > share/mk/src.opts.mk | 8 ++++++++ > > tools/build/options/WITH_LLVM_BINUTILS | 2 ++ > > usr.bin/Makefile | 16 +++++++++++----- > > usr.bin/clang/Makefile | 13 +++++++++---- > > usr.bin/clang/llvm-ar/Makefile | 7 +++++++ > > usr.bin/clang/llvm-nm/Makefile | 7 +++++++ > > usr.bin/clang/llvm-objcopy/Makefile | 7 +++++++ > > usr.bin/clang/llvm-objdump/Makefile | 7 +++++++ > > usr.bin/clang/llvm-size/Makefile | 7 +++++++ > > usr.bin/clang/llvm-symbolizer/Makefile | 7 +++++++ > > 14 files changed, 85 insertions(+), 15 deletions(-) > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > index b59c1913f8ce..478824675382 100644 > > --- a/Makefile.inc1 > > +++ b/Makefile.inc1 > > @@ -771,6 +771,7 @@ XMAKE= ${BMAKE} \ > > TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ > > MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \ > > MK_LLDB=no \ > > + MK_LLVM_BINUTILS=no \ > > MK_TESTS=no > > > > # kernel-tools stage > > @@ -2339,9 +2340,10 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree > > > > # We need to build tblgen when we're building clang or lld, either as > > # bootstrap tools, or as the part of the normal build. > > +# llvm-tblgen is also needed for various llvm binutils (e.g. objcopy). > > .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ > > ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ > > - ${MK_LLDB} != "no" > > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > > _clang_tblgen= \ > > lib/clang/libllvmminimal \ > > usr.bin/clang/llvm-tblgen > > diff --git a/lib/Makefile b/lib/Makefile > > index 674368a19ffd..1e375bb456e6 100644 > > --- a/lib/Makefile > > +++ b/lib/Makefile > > @@ -157,7 +157,10 @@ SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp > > SUBDIR.${MK_BSNMP}+= libbsnmp > > > > .if !defined(COMPAT_32BIT) && !defined(COMPAT_SOFTFP) > > -SUBDIR.${MK_CLANG}+= clang > > +.if ${MK_CLANG} != "no" || ${MK_LLD} != "no" || \ > > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > > +SUBDIR+= clang > > +.endif > > .endif > > > > SUBDIR.${MK_CUSE}+= libcuse > > diff --git a/lib/clang/Makefile b/lib/clang/Makefile > > index bc09ea62dc67..df4aa01a2653 100644 > > --- a/lib/clang/Makefile > > +++ b/lib/clang/Makefile > > @@ -4,10 +4,12 @@ > > > > # These have to be built in order. > > SUBDIR= libllvm > > +.if ${MK_CLANG} != "no" > > SUBDIR+= libclang > > +SUBDIR+= headers > > +.endif > > .if ${MK_LLDB} != "no" > > SUBDIR+= liblldb > > .endif > > -SUBDIR+= headers > > > > .include > > diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile > > index 09d6336c01d9..7eaedf65dcb3 100644 > > --- a/lib/clang/libllvm/Makefile > > +++ b/lib/clang/libllvm/Makefile > > @@ -830,7 +830,7 @@ SRCS_MIN+= Object/IRObjectFile.cpp > > SRCS_MIN+= Object/IRSymtab.cpp > > SRCS_MIN+= Object/MachOObjectFile.cpp > > SRCS_MIW+= Object/MachOUniversal.cpp > > -SRCS_EXT+= Object/MachOUniversalWriter.cpp > > +SRCS_MIW+= Object/MachOUniversalWriter.cpp > > SRCS_MIW+= Object/Minidump.cpp > > SRCS_MIN+= Object/ModuleSymbolTable.cpp > > SRCS_EXT+= Object/Object.cpp > > @@ -920,7 +920,7 @@ SRCS_MIN+= Support/Errno.cpp > > SRCS_MIN+= Support/Error.cpp > > SRCS_MIN+= Support/ErrorHandling.cpp > > SRCS_MIN+= Support/FileCollector.cpp > > -SRCS_EXL+= Support/FileOutputBuffer.cpp > > +SRCS_MIW+= Support/FileOutputBuffer.cpp > > SRCS_MIN+= Support/FileUtilities.cpp > > SRCS_MIN+= Support/FoldingSet.cpp > > SRCS_MIN+= Support/FormatVariadic.cpp > > @@ -945,7 +945,7 @@ SRCS_MIN+= Support/MD5.cpp > > SRCS_MIN+= Support/ManagedStatic.cpp > > SRCS_MIN+= Support/MathExtras.cpp > > SRCS_MIN+= Support/MemAlloc.cpp > > -SRCS_XDL+= Support/Memory.cpp > > +SRCS_MIW+= Support/Memory.cpp > > SRCS_MIN+= Support/MemoryBuffer.cpp > > SRCS_MIN+= Support/MemoryBufferRef.cpp > > SRCS_MIN+= Support/NativeFormatting.cpp > > diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk > > index 32346e31a752..5363cb6e78f9 100644 > > --- a/share/mk/src.opts.mk > > +++ b/share/mk/src.opts.mk > > @@ -203,6 +203,7 @@ __DEFAULT_NO_OPTIONS = \ > > LOADER_FIREWIRE \ > > LOADER_VERBOSE \ > > LOADER_VERIEXEC_PASS_MANIFEST \ > > + LLVM_BINUTILS \ > > MALLOC_PRODUCTION \ > > OFED_EXTRA \ > > OPENLDAP \ > > @@ -459,6 +460,7 @@ MK_CLANG:= no > > MK_INCLUDES:= no > > MK_LLD:= no > > MK_LLDB:= no > > +MK_LLVM_BINUTILS:= no > > .endif > > > > .if ${MK_CLANG} == "no" > > @@ -468,6 +470,12 @@ MK_CLANG_FULL:= no > > MK_LLVM_COV:= no > > .endif > > > > +.if ${MK_LLVM_BINUTILS} == "yes" > > +# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be > > +# enabled if MK_LLVM_BINUTILS is set. > > +MK_LLVM_CXXFILT:= yes > > +.endif > > + > > .if ${MK_LOADER_VERIEXEC} == "no" > > MK_LOADER_VERIEXEC_PASS_MANIFEST := no > > .endif > > diff --git a/tools/build/options/WITH_LLVM_BINUTILS b/tools/build/options/WITH_LLVM_BINUTILS > > new file mode 100644 > > index 000000000000..8fa2c55f31a9 > > --- /dev/null > > +++ b/tools/build/options/WITH_LLVM_BINUTILS > > @@ -0,0 +1,2 @@ > > +.\" $FreeBSD$ > > +Install LLVM's binutils (ar, addr2line, nm, etc.) instead of ELF Tool Chain's. > > diff --git a/usr.bin/Makefile b/usr.bin/Makefile > > index f1b07a7007be..e8be161db01a 100644 > > --- a/usr.bin/Makefile > > +++ b/usr.bin/Makefile > > @@ -195,7 +195,10 @@ SUBDIR.${MK_ATM}+= atm > > SUBDIR.${MK_BLUETOOTH}+= bluetooth > > SUBDIR.${MK_BSD_CPIO}+= cpio > > SUBDIR.${MK_CALENDAR}+= calendar > > -SUBDIR.${MK_CLANG}+= clang > > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" || \ > > + ${MK_LLD} != "no" || ${MK_LLDB} != "no" > > +SUBDIR+= clang > > +.endif > > SUBDIR.${MK_DIALOG}+= dpv > > SUBDIR.${MK_EE}+= ee > > SUBDIR.${MK_FILE}+= file > > @@ -251,25 +254,28 @@ SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= kyua > > SUBDIR.${MK_TESTS}+= tests > > SUBDIR.${MK_TEXTPROC}+= ul > > SUBDIR.${MK_TFTP}+= tftp > > +.if ${MK_LLVM_BINUTILS} == "no" > > +# Only build the elftoolchain tools if we aren't using the LLVM ones. > > SUBDIR.${MK_TOOLCHAIN}+= addr2line > > SUBDIR.${MK_TOOLCHAIN}+= ar > > +SUBDIR.${MK_TOOLCHAIN}+= nm > > +SUBDIR.${MK_TOOLCHAIN}+= objcopy > > +SUBDIR.${MK_TOOLCHAIN}+= readelf > > +SUBDIR.${MK_TOOLCHAIN}+= size > > +.endif > > SUBDIR.${MK_TOOLCHAIN}+= c89 > > SUBDIR.${MK_TOOLCHAIN}+= c99 > > SUBDIR.${MK_TOOLCHAIN}+= ctags > > .if ${MK_LLVM_CXXFILT} == "no" > > SUBDIR.${MK_TOOLCHAIN}+= cxxfilt > > .endif > > -SUBDIR.${MK_TOOLCHAIN}+= objcopy > > SUBDIR.${MK_TOOLCHAIN}+= file2c > > SUBDIR.${MK_TOOLCHAIN}+= gprof > > SUBDIR.${MK_TOOLCHAIN}+= indent > > SUBDIR.${MK_TOOLCHAIN}+= lex > > SUBDIR.${MK_TOOLCHAIN}+= mkstr > > -SUBDIR.${MK_TOOLCHAIN}+= nm > > -SUBDIR.${MK_TOOLCHAIN}+= readelf > > SUBDIR.${MK_TOOLCHAIN}+= rpcgen > > SUBDIR.${MK_TOOLCHAIN}+= unifdef > > -SUBDIR.${MK_TOOLCHAIN}+= size > > SUBDIR.${MK_TOOLCHAIN}+= xstr > > SUBDIR.${MK_TOOLCHAIN}+= yacc > > SUBDIR.${MK_VI}+= vi > > diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile > > index 1c53e94965f7..7fc31e8df194 100644 > > --- a/usr.bin/clang/Makefile > > +++ b/usr.bin/clang/Makefile > > @@ -7,12 +7,20 @@ SUBDIR+= clang > > .endif > > > > .if !defined(TOOLS_PREFIX) > > +# LLVM binutils are needed to support features such as LTO, so we build them > > +# by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them > > +# as the default binutils (ar,nm,addr2line, etc.). > > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" > > SUBDIR+= llvm-ar > > SUBDIR+= llvm-nm > > +SUBDIR+= llvm-objcopy > > SUBDIR+= llvm-objdump > > +SUBDIR+= llvm-size > > +SUBDIR+= llvm-strings > > SUBDIR+= llvm-symbolizer > > +.endif > > Update tools/build/mk/OptionalObsoleteFiles.inc? > > # make delete-old > >>> Removing old files (only deletes safe to delete libs) > remove /usr/bin/llvm-objcopy? n > remove /usr/bin/llvm-size? n > remove /usr/bin/llvm-strings? n > remove /usr/share/man/man1/llvm-objcopy.1.gz? n > remove /usr/share/man/man1/llvm-size.1.gz? n > remove /usr/share/man/man1/llvm-strings.1.gz? n > > -- > Herbert Hi Herbert, Sorry about that, I've posted https://reviews.freebsd.org/D32022 which should hopefully fix the issue? Thanks, Alex From owner-dev-commits-src-main@freebsd.org Mon Sep 20 09:01:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7063C67B6B5; Mon, 20 Sep 2021 09:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCdp92mVNz3q7Y; Mon, 20 Sep 2021 09:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F1625964; Mon, 20 Sep 2021 09:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18K91LTH014189; Mon, 20 Sep 2021 09:01:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18K91LjC014188; Mon, 20 Sep 2021 09:01:21 GMT (envelope-from git) Date: Mon, 20 Sep 2021 09:01:21 GMT Message-Id: <202109200901.18K91LjC014188@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: b831f9ce7079 - main - if_mvneta: Build the driver as a kernel module 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: b831f9ce7079b040b5f319b9c0f60daba4c6151a 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, 20 Sep 2021 09:01:21 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=b831f9ce7079b040b5f319b9c0f60daba4c6151a commit b831f9ce7079b040b5f319b9c0f60daba4c6151a Author: Hubert Mazur AuthorDate: 2021-09-13 09:44:31 +0000 Commit: Wojciech Macek CommitDate: 2021-09-20 08:58:58 +0000 if_mvneta: Build the driver as a kernel module Fix device detach and attach routine. Add required Makefile to build as a module. Remove entry from GENERIC, since now it can be loaded automatically. Tested on EspressoBin. Obtained from: Semihalf Reviewed by: manu Differential revision: https://reviews.freebsd.org/D31581 --- sys/dev/neta/if_mvneta.c | 81 +++++++++++++++++++++++++++-------------------- sys/modules/Makefile | 2 ++ sys/modules/neta/Makefile | 10 ++++++ 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index debb4a922cbc..71552bf2c515 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -222,6 +222,11 @@ static device_method_t mvneta_methods[] = { DEVMETHOD_END }; +static struct ofw_compat_data compat_data[] = { + { "marvell,armada-3700-neta", true }, + { NULL, false } +}; + DEFINE_CLASS_0(mvneta, mvneta_driver, mvneta_methods, sizeof(struct mvneta_softc)); DRIVER_MODULE(miibus, mvneta, miibus_driver, miibus_devclass, 0, 0); @@ -229,7 +234,7 @@ DRIVER_MODULE(mdio, mvneta, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(mvneta, mdio, 1, 1, 1); MODULE_DEPEND(mvneta, ether, 1, 1, 1); MODULE_DEPEND(mvneta, miibus, 1, 1, 1); -MODULE_DEPEND(mvneta, mvxpbm, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data); /* * List of MIB register and names @@ -609,6 +614,16 @@ mvneta_attach(device_t self) } #endif + error = bus_setup_intr(self, sc->res[1], + INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, + &sc->ih_cookie[0]); + if (error) { + device_printf(self, "could not setup %s\n", + mvneta_intrs[0].description); + mvneta_detach(self); + return (error); + } + /* * MAC address */ @@ -704,8 +719,6 @@ mvneta_attach(device_t self) } } - ether_ifattach(ifp, sc->enaddr); - /* * Enable DMA engines and Initialize Device Registers. */ @@ -835,20 +848,11 @@ mvneta_attach(device_t self) mvneta_update_media(sc, ifm_target); } - sysctl_mvneta_init(sc); + ether_ifattach(ifp, sc->enaddr); callout_reset(&sc->tick_ch, 0, mvneta_tick, sc); - error = bus_setup_intr(self, sc->res[1], - INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, - &sc->ih_cookie[0]); - if (error) { - device_printf(self, "could not setup %s\n", - mvneta_intrs[0].description); - ether_ifdetach(sc->ifp); - mvneta_detach(self); - return (error); - } + sysctl_mvneta_init(sc); return (0); } @@ -857,20 +861,28 @@ STATIC int mvneta_detach(device_t dev) { struct mvneta_softc *sc; + struct ifnet *ifp; int q; sc = device_get_softc(dev); + ifp = sc->ifp; - mvneta_stop(sc); - /* Detach network interface */ - if (sc->ifp) - if_free(sc->ifp); + if (device_is_attached(dev)) { + mvneta_stop(sc); + callout_drain(&sc->tick_ch); + ether_ifdetach(sc->ifp); + } for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) mvneta_ring_dealloc_rx_queue(sc, q); for (q = 0; q < MVNETA_TX_QNUM_MAX; q++) mvneta_ring_dealloc_tx_queue(sc, q); + device_delete_children(dev); + + if (sc->ih_cookie[0] != NULL) + bus_teardown_intr(dev, sc->res[1], sc->ih_cookie[0]); + if (sc->tx_dtag != NULL) bus_dma_tag_destroy(sc->tx_dtag); if (sc->rx_dtag != NULL) @@ -881,6 +893,13 @@ mvneta_detach(device_t dev) bus_dma_tag_destroy(sc->rxbuf_dtag); bus_release_resources(dev, res_spec, sc->res); + + if (sc->ifp) + if_free(sc->ifp); + + if (mtx_initialized(&sc->mtx)) + mtx_destroy(&sc->mtx); + return (0); } @@ -1254,6 +1273,9 @@ mvneta_ring_alloc_rx_queue(struct mvneta_softc *sc, int q) return (0); fail: + mvneta_rx_lockq(sc, q); + mvneta_ring_flush_rx_queue(sc, q); + mvneta_rx_unlockq(sc, q); mvneta_ring_dealloc_rx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1295,6 +1317,9 @@ mvneta_ring_alloc_tx_queue(struct mvneta_softc *sc, int q) return (0); fail: + mvneta_tx_lockq(sc, q); + mvneta_ring_flush_tx_queue(sc, q); + mvneta_tx_unlockq(sc, q); mvneta_ring_dealloc_tx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1324,16 +1349,6 @@ mvneta_ring_dealloc_tx_queue(struct mvneta_softc *sc, int q) #endif if (sc->txmbuf_dtag != NULL) { - if (mtx_name(&tx->ring_mtx) != NULL) { - /* - * It is assumed that maps are being loaded after mutex - * is initialized. Therefore we can skip unloading maps - * when mutex is empty. - */ - mvneta_tx_lockq(sc, q); - mvneta_ring_flush_tx_queue(sc, q); - mvneta_tx_unlockq(sc, q); - } for (i = 0; i < MVNETA_TX_RING_CNT; i++) { txbuf = &tx->txbuf[i]; if (txbuf->dmap != NULL) { @@ -1372,8 +1387,6 @@ mvneta_ring_dealloc_rx_queue(struct mvneta_softc *sc, int q) rx = MVNETA_RX_RING(sc, q); - mvneta_ring_flush_rx_queue(sc, q); - if (rx->desc_pa != 0) bus_dmamap_unload(sc->rx_dtag, rx->desc_map); @@ -2574,8 +2587,8 @@ mvneta_link_isr(struct mvneta_softc *sc) mvneta_linkdown(sc); #ifdef DEBUG - log(LOG_DEBUG, - "%s: link %s\n", device_xname(sc->dev), linkup ? "up" : "down"); + device_printf(sc->dev, + "%s: link %s\n", sc->ifp->if_xname, linkup ? "up" : "down"); #endif } @@ -2591,8 +2604,8 @@ mvneta_linkupdate(struct mvneta_softc *sc, boolean_t linkup) mvneta_linkdown(sc); #ifdef DEBUG - log(LOG_DEBUG, - "%s: link %s\n", device_xname(sc->dev), linkup ? "up" : "down"); + device_printf(sc->dev, + "%s: link %s\n", sc->ifp->if_xname, linkup ? "up" : "down"); #endif } diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 7ed2169445e4..b1063ad003d8 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -264,6 +264,7 @@ SUBDIR= \ mxge \ my \ ${_nctgpio} \ + ${_neta} \ ${_netgraph} \ ${_nfe} \ nfscl \ @@ -626,6 +627,7 @@ _rockchip= rockchip .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" _sdhci_fdt= sdhci_fdt _e6000sw= e6000sw +_neta= neta .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" diff --git a/sys/modules/neta/Makefile b/sys/modules/neta/Makefile new file mode 100644 index 000000000000..8845e181efaa --- /dev/null +++ b/sys/modules/neta/Makefile @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/neta + +CFLAGS+= -DFDT + +KMOD= if_mvneta +SRCS= if_mvneta.c if_mvneta_fdt.c if_mvnetavar.h +SRCS+= bus_if.h device_if.h mdio_if.h miibus_if.h ofw_bus_if.h opt_platform.h +.include From owner-dev-commits-src-main@freebsd.org Mon Sep 20 09:43: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 BFAB267C1C9; Mon, 20 Sep 2021 09:43:11 +0000 (UTC) (envelope-from herbert@gojira.at) Received: from mail.bsd4all.net (mail.bsd4all.net [IPv6:2a01:4f8:13b:240c::25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail.bsd4all.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCfkR3skWz4VxH; Mon, 20 Sep 2021 09:43:11 +0000 (UTC) (envelope-from herbert@gojira.at) Date: Mon, 20 Sep 2021 11:43:03 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=gojira.at; s=mail202005; t=1632130983; bh=OwzbF0KvrUn8IzhPgS8ZLtf6mjppjUv+YHpfSxRC/zQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=SsCroeUs4r7al4ezv7NOltO3vPLOlnOEQk+CKLHfc0QIdjzw1SdlxFn5ejxKcSCT4 92nC98aCrunFeXUToTzqFtbP6fWBU5vtRJ0wD8L2m0zIhUHEWSC2nCO7Y5JTOlDIwf xr1fAhWLJp3MVHmwK1aVSt6HeEy1b1C7Xn51O0F7HxFLw5PAFh/M7pHJ/QYbStiEyV LRxkoeOrEkW5anmeQ9cL9AbCmANmxRaV9IVsEYePJMkLG4tmHALfhL2fPlsdTJbag8 1aZOmRNOjJd4+CHf9L7/gbXWVoAX+DRUdsw4FXGfh9Szp/TJbk+M/0s/H8o69h3D10 5xZWpF3dtJBFw== From: "Herbert J. Skuhra" To: Alexander Richardson Cc: src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain Message-ID: References: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> <87sfy1rmj7.wl-herbert@gojira.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HCfkR3skWz4VxH 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, 20 Sep 2021 09:43:11 -0000 On Mon, Sep 20, 2021 at 09:50:27AM +0100, Alexander Richardson wrote: > On Sun, 19 Sept 2021 at 09:37, Herbert J. Skuhra wrote: > > > > On Mon, 06 Sep 2021 11:24:02 +0200, Alex Richardson wrote: > > > > > > The branch main has been updated by arichardson: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=021385aba56279febcfdcc64d23673a0106ae45d > > > > > > commit 021385aba56279febcfdcc64d23673a0106ae45d > > > Author: Alex Richardson > > > AuthorDate: 2021-09-06 08:49:49 +0000 > > > Commit: Alex Richardson > > > CommitDate: 2021-09-06 08:49:49 +0000 > > > > > > Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain > > > > > > When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as > > > ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. > > > Having the LLVM binutils instead of the elftoolchain ones allows us to use > > > features such as LTO that depend on binutils that understand LLVM IR. > > > Another benefit will be an improved user-experience when compiling with > > > AddressSanitizer, since ASAN does not symbolize backtraces correctly if > > > addr2line is elftoolchain addr2line instead of llvm-symbolizer. > > > See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html > > > for more details. > > > > > > This is currently off by default but will be turned on by default at some > > > point in the near future. > > > > > > Reviewed By: emaste > > > > > > Differential Revision: https://reviews.freebsd.org/D31060 > > > --- > > > Makefile.inc1 | 4 +++- > > > lib/Makefile | 5 ++++- > > > lib/clang/Makefile | 4 +++- > > > lib/clang/libllvm/Makefile | 6 +++--- > > > share/mk/src.opts.mk | 8 ++++++++ > > > tools/build/options/WITH_LLVM_BINUTILS | 2 ++ > > > usr.bin/Makefile | 16 +++++++++++----- > > > usr.bin/clang/Makefile | 13 +++++++++---- > > > usr.bin/clang/llvm-ar/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-nm/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-objcopy/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-objdump/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-size/Makefile | 7 +++++++ > > > usr.bin/clang/llvm-symbolizer/Makefile | 7 +++++++ > > > 14 files changed, 85 insertions(+), 15 deletions(-) > > > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > > index b59c1913f8ce..478824675382 100644 > > > --- a/Makefile.inc1 > > > +++ b/Makefile.inc1 > > > @@ -771,6 +771,7 @@ XMAKE= ${BMAKE} \ > > > TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ > > > MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \ > > > MK_LLDB=no \ > > > + MK_LLVM_BINUTILS=no \ > > > MK_TESTS=no > > > > > > # kernel-tools stage > > > @@ -2339,9 +2340,10 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree > > > > > > # We need to build tblgen when we're building clang or lld, either as > > > # bootstrap tools, or as the part of the normal build. > > > +# llvm-tblgen is also needed for various llvm binutils (e.g. objcopy). > > > .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ > > > ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ > > > - ${MK_LLDB} != "no" > > > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > > > _clang_tblgen= \ > > > lib/clang/libllvmminimal \ > > > usr.bin/clang/llvm-tblgen > > > diff --git a/lib/Makefile b/lib/Makefile > > > index 674368a19ffd..1e375bb456e6 100644 > > > --- a/lib/Makefile > > > +++ b/lib/Makefile > > > @@ -157,7 +157,10 @@ SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp > > > SUBDIR.${MK_BSNMP}+= libbsnmp > > > > > > .if !defined(COMPAT_32BIT) && !defined(COMPAT_SOFTFP) > > > -SUBDIR.${MK_CLANG}+= clang > > > +.if ${MK_CLANG} != "no" || ${MK_LLD} != "no" || \ > > > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > > > +SUBDIR+= clang > > > +.endif > > > .endif > > > > > > SUBDIR.${MK_CUSE}+= libcuse > > > diff --git a/lib/clang/Makefile b/lib/clang/Makefile > > > index bc09ea62dc67..df4aa01a2653 100644 > > > --- a/lib/clang/Makefile > > > +++ b/lib/clang/Makefile > > > @@ -4,10 +4,12 @@ > > > > > > # These have to be built in order. > > > SUBDIR= libllvm > > > +.if ${MK_CLANG} != "no" > > > SUBDIR+= libclang > > > +SUBDIR+= headers > > > +.endif > > > .if ${MK_LLDB} != "no" > > > SUBDIR+= liblldb > > > .endif > > > -SUBDIR+= headers > > > > > > .include > > > diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile > > > index 09d6336c01d9..7eaedf65dcb3 100644 > > > --- a/lib/clang/libllvm/Makefile > > > +++ b/lib/clang/libllvm/Makefile > > > @@ -830,7 +830,7 @@ SRCS_MIN+= Object/IRObjectFile.cpp > > > SRCS_MIN+= Object/IRSymtab.cpp > > > SRCS_MIN+= Object/MachOObjectFile.cpp > > > SRCS_MIW+= Object/MachOUniversal.cpp > > > -SRCS_EXT+= Object/MachOUniversalWriter.cpp > > > +SRCS_MIW+= Object/MachOUniversalWriter.cpp > > > SRCS_MIW+= Object/Minidump.cpp > > > SRCS_MIN+= Object/ModuleSymbolTable.cpp > > > SRCS_EXT+= Object/Object.cpp > > > @@ -920,7 +920,7 @@ SRCS_MIN+= Support/Errno.cpp > > > SRCS_MIN+= Support/Error.cpp > > > SRCS_MIN+= Support/ErrorHandling.cpp > > > SRCS_MIN+= Support/FileCollector.cpp > > > -SRCS_EXL+= Support/FileOutputBuffer.cpp > > > +SRCS_MIW+= Support/FileOutputBuffer.cpp > > > SRCS_MIN+= Support/FileUtilities.cpp > > > SRCS_MIN+= Support/FoldingSet.cpp > > > SRCS_MIN+= Support/FormatVariadic.cpp > > > @@ -945,7 +945,7 @@ SRCS_MIN+= Support/MD5.cpp > > > SRCS_MIN+= Support/ManagedStatic.cpp > > > SRCS_MIN+= Support/MathExtras.cpp > > > SRCS_MIN+= Support/MemAlloc.cpp > > > -SRCS_XDL+= Support/Memory.cpp > > > +SRCS_MIW+= Support/Memory.cpp > > > SRCS_MIN+= Support/MemoryBuffer.cpp > > > SRCS_MIN+= Support/MemoryBufferRef.cpp > > > SRCS_MIN+= Support/NativeFormatting.cpp > > > diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk > > > index 32346e31a752..5363cb6e78f9 100644 > > > --- a/share/mk/src.opts.mk > > > +++ b/share/mk/src.opts.mk > > > @@ -203,6 +203,7 @@ __DEFAULT_NO_OPTIONS = \ > > > LOADER_FIREWIRE \ > > > LOADER_VERBOSE \ > > > LOADER_VERIEXEC_PASS_MANIFEST \ > > > + LLVM_BINUTILS \ > > > MALLOC_PRODUCTION \ > > > OFED_EXTRA \ > > > OPENLDAP \ > > > @@ -459,6 +460,7 @@ MK_CLANG:= no > > > MK_INCLUDES:= no > > > MK_LLD:= no > > > MK_LLDB:= no > > > +MK_LLVM_BINUTILS:= no > > > .endif > > > > > > .if ${MK_CLANG} == "no" > > > @@ -468,6 +470,12 @@ MK_CLANG_FULL:= no > > > MK_LLVM_COV:= no > > > .endif > > > > > > +.if ${MK_LLVM_BINUTILS} == "yes" > > > +# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be > > > +# enabled if MK_LLVM_BINUTILS is set. > > > +MK_LLVM_CXXFILT:= yes > > > +.endif > > > + > > > .if ${MK_LOADER_VERIEXEC} == "no" > > > MK_LOADER_VERIEXEC_PASS_MANIFEST := no > > > .endif > > > diff --git a/tools/build/options/WITH_LLVM_BINUTILS b/tools/build/options/WITH_LLVM_BINUTILS > > > new file mode 100644 > > > index 000000000000..8fa2c55f31a9 > > > --- /dev/null > > > +++ b/tools/build/options/WITH_LLVM_BINUTILS > > > @@ -0,0 +1,2 @@ > > > +.\" $FreeBSD$ > > > +Install LLVM's binutils (ar, addr2line, nm, etc.) instead of ELF Tool Chain's. > > > diff --git a/usr.bin/Makefile b/usr.bin/Makefile > > > index f1b07a7007be..e8be161db01a 100644 > > > --- a/usr.bin/Makefile > > > +++ b/usr.bin/Makefile > > > @@ -195,7 +195,10 @@ SUBDIR.${MK_ATM}+= atm > > > SUBDIR.${MK_BLUETOOTH}+= bluetooth > > > SUBDIR.${MK_BSD_CPIO}+= cpio > > > SUBDIR.${MK_CALENDAR}+= calendar > > > -SUBDIR.${MK_CLANG}+= clang > > > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" || \ > > > + ${MK_LLD} != "no" || ${MK_LLDB} != "no" > > > +SUBDIR+= clang > > > +.endif > > > SUBDIR.${MK_DIALOG}+= dpv > > > SUBDIR.${MK_EE}+= ee > > > SUBDIR.${MK_FILE}+= file > > > @@ -251,25 +254,28 @@ SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= kyua > > > SUBDIR.${MK_TESTS}+= tests > > > SUBDIR.${MK_TEXTPROC}+= ul > > > SUBDIR.${MK_TFTP}+= tftp > > > +.if ${MK_LLVM_BINUTILS} == "no" > > > +# Only build the elftoolchain tools if we aren't using the LLVM ones. > > > SUBDIR.${MK_TOOLCHAIN}+= addr2line > > > SUBDIR.${MK_TOOLCHAIN}+= ar > > > +SUBDIR.${MK_TOOLCHAIN}+= nm > > > +SUBDIR.${MK_TOOLCHAIN}+= objcopy > > > +SUBDIR.${MK_TOOLCHAIN}+= readelf > > > +SUBDIR.${MK_TOOLCHAIN}+= size > > > +.endif > > > SUBDIR.${MK_TOOLCHAIN}+= c89 > > > SUBDIR.${MK_TOOLCHAIN}+= c99 > > > SUBDIR.${MK_TOOLCHAIN}+= ctags > > > .if ${MK_LLVM_CXXFILT} == "no" > > > SUBDIR.${MK_TOOLCHAIN}+= cxxfilt > > > .endif > > > -SUBDIR.${MK_TOOLCHAIN}+= objcopy > > > SUBDIR.${MK_TOOLCHAIN}+= file2c > > > SUBDIR.${MK_TOOLCHAIN}+= gprof > > > SUBDIR.${MK_TOOLCHAIN}+= indent > > > SUBDIR.${MK_TOOLCHAIN}+= lex > > > SUBDIR.${MK_TOOLCHAIN}+= mkstr > > > -SUBDIR.${MK_TOOLCHAIN}+= nm > > > -SUBDIR.${MK_TOOLCHAIN}+= readelf > > > SUBDIR.${MK_TOOLCHAIN}+= rpcgen > > > SUBDIR.${MK_TOOLCHAIN}+= unifdef > > > -SUBDIR.${MK_TOOLCHAIN}+= size > > > SUBDIR.${MK_TOOLCHAIN}+= xstr > > > SUBDIR.${MK_TOOLCHAIN}+= yacc > > > SUBDIR.${MK_VI}+= vi > > > diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile > > > index 1c53e94965f7..7fc31e8df194 100644 > > > --- a/usr.bin/clang/Makefile > > > +++ b/usr.bin/clang/Makefile > > > @@ -7,12 +7,20 @@ SUBDIR+= clang > > > .endif > > > > > > .if !defined(TOOLS_PREFIX) > > > +# LLVM binutils are needed to support features such as LTO, so we build them > > > +# by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them > > > +# as the default binutils (ar,nm,addr2line, etc.). > > > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" > > > SUBDIR+= llvm-ar > > > SUBDIR+= llvm-nm > > > +SUBDIR+= llvm-objcopy > > > SUBDIR+= llvm-objdump > > > +SUBDIR+= llvm-size > > > +SUBDIR+= llvm-strings > > > SUBDIR+= llvm-symbolizer > > > +.endif > > > > Update tools/build/mk/OptionalObsoleteFiles.inc? > > > > # make delete-old > > >>> Removing old files (only deletes safe to delete libs) > > remove /usr/bin/llvm-objcopy? n > > remove /usr/bin/llvm-size? n > > remove /usr/bin/llvm-strings? n > > remove /usr/share/man/man1/llvm-objcopy.1.gz? n > > remove /usr/share/man/man1/llvm-size.1.gz? n > > remove /usr/share/man/man1/llvm-strings.1.gz? n > > > > -- > > Herbert > > Hi Herbert, > > Sorry about that, I've posted https://reviews.freebsd.org/D32022 which > should hopefully fix the issue? Thanks. 'make delete-old' still prompts to delete the man pages: >>> Removing old files (only deletes safe to delete libs) remove /usr/share/man/man1/llvm-objcopy.1.gz? n remove /usr/share/man/man1/llvm-size.1.gz? n remove /usr/share/man/man1/llvm-strings.1.gz? n -- Herbert From owner-dev-commits-src-main@freebsd.org Mon Sep 20 10:58: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 C18E867CF02; Mon, 20 Sep 2021 10:58: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 4HChPC4XCNz4sbZ; Mon, 20 Sep 2021 10:58: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 7C066751F; Mon, 20 Sep 2021 10:58: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 18KAwNcZ061008; Mon, 20 Sep 2021 10:58:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KAwNqh061007; Mon, 20 Sep 2021 10:58:23 GMT (envelope-from git) Date: Mon, 20 Sep 2021 10:58:23 GMT Message-Id: <202109201058.18KAwNqh061007@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: b94d360e4aa6 - main - Add ELF macros found in the aaelf64 spec MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b94d360e4aa66d626ad5a0acde683ae9a9c71729 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, 20 Sep 2021 10:58:23 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=b94d360e4aa66d626ad5a0acde683ae9a9c71729 commit b94d360e4aa66d626ad5a0acde683ae9a9c71729 Author: Andrew Turner AuthorDate: 2021-09-20 08:55:44 +0000 Commit: Andrew Turner CommitDate: 2021-09-20 10:34:04 +0000 Add ELF macros found in the aaelf64 spec The arm64 aaelf64 spec [0] has DT_AARCH64_ that could be used with dynamic linking. It also adds GNU_PROPERTY_AARCH64_FEATURE_1_AND used to tell the kernel which CPU features the binary is compatible with, but does not require to execute correctly. Add these values so the kernel and elf tools can make use of them. [0] https://github.com/ARM-software/abi-aa/blob/2021Q1/aaelf64/aaelf64.rst Sponsored by: The FreeBSD Foundation --- sys/sys/elf_common.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h index d362f51ed833..4df2751b07cf 100644 --- a/sys/sys/elf_common.h +++ b/sys/sys/elf_common.h @@ -678,6 +678,10 @@ typedef struct { #define DT_LOPROC 0x70000000 /* First processor-specific type. */ +#define DT_AARCH64_BTI_PLT 0x70000001 +#define DT_AARCH64_PAC_PLT 0x70000003 +#define DT_AARCH64_VARIANT_PCS 0x70000005 + #define DT_ARM_SYMTABSZ 0x70000001 #define DT_ARM_PREEMPTMAP 0x70000002 @@ -829,6 +833,11 @@ typedef struct { #define GNU_PROPERTY_LOPROC 0xc0000000 #define GNU_PROPERTY_HIPROC 0xdfffffff +#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 + +#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI 0x00000001 +#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC 0x00000002 + #define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 #define GNU_PROPERTY_X86_FEATURE_1_IBT 0x00000001 From owner-dev-commits-src-main@freebsd.org Mon Sep 20 13:55: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 E59D767E642; Mon, 20 Sep 2021 13:55: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 4HCmKj5ykcz4lVv; Mon, 20 Sep 2021 13:55: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 A993F11A57; Mon, 20 Sep 2021 13:55: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 18KDtbTM099982; Mon, 20 Sep 2021 13:55:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KDtb4r099981; Mon, 20 Sep 2021 13:55:37 GMT (envelope-from git) Date: Mon, 20 Sep 2021 13:55:37 GMT Message-Id: <202109201355.18KDtb4r099981@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: 34b1efcea19d - main - sctp: use a valid outstream when adding it to the scheduler 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: 34b1efcea19dd4324eecd19d2de313d039fd9656 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, 20 Sep 2021 13:55:38 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=34b1efcea19dd4324eecd19d2de313d039fd9656 commit 34b1efcea19dd4324eecd19d2de313d039fd9656 Author: Michael Tuexen AuthorDate: 2021-09-20 13:52:10 +0000 Commit: Michael Tuexen CommitDate: 2021-09-20 13:52:10 +0000 sctp: use a valid outstream when adding it to the scheduler Without holding the stcb send lock, the outstreams might get reallocated if the number of streams are increased. Reported by: syzbot+4a5431d7caa666f2c19c@syzkaller.appspotmail.com Reported by: syzbot+aa2e3b013a48870e193d@syzkaller.appspotmail.com Reported by: syzbot+e4368c3bde07cd2fb29f@syzkaller.appspotmail.com Reported by: syzbot+fe2f110e34811ea91690@syzkaller.appspotmail.com Reported by: syzbot+ed6e8de942351d0309f4@syzkaller.appspotmail.com MFC after: 1 week --- sys/netinet/sctp_output.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 35a834438895..434ab7e1f8dc 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -6337,7 +6337,6 @@ sctp_msg_append(struct sctp_tcb *stcb, error = EINVAL; goto out_now; } - strm = &stcb->asoc.strmout[srcv->sinfo_stream]; /* Now can we send this? */ if ((SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_SENT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENT) || @@ -6396,6 +6395,7 @@ sctp_msg_append(struct sctp_tcb *stcb, if (hold_stcb_lock == 0) { SCTP_TCB_SEND_LOCK(stcb); } + strm = &stcb->asoc.strmout[srcv->sinfo_stream]; sctp_snd_sb_alloc(stcb, sp->length); atomic_add_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); @@ -13137,6 +13137,8 @@ skip_preblock: goto out; } SCTP_TCB_SEND_LOCK(stcb); + /* The out streams might be reallocated. */ + strm = &stcb->asoc.strmout[srcv->sinfo_stream]; if (sp->msg_is_complete) { strm->last_msg_incomplete = 0; asoc->stream_locked = 0; From owner-dev-commits-src-main@freebsd.org Mon Sep 20 15:18: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 5FA636A8310; Mon, 20 Sep 2021 15:18: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 4HCp961z8hz3PTk; Mon, 20 Sep 2021 15:18: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 1FEF812BCF; Mon, 20 Sep 2021 15:18: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 18KFIHOw007404; Mon, 20 Sep 2021 15:18:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KFIHGd007403; Mon, 20 Sep 2021 15:18:17 GMT (envelope-from git) Date: Mon, 20 Sep 2021 15:18:17 GMT Message-Id: <202109201518.18KFIHGd007403@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: b91fc6c43a81 - main - acpica: add ACPI_GET_PROPERTY to access Device Specific Data (DSD) 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: b91fc6c43a81d3b760fb570c8439a922e536d7e6 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, 20 Sep 2021 15:18:18 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=b91fc6c43a81d3b760fb570c8439a922e536d7e6 commit b91fc6c43a81d3b760fb570c8439a922e536d7e6 Author: Bartlomiej Grzesik AuthorDate: 2021-07-27 12:39:31 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-20 14:31:08 +0000 acpica: add ACPI_GET_PROPERTY to access Device Specific Data (DSD) Add lazy acquiring of DSD package, which allows accessing Device Specific Data. Reviewed by: manu, mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31596 --- sys/dev/acpica/acpi.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/acpica/acpi_if.m | 21 ++++++++++ sys/dev/acpica/acpivar.h | 12 ++++++ 3 files changed, 132 insertions(+) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 02358d407c66..40b928f9cdd6 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(__i386__) || defined(__amd64__) #include @@ -147,10 +148,13 @@ static int acpi_device_id_probe(device_t bus, device_t dev, char **ids, char **m static ACPI_STATUS acpi_device_eval_obj(device_t bus, device_t dev, ACPI_STRING pathname, ACPI_OBJECT_LIST *parameters, ACPI_BUFFER *ret); +static ACPI_STATUS acpi_device_get_prop(device_t bus, device_t dev, + ACPI_STRING propname, const ACPI_OBJECT **value); static ACPI_STATUS acpi_device_scan_cb(ACPI_HANDLE h, UINT32 level, void *context, void **retval); static ACPI_STATUS acpi_device_scan_children(device_t bus, device_t dev, int max_depth, acpi_scan_cb_t user_fn, void *arg); +static ACPI_STATUS acpi_find_dsd(device_t bus, device_t dev); static int acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids); static void acpi_platform_osc(device_t dev); @@ -223,6 +227,7 @@ static device_method_t acpi_methods[] = { /* ACPI bus */ DEVMETHOD(acpi_id_probe, acpi_device_id_probe), DEVMETHOD(acpi_evaluate_object, acpi_device_eval_obj), + DEVMETHOD(acpi_get_property, acpi_device_get_prop), DEVMETHOD(acpi_pwr_for_sleep, acpi_device_pwr_for_sleep), DEVMETHOD(acpi_scan_children, acpi_device_scan_children), @@ -296,6 +301,15 @@ int acpi_susp_bounce; SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW, &acpi_susp_bounce, 0, "Don't actually suspend, just test devices."); +/* + * ACPI standard UUID for Device Specific Data Package + * "Device Properties UUID for _DSD" Rev. 2.0 + */ +static const struct uuid acpi_dsd_uuid = { + 0xdaffd814, 0x6eba, 0x4d8c, 0x8a, 0x91, + { 0xbc, 0x9b, 0xbf, 0x4a, 0xa3, 0x01 } +}; + /* * ACPI can only be loaded as a module by the loader; activating it after * system bootstrap time is not useful, and can be fatal to the system. @@ -1727,6 +1741,82 @@ acpi_device_eval_obj(device_t bus, device_t dev, ACPI_STRING pathname, return (AcpiEvaluateObject(h, pathname, parameters, ret)); } +static ACPI_STATUS +acpi_device_get_prop(device_t bus, device_t dev, ACPI_STRING propname, + const ACPI_OBJECT **value) +{ + const ACPI_OBJECT *pkg, *name, *val; + struct acpi_device *ad; + ACPI_STATUS status; + int i; + + ad = device_get_ivars(dev); + + if (ad == NULL || propname == NULL) + return (AE_BAD_PARAMETER); + if (ad->dsd_pkg == NULL) { + if (ad->dsd.Pointer == NULL) { + status = acpi_find_dsd(bus, dev); + if (ACPI_FAILURE(status)) + return (status); + } else { + return (AE_NOT_FOUND); + } + } + + for (i = 0; i < ad->dsd_pkg->Package.Count; i ++) { + pkg = &ad->dsd_pkg->Package.Elements[i]; + if (pkg->Type != ACPI_TYPE_PACKAGE || pkg->Package.Count != 2) + continue; + + name = &pkg->Package.Elements[0]; + val = &pkg->Package.Elements[1]; + if (name->Type != ACPI_TYPE_STRING) + continue; + if (strncmp(propname, name->String.Pointer, name->String.Length) == 0) { + if (value != NULL) + *value = val; + + return (AE_OK); + } + } + + return (AE_NOT_FOUND); +} + +static ACPI_STATUS +acpi_find_dsd(device_t bus, device_t dev) +{ + const ACPI_OBJECT *dsd, *guid, *pkg; + struct acpi_device *ad; + ACPI_STATUS status; + + ad = device_get_ivars(dev); + ad->dsd.Length = ACPI_ALLOCATE_BUFFER; + ad->dsd.Pointer = NULL; + ad->dsd_pkg = NULL; + + status = ACPI_EVALUATE_OBJECT(bus, dev, "_DSD", NULL, &ad->dsd); + if (ACPI_FAILURE(status)) + return (status); + + dsd = ad->dsd.Pointer; + guid = &dsd->Package.Elements[0]; + pkg = &dsd->Package.Elements[1]; + + if (guid->Type != ACPI_TYPE_BUFFER || pkg->Type != ACPI_TYPE_PACKAGE || + guid->Buffer.Length != sizeof(acpi_dsd_uuid)) + return (AE_NOT_FOUND); + if (memcmp(guid->Buffer.Pointer, &acpi_dsd_uuid, + sizeof(acpi_dsd_uuid)) == 0) { + + ad->dsd_pkg = pkg; + return (AE_OK); + } + + return (AE_NOT_FOUND); +} + int acpi_device_pwr_for_sleep(device_t bus, device_t dev, int *dstate) { @@ -2399,6 +2489,15 @@ acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, ACPI_HANDLE *result) } } +ACPI_STATUS +acpi_GetProperty(device_t dev, ACPI_STRING propname, + const ACPI_OBJECT **value) +{ + device_t bus = device_get_parent(dev); + + return (ACPI_GET_PROPERTY(bus, dev, propname, value)); +} + /* * Allocate a buffer with a preset data size. */ diff --git a/sys/dev/acpica/acpi_if.m b/sys/dev/acpica/acpi_if.m index 6e36f398411e..e0ed4d72e899 100644 --- a/sys/dev/acpica/acpi_if.m +++ b/sys/dev/acpica/acpi_if.m @@ -121,6 +121,27 @@ METHOD ACPI_STATUS evaluate_object { ACPI_BUFFER *ret; }; +# +# Get property value from Device Specific Data +# +# device_t bus: parent bus for the device +# +# device_t dev: find property for this device's handle. +# +# const ACPI_STRING propname: name of the property +# +# const ACPI_OBJECT **value: property value output +# Specify NULL if ignored +# +# Returns: AE_OK or an error value +# +METHOD ACPI_STATUS get_property { + device_t bus; + device_t dev; + ACPI_STRING propname; + const ACPI_OBJECT **value; +}; + # # Get the highest power state (D0-D3) that is usable for a device when # suspending/resuming. If a bus calls this when suspending a device, it diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 1f64b479d414..e276193aebc0 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -90,6 +90,9 @@ struct acpi_device { int ad_flags; int ad_cls_class; + ACPI_BUFFER dsd; /* Device Specific Data */ + const ACPI_OBJECT *dsd_pkg; + /* Resources */ struct resource_list ad_rl; }; @@ -350,6 +353,8 @@ BOOLEAN acpi_DeviceIsPresent(device_t dev); BOOLEAN acpi_BatteryIsPresent(device_t dev); ACPI_STATUS acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, ACPI_HANDLE *result); +ACPI_STATUS acpi_GetProperty(device_t dev, ACPI_STRING propname, + const ACPI_OBJECT **value); ACPI_BUFFER *acpi_AllocBuffer(int size); ACPI_STATUS acpi_ConvertBufferToInteger(ACPI_BUFFER *bufp, UINT32 *number); @@ -396,6 +401,13 @@ int acpi_MatchHid(ACPI_HANDLE h, const char *hid); #define ACPI_MATCHHID_HID 1 #define ACPI_MATCHHID_CID 2 +static __inline bool +acpi_HasProperty(device_t dev, ACPI_STRING propname) +{ + + return ACPI_SUCCESS(acpi_GetProperty(dev, propname, NULL)); +} + struct acpi_parse_resource_set { void (*set_init)(device_t dev, void *arg, void **context); void (*set_done)(device_t dev, void *context); From owner-dev-commits-src-main@freebsd.org Mon Sep 20 15:18: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 702B96A8311; Mon, 20 Sep 2021 15:18: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 4HCp972dspz3Phv; Mon, 20 Sep 2021 15:18: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 3C62212DAB; Mon, 20 Sep 2021 15:18: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 18KFIJ2i007428; Mon, 20 Sep 2021 15:18:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KFIJa5007427; Mon, 20 Sep 2021 15:18:19 GMT (envelope-from git) Date: Mon, 20 Sep 2021 15:18:19 GMT Message-Id: <202109201518.18KFIJa5007427@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: 3f9a00e3b577 - main - device: add device_get_property and device_has_property 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: 3f9a00e3b577dcca57e331842e0baf2dbdf9325f 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, 20 Sep 2021 15:18:19 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=3f9a00e3b577dcca57e331842e0baf2dbdf9325f commit 3f9a00e3b577dcca57e331842e0baf2dbdf9325f Author: Bartlomiej Grzesik AuthorDate: 2021-07-30 08:57:06 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-20 15:17:57 +0000 device: add device_get_property and device_has_property Generialize bus specific property accessors. Those functions allow driver code to access device specific information. Currently there is only support for FDT and ACPI buses. Reviewed by: manu, mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31597 --- share/man/man9/BUS_GET_PROPERTY.9 | 65 ++++++++++++++++++++++++++++++++++ share/man/man9/Makefile | 2 ++ share/man/man9/device_get_property.9 | 67 ++++++++++++++++++++++++++++++++++++ sys/dev/acpica/acpi.c | 37 ++++++++++++++++++++ sys/dev/fdt/simplebus.c | 16 +++++++++ sys/kern/bus_if.m | 31 +++++++++++++++++ sys/kern/subr_bus.c | 14 ++++++++ sys/sys/bus.h | 2 ++ 8 files changed, 234 insertions(+) diff --git a/share/man/man9/BUS_GET_PROPERTY.9 b/share/man/man9/BUS_GET_PROPERTY.9 new file mode 100644 index 000000000000..89edbd95b68c --- /dev/null +++ b/share/man/man9/BUS_GET_PROPERTY.9 @@ -0,0 +1,65 @@ +.\" - +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" 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 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 August 19, 2021 +.Dt BUS_GET_PROPERTY 9 +.Os +.Sh NAME +.Nm BUS_GET_PROPERTY +.Nd get child's specific property +.Sh SYNOPSIS +.In sys/param.h +.In sys/bus.h +.Ft ssize_t +.Fn BUS_GET_PROPERTY "device_t dev" "device_t child" "const char *propname" \ + "void *propvalue" "size_t size" +.Sh DESCRIPTION +The +.Fn BUS_GET_PROPERTY +method +is called from driver code which wants to access child's specific data stored +on the bus. +Property consits of its name and value. +Implementation shall copy to +.Fa propvalue +at most +.Fa size +bytes. +.Sh NOTES +If +.Fa propvalue +is NULL or +.Fa size +is zero, then implementation shall only return size of the property. +.Sh RETURN VALUES +Property's size if successful, otherwise -1. +.Sh SEE ALSO +.Xr device 9 , +.Xr device_get_property 9 +.Sh AUTHORS +This manual page was written by +.An Bartlomiej Grzesik . diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 4764db983f8a..30632e0a6cb6 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -47,6 +47,7 @@ MAN= accept_filter.9 \ bus_generic_read_ivar.9 \ bus_generic_shutdown.9 \ BUS_GET_CPUS.9 \ + BUS_GET_PROPERTY.9 \ bus_get_resource.9 \ bus_map_resource.9 \ BUS_NEW_PASS.9 \ @@ -108,6 +109,7 @@ MAN= accept_filter.9 \ device_get_ivars.9 \ device_get_name.9 \ device_get_parent.9 \ + device_get_property.9 \ device_get_softc.9 \ device_get_state.9 \ device_get_sysctl.9 \ diff --git a/share/man/man9/device_get_property.9 b/share/man/man9/device_get_property.9 new file mode 100644 index 000000000000..1d9bd5058b1a --- /dev/null +++ b/share/man/man9/device_get_property.9 @@ -0,0 +1,67 @@ +.\" - +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" 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 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 August 19, 2021 +.Dt DEVICE_GET_PROPERTY 9 +.Os +.Sh NAME +.Nm device_get_property , +.Nm device_has_property +.Nd access device specific data +.Sh SYNOPSIS +.In sys/param.h +.In sys/bus.h +.Ft ssize_t +.Fn device_get_property "device_t dev" "const char *prop" "void *val" "size_t sz" +.Ft bool +.Fn device_has_property "device_t dev" "const char *prop" +.Sh DESCRIPTION +Access device specific data provided by the parent bus. +Drivers can use these properties to obtain device capabilities and set +necessary quirks. +.Sh NOTES +You can pass NULL as pointer to property's value when calling +.Fn device_get_property +to obtain its size. +.Pp +Currently this interface is implemented by +.Xr simplebus 4 +and +.Xr acpi 4 . +.Sh RETURN VALUES +.Fn device_get_property +if successful returns property's size, otherwise returns -1. +.Pp +.Fn device_has_property +returns true if given property was found. +.Sh SEE ALSO +.Xr acpi 4 , +.Xr simplebus 4 , +.Xr device 9 +.Sh AUTHORS +This manual page was written by +.An Bartlomiej Grzesik . diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 40b928f9cdd6..5d2b895bbe88 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -144,6 +144,8 @@ static void acpi_delete_resource(device_t bus, device_t child, int type, int rid); static uint32_t acpi_isa_get_logicalid(device_t dev); static int acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count); +static ssize_t acpi_bus_get_prop(device_t bus, device_t child, const char *propname, + void *propvalue, size_t size); static int acpi_device_id_probe(device_t bus, device_t dev, char **ids, char **match); static ACPI_STATUS acpi_device_eval_obj(device_t bus, device_t dev, ACPI_STRING pathname, ACPI_OBJECT_LIST *parameters, @@ -223,6 +225,7 @@ static device_method_t acpi_methods[] = { DEVMETHOD(bus_hint_device_unit, acpi_hint_device_unit), DEVMETHOD(bus_get_cpus, acpi_get_cpus), DEVMETHOD(bus_get_domain, acpi_get_domain), + DEVMETHOD(bus_get_property, acpi_bus_get_prop), /* ACPI bus */ DEVMETHOD(acpi_id_probe, acpi_device_id_probe), @@ -1817,6 +1820,40 @@ acpi_find_dsd(device_t bus, device_t dev) return (AE_NOT_FOUND); } +static ssize_t +acpi_bus_get_prop(device_t bus, device_t child, const char *propname, + void *propvalue, size_t size) +{ + ACPI_STATUS status; + const ACPI_OBJECT *obj; + + status = acpi_device_get_prop(bus, child, __DECONST(char *, propname), + &obj); + if (ACPI_FAILURE(status)) + return (-1); + + switch (obj->Type) { + case ACPI_TYPE_INTEGER: + if (propvalue != NULL && size >= sizeof(uint64_t)) + *((uint64_t *) propvalue) = obj->Integer.Value; + return (sizeof(uint64_t)); + + case ACPI_TYPE_STRING: + if (propvalue != NULL && size > 0) + memcpy(propvalue, obj->String.Pointer, + MIN(size, obj->String.Length)); + return (obj->String.Length); + + case ACPI_TYPE_BUFFER: + if (propvalue != NULL && size > 0) + memcpy(propvalue, obj->Buffer.Pointer, + MIN(size, obj->Buffer.Length)); + return (obj->Buffer.Length); + } + + return (-1); +} + int acpi_device_pwr_for_sleep(device_t bus, device_t dev, int *dstate) { diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c index 76814ed40b04..4d58f9b3ea69 100644 --- a/sys/dev/fdt/simplebus.c +++ b/sys/dev/fdt/simplebus.c @@ -54,6 +54,9 @@ static device_t simplebus_add_child(device_t dev, u_int order, const char *name, int unit); static struct resource_list *simplebus_get_resource_list(device_t bus, device_t child); + +static ssize_t simplebus_get_property(device_t bus, device_t child, + const char *propname, void *propvalue, size_t size); /* * ofw_bus interface */ @@ -89,6 +92,7 @@ static device_method_t simplebus_methods[] = { DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo), DEVMETHOD(bus_get_resource_list, simplebus_get_resource_list), + DEVMETHOD(bus_get_property, simplebus_get_property), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_devinfo, simplebus_get_devinfo), @@ -350,6 +354,18 @@ simplebus_get_resource_list(device_t bus __unused, device_t child) return (&ndi->rl); } +static ssize_t +simplebus_get_property(device_t bus, device_t child, const char *propname, + void *propvalue, size_t size) +{ + phandle_t node = ofw_bus_get_node(child); + + if (propvalue == NULL || size == 0) + return (OF_getproplen(node, propname)); + + return (OF_getencprop(node, propname, propvalue, size)); +} + static struct resource * simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index 71d83954ef4d..0bd7056019ab 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -88,6 +88,13 @@ CODE { *newstart = start; return (0); } + + static ssize_t + null_get_property(device_t dev, device_t child, const char *propname, + void *propvalue, size_t size) + { + return (-1); + } }; /** @@ -924,3 +931,27 @@ METHOD int reset_child { device_t _child; int _flags; }; + +/** + * @brief Gets child's specific property + * + * The bus_get_property can be used to access device + * specific properties stored on the bus. If _propvalue + * is NULL or _size is 0, then method only returns size + * of the property. + * + * @param _dev the bus device + * @param _child the child device + * @param _propname property name + * @param _propvalue property value destination + * @param _size property value size + * + * @returns size of property if successful otherwise -1 + */ +METHOD ssize_t get_property { + device_t _dev; + device_t _child; + const char *_propname; + void *_propvalue; + size_t _size; +} DEFAULT null_get_property; diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 77b4c4c66c4b..1f580f455dc0 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2708,6 +2708,20 @@ device_verbose(device_t dev) dev->flags &= ~DF_QUIET; } +ssize_t +device_get_property(device_t dev, const char *prop, void *val, size_t sz) +{ + device_t bus = device_get_parent(dev); + + return (BUS_GET_PROPERTY(bus, dev, prop, val, sz)); +} + +bool +device_has_property(device_t dev, const char *prop) +{ + return (device_get_property(dev, prop, NULL, 0) >= 0); +} + /** * @brief Return non-zero if the DF_QUIET_CHIDLREN flag is set on the device */ diff --git a/sys/sys/bus.h b/sys/sys/bus.h index c9ac84020ba5..ff86cbcf457f 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -631,6 +631,8 @@ int device_set_unit(device_t dev, int unit); /* XXX DONT USE XXX */ int device_shutdown(device_t dev); void device_unbusy(device_t dev); void device_verbose(device_t dev); +ssize_t device_get_property(device_t dev, const char *prop, void *val, size_t sz); +bool device_has_property(device_t dev, const char *prop); /* * Access functions for devclass. From owner-dev-commits-src-main@freebsd.org Mon Sep 20 15:18:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8F726A8480; Mon, 20 Sep 2021 15:18:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCp984kgTz3Phx; Mon, 20 Sep 2021 15:18:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 647F812CF6; Mon, 20 Sep 2021 15:18:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18KFIK6v007452; Mon, 20 Sep 2021 15:18:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KFIKnL007451; Mon, 20 Sep 2021 15:18:20 GMT (envelope-from git) Date: Mon, 20 Sep 2021 15:18:20 GMT Message-Id: <202109201518.18KFIKnL007451@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: 8a8166e5bcfb - main - mmc: switch mmc_helper to device_ api 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: 8a8166e5bcfb50e2b7280581b600d098fa6c9fc7 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, 20 Sep 2021 15:18:20 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=8a8166e5bcfb50e2b7280581b600d098fa6c9fc7 commit 8a8166e5bcfb50e2b7280581b600d098fa6c9fc7 Author: Bartlomiej Grzesik AuthorDate: 2021-08-02 14:27:23 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-20 15:18:02 +0000 mmc: switch mmc_helper to device_ api Add generic mmc_helper which uses newly introduced device_*_property api. Thanks to this change the sd/mmc drivers will be capable of parsing both DT and ACPI description. Ensure backward compatibility for all mmc_fdt_helper users. Reviewed by: manu, mw Sponsored by: Semihalf Differential revision: https://reviews.freebsd.org/D31598 --- sys/arm/allwinner/aw_mmc.c | 2 +- sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 2 +- sys/conf/files | 1 + sys/dev/mmc/host/dwmmc_var.h | 2 +- sys/dev/mmc/mmc_fdt_helpers.c | 116 ++++---------------------- sys/dev/mmc/mmc_fdt_helpers.h | 42 ++-------- sys/dev/mmc/mmc_helpers.c | 134 +++++++++++++++++++++++++++++++ sys/dev/mmc/mmc_helpers.h | 70 ++++++++++++++++ sys/dev/sdhci/sdhci_fsl_fdt.c | 2 +- sys/dev/sdhci/sdhci_xenon.c | 2 +- 10 files changed, 234 insertions(+), 139 deletions(-) diff --git a/sys/arm/allwinner/aw_mmc.c b/sys/arm/allwinner/aw_mmc.c index 9f215399e62b..3271090f19e3 100644 --- a/sys/arm/allwinner/aw_mmc.c +++ b/sys/arm/allwinner/aw_mmc.c @@ -130,7 +130,7 @@ struct aw_mmc_softc { int aw_timeout; struct callout aw_timeoutc; struct mmc_host aw_host; - struct mmc_fdt_helper mmc_helper; + struct mmc_helper mmc_helper; #ifdef MMCCAM union ccb * ccb; struct mmc_sim mmc_sim; diff --git a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c index cd9b60743be3..38617dcd38eb 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c @@ -156,7 +156,7 @@ struct bcm_sdhci_softc { void * sc_intrhand; struct mmc_request * sc_req; struct sdhci_slot sc_slot; - struct mmc_fdt_helper sc_mmc_helper; + struct mmc_helper sc_mmc_helper; int sc_dma_ch; bus_dma_tag_t sc_dma_tag; bus_dmamap_t sc_dma_map; diff --git a/sys/conf/files b/sys/conf/files index bf1c680093d1..1d3a36ac6bc7 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2483,6 +2483,7 @@ dev/mmc/mmcbr_if.m standard dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd !mmccam dev/mmc/mmc_fdt_helpers.c optional ext_resources mmc fdt | ext_resources mmccam fdt +dev/mmc/mmc_helpers.c optional ext_resources mmc | ext_resources mmccam dev/mmc/mmc_pwrseq.c optional ext_resources mmc fdt | ext_resources mmccam fdt dev/mmc/mmc_pwrseq_if.m optional ext_resources mmc fdt | ext_resources mmccam fdt dev/mmcnull/mmcnull.c optional mmcnull diff --git a/sys/dev/mmc/host/dwmmc_var.h b/sys/dev/mmc/host/dwmmc_var.h index ef7c91fa628e..a3f20278ad2a 100644 --- a/sys/dev/mmc/host/dwmmc_var.h +++ b/sys/dev/mmc/host/dwmmc_var.h @@ -56,7 +56,7 @@ struct dwmmc_softc { device_t dev; void *intr_cookie; struct mmc_host host; - struct mmc_fdt_helper mmc_helper; + struct mmc_helper mmc_helper; struct mtx sc_mtx; #ifdef MMCCAM union ccb * ccb; diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c index 291a4bc72ff2..249a430311fa 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.c +++ b/sys/dev/mmc/mmc_fdt_helpers.c @@ -45,105 +45,21 @@ __FBSDID("$FreeBSD$"); #include #endif -#include "mmc_pwrseq_if.h" - -static inline void -mmc_fdt_parse_sd_speed(phandle_t node, struct mmc_host *host) -{ - bool no_18v = false; - - /* - * Parse SD supported modes - * All UHS-I modes requires 1.8V signaling. - */ - if (OF_hasprop(node, "no-1-8-v")) - no_18v = true; - if (OF_hasprop(node, "cap-sd-highspeed")) - host->caps |= MMC_CAP_HSPEED; - if (OF_hasprop(node, "sd-uhs-sdr12") && no_18v == false) - host->caps |= MMC_CAP_UHS_SDR12 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "sd-uhs-sdr25") && no_18v == false) - host->caps |= MMC_CAP_UHS_SDR25 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "sd-uhs-sdr50") && no_18v == false) - host->caps |= MMC_CAP_UHS_SDR50 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "sd-uhs-sdr104") && no_18v == false) - host->caps |= MMC_CAP_UHS_SDR104 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "sd-uhs-ddr50") && no_18v == false) - host->caps |= MMC_CAP_UHS_DDR50 | MMC_CAP_SIGNALING_180; -} +#include -static inline void -mmc_fdt_parse_mmc_speed(phandle_t node, struct mmc_host *host) -{ - - /* Parse eMMC supported modes */ - if (OF_hasprop(node, "cap-mmc-highspeed")) - host->caps |= MMC_CAP_HSPEED; - if (OF_hasprop(node, "mmc-ddr-1_2v")) - host->caps |= MMC_CAP_MMC_DDR52_120 | MMC_CAP_SIGNALING_120; - if (OF_hasprop(node, "mmc-ddr-1_8v")) - host->caps |= MMC_CAP_MMC_DDR52_180 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "mmc-ddr-3_3v")) - host->caps |= MMC_CAP_SIGNALING_330; - if (OF_hasprop(node, "mmc-hs200-1_2v")) - host->caps |= MMC_CAP_MMC_HS200_120 | MMC_CAP_SIGNALING_120; - if (OF_hasprop(node, "mmc-hs200-1_8v")) - host->caps |= MMC_CAP_MMC_HS200_180 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "mmc-hs400-1_2v")) - host->caps |= MMC_CAP_MMC_HS400_120 | MMC_CAP_SIGNALING_120; - if (OF_hasprop(node, "mmc-hs400-1_8v")) - host->caps |= MMC_CAP_MMC_HS400_180 | MMC_CAP_SIGNALING_180; - if (OF_hasprop(node, "mmc-hs400-enhanced-strobe")) - host->caps |= MMC_CAP_MMC_ENH_STROBE; -} +#include "mmc_pwrseq_if.h" int -mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, +mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_helper *helper, struct mmc_host *host) { - uint32_t bus_width; + struct mmc_helper mmc_helper; phandle_t pwrseq_xref; - if (node <= 0) - node = ofw_bus_get_node(dev); - if (node <= 0) - return (ENXIO); - - if (OF_getencprop(node, "bus-width", &bus_width, sizeof(uint32_t)) <= 0) - bus_width = 1; - - if (bus_width >= 4) - host->caps |= MMC_CAP_4_BIT_DATA; - if (bus_width >= 8) - host->caps |= MMC_CAP_8_BIT_DATA; + memset(&mmc_helper, 0, sizeof(mmc_helper)); + mmc_parse(dev, &mmc_helper, host); - /* - * max-frequency is optional, drivers should tweak this value - * if it's not present based on the clock that the mmc controller - * operates on - */ - OF_getencprop(node, "max-frequency", &host->f_max, sizeof(uint32_t)); - - if (OF_hasprop(node, "broken-cd")) - helper->props |= MMC_PROP_BROKEN_CD; - if (OF_hasprop(node, "non-removable")) - helper->props |= MMC_PROP_NON_REMOVABLE; - if (OF_hasprop(node, "wp-inverted")) - helper->props |= MMC_PROP_WP_INVERTED; - if (OF_hasprop(node, "cd-inverted")) - helper->props |= MMC_PROP_CD_INVERTED; - if (OF_hasprop(node, "no-sdio")) - helper->props |= MMC_PROP_NO_SDIO; - if (OF_hasprop(node, "no-sd")) - helper->props |= MMC_PROP_NO_SD; - if (OF_hasprop(node, "no-mmc")) - helper->props |= MMC_PROP_NO_MMC; - - if (!(helper->props & MMC_PROP_NO_SD)) - mmc_fdt_parse_sd_speed(node, host); - - if (!(helper->props & MMC_PROP_NO_MMC)) - mmc_fdt_parse_mmc_speed(node, host); + helper->props = mmc_helper.props; #ifdef EXT_RESOURCES /* @@ -200,7 +116,7 @@ mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, static void cd_intr(void *arg) { - struct mmc_fdt_helper *helper = arg; + struct mmc_helper *helper = arg; taskqueue_enqueue_timeout(taskqueue_swi_giant, &helper->cd_delayed_task, -(hz / 2)); @@ -209,7 +125,7 @@ cd_intr(void *arg) static void cd_card_task(void *arg, int pending __unused) { - struct mmc_fdt_helper *helper = arg; + struct mmc_helper *helper = arg; bool cd_present; cd_present = mmc_fdt_gpio_get_present(helper); @@ -228,7 +144,7 @@ cd_card_task(void *arg, int pending __unused) * Card detect setup. */ static void -cd_setup(struct mmc_fdt_helper *helper, phandle_t node) +cd_setup(struct mmc_helper *helper, phandle_t node) { int pincaps; device_t dev; @@ -330,7 +246,7 @@ without_interrupts: * Write protect setup. */ static void -wp_setup(struct mmc_fdt_helper *helper, phandle_t node) +wp_setup(struct mmc_helper *helper, phandle_t node) { device_t dev; @@ -352,7 +268,7 @@ wp_setup(struct mmc_fdt_helper *helper, phandle_t node) } int -mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, +mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_helper *helper, mmc_fdt_cd_handler handler) { @@ -377,7 +293,7 @@ mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, } void -mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper) +mmc_fdt_gpio_teardown(struct mmc_helper *helper) { if (helper == NULL) @@ -396,7 +312,7 @@ mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper) } bool -mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper) +mmc_fdt_gpio_get_present(struct mmc_helper *helper) { bool pinstate; @@ -411,7 +327,7 @@ mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper) } bool -mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper) +mmc_fdt_gpio_get_readonly(struct mmc_helper *helper) { bool pinstate; @@ -427,7 +343,7 @@ mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper) } void -mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum mmc_power_mode power_mode) +mmc_fdt_set_power(struct mmc_helper *helper, enum mmc_power_mode power_mode) { int reg_status; int rv; diff --git a/sys/dev/mmc/mmc_fdt_helpers.h b/sys/dev/mmc/mmc_fdt_helpers.h index e6d6f3fbfd84..f07ca1684440 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.h +++ b/sys/dev/mmc/mmc_fdt_helpers.h @@ -37,43 +37,17 @@ #include #endif -struct mmc_fdt_helper { - device_t dev; - gpio_pin_t wp_pin; - gpio_pin_t cd_pin; - void * cd_ihandler; - struct resource * cd_ires; - int cd_irid; - void (*cd_handler)(device_t, bool); - struct timeout_task cd_delayed_task; - bool cd_disabled; - bool wp_disabled; - bool cd_present; - uint32_t props; -#define MMC_PROP_BROKEN_CD (1 << 0) -#define MMC_PROP_NON_REMOVABLE (1 << 1) -#define MMC_PROP_WP_INVERTED (1 << 2) -#define MMC_PROP_CD_INVERTED (1 << 3) -#define MMC_PROP_DISABLE_WP (1 << 4) -#define MMC_PROP_NO_SDIO (1 << 5) -#define MMC_PROP_NO_SD (1 << 6) -#define MMC_PROP_NO_MMC (1 << 7) +#include -#ifdef EXT_RESOURCES - regulator_t vmmc_supply; - regulator_t vqmmc_supply; -#endif - - device_t mmc_pwrseq; -}; +#define mmc_fdt_helper mmc_helper /* For backwards compatibility */ typedef void (*mmc_fdt_cd_handler)(device_t dev, bool present); -int mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, struct mmc_host *host); -int mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_fdt_helper *helper, mmc_fdt_cd_handler handler); -void mmc_fdt_gpio_teardown(struct mmc_fdt_helper *helper); -bool mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper); -bool mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper); -void mmc_fdt_set_power(struct mmc_fdt_helper *helper, enum mmc_power_mode power_mode); +int mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_helper *helper, struct mmc_host *host); +int mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_helper *helper, mmc_fdt_cd_handler handler); +void mmc_fdt_gpio_teardown(struct mmc_helper *helper); +bool mmc_fdt_gpio_get_present(struct mmc_helper *helper); +bool mmc_fdt_gpio_get_readonly(struct mmc_helper *helper); +void mmc_fdt_set_power(struct mmc_helper *helper, enum mmc_power_mode power_mode); #endif diff --git a/sys/dev/mmc/mmc_helpers.c b/sys/dev/mmc/mmc_helpers.c new file mode 100644 index 000000000000..0e1e16666367 --- /dev/null +++ b/sys/dev/mmc/mmc_helpers.c @@ -0,0 +1,134 @@ +/* + * Copyright 2019 Emmanuel Vadot + * Copyright (c) 2017 Ian Lepore 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 +#include +#include + +#include +#include + +static inline void +mmc_parse_sd_speed(device_t dev, struct mmc_host *host) +{ + bool no_18v = false; + + /* + * Parse SD supported modes + * All UHS-I modes requires 1.8V signaling. + */ + if (device_has_property(dev, "no-1-8-v")) + no_18v = true; + if (device_has_property(dev, "cap-sd-highspeed")) + host->caps |= MMC_CAP_HSPEED; + if (device_has_property(dev, "sd-uhs-sdr12") && !no_18v) + host->caps |= MMC_CAP_UHS_SDR12 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "sd-uhs-sdr25") && !no_18v) + host->caps |= MMC_CAP_UHS_SDR25 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "sd-uhs-sdr50") && !no_18v) + host->caps |= MMC_CAP_UHS_SDR50 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "sd-uhs-sdr104") && !no_18v) + host->caps |= MMC_CAP_UHS_SDR104 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "sd-uhs-ddr50") && !no_18v) + host->caps |= MMC_CAP_UHS_DDR50 | MMC_CAP_SIGNALING_180; +} + +static inline void +mmc_parse_mmc_speed(device_t dev, struct mmc_host *host) +{ + /* Parse eMMC supported modes */ + if (device_has_property(dev, "cap-mmc-highspeed")) + host->caps |= MMC_CAP_HSPEED; + if (device_has_property(dev, "mmc-ddr-1_2v")) + host->caps |= MMC_CAP_MMC_DDR52_120 | MMC_CAP_SIGNALING_120; + if (device_has_property(dev, "mmc-ddr-1_8v")) + host->caps |= MMC_CAP_MMC_DDR52_180 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "mmc-ddr-3_3v")) + host->caps |= MMC_CAP_SIGNALING_330; + if (device_has_property(dev, "mmc-hs200-1_2v")) + host->caps |= MMC_CAP_MMC_HS200_120 | MMC_CAP_SIGNALING_120; + if (device_has_property(dev, "mmc-hs200-1_8v")) + host->caps |= MMC_CAP_MMC_HS200_180 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "mmc-hs400-1_2v")) + host->caps |= MMC_CAP_MMC_HS400_120 | MMC_CAP_SIGNALING_120; + if (device_has_property(dev, "mmc-hs400-1_8v")) + host->caps |= MMC_CAP_MMC_HS400_180 | MMC_CAP_SIGNALING_180; + if (device_has_property(dev, "mmc-hs400-enhanced-strobe")) + host->caps |= MMC_CAP_MMC_ENH_STROBE; +} + +int +mmc_parse(device_t dev, struct mmc_helper *helper, struct mmc_host *host) +{ + uint64_t bus_width, max_freq; + + bus_width = 0; + if (device_get_property(dev, "bus-width", &bus_width, sizeof(uint64_t)) <= 0) + bus_width = 1; + + if (bus_width >= 4) + host->caps |= MMC_CAP_4_BIT_DATA; + if (bus_width >= 8) + host->caps |= MMC_CAP_8_BIT_DATA; + + /* + * max-frequency is optional, drivers should tweak this value + * if it's not present based on the clock that the mmc controller + * operates on + */ + max_freq = 0; + device_get_property(dev, "max-frequency", &max_freq, sizeof(uint64_t)); + host->f_max = max_freq; + + if (device_has_property(dev, "broken-cd")) + helper->props |= MMC_PROP_BROKEN_CD; + if (device_has_property(dev, "non-removable")) + helper->props |= MMC_PROP_NON_REMOVABLE; + if (device_has_property(dev, "wp-inverted")) + helper->props |= MMC_PROP_WP_INVERTED; + if (device_has_property(dev, "cd-inverted")) + helper->props |= MMC_PROP_CD_INVERTED; + if (device_has_property(dev, "no-sdio")) + helper->props |= MMC_PROP_NO_SDIO; + if (device_has_property(dev, "no-sd")) + helper->props |= MMC_PROP_NO_SD; + if (device_has_property(dev, "no-mmc")) + helper->props |= MMC_PROP_NO_MMC; + + if (!(helper->props & MMC_PROP_NO_SD)) + mmc_parse_sd_speed(dev, host); + + if (!(helper->props & MMC_PROP_NO_MMC)) + mmc_parse_mmc_speed(dev, host); + + return (0); +} diff --git a/sys/dev/mmc/mmc_helpers.h b/sys/dev/mmc/mmc_helpers.h new file mode 100644 index 000000000000..e402e587a159 --- /dev/null +++ b/sys/dev/mmc/mmc_helpers.h @@ -0,0 +1,70 @@ +/* + * Copyright 2019 Emmanuel Vadot + * Copyright (c) 2017 Ian Lepore 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. + */ + +#ifndef _MMC_HELPERS_H_ +#define _MMC_HELPERS_H_ + +#include + +#ifdef EXT_RESOURCES +#include +#endif + +struct mmc_helper { + device_t dev; + gpio_pin_t wp_pin; + gpio_pin_t cd_pin; + void * cd_ihandler; + struct resource * cd_ires; + int cd_irid; + void (*cd_handler)(device_t, bool); + struct timeout_task cd_delayed_task; + bool cd_disabled; + bool wp_disabled; + bool cd_present; + uint32_t props; +#define MMC_PROP_BROKEN_CD (1 << 0) +#define MMC_PROP_NON_REMOVABLE (1 << 1) +#define MMC_PROP_WP_INVERTED (1 << 2) +#define MMC_PROP_CD_INVERTED (1 << 3) +#define MMC_PROP_DISABLE_WP (1 << 4) +#define MMC_PROP_NO_SDIO (1 << 5) +#define MMC_PROP_NO_SD (1 << 6) +#define MMC_PROP_NO_MMC (1 << 7) + +#ifdef EXT_RESOURCES + regulator_t vmmc_supply; + regulator_t vqmmc_supply; +#endif + + device_t mmc_pwrseq; +}; + +int mmc_parse(device_t dev, struct mmc_helper *helper, + struct mmc_host *host); + +#endif diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index 91d926c343cc..5aec394b9192 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -106,7 +106,7 @@ struct sdhci_fsl_fdt_softc { bool slot_init_done; uint32_t cmd_and_mode; uint16_t sdclk_bits; - struct mmc_fdt_helper fdt_helper; + struct mmc_helper fdt_helper; uint32_t (* read)(struct sdhci_fsl_fdt_softc *, bus_size_t); void (* write)(struct sdhci_fsl_fdt_softc *, bus_size_t, uint32_t); diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index b6f7513245eb..d88514d8fd8f 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -94,7 +94,7 @@ struct sdhci_xenon_softc { uint8_t zpr; /* PHY ZPR */ bool slow_mode; /* PHY slow mode */ - struct mmc_fdt_helper mmc_helper; /* MMC helper for parsing FDT */ + struct mmc_helper mmc_helper; /* MMC helper for parsing FDT */ }; static uint8_t From owner-dev-commits-src-main@freebsd.org Mon Sep 20 16:26: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 AB4A46A96AE; Mon, 20 Sep 2021 16:26: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 4HCqgM4CgWz4SSb; Mon, 20 Sep 2021 16:26: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 6C6DD13AE2; Mon, 20 Sep 2021 16:26: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 18KGQ7VL000931; Mon, 20 Sep 2021 16:26:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KGQ7cU000930; Mon, 20 Sep 2021 16:26:07 GMT (envelope-from git) Date: Mon, 20 Sep 2021 16:26:07 GMT Message-Id: <202109201626.18KGQ7cU000930@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: 9e0c051249e3 - main - opencrypto: Allow kern.crypto.allow_soft to be specified as a tunable 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: 9e0c051249e3832e0f6a0067058ff9735677f3d5 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, 20 Sep 2021 16:26:07 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9e0c051249e3832e0f6a0067058ff9735677f3d5 commit 9e0c051249e3832e0f6a0067058ff9735677f3d5 Author: Mark Johnston AuthorDate: 2021-09-20 16:07:29 +0000 Commit: Mark Johnston CommitDate: 2021-09-20 16:07:29 +0000 opencrypto: Allow kern.crypto.allow_soft to be specified as a tunable MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/opencrypto/crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 9a992100f222..ef8422d5f32c 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -189,11 +189,11 @@ SYSCTL_INT(_kern, OID_AUTO, crypto_workers_num, CTLFLAG_RDTUN, static uma_zone_t cryptop_zone; int crypto_devallowsoft = 0; -SYSCTL_INT(_kern_crypto, OID_AUTO, allow_soft, CTLFLAG_RW, +SYSCTL_INT(_kern_crypto, OID_AUTO, allow_soft, CTLFLAG_RWTUN, &crypto_devallowsoft, 0, "Enable use of software crypto by /dev/crypto"); #ifdef COMPAT_FREEBSD12 -SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RW, +SYSCTL_INT(_kern, OID_AUTO, cryptodevallowsoft, CTLFLAG_RWTUN, &crypto_devallowsoft, 0, "Enable/disable use of software crypto by /dev/crypto"); #endif From owner-dev-commits-src-main@freebsd.org Mon Sep 20 18:07: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 B344D6AACD2; Mon, 20 Sep 2021 18:07: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 4HCswT4Vfnz4gps; Mon, 20 Sep 2021 18:07: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 7B56D150D4; Mon, 20 Sep 2021 18:07: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 18KI7btS034187; Mon, 20 Sep 2021 18:07:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KI7bbK034186; Mon, 20 Sep 2021 18:07:37 GMT (envelope-from git) Date: Mon, 20 Sep 2021 18:07:37 GMT Message-Id: <202109201807.18KI7bbK034186@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: c937a405bdce - main - vt: call driver's postswitch when panicking on ttyv0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c937a405bdce2fd12c534446a8cc9e5548dd27eb 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, 20 Sep 2021 18:07:37 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=c937a405bdce2fd12c534446a8cc9e5548dd27eb commit c937a405bdce2fd12c534446a8cc9e5548dd27eb Author: Greg V AuthorDate: 2021-04-24 11:53:34 +0000 Commit: Toomas Soome CommitDate: 2021-09-20 17:29:37 +0000 vt: call driver's postswitch when panicking on ttyv0 In vt_kms, the postswitch callback restores fbdev mode when panicking or entering the debugger. This ensures that even when a graphical applicatino was running on the first tty, simple framebuffer mode would be restored and the panic would be visible instead of the frozen GUI. But vt wouldn't call the postswitch callback when we're already on the first tty, so running a GUI on it would prevent you from reading any panics. Reviewed by: tsoome MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29961 --- sys/dev/vt/vt_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 2693c32d45be..fac1ad898db9 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -594,7 +594,13 @@ vt_window_switch(struct vt_window *vw) VT_LOCK(vd); if (curvw == vw) { - /* Nothing to do. */ + /* + * Nothing to do, except ensure the driver has the opportunity to + * switch to console mode when panicking, making sure the panic + * is readable (even when a GUI was using ttyv0). + */ + if ((kdb_active || panicstr) && vd->vd_driver->vd_postswitch) + vd->vd_driver->vd_postswitch(vd); VT_UNLOCK(vd); return (0); } From owner-dev-commits-src-main@freebsd.org Mon Sep 20 19:46: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 C68DF6AC4C4; Mon, 20 Sep 2021 19:46:19 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCw6L3GHDz4rMy; Mon, 20 Sep 2021 19:46:18 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id BBBD78D4A213; Mon, 20 Sep 2021 19:46:10 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 39040E708BC; Mon, 20 Sep 2021 19:46:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id p011RmGc1enj; Mon, 20 Sep 2021 19:46:08 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 86A25E708BA; Mon, 20 Sep 2021 19:46:08 +0000 (UTC) Date: Mon, 20 Sep 2021 19:46:07 +0000 (UTC) From: "Bjoern A. Zeeb" To: Toomas Soome cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b4cb3fe0e39a - main - loader: implement mount/unmount rootfs In-Reply-To: <202109081249.188CncXF065953@gitrepo.freebsd.org> Message-ID: References: <202109081249.188CncXF065953@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4HCw6L3GHDz4rMy X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of bzeeb-lists@lists.zabbadoz.net designates 195.201.62.131 as permitted sender) smtp.mailfrom=bzeeb-lists@lists.zabbadoz.net X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; 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]; R_SPF_ALLOW(-0.20)[+ip4:195.201.62.131]; DMARC_NA(0.00)[zabbadoz.net]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:195.201.0.0/16, country:DE]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 19:46:19 -0000 On Wed, 8 Sep 2021, Toomas Soome wrote: > The branch main has been updated by tsoome: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b4cb3fe0e39a31e60292018dc9fb7510b3de92bf > > commit b4cb3fe0e39a31e60292018dc9fb7510b3de92bf > Author: Toomas Soome > AuthorDate: 2021-08-12 05:45:52 +0000 > Commit: Toomas Soome > CommitDate: 2021-09-08 01:01:20 +0000 > > loader: implement mount/unmount rootfs > > We want to keep our root file system open to preserve bcache segment > between file accesses, thus reducing physical disk IO. > > Reviewed by: imp, allanjude, kevans (previous version) > Differential Revision: https://reviews.freebsd.org/D30848 > MFC after: 1 month This makes netbooting on at least one of my arm64 impossible: ------------------------------------------------------------------------ Consoles: serial port Reading loader env vars from /efi/freebsd/loader.env FreeBSD/arm64 EFI loader, Revision 1.1 (Mon Sep 20 13:12:35 UTC 2021 root@localhost) Command line arguments: loader.efi Image base: 0xeb7e9000 EFI version: 2.70 EFI Firmware: EDK II (rev 1.00) Console: comconsole (0) Load Path: Load Device: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) BootCurrent: 0004 BootOrder: 0000 0001 0002 0003 0008 0004[*] 0005 0006 0007 BootInfo Path: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) Ignoring Boot0004: Only one DP found Setting currdev to net0: Synchronous Exception at 0x00000000EB8217A8 ------------------------------------------------------------------------ I've backed out this change and rebuild and things boot fine again. Any idea what I could try? /bz -- Bjoern A. Zeeb r15:7 From owner-dev-commits-src-main@freebsd.org Mon Sep 20 20:27: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 8B74C6AD392; Mon, 20 Sep 2021 20:27: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 4HCx243LsQz3C2y; Mon, 20 Sep 2021 20:27: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 52E1B168E2; Mon, 20 Sep 2021 20:27: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 18KKRejb022258; Mon, 20 Sep 2021 20:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KKReeQ022257; Mon, 20 Sep 2021 20:27:40 GMT (envelope-from git) Date: Mon, 20 Sep 2021 20:27:40 GMT Message-Id: <202109202027.18KKReeQ022257@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: 922bee44e400 - main - aio_fsync_vnode: use for(; ; ) loop instead of label 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: 922bee44e400321ac98b3b371cde3f0ff6137dd0 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, 20 Sep 2021 20:27:40 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=922bee44e400321ac98b3b371cde3f0ff6137dd0 commit 922bee44e400321ac98b3b371cde3f0ff6137dd0 Author: Konstantin Belousov AuthorDate: 2021-09-20 09:30:54 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-20 18:39:46 +0000 aio_fsync_vnode: use for(;;) loop instead of label Reviewed by: jhb, tmunro Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32023 --- sys/kern/vfs_aio.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 2da1a81d41bc..66792ccc1b92 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -724,24 +724,29 @@ static int aio_fsync_vnode(struct thread *td, struct vnode *vp, int op) { struct mount *mp; + vm_object_t obj; int error; - if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) - goto drop; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - if (vp->v_object != NULL) { - VM_OBJECT_WLOCK(vp->v_object); - vm_object_page_clean(vp->v_object, 0, 0, 0); - VM_OBJECT_WUNLOCK(vp->v_object); - } - if (op == LIO_DSYNC) - error = VOP_FDATASYNC(vp, td); - else - error = VOP_FSYNC(vp, MNT_WAIT, td); + for (;;) { + error = vn_start_write(vp, &mp, V_WAIT | PCATCH); + if (error != 0) + break; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + obj = vp->v_object; + if (obj != NULL) { + VM_OBJECT_WLOCK(obj); + vm_object_page_clean(obj, 0, 0, 0); + VM_OBJECT_WUNLOCK(obj); + } + if (op == LIO_DSYNC) + error = VOP_FDATASYNC(vp, td); + else + error = VOP_FSYNC(vp, MNT_WAIT, td); - VOP_UNLOCK(vp); - vn_finished_write(mp); -drop: + VOP_UNLOCK(vp); + vn_finished_write(mp); + break; + } return (error); } From owner-dev-commits-src-main@freebsd.org Mon Sep 20 20:27: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 CF0FE6AD0FD; Mon, 20 Sep 2021 20:27: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 4HCx254GVZz4vwq; Mon, 20 Sep 2021 20:27: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 73B44171A2; Mon, 20 Sep 2021 20:27: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 18KKRfk8022282; Mon, 20 Sep 2021 20:27:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KKRfUU022281; Mon, 20 Sep 2021 20:27:41 GMT (envelope-from git) Date: Mon, 20 Sep 2021 20:27:41 GMT Message-Id: <202109202027.18KKRfUU022281@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: 2933a7ca03f1 - main - aio_fsync_vnode: handle ERELOOKUP after VOP_FSYNC() 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: 2933a7ca03f16ba7b048a9bd2b3df1fc3cf9c344 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, 20 Sep 2021 20:27:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2933a7ca03f16ba7b048a9bd2b3df1fc3cf9c344 commit 2933a7ca03f16ba7b048a9bd2b3df1fc3cf9c344 Author: Konstantin Belousov AuthorDate: 2021-09-20 09:32:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-20 18:40:17 +0000 aio_fsync_vnode: handle ERELOOKUP after VOP_FSYNC() Reported by: tmunro Reviewed by: jhb, tmunro Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32023 --- sys/kern/vfs_aio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 66792ccc1b92..87c45bf2c078 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -745,7 +745,8 @@ aio_fsync_vnode(struct thread *td, struct vnode *vp, int op) VOP_UNLOCK(vp); vn_finished_write(mp); - break; + if (error != ERELOOKUP) + break; } return (error); } From owner-dev-commits-src-main@freebsd.org Mon Sep 20 22:39: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 6428E6AEE3B; Mon, 20 Sep 2021 22:39: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 4HCzyF23PVz3N7G; Mon, 20 Sep 2021 22:39: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 17CEB18D07; Mon, 20 Sep 2021 22:39: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 18KMdX9v095569; Mon, 20 Sep 2021 22:39:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KMdWRF095568; Mon, 20 Sep 2021 22:39:32 GMT (envelope-from git) Date: Mon, 20 Sep 2021 22:39:32 GMT Message-Id: <202109202239.18KMdWRF095568@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: da73926566da - main - libcam: Define depop structures and introduce scsi_wrap 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: da73926566da6f708ce3f17ff29fe867f1ad33cd 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, 20 Sep 2021 22:39:33 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=da73926566da6f708ce3f17ff29fe867f1ad33cd commit da73926566da6f708ce3f17ff29fe867f1ad33cd Author: Warner Losh AuthorDate: 2021-09-17 22:29:22 +0000 Commit: Warner Losh CommitDate: 2021-09-20 22:27:59 +0000 libcam: Define depop structures and introduce scsi_wrap Define structures related to the depop set of commands (GET PHYSICAL ELEMENT STATUS, REMOVE ELEMENT AND TRUNCATE, and RESTORE ELEMENT AND REBUILD) as well as the CDB construction routines. Also create scsi_wrap.c. This will have convenience routines that will do all the elements of allocating the ccb, generating the CDB, sending the command (looping as necessary for cases where data is returned, but it's size isn't known up front), etc. As this functionality is fleshed out, calling many camcontrol commands programatically gets much easier. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29017 --- lib/libcam/Makefile | 4 +- lib/libcam/scsi_wrap.c | 181 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/libcam/scsi_wrap.h | 38 ++++++++++ sys/cam/scsi/scsi_all.c | 82 ++++++++++++++++++++++ sys/cam/scsi/scsi_all.h | 87 +++++++++++++++++++++++ 5 files changed, 390 insertions(+), 2 deletions(-) diff --git a/lib/libcam/Makefile b/lib/libcam/Makefile index 2a5d13ba4f34..e0f8869f89ce 100644 --- a/lib/libcam/Makefile +++ b/lib/libcam/Makefile @@ -5,8 +5,8 @@ PACKAGE= runtime LIB= cam SHLIBDIR?= /lib SRCS= camlib.c scsi_cmdparse.c scsi_all.c scsi_da.c scsi_sa.c cam.c \ - ata_all.c nvme_all.c smp_all.c -INCS= camlib.h + ata_all.c nvme_all.c smp_all.c scsi_wrap.c +INCS= camlib.h scsi_wrap.h LIBADD= sbuf diff --git a/lib/libcam/scsi_wrap.c b/lib/libcam/scsi_wrap.c new file mode 100644 index 000000000000..524d36955c17 --- /dev/null +++ b/lib/libcam/scsi_wrap.c @@ -0,0 +1,181 @@ +/*- + * 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 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. + */ + +/* + * Wrapper functions to make requests and get answers w/o managing the + * details. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "camlib.h" +#include "scsi_wrap.h" + +void * +scsi_wrap_get_physical_element_status(struct cam_device *device, int task_attr, int retry_count, + int timeout, uint8_t report_type, uint32_t start_element) +{ + uint32_t allocation_length; + union ccb *ccb = NULL; + struct scsi_get_physical_element_hdr *hdr = NULL; + uint32_t dtors; + uint32_t reported; + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("Can't allocate ccb"); + return (NULL); + } + + /* + * Do the request up to twice. Once to get the length and once to get + * the data. We'll guess that 4096 is enough to almost always long + * enough since that's 127 entries and most drives have < 20 heads. If + * by chance it's not, then we'll loop once as we'll then know the + * proper length. + */ + allocation_length = MAX(sizeof(*hdr), 4096); +again: + free(hdr); + hdr = calloc(allocation_length, 1); + if (hdr == NULL) { + warnx("Can't allocate memory for physical element list"); + return (NULL); + } + + scsi_get_physical_element_status(&ccb->csio, + retry_count, + NULL, + task_attr, + (uint8_t *)hdr, + allocation_length, + report_type, + start_element, + SSD_FULL_SIZE, + timeout); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending GET PHYSICAL ELEMENT STATUS command"); + goto errout; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + goto errout; + } + + dtors = scsi_4btoul(hdr->num_descriptors); + reported = scsi_4btoul(hdr->num_returned); + if (dtors != 0 && dtors != reported) { + /* + * Get all the data... in the future we may need to step through + * a long list, but so far all drives I've found fit into one + * response. A 4k transfer can do 128 heads and current designs + * have 16. + */ + allocation_length = dtors * sizeof(struct scsi_get_physical_element_descriptor) + + sizeof(*hdr); + goto again; + } + cam_freeccb(ccb); + return (hdr); +errout: + cam_freeccb(ccb); + free(hdr); + return (NULL); +} + +void * +scsi_wrap_inquiry(struct cam_device *device, uint32_t page, uint32_t length) +{ + union ccb *ccb; + uint8_t *buf; + + ccb = cam_getccb(device); + + if (ccb == NULL) + return (NULL); + + buf = malloc(length); + + if (buf == NULL) { + cam_freeccb(ccb); + return (NULL); + } + + scsi_inquiry(&ccb->csio, + /*retries*/ 0, + /*cbfcnp*/ NULL, + /* tag_action */ MSG_SIMPLE_Q_TAG, + /* inq_buf */ (u_int8_t *)buf, + /* inq_len */ length, + /* evpd */ 1, + /* page_code */ page, + /* sense_len */ SSD_FULL_SIZE, + /* timeout */ 5000); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + // ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; + + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending INQUIRY command"); + cam_freeccb(ccb); + free(buf); + return (NULL); + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + free(buf); + buf = NULL; + } + cam_freeccb(ccb); + return (buf); +} + +struct scsi_vpd_block_device_characteristics * +scsi_wrap_vpd_block_device_characteristics(struct cam_device *device) +{ + + return ((struct scsi_vpd_block_device_characteristics *)scsi_wrap_inquiry( + device, SVPD_BDC, sizeof(struct scsi_vpd_block_device_characteristics))); +} diff --git a/lib/libcam/scsi_wrap.h b/lib/libcam/scsi_wrap.h new file mode 100644 index 000000000000..ff201538d527 --- /dev/null +++ b/lib/libcam/scsi_wrap.h @@ -0,0 +1,38 @@ +/*- + * 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _CAM_SCSI_WRAP_H +#define _CAM_SCSI_WRAP_H + +void *scsi_wrap_get_physical_element_status(struct cam_device *device, + int task_attr, int retry_count, int timeout, uint8_t report_type, + uint32_t start_element); +void *scsi_wrap_inquiry(struct cam_device *device, uint32_t page, uint32_t length); +struct scsi_vpd_block_device_characteristics *scsi_wrap_vpd_block_device_characteristics( + struct cam_device *device); + +#endif /* _CAM_SCSI_WRAP_H */ diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 729a2a06e616..dc249dac8000 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -8751,6 +8751,88 @@ scsi_send_diagnostic(struct ccb_scsiio *csio, u_int32_t retries, timeout); } +void +scsi_get_physical_element_status(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, + uint16_t allocation_length, uint8_t report_type, + uint32_t starting_element, + uint8_t sense_len, uint32_t timeout) +{ + struct scsi_get_physical_element_status *scsi_cmd; + + scsi_cmd = (struct scsi_get_physical_element_status *)&csio->cdb_io.cdb_bytes; + memset(scsi_cmd, 0, sizeof(*scsi_cmd)); + scsi_cmd->opcode = SERVICE_ACTION_IN; + scsi_cmd->service_action = GET_PHYSICAL_ELEMENT_STATUS; + scsi_ulto4b(starting_element, scsi_cmd->starting_element); + scsi_ulto4b(allocation_length, scsi_cmd->allocation_length); + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/ CAM_DIR_IN, + tag_action, + data_ptr, + allocation_length, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + +void +scsi_remove_element_and_truncate(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, + uint64_t requested_capacity, uint32_t element_id, + uint8_t sense_len, uint32_t timeout) +{ + struct scsi_remove_element_and_truncate *scsi_cmd; + + scsi_cmd = (struct scsi_remove_element_and_truncate *)&csio->cdb_io.cdb_bytes; + memset(scsi_cmd, 0, sizeof(*scsi_cmd)); + scsi_cmd->opcode = SERVICE_ACTION_IN; + scsi_cmd->service_action = REMOVE_ELEMENT_AND_TRUNCATE; + scsi_u64to8b(requested_capacity, scsi_cmd->requested_capacity); + scsi_ulto4b(element_id, scsi_cmd->element_identifier); + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/ CAM_DIR_OUT, + tag_action, + NULL, + 0, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + +void +scsi_restore_elements_and_rebuild(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, + uint8_t sense_len, uint32_t timeout) +{ + struct scsi_service_action_in *scsi_cmd; + + scsi_cmd = (struct scsi_service_action_in *)&csio->cdb_io.cdb_bytes; + memset(scsi_cmd, 0, sizeof(*scsi_cmd)); + scsi_cmd->opcode = SERVICE_ACTION_IN; + scsi_cmd->service_action = RESTORE_ELEMENTS_AND_REBUILD; + + cam_fill_csio(csio, + retries, + cbfcnp, + /*flags*/ CAM_DIR_OUT, + tag_action, + NULL, + 0, + sense_len, + sizeof(*scsi_cmd), + timeout); +} + void scsi_read_buffer(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h index 597d5fd68447..3272f23b172e 100644 --- a/sys/cam/scsi/scsi_all.h +++ b/sys/cam/scsi/scsi_all.h @@ -2158,6 +2158,9 @@ struct ata_pass_32 { #define REPORT_PRIORITY 0x0E #define REPORT_TIMESTAMP 0x0F #define MANAGEMENT_PROTOCOL_IN 0x10 +#define GET_PHYSICAL_ELEMENT_STATUS 0x17 +#define REMOVE_ELEMENT_AND_TRUNCATE 0x18 +#define RESTORE_ELEMENTS_AND_REBUILD 0x19 /* Maintenance Out Service Action Codes */ #define SET_IDENTIFY_INFORMATION 0x06 #define SET_TARGET_PORT_GROUPS 0x0A @@ -2847,6 +2850,8 @@ struct scsi_vpd_block_device_characteristics uint8_t depopulation_time[4]; uint8_t reserved2[48]; }; +_Static_assert(sizeof(struct scsi_vpd_block_device_characteristics) == 64, + "scsi_vpd_block_characteristics wrong size"); #define SBDC_IS_PRESENT(bdc, length, field) \ ((length >= offsetof(struct scsi_vpd_block_device_characteristics, \ @@ -3064,6 +3069,70 @@ struct scsi_report_luns_data { struct scsi_report_luns_lundata luns[0]; }; +/* + * GET PHYSICAL ELEMENT STATUS (GPES) from SBC-4 (r21 or later) + * REMOVE ELEMENT AND TRUNCATE (RET) from SBC-4 (r21 or later) + * RESTORE ELEMENT AND REBUILD (RER) from SBC-4 (r21 or later) + * + * Queries drives that support it for the status of feach of their physical + * storage elements (which typically map to heads, but aren't required to). + * These elements can be selective removed (at a reduced capacity) or restored + * to service. + */ +struct scsi_get_physical_element_status +{ + uint8_t opcode; + uint8_t service_action; + uint8_t rsvd[4]; + uint8_t starting_element[4]; + uint8_t allocation_length[4]; + uint8_t report_type; +#define SCSI_GPES_FILTER_ALL 0x00 +#define SCSI_GPES_FILTER_EXEPTION 0x40 +#define SCSI_GPES_REPORT_TYPE_PHYS 0x00 +#define SCSI_GEPS_REPORT_TYPE_STORAGE 0x01 + uint8_t control; +}; +_Static_assert(sizeof(struct scsi_get_physical_element_status) == 16, + "scsi_get_physical_element_status wrong size"); + +struct scsi_get_physical_element_hdr +{ + uint8_t num_descriptors[4]; + uint8_t num_returned[4]; + uint8_t id_depop[4]; + uint8_t rsvd[20]; +}; +_Static_assert(sizeof(struct scsi_get_physical_element_hdr) == 32, + "scsi_get_physical_element_hdr wrong size"); + +struct scsi_get_physical_element_descriptor +{ + uint8_t rsvd1[4]; + uint8_t element_identifier[4]; + uint8_t rsvd2[5]; + uint8_t ralwd; + uint8_t physical_element_type; +#define GPED_TYPE_STORAGE 0x1 + uint8_t physical_element_health; + uint8_t capacity[8]; + uint8_t rsvd3[8]; +}; +_Static_assert(sizeof(struct scsi_get_physical_element_descriptor) == 32, + "scsi_get_physical_element_descriptor wrong size"); + +struct scsi_remove_element_and_truncate +{ + uint8_t opcode; + uint8_t service_action; + uint8_t requested_capacity[8]; + uint8_t element_identifier[4]; + uint8_t rsvd; + uint8_t control; +}; +_Static_assert(sizeof(struct scsi_remove_element_and_truncate) == 16, + "scsi_remove_element_and_truncate wrong size"); + struct scsi_target_group { uint8_t opcode; @@ -4160,6 +4229,24 @@ void scsi_send_diagnostic(struct ccb_scsiio *csio, u_int32_t retries, uint16_t param_list_length, uint8_t sense_len, uint32_t timeout); +void scsi_get_physical_element_status(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t *data_ptr, + uint16_t allocation_length, uint8_t report_type, + uint32_t starting_element, + uint8_t sense_len, uint32_t timeout); + +void scsi_remove_element_and_truncate(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, + uint64_t requested_capacity, uint32_t element_id, + uint8_t sense_len, uint32_t timeout); + +void scsi_restore_elements_and_rebuild(struct ccb_scsiio *csio, u_int32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, + uint8_t sense_len, uint32_t timeout); + void scsi_read_buffer(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), uint8_t tag_action, int mode, From owner-dev-commits-src-main@freebsd.org Mon Sep 20 22:39: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 868546AE53B; Mon, 20 Sep 2021 22:39: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 4HCzyG2q12z3NGV; Mon, 20 Sep 2021 22:39: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 28DA718960; Mon, 20 Sep 2021 22:39: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 18KMdYCo095593; Mon, 20 Sep 2021 22:39:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18KMdYA6095592; Mon, 20 Sep 2021 22:39:34 GMT (envelope-from git) Date: Mon, 20 Sep 2021 22:39:34 GMT Message-Id: <202109202239.18KMdYA6095592@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: 53cce2e744c1 - main - camcontrol: depop command 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: 53cce2e744c1086bd5c6aa18bff4daac42468538 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, 20 Sep 2021 22:39:34 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=53cce2e744c1086bd5c6aa18bff4daac42468538 commit 53cce2e744c1086bd5c6aa18bff4daac42468538 Author: Warner Losh AuthorDate: 2021-09-17 22:30:06 +0000 Commit: Warner Losh CommitDate: 2021-09-20 22:27:59 +0000 camcontrol: depop command Implement and document the new depop command. This command manages drive elements for drives that support it. Storage elements are typically heads. Element status can be discovered. Elements may be removed or restored. And the status of any current depop operation can be assessed. depop -d elm will remove element elm and truncate available capacity. depop -l will list the current drive elements and their current status. depop -r elm will try to restore all retired elements and rebuild capacity. Changing storage elements may reinitialize the drive. This operation will lose data and may take hours to complete. Use the drive provided timeout for operations by default. Reviewed by: gbe (manpages) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29018 --- sbin/camcontrol/Makefile | 2 +- sbin/camcontrol/camcontrol.8 | 61 +++++++++ sbin/camcontrol/camcontrol.c | 15 +++ sbin/camcontrol/camcontrol.h | 3 + sbin/camcontrol/depop.c | 297 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 377 insertions(+), 1 deletion(-) diff --git a/sbin/camcontrol/Makefile b/sbin/camcontrol/Makefile index 3ed8b92372f8..958f37714662 100644 --- a/sbin/camcontrol/Makefile +++ b/sbin/camcontrol/Makefile @@ -5,7 +5,7 @@ PACKAGE=runtime PROG= camcontrol SRCS= camcontrol.c util.c -SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.c progress.c timestamp.c zone.c +SRCS+= attrib.c depop.c epc.c fwdownload.c modeedit.c persist.c progress.c timestamp.c zone.c .if ${MK_NVME} != "no" .PATH: ${SRCTOP}/sbin/nvmecontrol CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol -DWITH_NVME diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8 index 9c128131d817..7790d047a255 100644 --- a/sbin/camcontrol/camcontrol.8 +++ b/sbin/camcontrol/camcontrol.8 @@ -366,6 +366,13 @@ .Ic devtype .Op device id .Nm +.Ic depop +.Op device id +.Op generic args +.Ao Fl l | Fl d | Fl r Ac +.Op Fl e Ar elem +.Op Fl c Ar capacity +.Nm .Ic help .Sh DESCRIPTION The @@ -2594,6 +2601,60 @@ Device type is unknown .It illegal A programming error occurred .El +.It Ic depop +Commands necessary to support the depopulation (depop) of defective elements of a device +(typically heads for hard drives) or setting capacity point (typically used on +flash drives). +Issues either GET PHYSICAL ELEMENT STATUS, REMOVE ELEMENT AND TRUNCATE, or RESTORE +ELEMENT AND REBUILD command to manage storage elements of a drive. +Removal or restoration of elements may take up to a day to complete. +One of the +.Fl d , +.Fl l , +or +.Fl r +options must be specified. +These options are mutually exclusive. +Only SCSI drives are supported. +Changing the storage elements of a storage drive may result in the loss of all +data on that storage drive. +The drive may need to reinitialize after +.Fl d +or +.Fl r +commands. +The data on the drive is inaccessible until one of these commands complete. +Once one of these commands start, the drive is format corrupt until the +operation successfully completes. +While format corrupt, no read or write I/O is possible to the drive. +If the drive power cycles, it will remain format corrupt and the operation +must be restarted. +TEST UNIT READY or +.Dq camcontrol tur +can monitor an in-progress depop operation. +.Bl -tag -width 6n +.It Fl c Ar capacity +Specify the desired capacity point for the drive. +Valid only for the +.Fl d +flag. +.It Fl d +Remove the physical element from service or set the capacity point specified by the +.Fl e +or +.Fl c +flags. +The drive's capacity may be reduced by this operation. +.It Fl e Ar element +Specify the physical element to remove from service. +Valid only for the +.Fl d +flag. +.It Fl l +Report the current status of the physical elements of a drive. +.It Fl r +Restore all the eligible physical elements to service. +.El .It Ic help Print out verbose usage information. .El diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 69939715898e..e560eb349f79 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -111,6 +111,7 @@ typedef enum { CAM_CMD_POWER_MODE, CAM_CMD_DEVTYPE, CAM_CMD_AMA, + CAM_CMD_DEPOP, } cam_cmd; typedef enum { @@ -228,6 +229,7 @@ static struct camcontrol_opts option_table[] = { {"zone", CAM_CMD_ZONE, CAM_ARG_NONE, "ac:l:No:P:"}, {"epc", CAM_CMD_EPC, CAM_ARG_NONE, "c:dDeHp:Pr:sS:T:"}, {"timestamp", CAM_CMD_TIMESTAMP, CAM_ARG_NONE, "f:mrsUT:"}, + {"depop", CAM_CMD_DEPOP, CAM_ARG_NONE, "ac:de:ls"}, {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-h", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -9946,6 +9948,7 @@ usage(int printlong) " camcontrol timestamp [dev_id][generic_args] <-r [-f format|-m|-U]>|\n" " <-s <-f format -T time | -U >>\n" " camcontrol devtype [dev_id]\n" +" camcontrol depop [dev_id] [-d | -l | -r] [-e element] [-c capacity]\n" " camcontrol mmcsdcmd [dev_id] [[-c mmc_opcode] [-a mmc_arg]\n" " [-f mmc_flags] [-l data_len]\n" " [-W [-b data_byte]]] |\n" @@ -9999,6 +10002,7 @@ usage(int printlong) "epc send ATA Extended Power Conditions commands\n" "timestamp report or set the device's timestamp\n" "devtype report the type of device\n" +"depop manage drive storage elements\n" "mmcsdcmd send the given MMC command, needs -c and -a as well\n" "help this message\n" "Device Identifiers:\n" @@ -10208,6 +10212,12 @@ usage(int printlong) "-f format the format of the time string passed into strptime(3)\n" "-T time the time value passed into strptime(3)\n" "-U set the timestamp of the device to UTC time\n" +"depop arguments:\n" +"-d remove an element from service\n" +"-l list status of all elements of drive\n" +"-r restore all elements to service\n" +"-e elm element to remove\n" +"-c capacity requested new capacity\n" "mmcsdcmd arguments:\n" "-c mmc_cmd MMC command to send to the card\n" "-a mmc_arg Argument for the MMC command\n" @@ -10631,6 +10641,11 @@ main(int argc, char **argv) task_attr, retry_count, timeout, arglist & CAM_ARG_VERBOSE); break; + case CAM_CMD_DEPOP: + error = depop(cam_dev, argc, argv, combinedopt, + task_attr, retry_count, timeout, + arglist & CAM_ARG_VERBOSE); + break; case CAM_CMD_USAGE: usage(1); break; diff --git a/sbin/camcontrol/camcontrol.h b/sbin/camcontrol/camcontrol.h index 85f2e8658fe8..b84587df7a3e 100644 --- a/sbin/camcontrol/camcontrol.h +++ b/sbin/camcontrol/camcontrol.h @@ -88,6 +88,9 @@ int epc(struct cam_device *device, int argc, char **argv, char *combinedopt, int timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout, int verbosemode); +int depop(struct cam_device *device, int argc, char **argv, + char *combinedopt, int task_attr, int retry_count, int timeout, + int verbosemode); void mode_sense(struct cam_device *device, int *cdb_len, int dbd, int llbaa, int pc, int page, int subpage, int task_attr, int retry_count, int timeout, uint8_t *data, int datalen); diff --git a/sbin/camcontrol/depop.c b/sbin/camcontrol/depop.c new file mode 100644 index 000000000000..3dbd2ba5358d --- /dev/null +++ b/sbin/camcontrol/depop.c @@ -0,0 +1,297 @@ +/*- + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * + * NO WARRANTY + * 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 MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + */ +/* + * SCSI disk depop (head depopulation) support + * + * The standard defines 'storage elements' as the generic way of referring to a + * disk drive head. Each storage element has an identifier and an active status. + * The health of an element can be querried. Active elements may be removed from + * service with a REMOVE ELEMENT AND TRUNCATE (RET) command. Inactive element + * may be returned to service with a RESTORE ELEMENTS AND REBUILD (RER) + * command. GET PHYSICAL ELEMENT STATUS (GPES) will return a list of elements, + * their health, whether they are in service, how much capacity the element is + * used for, etc. + * + * When a depop operation starts, the drive becomes format corrupt. No normal + * I/O can be done to the drive and a limited number of CDBs will + * succeed. Status can be obtained by either a TEST UNIT READY or a GPES + * command. A drive reset will not stop a depop operation, but a power cycle + * will. A failed depop operation will be reported when the next TEST UNIT READY + * is sent to the drive. Drives that are format corrupt after an interrupted + * operation need to have that operation repeated. + * + * 'depop' provides a wrapper around all these functions. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include "camcontrol.h" + +enum depop_action { + DEPOP_NONE, + DEPOP_LIST, + DEPOP_RESTORE, + DEPOP_REMOVE, +}; + +static int +depop_list(struct cam_device *device, int task_attr, int retry_count, + int timeout, int verbosemode __unused) +{ + int error = 0; + uint32_t dtors; + struct scsi_get_physical_element_hdr *hdr; + struct scsi_get_physical_element_descriptor *dtor_ptr; + + hdr = scsi_wrap_get_physical_element_status(device, task_attr, retry_count, timeout, + SCSI_GPES_FILTER_ALL | SCSI_GPES_REPORT_TYPE_PHYS, 1); + if (hdr == NULL) + errx(1, "scsi_wrap_get_physical_element_status returned an error"); + + /* + * OK, we have the data, not report it out. + */ + dtor_ptr = (struct scsi_get_physical_element_descriptor *)(hdr + 1); + dtors = scsi_4btoul(hdr->num_descriptors); + printf("Elem ID * Health Capacity\n"); + for (uint32_t i = 0; i < dtors; i++) { + uint32_t id = scsi_4btoul(dtor_ptr[i].element_identifier); + uint8_t ralwd = dtor_ptr[i].ralwd; + uint8_t type = dtor_ptr[i].physical_element_type; + uint8_t health = dtor_ptr[i].physical_element_health; + uint64_t cap = scsi_8btou64(dtor_ptr[i].capacity); + if (type != GPED_TYPE_STORAGE) + printf("0x%08x -- type unknown %d\n", id, type); + else + printf("0x%08x %c 0x%02x %jd\n", id, ralwd ? '*' : ' ', health, cap); + } + printf("* -- Element can be restored\n"); + + free(hdr); + return (error); +} + +static int +depop_remove(struct cam_device *device, int task_attr, int retry_count, + int timeout, int verbosemode __unused, uint32_t elem, uint64_t capacity) +{ + union ccb *ccb; + int error = 0; + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("Can't allocate ccb"); + return (1); + } + scsi_remove_element_and_truncate(&ccb->csio, + retry_count, + NULL, + task_attr, + capacity, + elem, + SSD_FULL_SIZE, + timeout); + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending GET PHYSICAL ELEMENT STATUS command"); + error = 1; + goto out; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + error = 1; + } + +out: + cam_freeccb(ccb); + return (error); +} + +static int +depop_restore(struct cam_device *device, int task_attr, int retry_count, + int timeout, int verbosemode __unused) +{ + union ccb *ccb; + int error = 0; + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("Can't allocate ccb"); + return (1); + } + scsi_restore_elements_and_rebuild(&ccb->csio, + retry_count, + NULL, + task_attr, + SSD_FULL_SIZE, + timeout); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending GET PHYSICAL ELEMENT STATUS command"); + error = 1; + goto out; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + error = 1; + } + +out: + cam_freeccb(ccb); + return (error); +} + +#define MUST_BE_NONE() \ + if (action != DEPOP_NONE) { \ + warnx("Use only one of -d, -l, or -r"); \ + error = 1; \ + goto bailout; \ + } + +int +depop(struct cam_device *device, int argc, char **argv, char *combinedopt, + int task_attr, int retry_count, int timeout, int verbosemode) +{ + int c; + int action = DEPOP_NONE; + char *endptr; + int error = 0; + uint32_t elem = 0; + uint64_t capacity = 0; + + while ((c = getopt(argc, argv, combinedopt)) != -1) { + switch (c) { + case 'c': + capacity = strtoumax(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("Invalid capacity: %s", optarg); + error = 1; + goto bailout; + } + break; + case 'e': + elem = strtoul(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("Invalid element: %s", optarg); + error = 1; + goto bailout; + } + break; + case 'd': + MUST_BE_NONE(); + action = DEPOP_REMOVE; + break; + case 'l': + MUST_BE_NONE(); + action = DEPOP_LIST; + break; + case 'r': + MUST_BE_NONE(); + action = DEPOP_RESTORE; + break; + default: + break; + } + } + + /* + * Compute a sane timeout if none given. 5 seconds for the list command + * and whatever the block device characteristics VPD says for other + * depop commands. If there's no value in that field, default to 1 + * day. Experience has shown that these operations take the better part + * of a day to complete, so a 1 day timeout default seems appropriate. + */ + if (timeout == 0 && action != DEPOP_NONE) { + if (action == DEPOP_LIST) { + timeout = 5 * 1000; + } else { + struct scsi_vpd_block_device_characteristics *bdc; + + timeout = 24 * 60 * 60 * 1000; /* 1 day */ + bdc = scsi_wrap_vpd_block_device_characteristics(device); + if (bdc != NULL) { + timeout = scsi_4btoul(bdc->depopulation_time); + } + free(bdc); + } + } + + switch (action) { + case DEPOP_NONE: + warnx("Must specify one of -d, -l, or -r"); + error = 1; + break; + case DEPOP_REMOVE: + if (elem == 0 && capacity == 0) { + warnx("Must specify at least one of -e and/or -c"); + error = 1; + break; + } + error = depop_remove(device, task_attr, retry_count, timeout, + verbosemode, elem, capacity); + break; + case DEPOP_RESTORE: + error = depop_restore(device, task_attr, retry_count, timeout, + verbosemode); + break; + case DEPOP_LIST: + error = depop_list(device, task_attr, retry_count, timeout, + verbosemode); + break; + } + +bailout: + + return (error); +} From owner-dev-commits-src-main@freebsd.org Tue Sep 21 04:09: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 0D24B6B5776; Tue, 21 Sep 2021 04:09:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HD7GQ6lNdz4ng8; Tue, 21 Sep 2021 04:09: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 C8B171D692; Tue, 21 Sep 2021 04:09: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 18L492Fm062763; Tue, 21 Sep 2021 04:09:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18L492SV062762; Tue, 21 Sep 2021 04:09:02 GMT (envelope-from git) Date: Tue, 21 Sep 2021 04:09:02 GMT Message-Id: <202109210409.18L492SV062762@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: 44fb3c695f5e - main - endian.h: Use the __bswap* versions 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: 44fb3c695f5e672ec00bdef0fa0f13793e6269a1 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, 21 Sep 2021 04:09:03 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=44fb3c695f5e672ec00bdef0fa0f13793e6269a1 commit 44fb3c695f5e672ec00bdef0fa0f13793e6269a1 Author: Warner Losh AuthorDate: 2021-09-21 04:02:35 +0000 Commit: Warner Losh CommitDate: 2021-09-21 04:02:35 +0000 endian.h: Use the __bswap* versions Make it possible to have all these macros work without bswap* being defined. bswap* is part of the application namespace and applications are free to redefine those functions. Reviewed by: emaste,jhb,markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31964 --- sys/sys/endian.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/sys/endian.h b/sys/sys/endian.h index d070d09ad9f7..faac0458ae2c 100644 --- a/sys/sys/endian.h +++ b/sys/sys/endian.h @@ -67,16 +67,16 @@ typedef __uint64_t uint64_t; * endian to host byte order functions as detailed in byteorder(9). */ #if _BYTE_ORDER == _LITTLE_ENDIAN -#define htobe16(x) bswap16((x)) -#define htobe32(x) bswap32((x)) -#define htobe64(x) bswap64((x)) +#define htobe16(x) __bswap16((x)) +#define htobe32(x) __bswap32((x)) +#define htobe64(x) __bswap64((x)) #define htole16(x) ((uint16_t)(x)) #define htole32(x) ((uint32_t)(x)) #define htole64(x) ((uint64_t)(x)) -#define be16toh(x) bswap16((x)) -#define be32toh(x) bswap32((x)) -#define be64toh(x) bswap64((x)) +#define be16toh(x) __bswap16((x)) +#define be32toh(x) __bswap32((x)) +#define be64toh(x) __bswap64((x)) #define le16toh(x) ((uint16_t)(x)) #define le32toh(x) ((uint32_t)(x)) #define le64toh(x) ((uint64_t)(x)) @@ -84,16 +84,16 @@ typedef __uint64_t uint64_t; #define htobe16(x) ((uint16_t)(x)) #define htobe32(x) ((uint32_t)(x)) #define htobe64(x) ((uint64_t)(x)) -#define htole16(x) bswap16((x)) -#define htole32(x) bswap32((x)) -#define htole64(x) bswap64((x)) +#define htole16(x) __bswap16((x)) +#define htole32(x) __bswap32((x)) +#define htole64(x) __bswap64((x)) #define be16toh(x) ((uint16_t)(x)) #define be32toh(x) ((uint32_t)(x)) #define be64toh(x) ((uint64_t)(x)) -#define le16toh(x) bswap16((x)) -#define le32toh(x) bswap32((x)) -#define le64toh(x) bswap64((x)) +#define le16toh(x) __bswap16((x)) +#define le32toh(x) __bswap32((x)) +#define le64toh(x) __bswap64((x)) #endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ /* Alignment-agnostic encode/decode bytestream to/from little/big endian. */ From owner-dev-commits-src-main@freebsd.org Tue Sep 21 07:39: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 7B8AD66D820; Tue, 21 Sep 2021 07:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDCwh2pBxz3Pby; Tue, 21 Sep 2021 07:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4008E20195; Tue, 21 Sep 2021 07:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18L7d0Y3040537; Tue, 21 Sep 2021 07:39:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18L7d05N040536; Tue, 21 Sep 2021 07:39:00 GMT (envelope-from git) Date: Tue, 21 Sep 2021 07:39:00 GMT Message-Id: <202109210739.18L7d05N040536@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: 5572fda3a2f3 - main - mvneta: split to FDT and generic part 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: 5572fda3a2f305fc4fb4c853d8d578c13d59c1a5 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, 21 Sep 2021 07:39:00 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=5572fda3a2f305fc4fb4c853d8d578c13d59c1a5 commit 5572fda3a2f305fc4fb4c853d8d578c13d59c1a5 Author: Wojciech Macek AuthorDate: 2021-09-14 07:11:15 +0000 Commit: Wojciech Macek CommitDate: 2021-09-21 07:38:38 +0000 mvneta: split to FDT and generic part Split some missing routines. Obtained from: Semihalf --- sys/dev/neta/if_mvneta.c | 45 +++++--------------------------------------- sys/dev/neta/if_mvneta_fdt.c | 44 +++++++++++++++++++++++++++++++++++++++++++ sys/dev/neta/if_mvnetavar.h | 1 + 3 files changed, 50 insertions(+), 40 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index 71552bf2c515..fe86f4a5effe 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -68,10 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include @@ -222,11 +218,6 @@ static device_method_t mvneta_methods[] = { DEVMETHOD_END }; -static struct ofw_compat_data compat_data[] = { - { "marvell,armada-3700-neta", true }, - { NULL, false } -}; - DEFINE_CLASS_0(mvneta, mvneta_driver, mvneta_methods, sizeof(struct mvneta_softc)); DRIVER_MODULE(miibus, mvneta, miibus_driver, miibus_devclass, 0, 0); @@ -234,7 +225,7 @@ DRIVER_MODULE(mdio, mvneta, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(mvneta, mdio, 1, 1, 1); MODULE_DEPEND(mvneta, ether, 1, 1, 1); MODULE_DEPEND(mvneta, miibus, 1, 1, 1); -SIMPLEBUS_PNP_INFO(compat_data); +MODULE_DEPEND(mvneta, mvxpbm, 1, 1, 1); /* * List of MIB register and names @@ -418,40 +409,14 @@ mvneta_get_mac_address(struct mvneta_softc *sc, uint8_t *addr) return (0); } -STATIC boolean_t -mvneta_find_ethernet_prop_switch(phandle_t ethernet, phandle_t node) -{ - boolean_t ret; - phandle_t child, switch_eth_handle, switch_eth; - - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (OF_getencprop(child, "ethernet", (void*)&switch_eth_handle, - sizeof(switch_eth_handle)) > 0) { - if (switch_eth_handle > 0) { - switch_eth = OF_node_from_xref( - switch_eth_handle); - - if (switch_eth == ethernet) - return (true); - } - } - - ret = mvneta_find_ethernet_prop_switch(ethernet, child); - if (ret != 0) - return (ret); - } - - return (false); -} - STATIC boolean_t mvneta_has_switch(device_t self) { - phandle_t node; - - node = ofw_bus_get_node(self); +#ifdef FDT + return (mvneta_has_switch_fdt(self)); +#endif - return mvneta_find_ethernet_prop_switch(node, OF_finddevice("/")); + return (false); } STATIC int diff --git a/sys/dev/neta/if_mvneta_fdt.c b/sys/dev/neta/if_mvneta_fdt.c index df7840845fcd..bedf4b253a45 100644 --- a/sys/dev/neta/if_mvneta_fdt.c +++ b/sys/dev/neta/if_mvneta_fdt.c @@ -58,6 +58,12 @@ __FBSDID("$FreeBSD$"); #include "if_mvnetareg.h" #include "if_mvnetavar.h" +#ifdef MVNETA_DEBUG +#define STATIC /* nothing */ +#else +#define STATIC static +#endif + #define PHY_MODE_MAXLEN 10 #define INBAND_STATUS_MAXLEN 16 @@ -89,6 +95,8 @@ static struct ofw_compat_data compat_data[] = { {NULL, false} }; +SIMPLEBUS_PNP_INFO(compat_data); + static int mvneta_fdt_probe(device_t dev) { @@ -250,3 +258,39 @@ mvneta_fdt_mac_address(struct mvneta_softc *sc, uint8_t *addr) return (0); } + +STATIC boolean_t +mvneta_find_ethernet_prop_switch(phandle_t ethernet, phandle_t node) +{ + boolean_t ret; + phandle_t child, switch_eth_handle, switch_eth; + + for (child = OF_child(node); child != 0; child = OF_peer(child)) { + if (OF_getencprop(child, "ethernet", (void*)&switch_eth_handle, + sizeof(switch_eth_handle)) > 0) { + if (switch_eth_handle > 0) { + switch_eth = OF_node_from_xref( + switch_eth_handle); + + if (switch_eth == ethernet) + return (true); + } + } + + ret = mvneta_find_ethernet_prop_switch(ethernet, child); + if (ret != 0) + return (ret); + } + + return (false); +} + +boolean_t +mvneta_has_switch_fdt(device_t self) +{ + phandle_t node; + + node = ofw_bus_get_node(self); + + return mvneta_find_ethernet_prop_switch(node, OF_finddevice("/")); +} diff --git a/sys/dev/neta/if_mvnetavar.h b/sys/dev/neta/if_mvnetavar.h index 00bfd1f0848c..0e6cf7829197 100644 --- a/sys/dev/neta/if_mvnetavar.h +++ b/sys/dev/neta/if_mvnetavar.h @@ -321,6 +321,7 @@ struct mvneta_softc { int mvneta_attach(device_t); #ifdef FDT +boolean_t mvneta_has_switch_fdt(device_t); int mvneta_fdt_mac_address(struct mvneta_softc *, uint8_t *); #endif From owner-dev-commits-src-main@freebsd.org Tue Sep 21 10:01: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 A234966F5AA; Tue, 21 Sep 2021 10:01:55 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDH5b0kD2z3tNr; Tue, 21 Sep 2021 10:01:54 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1632218512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eS6A0qiwIivnLoyBpp4cqImqR7TeXA7BbKSeOwOqHp0=; b=FZqfP9ybtJs1oDOrxsCjpGkjfwUa0wxZ5kgmPSeIaLCIGHBlgpCYBPqGDEhikIfneT16UB Xv0ByvDiqXkNRjpYGC83F0zju2pq70b14mZtX+jQ2Gnrp1U8/mZgHhrlyFaXB495rMBq0t WKBR+EPcZEbmFE9EOJCJryahXetBD9U= Received: from amy (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 5ef177d3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 21 Sep 2021 10:01:52 +0000 (UTC) Date: Tue, 21 Sep 2021 12:01:52 +0200 From: Emmanuel Vadot To: "Bjoern A. Zeeb" Cc: Toomas Soome , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b4cb3fe0e39a - main - loader: implement mount/unmount rootfs Message-Id: <20210921120152.a76525d0849640320b2b156e@bidouilliste.com> In-Reply-To: References: <202109081249.188CncXF065953@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HDH5b0kD2z3tNr 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, 21 Sep 2021 10:01:55 -0000 On Mon, 20 Sep 2021 19:46:07 +0000 (UTC) "Bjoern A. Zeeb" wrote: > On Wed, 8 Sep 2021, Toomas Soome wrote: > > > The branch main has been updated by tsoome: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=b4cb3fe0e39a31e60292018dc9fb7510b3de92bf > > > > commit b4cb3fe0e39a31e60292018dc9fb7510b3de92bf > > Author: Toomas Soome > > AuthorDate: 2021-08-12 05:45:52 +0000 > > Commit: Toomas Soome > > CommitDate: 2021-09-08 01:01:20 +0000 > > > > loader: implement mount/unmount rootfs > > > > We want to keep our root file system open to preserve bcache segment > > between file accesses, thus reducing physical disk IO. > > > > Reviewed by: imp, allanjude, kevans (previous version) > > Differential Revision: https://reviews.freebsd.org/D30848 > > MFC after: 1 month > > > This makes netbooting on at least one of my arm64 impossible: > > ------------------------------------------------------------------------ > Consoles: serial port > Reading loader env vars from /efi/freebsd/loader.env > FreeBSD/arm64 EFI loader, Revision 1.1 > (Mon Sep 20 13:12:35 UTC 2021 root@localhost) > > Command line arguments: loader.efi > Image base: 0xeb7e9000 > EFI version: 2.70 > EFI Firmware: EDK II (rev 1.00) > Console: comconsole (0) > Load Path: > Load Device: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) > BootCurrent: 0004 > BootOrder: 0000 0001 0002 0003 0008 0004[*] 0005 0006 0007 > BootInfo Path: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) > Ignoring Boot0004: Only one DP found > Setting currdev to net0: > > > Synchronous Exception at 0x00000000EB8217A8 > > ------------------------------------------------------------------------ > > I've backed out this change and rebuild and things boot fine again. > > Any idea what I could try? > > > /bz > > -- > Bjoern A. Zeeb r15:7 Same thing for me on u-boot based systems : Consoles: EFI console Reading loader env vars from /efi/freebsd/loader.env FreeBSD/arm64 EFI loader, Revision 1.1 Command line arguments: loader.efi Image base: 0xfbde0000 EFI version: 2.80 EFI Firmware: Das U-Boot (rev 8225.1792) Console: comconsole (0) Load Path: /aarch64\loader.efi Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(86e0c0eafaa9,1) Setting currdev to net0: Speed: 1000, full duplex net0: cannot set rx. filters (status=3) "Synchronous Abort" handler, esr 0x96000004 elr: fffffffffd0f1b9c lr : fffffffffd0effb4 (reloc) elr: 00000000fbe37b9c lr : 00000000fbe35fb4 x0 : fbee447500000000 x1 : 0000000000000020 x2 : 0000000000000001 x3 : 00000000fbee4452 x4 : 0000000000000073 x5 : 0000000000000050 x6 : 00000000fbe357a4 x7 : 0000000000000000 x8 : fbee447500000000 x9 : fbee447500000000 x10: 0000000000000000 x11: 00000000fbee3b86 x12: 0000000000000000 x13: 0000000000000000 x14: 0000000000000000 x15: 0000000000000000 x16: 0000000000000000 x17: 0000000000000000 x18: 0000000000000000 x19: 0000000000000020 x20: 00000000fbf05df8 x21: 0000000000000000 x22: 0000000000000000 x23: fbee447500000000 x24: 0000000000000000 x25: 00000000fbf079b0 x26: 00000000fbee4453 x27: 00000000fbf079b0 x28: 00000000fbee79ee x29: 00000000fbf05d50 Code: 8b090100 d65f03c0 927df009 aa0903e8 (f840850b) UEFI image [0x00000000fbde0000:0x00000000fbf14e9f] pc=0x57b9c '/aarch64\loader.efi' Resetting CPU ... -- Emmanuel Vadot From owner-dev-commits-src-main@freebsd.org Tue Sep 21 10:03: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 1794566F5BF for ; Tue, 21 Sep 2021 10:03:35 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-zteg10021301.me.com (pv50p00im-zteg10021301.me.com [17.58.6.46]) (using TLSv1.3 with cipher TLS_AES_256_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 4HDH7V6cZmz3tPM for ; Tue, 21 Sep 2021 10:03:34 +0000 (UTC) (envelope-from tsoome@me.com) Received: from smtpclient.apple (unknown [91.209.240.229]) by pv50p00im-zteg10021301.me.com (Postfix) with ESMTPSA id 4B859CC04B9; Tue, 21 Sep 2021 10:03:26 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: b4cb3fe0e39a - main - loader: implement mount/unmount rootfs From: Toomas Soome In-Reply-To: <20210921120152.a76525d0849640320b2b156e@bidouilliste.com> Date: Tue, 21 Sep 2021 13:03:22 +0300 Cc: "Bjoern A. Zeeb" , Toomas Soome , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202109081249.188CncXF065953@gitrepo.freebsd.org> <20210921120152.a76525d0849640320b2b156e@bidouilliste.com> To: Emmanuel Vadot X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-09-21_01:2021-09-20, 2021-09-21 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2009150000 definitions=main-2109210064 X-Rspamd-Queue-Id: 4HDH7V6cZmz3tPM 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: Tue, 21 Sep 2021 10:03:35 -0000 > On 21. Sep 2021, at 13:01, Emmanuel Vadot = wrote: >=20 > On Mon, 20 Sep 2021 19:46:07 +0000 (UTC) > "Bjoern A. Zeeb" wrote: >=20 >> On Wed, 8 Sep 2021, Toomas Soome wrote: >>=20 >>> The branch main has been updated by tsoome: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Db4cb3fe0e39a31e60292018dc9fb7510= b3de92bf >>>=20 >>> commit b4cb3fe0e39a31e60292018dc9fb7510b3de92bf >>> Author: Toomas Soome >>> AuthorDate: 2021-08-12 05:45:52 +0000 >>> Commit: Toomas Soome >>> CommitDate: 2021-09-08 01:01:20 +0000 >>>=20 >>> loader: implement mount/unmount rootfs >>>=20 >>> We want to keep our root file system open to preserve bcache = segment >>> between file accesses, thus reducing physical disk IO. >>>=20 >>> Reviewed by: imp, allanjude, kevans (previous version) >>> Differential Revision: https://reviews.freebsd.org/D30848 >>> MFC after: 1 month >>=20 >>=20 >> This makes netbooting on at least one of my arm64 impossible: >>=20 >> = ------------------------------------------------------------------------ >> Consoles: serial port >> Reading loader env vars from /efi/freebsd/loader.env >> FreeBSD/arm64 EFI loader, Revision 1.1 >> (Mon Sep 20 13:12:35 UTC 2021 root@localhost) >>=20 >> Command line arguments: loader.efi >> Image base: 0xeb7e9000 >> EFI version: 2.70 >> EFI Firmware: EDK II (rev 1.00) >> Console: comconsole (0) >> Load Path: >> Load Device: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) >> BootCurrent: 0004 >> BootOrder: 0000 0001 0002 0003 0008 0004[*] 0005 0006 0007 >> BootInfo Path: MAC(xxxxxxxxxxxx,0x1)/IPv4(0.0.0.0) >> Ignoring Boot0004: Only one DP found >> Setting currdev to net0: >>=20 >>=20 >> Synchronous Exception at 0x00000000EB8217A8 >>=20 >> = ------------------------------------------------------------------------ >>=20 >> I've backed out this change and rebuild and things boot fine again. >>=20 >> Any idea what I could try? >>=20 >>=20 >> /bz >>=20 >> --=20 >> Bjoern A. Zeeb = r15:7 >=20 > Same thing for me on u-boot based systems : Ye, it seems to be the same issue, UEFI netboot is broken, = investigating. sorry, toomas >=20 > Consoles: EFI > console Reading loader env vars > from /efi/freebsd/loader.env FreeBSD/arm64 EFI loader, Revision > 1.1=20 > Command line arguments: > loader.efi Image base: > 0xfbde0000 EFI version: > 2.80 EFI Firmware: Das U-Boot (rev > 8225.1792) Console: comconsole > (0) Load > Path: /aarch64\loader.efi Load > Device: = /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(86e0c0eafaa9,1) > Setting currdev to net0: Speed: 1000, full > duplex net0: cannot set rx. filters > (status=3D3) "Synchronous Abort" handler, esr > 0x96000004 elr: fffffffffd0f1b9c lr : fffffffffd0effb4 > (reloc) elr: 00000000fbe37b9c lr : > 00000000fbe35fb4 x0 : fbee447500000000 x1 : > 0000000000000020 x2 : 0000000000000001 x3 : > 00000000fbee4452 x4 : 0000000000000073 x5 : > 0000000000000050 x6 : 00000000fbe357a4 x7 : > 0000000000000000 x8 : fbee447500000000 x9 : > fbee447500000000 x10: 0000000000000000 x11: > 00000000fbee3b86 x12: 0000000000000000 x13: > 0000000000000000 x14: 0000000000000000 x15: > 0000000000000000 x16: 0000000000000000 x17: > 0000000000000000 x18: 0000000000000000 x19: > 0000000000000020 x20: 00000000fbf05df8 x21: > 0000000000000000 x22: 0000000000000000 x23: > fbee447500000000 x24: 0000000000000000 x25: > 00000000fbf079b0 x26: 00000000fbee4453 x27: > 00000000fbf079b0 x28: 00000000fbee79ee x29: > 00000000fbf05d50=20 > Code: 8b090100 d65f03c0 927df009 aa0903e8 > (f840850b) UEFI image [0x00000000fbde0000:0x00000000fbf14e9f] > pc=3D0x57b9c '/aarch64\loader.efi' Resetting CPU ... >=20 > --=20 > Emmanuel Vadot From owner-dev-commits-src-main@freebsd.org Tue Sep 21 12:02: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 D46B8671393; Tue, 21 Sep 2021 12:02: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 4HDKmL5bfHz4YK9; Tue, 21 Sep 2021 12:02: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 A06A323B9E; Tue, 21 Sep 2021 12:02: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 18LC2A2O096914; Tue, 21 Sep 2021 12:02:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LC2Api096913; Tue, 21 Sep 2021 12:02:10 GMT (envelope-from git) Date: Tue, 21 Sep 2021 12:02:10 GMT Message-Id: <202109211202.18LC2Api096913@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: 0b79a76f8487 - main - sctp: improve consistency when calling stream scheduler 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: 0b79a76f848768068d409edcb36f2a58cdd17e61 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, 21 Sep 2021 12:02:10 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=0b79a76f848768068d409edcb36f2a58cdd17e61 commit 0b79a76f848768068d409edcb36f2a58cdd17e61 Author: Michael Tuexen AuthorDate: 2021-09-20 22:54:13 +0000 Commit: Michael Tuexen CommitDate: 2021-09-20 22:54:13 +0000 sctp: improve consistency when calling stream scheduler Hold always the stcb send lock when calling sctp_ss_init() and sctp_ss_remove_from_stream(). MFC after: 1 week --- sys/netinet/sctp_output.c | 8 ++++---- sys/netinet/sctp_timer.c | 17 +++++++++-------- sys/netinet/sctputil.c | 4 +++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 434ab7e1f8dc..27ad92527454 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -7207,13 +7207,13 @@ one_more_time: sp->put_last_out, send_lock_up); } - if ((TAILQ_NEXT(sp, next) == NULL) && (send_lock_up == 0)) { + if (send_lock_up == 0) { SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; } atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, send_lock_up); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, 1); if ((strq->state == SCTP_STREAM_RESET_PENDING) && (strq->chunks_on_queues == 0) && TAILQ_EMPTY(&strq->outqueue)) { @@ -7638,13 +7638,13 @@ dont_do_it: sp->put_last_out, send_lock_up); } - if ((send_lock_up == 0) && (TAILQ_NEXT(sp, next) == NULL)) { + if (send_lock_up == 0) { SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; } atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, send_lock_up); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, 1); if ((strq->state == SCTP_STREAM_RESET_PENDING) && (strq->chunks_on_queues == 0) && TAILQ_EMPTY(&strq->outqueue)) { diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index e657bc280ccc..72a0a2c32c88 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -1344,18 +1344,18 @@ sctp_shutdownack_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } static void -sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, - struct sctp_tcb *stcb) +sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, struct sctp_tcb *stcb) { struct sctp_stream_queue_pending *sp; unsigned int i, chks_in_queue = 0; int being_filled = 0; - /* - * This function is ONLY called when the send/sent queues are empty. - */ - if ((stcb == NULL) || (inp == NULL)) - return; + KASSERT(inp != NULL, ("inp is NULL")); + KASSERT(stcb != NULL, ("stcb is NULL")); + + SCTP_TCB_SEND_LOCK(stcb); + KASSERT(TAILQ_EMPTY(&stcb->asoc.send_queue), ("send_queue not empty")); + KASSERT(TAILQ_EMPTY(&stcb->asoc.sent_queue), ("sent_queue not empty")); if (stcb->asoc.sent_queue_retran_cnt) { SCTP_PRINTF("Hmm, sent_queue_retran_cnt is non-zero %d\n", @@ -1364,7 +1364,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, } if (stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) { /* No stream scheduler information, initialize scheduler */ - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 0); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); if (!stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) { /* yep, we lost a stream or two */ SCTP_PRINTF("Found additional streams NOT managed by scheduler, corrected\n"); @@ -1406,6 +1406,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, (u_long)stcb->asoc.total_output_queue_size); stcb->asoc.total_output_queue_size = 0; } + SCTP_TCB_SEND_UNLOCK(stcb); } int diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index c6cdd3315704..a7eb50716cc9 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1288,6 +1288,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ENOMEM); return (ENOMEM); } + SCTP_TCB_SEND_LOCK(stcb); for (i = 0; i < asoc->streamoutcnt; i++) { /* * inbound side must be set to 0xffff, also NOTE when we get @@ -1315,7 +1316,8 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->strmout[i].last_msg_incomplete = 0; asoc->strmout[i].state = SCTP_STREAM_OPENING; } - asoc->ss_functions.sctp_ss_init(stcb, asoc, 0); + asoc->ss_functions.sctp_ss_init(stcb, asoc, 1); + SCTP_TCB_SEND_UNLOCK(stcb); /* Now the mapping array */ asoc->mapping_array_size = SCTP_INITIAL_MAPPING_ARRAY; From owner-dev-commits-src-main@freebsd.org Tue Sep 21 13:09: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 78035672F28; Tue, 21 Sep 2021 13:09: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 4HDMGT2yBNz4fms; Tue, 21 Sep 2021 13:09: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 45C88246D4; Tue, 21 Sep 2021 13:09: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 18LD9rOi082710; Tue, 21 Sep 2021 13:09:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LD9rIR082709; Tue, 21 Sep 2021 13:09:53 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:09:53 GMT Message-Id: <202109211309.18LD9rIR082709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 806ebc9eba2a - main - bcm2835_sdhci: don't use DMA for kernel dumps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e 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, 21 Sep 2021 13:09:53 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e commit 806ebc9eba2a45638d63ae8a2ed20e6fb44dd06e Author: Mitchell Horne AuthorDate: 2021-09-09 18:07:06 +0000 Commit: Mitchell Horne CommitDate: 2021-09-21 13:08:39 +0000 bcm2835_sdhci: don't use DMA for kernel dumps When handling a data irq, the sdhci driver calls the sdhci_platform_will_handle() method, to determine if it should allow the platform driver to handle the transfer or fall back to programmed I/O. While dumping, the data irq path may be invoked directly (not from an interrupt context), which the bcm2835_sdhci DMA code is not prepared to handle. Return early in this case, to force the fallback to PIO. Otherwise, the KASSERT that follows will be triggered, and the dump will fail. On non-INVARIANTS kernels, the system will hang, waiting for a DMA interrupt that will never arrive. Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31893 --- sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c index 38617dcd38eb..c8725b6067f6 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -762,6 +763,13 @@ bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot) struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); #endif + /* + * We don't want to perform DMA in this context -- interrupts are + * disabled, and a transaction may already be in progress. + */ + if (dumping) + return (0); + /* * This indicates that we somehow let a data interrupt slip by into the * SDHCI framework, when it should not have. This really needs to be From owner-dev-commits-src-main@freebsd.org Tue Sep 21 13:52: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 07CD1674124; Tue, 21 Sep 2021 13:52: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 4HDNCm6ldDz4lrG; Tue, 21 Sep 2021 13:52: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 C81D225241; Tue, 21 Sep 2021 13:52: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 18LDqaId048375; Tue, 21 Sep 2021 13:52:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDqalq048374; Tue, 21 Sep 2021 13:52:36 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:52:36 GMT Message-Id: <202109211352.18LDqalq048374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 5a619ca07a2d - main - Fix the arm64 L2_BLOCK_MASK definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a619ca07a2d6614b7b4ecbb7078d0949702dcd2 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, 21 Sep 2021 13:52:37 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5a619ca07a2d6614b7b4ecbb7078d0949702dcd2 commit 5a619ca07a2d6614b7b4ecbb7078d0949702dcd2 Author: Andrew Turner AuthorDate: 2021-09-21 13:46:10 +0000 Commit: Andrew Turner CommitDate: 2021-09-21 13:47:34 +0000 Fix the arm64 L2_BLOCK_MASK definition It was missing the top 16 bits. Sponsored by: The FreeBSD Foundation --- sys/arm64/include/pte.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/include/pte.h b/sys/arm64/include/pte.h index 5d4412d2c141..b3bec720e9f9 100644 --- a/sys/arm64/include/pte.h +++ b/sys/arm64/include/pte.h @@ -125,7 +125,7 @@ typedef uint64_t pt_entry_t; /* page table entry */ #define L2_BLOCK L1_BLOCK #define L2_TABLE L1_TABLE -#define L2_BLOCK_MASK UINT64_C(0xffffffe00000) +#define L2_BLOCK_MASK UINT64_C(0xffffffffffe00000) /* Level 3 table, 4KiB per entry */ #define L3_SHIFT 12 From owner-dev-commits-src-main@freebsd.org Tue Sep 21 13:53: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 BB7406743A0; Tue, 21 Sep 2021 13:53: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 4HDNDg4wzZz4llG; Tue, 21 Sep 2021 13:53: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 8954224CE1; Tue, 21 Sep 2021 13:53: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 18LDrNNg048562; Tue, 21 Sep 2021 13:53:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LDrNKW048561; Tue, 21 Sep 2021 13:53:23 GMT (envelope-from git) Date: Tue, 21 Sep 2021 13:53:23 GMT Message-Id: <202109211353.18LDrNKW048561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: 273405015492 - main - arm64: Handle 32bits breakpoint exception. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2734050154927eaa63d3b65de5d46d05569b3a5b 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, 21 Sep 2021 13:53:23 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=2734050154927eaa63d3b65de5d46d05569b3a5b commit 2734050154927eaa63d3b65de5d46d05569b3a5b Author: Olivier Houchard AuthorDate: 2021-09-21 13:49:45 +0000 Commit: Olivier Houchard CommitDate: 2021-09-21 13:52:42 +0000 arm64: Handle 32bits breakpoint exception. A different exception is raised when we hit a 32bits breakpoint, rather than a 64bits one, so handle those as well when COMPAT_FREEBSD32 is defined. This should fix SIGBUS at least when using breakpoints with thumb2 code. PR: 256468 MFC After: 1 week --- sys/arm64/arm64/trap.c | 3 +++ sys/arm64/include/armreg.h | 1 + 2 files changed, 4 insertions(+) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 40bad51e8513..af17a6a2951e 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -555,6 +555,9 @@ do_el0_sync(struct thread *td, struct trapframe *frame) break; case EXCP_BRKPT_EL0: case EXCP_BRK: +#ifdef COMPAT_FREEBSD32 + case EXCP_BRKPT_32: +#endif /* COMPAT_FREEBSD32 */ call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr, exception); userret(td, frame); diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index bc6d34cb3c1a..bcbe9d13863d 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -238,6 +238,7 @@ #define EXCP_SOFTSTP_EL1 0x33 /* Software Step, from same EL */ #define EXCP_WATCHPT_EL0 0x34 /* Watchpoint, from lower EL */ #define EXCP_WATCHPT_EL1 0x35 /* Watchpoint, from same EL */ +#define EXCP_BRKPT_32 0x38 /* 32bits breakpoint */ #define EXCP_BRK 0x3c /* Breakpoint */ /* ICC_CTLR_EL1 */ From owner-dev-commits-src-main@freebsd.org Tue Sep 21 16:02: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 B46256761A9; Tue, 21 Sep 2021 16:02: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 4HDR6C4b00z3GNk; Tue, 21 Sep 2021 16:02: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 7D2AB26EA0; Tue, 21 Sep 2021 16:02: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 18LG2xaP022239; Tue, 21 Sep 2021 16:02:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG2xtt022238; Tue, 21 Sep 2021 16:02:59 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:02:59 GMT Message-Id: <202109211602.18LG2xtt022238@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: 762ae0ec8d83 - main - sctp: Simplify stream scheduler usage 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: 762ae0ec8d83ed0e3c084e19174b4bd809a7ef2d 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, 21 Sep 2021 16:02:59 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=762ae0ec8d83ed0e3c084e19174b4bd809a7ef2d commit 762ae0ec8d83ed0e3c084e19174b4bd809a7ef2d Author: Michael Tuexen AuthorDate: 2021-09-21 15:13:57 +0000 Commit: Michael Tuexen CommitDate: 2021-09-21 15:13:57 +0000 sctp: Simplify stream scheduler usage Callers are getting the stcb send lock, so just KASSERT that. No need to signal this when calling stream scheduler functions. No functional change intended. MFC after: 1 week --- sys/netinet/sctp_input.c | 4 +- sys/netinet/sctp_lock_bsd.h | 5 ++ sys/netinet/sctp_output.c | 12 +-- sys/netinet/sctp_pcb.c | 2 +- sys/netinet/sctp_ss_functions.c | 171 ++++++++++++---------------------------- sys/netinet/sctp_structs.h | 9 +-- sys/netinet/sctp_timer.c | 2 +- sys/netinet/sctp_usrreq.c | 8 +- sys/netinet/sctputil.c | 4 +- 9 files changed, 76 insertions(+), 141 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index e2cd2cf87ac9..c0a976b84184 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -213,7 +213,7 @@ sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked) } atomic_subtract_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_REMOVE(&stcb->asoc.strmout[i].outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, &asoc->strmout[i], sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, &asoc->strmout[i], sp); if (sp->net) { sctp_free_remote_addr(sp->net); sp->net = NULL; @@ -302,7 +302,7 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb) TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { atomic_subtract_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_REMOVE(&outs->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp); sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, 0, sp, SCTP_SO_NOT_LOCKED); if (sp->data) { diff --git a/sys/netinet/sctp_lock_bsd.h b/sys/netinet/sctp_lock_bsd.h index e7cf8b3221b9..cd20a730e5b8 100644 --- a/sys/netinet/sctp_lock_bsd.h +++ b/sys/netinet/sctp_lock_bsd.h @@ -354,6 +354,11 @@ __FBSDID("$FreeBSD$"); mtx_unlock(&(_tcb)->tcb_send_mtx); \ } while (0) +#define SCTP_TCB_SEND_LOCK_ASSERT(_tcb) do { \ + KASSERT(mtx_owned(&(_tcb)->tcb_send_mtx), \ + ("Don't own TCB send lock")); \ +} while (0) + /* * For the majority of things (once we have found the association) we will * lock the actual association mutex. This will protect all the assoiciation diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 27ad92527454..36339ac0f2b1 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -6399,7 +6399,7 @@ sctp_msg_append(struct sctp_tcb *stcb, sctp_snd_sb_alloc(stcb, sp->length); atomic_add_int(&stcb->asoc.stream_queue_cnt, 1); TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, strm, sp, 1); + stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, strm, sp); m = NULL; if (hold_stcb_lock == 0) { SCTP_TCB_SEND_UNLOCK(stcb); @@ -7213,7 +7213,7 @@ one_more_time: } atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp); if ((strq->state == SCTP_STREAM_RESET_PENDING) && (strq->chunks_on_queues == 0) && TAILQ_EMPTY(&strq->outqueue)) { @@ -7644,7 +7644,7 @@ dont_do_it: } atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&strq->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp); if ((strq->state == SCTP_STREAM_RESET_PENDING) && (strq->chunks_on_queues == 0) && TAILQ_EMPTY(&strq->outqueue)) { @@ -12176,7 +12176,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, * initializing the new stuff. */ SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); /* FIX ME FIX ME */ @@ -12207,7 +12207,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, } } /* now the new streams */ - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); for (i = stcb->asoc.streamoutcnt; i < (stcb->asoc.streamoutcnt + adding_o); i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); stcb->asoc.strmout[i].chunks_on_queues = 0; @@ -13161,7 +13161,7 @@ skip_preblock: } sp->processing = 1; TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp, 1); + stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp); } else { sp = TAILQ_LAST(&strm->outqueue, sctp_streamhead); if (sp == NULL) { diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index fabe19c1444d..563a167b782f 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4923,7 +4923,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&outs->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp); sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { if (so) { diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 0a5a788428bc..9d877568bcf1 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -41,22 +41,19 @@ __FBSDID("$FreeBSD$"); static void sctp_ss_default_add(struct sctp_tcb *, struct sctp_association *, struct sctp_stream_out *, - struct sctp_stream_queue_pending *, int); + struct sctp_stream_queue_pending *); static void sctp_ss_default_remove(struct sctp_tcb *, struct sctp_association *, struct sctp_stream_out *, - struct sctp_stream_queue_pending *, int); + struct sctp_stream_queue_pending *); static void -sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc, - int holds_lock) +sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc) { uint16_t i; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); asoc->ss_data.locked_on_sending = NULL; asoc->ss_data.last_out_stream = NULL; TAILQ_INIT(&asoc->ss_data.out.wheel); @@ -68,21 +65,17 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc, for (i = 0; i < stcb->asoc.streamoutcnt; i++) { stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, &stcb->asoc.strmout[i], - NULL, 1); - } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); + NULL); } return; } static void sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values SCTP_UNUSED, int holds_lock) + int clear_values SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { struct sctp_stream_out *strq; @@ -92,9 +85,6 @@ sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.rr.next_spoke.tqe_prev = NULL; } asoc->ss_data.last_out_stream = NULL; - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -117,11 +107,10 @@ sctp_ss_default_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, static void sctp_ss_default_add(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, - struct sctp_stream_queue_pending *sp SCTP_UNUSED, int holds_lock) + struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* Add to wheel if not already on it and stream queue not empty */ if (!TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.rr.next_spoke.tqe_next == NULL) && @@ -129,9 +118,6 @@ sctp_ss_default_add(struct sctp_tcb *stcb, struct sctp_association *asoc, TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -148,11 +134,10 @@ sctp_ss_default_is_empty(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_associat static void sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, - struct sctp_stream_queue_pending *sp SCTP_UNUSED, int holds_lock) + struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* * Remove from wheel if stream queue is empty and actually is on the * wheel @@ -176,9 +161,6 @@ sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.rr.next_spoke.tqe_next = NULL; strq->ss_params.rr.next_spoke.tqe_prev = NULL; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -302,13 +284,12 @@ sctp_ss_default_is_user_msgs_incomplete(struct sctp_tcb *stcb SCTP_UNUSED, struc static void sctp_ss_rr_add(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, - struct sctp_stream_queue_pending *sp SCTP_UNUSED, int holds_lock) + struct sctp_stream_queue_pending *sp SCTP_UNUSED) { struct sctp_stream_out *strqt; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + if (!TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.rr.next_spoke.tqe_next == NULL) && (strq->ss_params.rr.next_spoke.tqe_prev == NULL)) { @@ -326,9 +307,6 @@ sctp_ss_rr_add(struct sctp_tcb *stcb, struct sctp_association *asoc, } } } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -394,11 +372,10 @@ rrp_again: */ static void sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values, int holds_lock) + int clear_values) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { struct sctp_stream_out *strq; @@ -411,9 +388,6 @@ sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.prio.next_spoke.tqe_prev = NULL; } asoc->ss_data.last_out_stream = NULL; - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -440,14 +414,12 @@ sctp_ss_prio_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, st static void sctp_ss_prio_add(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED, - int holds_lock) + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED) { struct sctp_stream_out *strqt; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* Add to wheel if not already on it and stream queue not empty */ if (!TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.prio.next_spoke.tqe_next == NULL) && @@ -466,20 +438,15 @@ sctp_ss_prio_add(struct sctp_tcb *stcb, struct sctp_association *asoc, } } } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } static void sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED, - int holds_lock) + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* * Remove from wheel if stream queue is empty and actually is on the * wheel @@ -502,9 +469,6 @@ sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.prio.next_spoke.tqe_next = NULL; strq->ss_params.prio.next_spoke.tqe_prev = NULL; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -576,8 +540,8 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, return (-1); } strq->ss_params.prio.priority = value; - sctp_ss_prio_remove(stcb, asoc, strq, NULL, 1); - sctp_ss_prio_add(stcb, asoc, strq, NULL, 1); + sctp_ss_prio_remove(stcb, asoc, strq, NULL); + sctp_ss_prio_add(stcb, asoc, strq, NULL); return (1); } @@ -587,11 +551,10 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, */ static void sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values, int holds_lock) + int clear_values) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + while (!TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { struct sctp_stream_out *strq; @@ -604,9 +567,6 @@ sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.fb.next_spoke.tqe_prev = NULL; } asoc->ss_data.last_out_stream = NULL; - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -633,12 +593,10 @@ sctp_ss_fb_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, stru static void sctp_ss_fb_add(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED, - int holds_lock) + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + if (!TAILQ_EMPTY(&strq->outqueue) && (strq->ss_params.fb.next_spoke.tqe_next == NULL) && (strq->ss_params.fb.next_spoke.tqe_prev == NULL)) { @@ -646,20 +604,15 @@ sctp_ss_fb_add(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.fb.next_spoke); } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } static void sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED, - int holds_lock) + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp SCTP_UNUSED) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + /* * Remove from wheel if stream queue is empty and actually is on the * wheel @@ -682,9 +635,6 @@ sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, strq->ss_params.fb.next_spoke.tqe_next = NULL; strq->ss_params.fb.next_spoke.tqe_prev = NULL; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -765,19 +715,17 @@ sctp_ss_fb_scheduled(struct sctp_tcb *stcb, struct sctp_nets *net SCTP_UNUSED, static void sctp_ss_fcfs_add(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq SCTP_UNUSED, - struct sctp_stream_queue_pending *sp, int holds_lock); + struct sctp_stream_queue_pending *sp); static void -sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc, - int holds_lock) +sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc) { uint32_t x, n = 0, add_more = 1; struct sctp_stream_queue_pending *sp; uint16_t i; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + TAILQ_INIT(&asoc->ss_data.out.list); /* * If there is data in the stream queues already, the scheduler of @@ -795,27 +743,23 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc, x++; } if (sp != NULL) { - sctp_ss_fcfs_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], sp, 1); + sctp_ss_fcfs_add(stcb, &stcb->asoc, &stcb->asoc.strmout[i], sp); add_more = 1; } } n++; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } static void sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values SCTP_UNUSED, int holds_lock) + int clear_values SCTP_UNUSED) { struct sctp_stream_queue_pending *sp; - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + while (!TAILQ_EMPTY(&asoc->ss_data.out.list)) { sp = TAILQ_FIRST(&asoc->ss_data.out.list); TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); @@ -823,9 +767,6 @@ sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, sp->ss_next.tqe_prev = NULL; } asoc->ss_data.last_out_stream = NULL; - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -847,19 +788,14 @@ sctp_ss_fcfs_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, st static void sctp_ss_fcfs_add(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq SCTP_UNUSED, struct sctp_stream_queue_pending *sp, - int holds_lock) + struct sctp_stream_out *strq SCTP_UNUSED, struct sctp_stream_queue_pending *sp) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + if (sp && (sp->ss_next.tqe_next == NULL) && (sp->ss_next.tqe_prev == NULL)) { TAILQ_INSERT_TAIL(&asoc->ss_data.out.list, sp, ss_next); } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } @@ -875,12 +811,10 @@ sctp_ss_fcfs_is_empty(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association static void sctp_ss_fcfs_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq SCTP_UNUSED, struct sctp_stream_queue_pending *sp, - int holds_lock) + struct sctp_stream_out *strq SCTP_UNUSED, struct sctp_stream_queue_pending *sp) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } + SCTP_TCB_SEND_LOCK_ASSERT(stcb); + if (sp && ((sp->ss_next.tqe_next != NULL) || (sp->ss_next.tqe_prev != NULL))) { @@ -888,9 +822,6 @@ sctp_ss_fcfs_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, sp->ss_next.tqe_next = NULL; sp->ss_next.tqe_prev = NULL; } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } return; } diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index a22dac047971..2f0ae4c45b24 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -729,16 +729,15 @@ struct sctp_cc_functions { * for stream scheduling. */ struct sctp_ss_functions { - void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc, - int holds_lock); + void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc); void (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values, int holds_lock); + int clear_values); void (*sctp_ss_init_stream) (struct sctp_tcb *stcb, struct sctp_stream_out *strq, struct sctp_stream_out *with_strq); void (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock); + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); int (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc); void (*sctp_ss_remove_from_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock); + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb, struct sctp_nets *net, struct sctp_association *asoc); void (*sctp_ss_scheduled) (struct sctp_tcb *stcb, struct sctp_nets *net, diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 72a0a2c32c88..c994b90b8353 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -1364,7 +1364,7 @@ sctp_audit_stream_queues_for_size(struct sctp_inpcb *inp, struct sctp_tcb *stcb) } if (stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) { /* No stream scheduler information, initialize scheduler */ - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); if (!stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, &stcb->asoc)) { /* yep, we lost a stream or two */ SCTP_PRINTF("Found additional streams NOT managed by scheduler, corrected\n"); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 690cdf3a3978..65037f0734ea 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -4043,10 +4043,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); } else { @@ -4066,10 +4066,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; - stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); } diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index a7eb50716cc9..cff22394dda3 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1316,7 +1316,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->strmout[i].last_msg_incomplete = 0; asoc->strmout[i].state = SCTP_STREAM_OPENING; } - asoc->ss_functions.sctp_ss_init(stcb, asoc, 1); + asoc->ss_functions.sctp_ss_init(stcb, asoc); SCTP_TCB_SEND_UNLOCK(stcb); /* Now the mapping array */ @@ -4325,7 +4325,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int so_locked) TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) { atomic_subtract_int(&asoc->stream_queue_cnt, 1); TAILQ_REMOVE(&outs->outqueue, sp, next); - stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp, 1); + stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp); sctp_free_spbufspace(stcb, asoc, sp); if (sp->data) { sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, From owner-dev-commits-src-main@freebsd.org Tue Sep 21 16:09: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 932EA675D51; Tue, 21 Sep 2021 16:09: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 4HDRFW3Z1rz3H85; Tue, 21 Sep 2021 16:09: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 56B0726E19; Tue, 21 Sep 2021 16:09: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 18LG9JCX022761; Tue, 21 Sep 2021 16:09:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG9JwO022760; Tue, 21 Sep 2021 16:09:19 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:09:19 GMT Message-Id: <202109211609.18LG9JwO022760@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: 867814012729 - main - syslog.conf.5: Fix the message priority order 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: 8678140127296c15894094087b81f71fe79a21d9 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, 21 Sep 2021 16:09:19 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8678140127296c15894094087b81f71fe79a21d9 commit 8678140127296c15894094087b81f71fe79a21d9 Author: Felix Guest AuthorDate: 2021-09-21 15:29:39 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:07:39 +0000 syslog.conf.5: Fix the message priority order PR: 219942 MFC after: 1 week --- usr.sbin/syslogd/syslog.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/syslogd/syslog.conf.5 b/usr.sbin/syslogd/syslog.conf.5 index 48f5c88048cb..7afd6b94cdf7 100644 --- a/usr.sbin/syslogd/syslog.conf.5 +++ b/usr.sbin/syslogd/syslog.conf.5 @@ -144,7 +144,7 @@ The .Em level describes the severity of the message, and is a keyword from the following ordered list (higher to lower): -.Cm emerg , crit , alert , err , warning , notice , info +.Cm emerg , alert , crit , err , warning , notice , info and .Cm debug . These keywords correspond to From owner-dev-commits-src-main@freebsd.org Tue Sep 21 16:09:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA7BE675D53; Tue, 21 Sep 2021 16:09:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDRFX491cz3GyB; Tue, 21 Sep 2021 16:09:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 705BE26CA8; Tue, 21 Sep 2021 16:09:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LG9KK7022792; Tue, 21 Sep 2021 16:09:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG9K4P022791; Tue, 21 Sep 2021 16:09:20 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:09:20 GMT Message-Id: <202109211609.18LG9K4P022791@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: dfd3bde5775e - main - bitset(9): Introduce BIT_FOREACH_ISSET and BIT_FOREACH_ISCLR 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: dfd3bde5775ecf88851d5dffd6a8ed6076b53566 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, 21 Sep 2021 16:09:20 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=dfd3bde5775ecf88851d5dffd6a8ed6076b53566 commit dfd3bde5775ecf88851d5dffd6a8ed6076b53566 Author: Mark Johnston AuthorDate: 2021-09-21 15:32:23 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:07:39 +0000 bitset(9): Introduce BIT_FOREACH_ISSET and BIT_FOREACH_ISCLR These allow one to non-destructively iterate over the set or clear bits in a bitset. The motivation is that we have several code fragments which iterate over a CPU set like this: while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); ; } This is slow since CPU_FFS begins the search at the beginning of the bitset each time. On amd64 and arm64, CPU sets have size 256, so there are four limbs in the bitset and we do a lot of unnecessary scanning. A second problem is that this is destructive, so code which needs to preserve the original set has to make a copy. In particular, we have quite a few functions which take a cpuset_t parameter by value, meaning that each call has to copy the 32 byte cpuset_t. The new macros address both problems. Reviewed by: cem, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32028 --- share/man/man9/Makefile | 2 ++ share/man/man9/bitset.9 | 34 ++++++++++++++++++++++++++++++++-- sys/sys/bitset.h | 10 ++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 30632e0a6cb6..49601b9b7f48 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -623,6 +623,8 @@ MLINKS+=bitset.9 BITSET_DEFINE.9 \ bitset.9 BIT_FFS.9 \ bitset.9 BIT_FFS_AT.9 \ bitset.9 BIT_FLS.9 \ + bitset.9 BIT_FOREACH_ISSET.9 \ + bitset.9 BIT_FOREACH_ISCLR.9 \ bitset.9 BIT_COUNT.9 \ bitset.9 BIT_SUBSET.9 \ bitset.9 BIT_OVERLAP.9 \ diff --git a/share/man/man9/bitset.9 b/share/man/man9/bitset.9 index 1e080f515788..5788f09f2465 100644 --- a/share/man/man9/bitset.9 +++ b/share/man/man9/bitset.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 31, 2020 +.Dd September 20, 2021 .Dt BITSET 9 .Os .Sh NAME @@ -45,6 +45,8 @@ .Nm BIT_FFS , .Nm BIT_FFS_AT , .Nm BIT_FLS , +.Nm BIT_FOREACH_ISSET , +.Nm BIT_FOREACH_ISCLR , .Nm BIT_COUNT , .Nm BIT_SUBSET , .Nm BIT_OVERLAP , @@ -92,9 +94,18 @@ .Fn BIT_FFS_AT "const SETSIZE" "struct STRUCTNAME *bitset" "long start" .Ft long .Fn BIT_FLS "const SETSIZE" "struct STRUCTNAME *bitset" +.Fo BIT_FOREACH_ISSET +.Fa "const SETSIZE" +.Fa "size_t bit" +.Fa "const struct STRUCTNAME *bitset" +.Fc +.Fo BIT_FOREACH_ISCLR +.Fa "const SETSIZE" +.Fa "size_t bit" +.Fa "const struct STRUCTNAME *bitset" +.Fc .Ft long .Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset" -.\" .Ft bool .Fo BIT_SUBSET .Fa "const SETSIZE" "struct STRUCTNAME *haystack" "struct STRUCTNAME *needle" @@ -329,6 +340,25 @@ index parameter to any other macro, you must subtract one from the result. .Pp The +.Fn BIT_FOREACH_ISSET +macro can be used to iterate over all set bits in +.Fa bitset . +The index variable +.Fa bit +must have been declared with type +.Ft int , +and upon each iteration +.Fa bit +is set to the index of successive set bits. +The value of +.Fa bit +after the loop terminates is undefined. +Similarly, +.Fn BIT_FOREACH_ISCLR +iterates over all clear bits in +.Fa bitset . +.Pp +The .Fn BIT_COUNT macro returns the total number of set bits in .Fa bitset . diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h index 2b5df78a8193..ab6eaf85b8df 100644 --- a/sys/sys/bitset.h +++ b/sys/sys/bitset.h @@ -271,6 +271,16 @@ __count; \ }) +/* Non-destructively loop over all set or clear bits in the set. */ +#define _BIT_FOREACH(_s, i, p, op) \ + for (__size_t __i = 0; __i < __bitset_words(_s); __i++) \ + for (long __j = op((p)->__bits[__i]), __b = ffsl(__j); \ + (i = (__b - 1) + __i * _BITSET_BITS), __j != 0; \ + __j &= ~(1l << i), __b = ffsl(__j)) + +#define BIT_FOREACH_ISSET(_s, i, p) _BIT_FOREACH(_s, i, p, ) +#define BIT_FOREACH_ISCLR(_s, i, p) _BIT_FOREACH(_s, i, p, ~) + #define BITSET_T_INITIALIZER(x) \ { .__bits = { x } } From owner-dev-commits-src-main@freebsd.org Tue Sep 21 16:09: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 076AF676306; Tue, 21 Sep 2021 16:09: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 4HDRFY5hCkz3H4R; Tue, 21 Sep 2021 16:09: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 94DE026EA2; Tue, 21 Sep 2021 16:09: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 18LG9LJB022816; Tue, 21 Sep 2021 16:09:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG9L1h022815; Tue, 21 Sep 2021 16:09:21 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:09:21 GMT Message-Id: <202109211609.18LG9L1h022815@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: 9068f6ea697b - main - cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use 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: 9068f6ea697b1b28ad1326a4c7a9ba86f08b985e 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, 21 Sep 2021 16:09:22 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9068f6ea697b1b28ad1326a4c7a9ba86f08b985e commit 9068f6ea697b1b28ad1326a4c7a9ba86f08b985e Author: Mark Johnston AuthorDate: 2021-09-21 15:36:55 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:07:47 +0000 cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it This implementation is faster and doesn't modify the cpuset, so it lets us avoid some unnecessary copying as well. No functional change intended. Reviewed by: cem, kib, jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32029 --- sys/amd64/amd64/mp_machdep.c | 11 +++-------- sys/amd64/vmm/io/vlapic.c | 13 +++---------- sys/amd64/vmm/vmm_lapic.c | 4 +--- sys/i386/i386/mp_machdep.c | 4 +--- sys/sys/cpuset.h | 2 ++ sys/x86/x86/mp_x86.c | 4 +--- 6 files changed, 11 insertions(+), 27 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 6c66bd622855..16ec277e9c34 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -618,7 +618,7 @@ static void smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, smp_invl_cb_t curcpu_cb, enum invl_op_codes op) { - cpuset_t other_cpus, mask1; + cpuset_t other_cpus; uint32_t generation, *p_cpudone; int cpu; bool is_all; @@ -662,10 +662,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, /* Fence between filling smp_tlb fields and clearing scoreboard. */ atomic_thread_fence_rel(); - mask1 = mask; - while ((cpu = CPU_FFS(&mask1)) != 0) { - cpu--; - CPU_CLR(cpu, &mask1); + CPU_FOREACH_ISSET(cpu, &mask) { KASSERT(*invl_scoreboard_slot(cpu) != 0, ("IPI scoreboard is zero, initiator %d target %d", PCPU_GET(cpuid), cpu)); @@ -686,9 +683,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, ipi_selected(mask, IPI_INVLOP); } curcpu_cb(pmap, addr1, addr2); - while ((cpu = CPU_FFS(&other_cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &other_cpus); + CPU_FOREACH_ISSET(cpu, &other_cpus) { p_cpudone = invl_scoreboard_slot(cpu); while (atomic_load_int(p_cpudone) != generation) ia32_pause(); diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index 06df1c1a87e5..4e7ddbafd447 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -860,10 +860,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys, */ CPU_ZERO(dmask); amask = vm_active_cpus(vm); - while ((vcpuid = CPU_FFS(&amask)) != 0) { - vcpuid--; - CPU_CLR(vcpuid, &amask); - + CPU_FOREACH_ISSET(vcpuid, &amask) { vlapic = vm_lapic(vm, vcpuid); dfr = vlapic->apic_page->dfr; ldr = vlapic->apic_page->ldr; @@ -1003,9 +1000,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) break; } - while ((i = CPU_FFS(&dmask)) != 0) { - i--; - CPU_CLR(i, &dmask); + CPU_FOREACH_ISSET(i, &dmask) { if (mode == APIC_DELMODE_FIXED) { lapic_intr_edge(vlapic->vm, i, vec); vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid, @@ -1554,9 +1549,7 @@ vlapic_deliver_intr(struct vm *vm, bool level, uint32_t dest, bool phys, */ vlapic_calcdest(vm, &dmask, dest, phys, lowprio, false); - while ((vcpuid = CPU_FFS(&dmask)) != 0) { - vcpuid--; - CPU_CLR(vcpuid, &dmask); + CPU_FOREACH_ISSET(vcpuid, &dmask) { if (delmode == IOART_DELEXINT) { vm_inject_extint(vm, vcpuid); } else { diff --git a/sys/amd64/vmm/vmm_lapic.c b/sys/amd64/vmm/vmm_lapic.c index 89a1ebc8eff9..8191da758100 100644 --- a/sys/amd64/vmm/vmm_lapic.c +++ b/sys/amd64/vmm/vmm_lapic.c @@ -87,9 +87,7 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vector) else CPU_SETOF(cpu, &dmask); error = 0; - while ((cpu = CPU_FFS(&dmask)) != 0) { - cpu--; - CPU_CLR(cpu, &dmask); + CPU_FOREACH_ISSET(cpu, &dmask) { vlapic = vm_lapic(vm, cpu); error = vlapic_trigger_lvt(vlapic, vector); if (error) diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 156702118c45..777aefa021b3 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -598,9 +598,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap, ipi_selected(mask, vector); } curcpu_cb(pmap, addr1, addr2); - while ((cpu = CPU_FFS(&other_cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &other_cpus); + CPU_FOREACH_ISSET(cpu, &other_cpus) { p_cpudone = &cpuid_to_pcpu[cpu]->pc_smp_tlb_done; while (*p_cpudone != generation) ia32_pause(); diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h index 1a96bb4766ce..9ef1a65f4506 100644 --- a/sys/sys/cpuset.h +++ b/sys/sys/cpuset.h @@ -66,6 +66,8 @@ #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) #define CPU_FLS(p) BIT_FLS(CPU_SETSIZE, p) +#define CPU_FOREACH_ISSET(i, p) BIT_FOREACH_ISSET(CPU_SETSIZE, i, p) +#define CPU_FOREACH_ISCLR(i, p) BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p) #define CPU_COUNT(p) ((int)BIT_COUNT(CPU_SETSIZE, p)) #define CPUSET_FSET BITSET_FSET(_NCPUWORDS) #define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 5e9a9735b09a..09d05d3f6de4 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1290,9 +1290,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &cpus); - while ((cpu = CPU_FFS(&cpus)) != 0) { - cpu--; - CPU_CLR(cpu, &cpus); + CPU_FOREACH_ISSET(cpu, &cpus) { CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); ipi_send_cpu(cpu, ipi); } From owner-dev-commits-src-main@freebsd.org Tue Sep 21 16:09: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 195F2675AD3; Tue, 21 Sep 2021 16:09: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 4HDRFZ671Lz3H89; Tue, 21 Sep 2021 16:09: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 AF34326CA9; Tue, 21 Sep 2021 16:09: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 18LG9MwJ022840; Tue, 21 Sep 2021 16:09:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LG9MME022839; Tue, 21 Sep 2021 16:09:22 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:09:22 GMT Message-Id: <202109211609.18LG9MME022839@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: a3e3d90863f3 - main - clang-format: Add bitset loop macros 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: a3e3d90863f3af81bca485468814a787206a235d 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, 21 Sep 2021 16:09:23 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a3e3d90863f3af81bca485468814a787206a235d commit a3e3d90863f3af81bca485468814a787206a235d Author: Mark Johnston AuthorDate: 2021-09-21 15:39:49 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:08:01 +0000 clang-format: Add bitset loop macros MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- .clang-format | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.clang-format b/.clang-format index 06709b762ec1..34ed52f7db51 100644 --- a/.clang-format +++ b/.clang-format @@ -52,7 +52,11 @@ ForEachMacros: - ARB_FOREACH_REVERSE - ARB_FOREACH_REVERSE_FROM - ARB_FOREACH_REVERSE_SAFE + - BIT_FOREACH_ISCLR + - BIT_FOREACH_ISSET - CPU_FOREACH + - CPU_FOREACH_ISCLR + - CPU_FOREACH_ISSET - FOREACH_THREAD_IN_PROC - FOREACH_PROC_IN_SYSTEM - FOREACH_PRISON_CHILD From owner-dev-commits-src-main@freebsd.org Tue Sep 21 16:11: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 608EF676454; Tue, 21 Sep 2021 16:11:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDRHW2F8rz3Ht0; Tue, 21 Sep 2021 16:11:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DAAD26CB6; Tue, 21 Sep 2021 16:11:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LGB30i032258; Tue, 21 Sep 2021 16:11:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LGB3cO032257; Tue, 21 Sep 2021 16:11:03 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:11:03 GMT Message-Id: <202109211611.18LGB3cO032257@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: 0e3ce6d082b3 - main - efi loader: Typo 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: 0e3ce6d082b34154e41e220757c03d66d881a47b 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, 21 Sep 2021 16:11:03 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0e3ce6d082b34154e41e220757c03d66d881a47b commit 0e3ce6d082b34154e41e220757c03d66d881a47b Author: Mark Johnston AuthorDate: 2021-09-21 16:09:55 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 16:09:55 +0000 efi loader: Typo MFC after: 3 days --- stand/efi/loader/arch/amd64/elf64_freebsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c index d0c8ef96eeea..4bdf675cd5a3 100644 --- a/stand/efi/loader/arch/amd64/elf64_freebsd.c +++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c @@ -269,7 +269,7 @@ elf64_exec(struct preloaded_file *fp) } } - printf("staging %#lx (%scoping) tramp %p PT4 %p\n", + printf("staging %#lx (%scopying) tramp %p PT4 %p\n", staging, copy_staging == COPY_STAGING_ENABLE ? "" : "not ", trampoline, PT4); printf("Start @ 0x%lx ...\n", ehdr->e_entry); From owner-dev-commits-src-main@freebsd.org Tue Sep 21 16:17: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 E12B067698E; Tue, 21 Sep 2021 16:17: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 4HDRRC635Dz3J6V; Tue, 21 Sep 2021 16:17: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 A51F027029; Tue, 21 Sep 2021 16:17: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 18LGHhVd036065; Tue, 21 Sep 2021 16:17:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LGHhCQ036064; Tue, 21 Sep 2021 16:17:43 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:17:43 GMT Message-Id: <202109211617.18LGHhCQ036064@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: af32e2cc32b2 - main - dwmmc: Properly implement power_off/power_up 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: af32e2cc32b2516826e301d5f857ff7343b1210e 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, 21 Sep 2021 16:17:43 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=af32e2cc32b2516826e301d5f857ff7343b1210e commit af32e2cc32b2516826e301d5f857ff7343b1210e Author: Emmanuel Vadot AuthorDate: 2021-09-21 14:10:11 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-21 16:17:20 +0000 dwmmc: Properly implement power_off/power_up Write to the PWREN register should be done in update_ios based on the power_mode value in the ios struct. Also none of the manual (RockChip and Altera) and Linux talks about the needed for an inverted PWREN value so just remove this. This fixes eMMC (and possibly SD) when u-boot didn't setup the controller. Reported by: avg Tested-on: Rock64, RockPro64 --- sys/dev/mmc/host/dwmmc.c | 20 +++++++++++--------- sys/dev/mmc/host/dwmmc_rockchip.c | 2 -- sys/dev/mmc/host/dwmmc_var.h | 1 - 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c index dce684ed8c7b..df7ac374a265 100644 --- a/sys/dev/mmc/host/dwmmc.c +++ b/sys/dev/mmc/host/dwmmc.c @@ -670,7 +670,6 @@ dwmmc_attach(device_t dev) { struct dwmmc_softc *sc; int error; - int slot; sc = device_get_softc(dev); @@ -703,14 +702,6 @@ dwmmc_attach(device_t dev) device_printf(dev, "Hardware version ID is %04x\n", READ4(sc, SDMMC_VERID) & 0xffff); - /* XXX: we support operation for slot index 0 only */ - slot = 0; - if (sc->pwren_inverted) { - WRITE4(sc, SDMMC_PWREN, (0 << slot)); - } else { - WRITE4(sc, SDMMC_PWREN, (1 << slot)); - } - /* Reset all */ if (dwmmc_ctrl_reset(sc, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET | @@ -892,6 +883,17 @@ dwmmc_update_ios(device_t brdev, device_t reqdev) dprintf("Setting up clk %u bus_width %d, timming: %d\n", ios->clock, ios->bus_width, ios->timing); + switch (ios->power_mode) { + case power_on: + break; + case power_off: + WRITE4(sc, SDMMC_PWREN, 0); + break; + case power_up: + WRITE4(sc, SDMMC_PWREN, 1); + break; + } + mmc_fdt_set_power(&sc->mmc_helper, ios->power_mode); if (ios->bus_width == bus_width_8) diff --git a/sys/dev/mmc/host/dwmmc_rockchip.c b/sys/dev/mmc/host/dwmmc_rockchip.c index 25baffb267e3..c025e531e27b 100644 --- a/sys/dev/mmc/host/dwmmc_rockchip.c +++ b/sys/dev/mmc/host/dwmmc_rockchip.c @@ -94,8 +94,6 @@ rockchip_dwmmc_attach(device_t dev) break; } - sc->pwren_inverted = 1; - #ifdef EXT_RESOURCES sc->update_ios = &dwmmc_rockchip_update_ios; #endif diff --git a/sys/dev/mmc/host/dwmmc_var.h b/sys/dev/mmc/host/dwmmc_var.h index a3f20278ad2a..33210f547dff 100644 --- a/sys/dev/mmc/host/dwmmc_var.h +++ b/sys/dev/mmc/host/dwmmc_var.h @@ -69,7 +69,6 @@ struct dwmmc_softc { uint32_t hwtype; uint32_t use_auto_stop; uint32_t use_pio; - uint32_t pwren_inverted; device_t child; struct task card_task; /* Card presence check task */ struct timeout_task card_delayed_task;/* Card insert delayed task */ From owner-dev-commits-src-main@freebsd.org Tue Sep 21 16:17: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 0D46A676990; Tue, 21 Sep 2021 16:17: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 4HDRRD6xB8z3J6W; Tue, 21 Sep 2021 16:17: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 CFBA826FB0; Tue, 21 Sep 2021 16:17: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 18LGHi1O036089; Tue, 21 Sep 2021 16:17:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LGHiLu036088; Tue, 21 Sep 2021 16:17:44 GMT (envelope-from git) Date: Tue, 21 Sep 2021 16:17:44 GMT Message-Id: <202109211617.18LGHiLu036088@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: 559f60214b74 - main - dwmmc: Remove dwmmc_setup_bus call from start_cmd 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: 559f60214b7498ac068c5aa1f2bdecc1610bab53 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, 21 Sep 2021 16:17:45 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=559f60214b7498ac068c5aa1f2bdecc1610bab53 commit 559f60214b7498ac068c5aa1f2bdecc1610bab53 Author: Emmanuel Vadot AuthorDate: 2021-09-21 15:52:38 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-21 16:17:20 +0000 dwmmc: Remove dwmmc_setup_bus call from start_cmd There is no need to re-setup the bus before each commands. Tested-on: Rock64, RockPro64 Reported by: avg --- sys/dev/mmc/host/dwmmc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c index df7ac374a265..77c8e42a6150 100644 --- a/sys/dev/mmc/host/dwmmc.c +++ b/sys/dev/mmc/host/dwmmc.c @@ -1102,9 +1102,6 @@ dwmmc_start_cmd(struct dwmmc_softc *sc, struct mmc_command *cmd) sc->curcmd = cmd; data = cmd->data; - if ((sc->hwtype & HWTYPE_MASK) == HWTYPE_ROCKCHIP) - dwmmc_setup_bus(sc, sc->host.ios.clock); - #ifndef MMCCAM /* XXX Upper layers don't always set this */ cmd->mrq = sc->req; From owner-dev-commits-src-main@freebsd.org Tue Sep 21 17:03: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 DBBA66773A5; Tue, 21 Sep 2021 17:03: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 4HDSS85Y38z3McL; Tue, 21 Sep 2021 17:03: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 9E2DB276D7; Tue, 21 Sep 2021 17:03: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 18LH3aN8002817; Tue, 21 Sep 2021 17:03:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LH3a5u002816; Tue, 21 Sep 2021 17:03:36 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:03:36 GMT Message-Id: <202109211703.18LH3a5u002816@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: 590d0715b348 - main - ipsec: enter epoch before calling into ipsec_run_hhooks 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: 590d0715b348d0d8da0c0355cebd9dff18e39831 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, 21 Sep 2021 17:03:36 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=590d0715b348d0d8da0c0355cebd9dff18e39831 commit 590d0715b348d0d8da0c0355cebd9dff18e39831 Author: Mateusz Guzik AuthorDate: 2021-09-17 12:00:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-21 17:02:41 +0000 ipsec: enter epoch before calling into ipsec_run_hhooks pfil_run_hooks which eventually can get called asserts on it. Reviewed by: ae Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32007 --- sys/netipsec/ipsec_input.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c index 73202cbb528b..ce8f1f02b8be 100644 --- a/sys/netipsec/ipsec_input.c +++ b/sys/netipsec/ipsec_input.c @@ -347,7 +347,7 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, buf, sizeof(buf)), (u_long) ntohl(sav->spi))); IPSEC_ISTAT(sproto, hdrops); error = ENOBUFS; - goto bad; + goto bad_noepoch; } ip = mtod(m, struct ip *); @@ -367,6 +367,11 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, (prot == IPPROTO_UDP || prot == IPPROTO_TCP)) udp_ipsec_adjust_cksum(m, sav, prot, skip); + /* + * Needed for ipsec_run_hooks and netisr_queue_src + */ + NET_EPOCH_ENTER(et); + IPSEC_INIT_CTX(&ctx, &m, NULL, sav, AF_INET, IPSEC_ENC_BEFORE); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_IN)) != 0) goto bad; @@ -466,18 +471,19 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, if (saidx->mode == IPSEC_MODE_TUNNEL) error = ipsec_if_input(m, sav, af); if (error == 0) { - NET_EPOCH_ENTER(et); error = netisr_queue_src(isr_prot, (uintptr_t)sav->spi, m); - NET_EPOCH_EXIT(et); if (error) { IPSEC_ISTAT(sproto, qfull); DPRINTF(("%s: queue full; proto %u packet dropped\n", __func__, sproto)); } } + NET_EPOCH_EXIT(et); key_freesav(&sav); return (error); bad: + NET_EPOCH_EXIT(et); +bad_noepoch: key_freesav(&sav); if (m != NULL) m_freem(m); @@ -560,6 +566,8 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, sproto == IPPROTO_IPCOMP, ("unexpected security protocol %u", sproto)); + NET_EPOCH_ENTER(et); + /* Fix IPv6 header */ if (m->m_len < sizeof(struct ip6_hdr) && (m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { @@ -671,16 +679,15 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, if (saidx->mode == IPSEC_MODE_TUNNEL) error = ipsec_if_input(m, sav, af); if (error == 0) { - NET_EPOCH_ENTER(et); error = netisr_queue_src(isr_prot, (uintptr_t)sav->spi, m); - NET_EPOCH_EXIT(et); if (error) { IPSEC_ISTAT(sproto, qfull); DPRINTF(("%s: queue full; proto %u packet" " dropped\n", __func__, sproto)); } } + NET_EPOCH_EXIT(et); key_freesav(&sav); return (error); } @@ -690,12 +697,11 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, */ nest = 0; nxt = nxt8; - NET_EPOCH_ENTER(et); while (nxt != IPPROTO_DONE) { if (V_ip6_hdrnestlimit && (++nest > V_ip6_hdrnestlimit)) { IP6STAT_INC(ip6s_toomanyhdr); error = EINVAL; - goto bad_epoch; + goto bad; } /* @@ -706,7 +712,7 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, IP6STAT_INC(ip6s_tooshort); in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); error = EINVAL; - goto bad_epoch; + goto bad; } /* * Enforce IPsec policy checking if we are seeing last header. @@ -716,16 +722,15 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0 && ipsec6_in_reject(m, NULL)) { error = EINVAL; - goto bad_epoch; + goto bad; } nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &skip, nxt); } NET_EPOCH_EXIT(et); key_freesav(&sav); return (0); -bad_epoch: - NET_EPOCH_EXIT(et); bad: + NET_EPOCH_EXIT(et); key_freesav(&sav); if (m) m_freem(m); From owner-dev-commits-src-main@freebsd.org Tue Sep 21 17:21: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 A683C677789; Tue, 21 Sep 2021 17:21: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 4HDSrR3mdrz3NhJ; Tue, 21 Sep 2021 17:21: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 537F527E79; Tue, 21 Sep 2021 17:21: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 18LHLBBP028826; Tue, 21 Sep 2021 17:21:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLB4w028825; Tue, 21 Sep 2021 17:21:11 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:11 GMT Message-Id: <202109211721.18LHLB4w028825@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: a42d362bb54a - main - amd64: centralize definitions of CS_SECURE and EFL_SECURE 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: a42d362bb54af91d8b82dca086fa656f4624bae2 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, 21 Sep 2021 17:21:11 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a42d362bb54af91d8b82dca086fa656f4624bae2 commit a42d362bb54af91d8b82dca086fa656f4624bae2 Author: Konstantin Belousov AuthorDate: 2021-09-14 16:07:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:14 +0000 amd64: centralize definitions of CS_SECURE and EFL_SECURE Requested by markj Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/machdep.c | 3 --- sys/amd64/ia32/ia32_reg.c | 3 --- sys/amd64/ia32/ia32_signal.c | 3 --- sys/amd64/include/frame.h | 5 +++++ sys/amd64/linux/linux_sysvec.c | 5 +---- sys/amd64/linux32/linux32_sysvec.c | 8 ++------ 6 files changed, 8 insertions(+), 19 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 864caa144f0d..55d52a28b576 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -166,9 +166,6 @@ CTASSERT(PC_PTI_STACK_SZ * sizeof(register_t) >= 2 * sizeof(struct pti_frame) - extern u_int64_t hammer_time(u_int64_t, u_int64_t); -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) -#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) - static void cpu_startup(void *); static void get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, size_t xfpusave_len); diff --git a/sys/amd64/ia32/ia32_reg.c b/sys/amd64/ia32/ia32_reg.c index ae041a325cba..343d1564e1ff 100644 --- a/sys/amd64/ia32/ia32_reg.c +++ b/sys/amd64/ia32/ia32_reg.c @@ -73,9 +73,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) -#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) - int fill_regs32(struct thread *td, struct reg32 *regs) { diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index c114cf1d240a..49b5797d68fd 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -85,9 +85,6 @@ __FBSDID("$FreeBSD$"); static void freebsd4_ia32_sendsig(sig_t, ksiginfo_t *, sigset_t *); #endif -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) -#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) - static void ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, char *xfpusave, size_t xfpusave_len) diff --git a/sys/amd64/include/frame.h b/sys/amd64/include/frame.h index fef5ab2b3765..5eb96d03b981 100644 --- a/sys/amd64/include/frame.h +++ b/sys/amd64/include/frame.h @@ -46,4 +46,9 @@ struct pti_frame { register_t pti_ss; }; +#ifdef _KERNEL +#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) +#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) +#endif + #endif diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 6f3f78639588..d6f2ec2ab832 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -555,9 +555,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * Corruption of the PSL_RF bit at worst causes one more or * one less debugger trap, so allowing it is fairly harmless. */ - -#define RFLAG_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) - if (!RFLAG_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { + if (!EFL_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { printf("linux_rt_sigreturn: rflags = 0x%lx\n", rflags); return (EINVAL); } @@ -567,7 +565,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(context->sc_cs)) { printf("linux_rt_sigreturn: cs = 0x%x\n", context->sc_cs); ksiginfo_init_trap(&ksi); diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index f45413cca1c8..b9d2d7aaf7cd 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -519,9 +519,8 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args) return (EFAULT); /* Check for security violations. */ -#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = frame.sf_sc.sc_eflags; - if (!EFLAGS_SECURE(eflags, regs->tf_rflags)) + if (!EFL_SECURE(eflags, regs->tf_rflags)) return(EINVAL); /* @@ -529,7 +528,6 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(frame.sf_sc.sc_cs)) { ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; @@ -602,9 +600,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) context = &uc.uc_mcontext; /* Check for security violations. */ -#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = context->sc_eflags; - if (!EFLAGS_SECURE(eflags, regs->tf_rflags)) + if (!EFL_SECURE(eflags, regs->tf_rflags)) return(EINVAL); /* @@ -612,7 +609,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(context->sc_cs)) { ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; From owner-dev-commits-src-main@freebsd.org Tue Sep 21 17:21: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 D0F9D67737C; Tue, 21 Sep 2021 17:21: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 4HDSrS4W9wz3NbF; Tue, 21 Sep 2021 17:21: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 6CB5527D38; Tue, 21 Sep 2021 17:21: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 18LHLCNv028850; Tue, 21 Sep 2021 17:21:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLCdF028849; Tue, 21 Sep 2021 17:21:12 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:12 GMT Message-Id: <202109211721.18LHLCdF028849@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: 12ca33f44fc7 - main - amd64: move signal handling and register structures manipulations into exec_machdep.c 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: 12ca33f44fc76890336f517ace402b47b9afb134 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, 21 Sep 2021 17:21:13 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=12ca33f44fc76890336f517ace402b47b9afb134 commit 12ca33f44fc76890336f517ace402b47b9afb134 Author: Konstantin Belousov AuthorDate: 2021-09-13 20:33:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 amd64: move signal handling and register structures manipulations into exec_machdep.c from machdep.c which is too large pile of unrelated things. Some ptrace functions are moved from machdep.c to ptrace_machdep.c. Now machdep.c contains code mostly related to the low level initialization and regular low level operation of the architecture, while signal MD code and registers handling is placed in exec_machdep.c. Reviewed by: jhb, markj Discussed with: jrtc27 Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 987 +++++++++++++++++++++++++++++++++++++++ sys/amd64/amd64/machdep.c | 924 ------------------------------------ sys/amd64/amd64/ptrace_machdep.c | 33 ++ sys/conf/files.amd64 | 1 + 4 files changed, 1021 insertions(+), 924 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c new file mode 100644 index 000000000000..5cd905e1051b --- /dev/null +++ b/sys/amd64/amd64/exec_machdep.c @@ -0,0 +1,987 @@ +/*- + * SPDX-License-Identifier: BSD-4-Clause + * + * Copyright (c) 2003 Peter Wemm. + * Copyright (c) 1992 Terrence R. Lambert. + * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * + * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_cpu.h" +#include "opt_ddb.h" +#include "opt_kstack_pages.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef SMP +#include +#endif +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef DDB +#ifndef KDB +#error KDB must be enabled in order for DDB to work! +#endif +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +static void get_fpcontext(struct thread *td, mcontext_t *mcp, + char *xfpusave, size_t xfpusave_len); +static int set_fpcontext(struct thread *td, mcontext_t *mcp, + char *xfpustate, size_t xfpustate_len); + +/* + * Send an interrupt to process. + * + * Stack is set up to allow sigcode stored at top to call routine, + * followed by call to sigreturn routine below. After sigreturn + * resets the signal mask, the stack, and the frame pointer, it + * returns to the user specified pc, psl. + */ +void +sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) +{ + struct sigframe sf, *sfp; + struct pcb *pcb; + struct proc *p; + struct thread *td; + struct sigacts *psp; + char *sp; + struct trapframe *regs; + char *xfpusave; + size_t xfpusave_len; + int sig; + int oonstack; + + td = curthread; + pcb = td->td_pcb; + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + sig = ksi->ksi_signo; + psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); + regs = td->td_frame; + oonstack = sigonstack(regs->tf_rsp); + + if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { + xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); + xfpusave = __builtin_alloca(xfpusave_len); + } else { + xfpusave_len = 0; + xfpusave = NULL; + } + + /* Save user context. */ + bzero(&sf, sizeof(sf)); + sf.sf_uc.uc_sigmask = *mask; + sf.sf_uc.uc_stack = td->td_sigstk; + sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) + ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; + sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; + bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs)); + sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ + get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); + fpstate_drop(td); + update_pcb_bases(pcb); + sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; + sf.sf_uc.uc_mcontext.mc_gsbase = pcb->pcb_gsbase; + bzero(sf.sf_uc.uc_mcontext.mc_spare, + sizeof(sf.sf_uc.uc_mcontext.mc_spare)); + + /* Allocate space for the signal handler context. */ + if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && + SIGISMEMBER(psp->ps_sigonstack, sig)) { + sp = (char *)td->td_sigstk.ss_sp + td->td_sigstk.ss_size; +#if defined(COMPAT_43) + td->td_sigstk.ss_flags |= SS_ONSTACK; +#endif + } else + sp = (char *)regs->tf_rsp - 128; + if (xfpusave != NULL) { + sp -= xfpusave_len; + sp = (char *)((unsigned long)sp & ~0x3Ful); + sf.sf_uc.uc_mcontext.mc_xfpustate = (register_t)sp; + } + sp -= sizeof(struct sigframe); + /* Align to 16 bytes. */ + sfp = (struct sigframe *)((unsigned long)sp & ~0xFul); + + /* Build the argument list for the signal handler. */ + regs->tf_rdi = sig; /* arg 1 in %rdi */ + regs->tf_rdx = (register_t)&sfp->sf_uc; /* arg 3 in %rdx */ + bzero(&sf.sf_si, sizeof(sf.sf_si)); + if (SIGISMEMBER(psp->ps_siginfo, sig)) { + /* Signal handler installed with SA_SIGINFO. */ + regs->tf_rsi = (register_t)&sfp->sf_si; /* arg 2 in %rsi */ + sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; + + /* Fill in POSIX parts */ + sf.sf_si = ksi->ksi_info; + sf.sf_si.si_signo = sig; /* maybe a translated signal */ + regs->tf_rcx = (register_t)ksi->ksi_addr; /* arg 4 in %rcx */ + } else { + /* Old FreeBSD-style arguments. */ + regs->tf_rsi = ksi->ksi_code; /* arg 2 in %rsi */ + regs->tf_rcx = (register_t)ksi->ksi_addr; /* arg 4 in %rcx */ + sf.sf_ahu.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 || + (xfpusave != NULL && copyout(xfpusave, + (void *)sf.sf_uc.uc_mcontext.mc_xfpustate, xfpusave_len) + != 0)) { +#ifdef DEBUG + printf("process %ld has trashed its stack\n", (long)p->p_pid); +#endif + PROC_LOCK(p); + sigexit(td, SIGILL); + } + + regs->tf_rsp = (long)sfp; + regs->tf_rip = p->p_sysent->sv_sigcode_base; + regs->tf_rflags &= ~(PSL_T | PSL_D); + regs->tf_cs = _ucodesel; + regs->tf_ds = _udatasel; + regs->tf_ss = _udatasel; + regs->tf_es = _udatasel; + regs->tf_fs = _ufssel; + regs->tf_gs = _ugssel; + regs->tf_flags = TF_HASSEGS; + PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); +} + +/* + * System call to cleanup state after a signal + * has been taken. Reset signal mask and + * stack state from context left by sendsig (above). + * Return to previous pc and psl as specified by + * context left by sendsig. Check carefully to + * make sure that the user has not modified the + * state to gain improper privileges. + */ +int +sys_sigreturn(td, uap) + struct thread *td; + struct sigreturn_args /* { + const struct __ucontext *sigcntxp; + } */ *uap; +{ + ucontext_t uc; + struct pcb *pcb; + struct proc *p; + struct trapframe *regs; + ucontext_t *ucp; + char *xfpustate; + size_t xfpustate_len; + long rflags; + int cs, error, ret; + ksiginfo_t ksi; + + pcb = td->td_pcb; + p = td->td_proc; + + error = copyin(uap->sigcntxp, &uc, sizeof(uc)); + if (error != 0) { + uprintf("pid %d (%s): sigreturn copyin failed\n", + p->p_pid, td->td_name); + return (error); + } + ucp = &uc; + if ((ucp->uc_mcontext.mc_flags & ~_MC_FLAG_MASK) != 0) { + uprintf("pid %d (%s): sigreturn mc_flags %x\n", p->p_pid, + td->td_name, ucp->uc_mcontext.mc_flags); + return (EINVAL); + } + regs = td->td_frame; + rflags = ucp->uc_mcontext.mc_rflags; + /* + * Don't allow users to change privileged or reserved flags. + */ + if (!EFL_SECURE(rflags, regs->tf_rflags)) { + uprintf("pid %d (%s): sigreturn rflags = 0x%lx\n", p->p_pid, + td->td_name, rflags); + return (EINVAL); + } + + /* + * Don't allow users to load a valid privileged %cs. Let the + * hardware check for invalid selectors, excess privilege in + * other selectors, invalid %eip's and invalid %esp's. + */ + cs = ucp->uc_mcontext.mc_cs; + if (!CS_SECURE(cs)) { + uprintf("pid %d (%s): sigreturn cs = 0x%x\n", p->p_pid, + td->td_name, cs); + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)regs->tf_rip; + trapsignal(td, &ksi); + return (EINVAL); + } + + if ((uc.uc_mcontext.mc_flags & _MC_HASFPXSTATE) != 0) { + xfpustate_len = uc.uc_mcontext.mc_xfpustate_len; + if (xfpustate_len > cpu_max_ext_state_size - + sizeof(struct savefpu)) { + uprintf("pid %d (%s): sigreturn xfpusave_len = 0x%zx\n", + p->p_pid, td->td_name, xfpustate_len); + return (EINVAL); + } + xfpustate = __builtin_alloca(xfpustate_len); + error = copyin((const void *)uc.uc_mcontext.mc_xfpustate, + xfpustate, xfpustate_len); + if (error != 0) { + uprintf( + "pid %d (%s): sigreturn copying xfpustate failed\n", + p->p_pid, td->td_name); + return (error); + } + } else { + xfpustate = NULL; + xfpustate_len = 0; + } + ret = set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); + if (ret != 0) { + uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", + p->p_pid, td->td_name, ret); + return (ret); + } + bcopy(&ucp->uc_mcontext.mc_rdi, regs, sizeof(*regs)); + update_pcb_bases(pcb); + pcb->pcb_fsbase = ucp->uc_mcontext.mc_fsbase; + pcb->pcb_gsbase = ucp->uc_mcontext.mc_gsbase; + +#if defined(COMPAT_43) + if (ucp->uc_mcontext.mc_onstack & 1) + td->td_sigstk.ss_flags |= SS_ONSTACK; + else + td->td_sigstk.ss_flags &= ~SS_ONSTACK; +#endif + + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); + return (EJUSTRETURN); +} + +#ifdef COMPAT_FREEBSD4 +int +freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) +{ + + return sys_sigreturn(td, (struct sigreturn_args *)uap); +} +#endif + +/* + * Reset the hardware debug registers if they were in use. + * They won't have any meaning for the newly exec'd process. + */ +void +x86_clear_dbregs(struct pcb *pcb) +{ + if ((pcb->pcb_flags & PCB_DBREGS) == 0) + return; + + pcb->pcb_dr0 = 0; + pcb->pcb_dr1 = 0; + pcb->pcb_dr2 = 0; + pcb->pcb_dr3 = 0; + pcb->pcb_dr6 = 0; + pcb->pcb_dr7 = 0; + + if (pcb == curpcb) { + /* + * Clear the debug registers on the running CPU, + * otherwise they will end up affecting the next + * process we switch to. + */ + reset_dbregs(); + } + clear_pcb_flags(pcb, PCB_DBREGS); +} + +/* + * Reset registers to default values on exec. + */ +void +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) +{ + struct trapframe *regs; + struct pcb *pcb; + register_t saved_rflags; + + regs = td->td_frame; + pcb = td->td_pcb; + + if (td->td_proc->p_md.md_ldt != NULL) + user_ldt_free(td); + + update_pcb_bases(pcb); + pcb->pcb_fsbase = 0; + pcb->pcb_gsbase = 0; + clear_pcb_flags(pcb, PCB_32BIT); + pcb->pcb_initial_fpucw = __INITIAL_FPUCW__; + + saved_rflags = regs->tf_rflags & PSL_T; + bzero((char *)regs, sizeof(struct trapframe)); + regs->tf_rip = imgp->entry_addr; + regs->tf_rsp = ((stack - 8) & ~0xFul) + 8; + regs->tf_rdi = stack; /* argv */ + regs->tf_rflags = PSL_USER | saved_rflags; + regs->tf_ss = _udatasel; + regs->tf_cs = _ucodesel; + regs->tf_ds = _udatasel; + regs->tf_es = _udatasel; + regs->tf_fs = _ufssel; + regs->tf_gs = _ugssel; + regs->tf_flags = TF_HASSEGS; + + x86_clear_dbregs(pcb); + + /* + * Drop the FP state if we hold it, so that the process gets a + * clean FP state if it uses the FPU again. + */ + fpstate_drop(td); +} + +int +fill_regs(struct thread *td, struct reg *regs) +{ + struct trapframe *tp; + + tp = td->td_frame; + return (fill_frame_regs(tp, regs)); +} + +int +fill_frame_regs(struct trapframe *tp, struct reg *regs) +{ + + regs->r_r15 = tp->tf_r15; + regs->r_r14 = tp->tf_r14; + regs->r_r13 = tp->tf_r13; + regs->r_r12 = tp->tf_r12; + regs->r_r11 = tp->tf_r11; + regs->r_r10 = tp->tf_r10; + regs->r_r9 = tp->tf_r9; + regs->r_r8 = tp->tf_r8; + regs->r_rdi = tp->tf_rdi; + regs->r_rsi = tp->tf_rsi; + regs->r_rbp = tp->tf_rbp; + regs->r_rbx = tp->tf_rbx; + regs->r_rdx = tp->tf_rdx; + regs->r_rcx = tp->tf_rcx; + regs->r_rax = tp->tf_rax; + regs->r_rip = tp->tf_rip; + regs->r_cs = tp->tf_cs; + regs->r_rflags = tp->tf_rflags; + regs->r_rsp = tp->tf_rsp; + regs->r_ss = tp->tf_ss; + if (tp->tf_flags & TF_HASSEGS) { + regs->r_ds = tp->tf_ds; + regs->r_es = tp->tf_es; + regs->r_fs = tp->tf_fs; + regs->r_gs = tp->tf_gs; + } else { + regs->r_ds = 0; + regs->r_es = 0; + regs->r_fs = 0; + regs->r_gs = 0; + } + regs->r_err = 0; + regs->r_trapno = 0; + return (0); +} + +int +set_regs(struct thread *td, struct reg *regs) +{ + struct trapframe *tp; + register_t rflags; + + tp = td->td_frame; + rflags = regs->r_rflags & 0xffffffff; + if (!EFL_SECURE(rflags, tp->tf_rflags) || !CS_SECURE(regs->r_cs)) + return (EINVAL); + tp->tf_r15 = regs->r_r15; + tp->tf_r14 = regs->r_r14; + tp->tf_r13 = regs->r_r13; + tp->tf_r12 = regs->r_r12; + tp->tf_r11 = regs->r_r11; + tp->tf_r10 = regs->r_r10; + tp->tf_r9 = regs->r_r9; + tp->tf_r8 = regs->r_r8; + tp->tf_rdi = regs->r_rdi; + tp->tf_rsi = regs->r_rsi; + tp->tf_rbp = regs->r_rbp; + tp->tf_rbx = regs->r_rbx; + tp->tf_rdx = regs->r_rdx; + tp->tf_rcx = regs->r_rcx; + tp->tf_rax = regs->r_rax; + tp->tf_rip = regs->r_rip; + tp->tf_cs = regs->r_cs; + tp->tf_rflags = rflags; + tp->tf_rsp = regs->r_rsp; + tp->tf_ss = regs->r_ss; + if (0) { /* XXXKIB */ + tp->tf_ds = regs->r_ds; + tp->tf_es = regs->r_es; + tp->tf_fs = regs->r_fs; + tp->tf_gs = regs->r_gs; + tp->tf_flags = TF_HASSEGS; + } + set_pcb_flags(td->td_pcb, PCB_FULL_IRET); + return (0); +} + +/* XXX check all this stuff! */ +/* externalize from sv_xmm */ +static void +fill_fpregs_xmm(struct savefpu *sv_xmm, struct fpreg *fpregs) +{ + struct envxmm *penv_fpreg = (struct envxmm *)&fpregs->fpr_env; + struct envxmm *penv_xmm = &sv_xmm->sv_env; + int i; + + /* pcb -> fpregs */ + bzero(fpregs, sizeof(*fpregs)); + + /* FPU control/status */ + penv_fpreg->en_cw = penv_xmm->en_cw; + penv_fpreg->en_sw = penv_xmm->en_sw; + penv_fpreg->en_tw = penv_xmm->en_tw; + penv_fpreg->en_opcode = penv_xmm->en_opcode; + penv_fpreg->en_rip = penv_xmm->en_rip; + penv_fpreg->en_rdp = penv_xmm->en_rdp; + penv_fpreg->en_mxcsr = penv_xmm->en_mxcsr; + penv_fpreg->en_mxcsr_mask = penv_xmm->en_mxcsr_mask; + + /* FPU registers */ + for (i = 0; i < 8; ++i) + bcopy(sv_xmm->sv_fp[i].fp_acc.fp_bytes, fpregs->fpr_acc[i], 10); + + /* SSE registers */ + for (i = 0; i < 16; ++i) + bcopy(sv_xmm->sv_xmm[i].xmm_bytes, fpregs->fpr_xacc[i], 16); +} + +/* internalize from fpregs into sv_xmm */ +static void +set_fpregs_xmm(struct fpreg *fpregs, struct savefpu *sv_xmm) +{ + struct envxmm *penv_xmm = &sv_xmm->sv_env; + struct envxmm *penv_fpreg = (struct envxmm *)&fpregs->fpr_env; + int i; + + /* fpregs -> pcb */ + /* FPU control/status */ + penv_xmm->en_cw = penv_fpreg->en_cw; + penv_xmm->en_sw = penv_fpreg->en_sw; + penv_xmm->en_tw = penv_fpreg->en_tw; + penv_xmm->en_opcode = penv_fpreg->en_opcode; + penv_xmm->en_rip = penv_fpreg->en_rip; + penv_xmm->en_rdp = penv_fpreg->en_rdp; + penv_xmm->en_mxcsr = penv_fpreg->en_mxcsr; + penv_xmm->en_mxcsr_mask = penv_fpreg->en_mxcsr_mask & cpu_mxcsr_mask; + + /* FPU registers */ + for (i = 0; i < 8; ++i) + bcopy(fpregs->fpr_acc[i], sv_xmm->sv_fp[i].fp_acc.fp_bytes, 10); + + /* SSE registers */ + for (i = 0; i < 16; ++i) + bcopy(fpregs->fpr_xacc[i], sv_xmm->sv_xmm[i].xmm_bytes, 16); +} + +/* externalize from td->pcb */ +int +fill_fpregs(struct thread *td, struct fpreg *fpregs) +{ + + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || + P_SHOULDSTOP(td->td_proc), + ("not suspended thread %p", td)); + fpugetregs(td); + fill_fpregs_xmm(get_pcb_user_save_td(td), fpregs); + return (0); +} + +/* internalize to td->pcb */ +int +set_fpregs(struct thread *td, struct fpreg *fpregs) +{ + + critical_enter(); + set_fpregs_xmm(fpregs, get_pcb_user_save_td(td)); + fpuuserinited(td); + critical_exit(); + return (0); +} + +/* + * Get machine context. + */ +int +get_mcontext(struct thread *td, mcontext_t *mcp, int flags) +{ + struct pcb *pcb; + struct trapframe *tp; + + pcb = td->td_pcb; + tp = td->td_frame; + PROC_LOCK(curthread->td_proc); + mcp->mc_onstack = sigonstack(tp->tf_rsp); + PROC_UNLOCK(curthread->td_proc); + mcp->mc_r15 = tp->tf_r15; + mcp->mc_r14 = tp->tf_r14; + mcp->mc_r13 = tp->tf_r13; + mcp->mc_r12 = tp->tf_r12; + mcp->mc_r11 = tp->tf_r11; + mcp->mc_r10 = tp->tf_r10; + mcp->mc_r9 = tp->tf_r9; + mcp->mc_r8 = tp->tf_r8; + mcp->mc_rdi = tp->tf_rdi; + mcp->mc_rsi = tp->tf_rsi; + mcp->mc_rbp = tp->tf_rbp; + mcp->mc_rbx = tp->tf_rbx; + mcp->mc_rcx = tp->tf_rcx; + mcp->mc_rflags = tp->tf_rflags; + if (flags & GET_MC_CLEAR_RET) { + mcp->mc_rax = 0; + mcp->mc_rdx = 0; + mcp->mc_rflags &= ~PSL_C; + } else { + mcp->mc_rax = tp->tf_rax; + mcp->mc_rdx = tp->tf_rdx; + } + mcp->mc_rip = tp->tf_rip; + mcp->mc_cs = tp->tf_cs; + mcp->mc_rsp = tp->tf_rsp; + mcp->mc_ss = tp->tf_ss; + mcp->mc_ds = tp->tf_ds; + mcp->mc_es = tp->tf_es; + mcp->mc_fs = tp->tf_fs; + mcp->mc_gs = tp->tf_gs; + mcp->mc_flags = tp->tf_flags; + mcp->mc_len = sizeof(*mcp); + get_fpcontext(td, mcp, NULL, 0); + update_pcb_bases(pcb); + mcp->mc_fsbase = pcb->pcb_fsbase; + mcp->mc_gsbase = pcb->pcb_gsbase; + mcp->mc_xfpustate = 0; + mcp->mc_xfpustate_len = 0; + bzero(mcp->mc_spare, sizeof(mcp->mc_spare)); + return (0); +} + +/* + * Set machine context. + * + * However, we don't set any but the user modifiable flags, and we won't + * touch the cs selector. + */ +int +set_mcontext(struct thread *td, mcontext_t *mcp) +{ + struct pcb *pcb; + struct trapframe *tp; + char *xfpustate; + long rflags; + int ret; + + pcb = td->td_pcb; + tp = td->td_frame; + if (mcp->mc_len != sizeof(*mcp) || + (mcp->mc_flags & ~_MC_FLAG_MASK) != 0) + return (EINVAL); + rflags = (mcp->mc_rflags & PSL_USERCHANGE) | + (tp->tf_rflags & ~PSL_USERCHANGE); + if (mcp->mc_flags & _MC_HASFPXSTATE) { + if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - + sizeof(struct savefpu)) + return (EINVAL); + xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); + ret = copyin((void *)mcp->mc_xfpustate, xfpustate, + mcp->mc_xfpustate_len); + if (ret != 0) + return (ret); + } else + xfpustate = NULL; + ret = set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); + if (ret != 0) + return (ret); + tp->tf_r15 = mcp->mc_r15; + tp->tf_r14 = mcp->mc_r14; + tp->tf_r13 = mcp->mc_r13; + tp->tf_r12 = mcp->mc_r12; + tp->tf_r11 = mcp->mc_r11; + tp->tf_r10 = mcp->mc_r10; + tp->tf_r9 = mcp->mc_r9; + tp->tf_r8 = mcp->mc_r8; + tp->tf_rdi = mcp->mc_rdi; + tp->tf_rsi = mcp->mc_rsi; + tp->tf_rbp = mcp->mc_rbp; + tp->tf_rbx = mcp->mc_rbx; + tp->tf_rdx = mcp->mc_rdx; + tp->tf_rcx = mcp->mc_rcx; + tp->tf_rax = mcp->mc_rax; + tp->tf_rip = mcp->mc_rip; + tp->tf_rflags = rflags; + tp->tf_rsp = mcp->mc_rsp; + tp->tf_ss = mcp->mc_ss; + tp->tf_flags = mcp->mc_flags; + if (tp->tf_flags & TF_HASSEGS) { + tp->tf_ds = mcp->mc_ds; + tp->tf_es = mcp->mc_es; + tp->tf_fs = mcp->mc_fs; + tp->tf_gs = mcp->mc_gs; + } + set_pcb_flags(pcb, PCB_FULL_IRET); + if (mcp->mc_flags & _MC_HASBASES) { + pcb->pcb_fsbase = mcp->mc_fsbase; + pcb->pcb_gsbase = mcp->mc_gsbase; + } + return (0); +} + +static void +get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, + size_t xfpusave_len) +{ + size_t max_len, len; + + mcp->mc_ownedfp = fpugetregs(td); + bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], + sizeof(mcp->mc_fpstate)); + mcp->mc_fpformat = fpuformat(); + if (!use_xsave || xfpusave_len == 0) + return; + max_len = cpu_max_ext_state_size - sizeof(struct savefpu); + len = xfpusave_len; + if (len > max_len) { + len = max_len; + bzero(xfpusave + max_len, len - max_len); + } + mcp->mc_flags |= _MC_HASFPXSTATE; + mcp->mc_xfpustate_len = len; + bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); +} + +static int +set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, + size_t xfpustate_len) +{ + int error; + + if (mcp->mc_fpformat == _MC_FPFMT_NODEV) + return (0); + else if (mcp->mc_fpformat != _MC_FPFMT_XMM) + return (EINVAL); + else if (mcp->mc_ownedfp == _MC_FPOWNED_NONE) { + /* We don't care what state is left in the FPU or PCB. */ + fpstate_drop(td); + error = 0; + } else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || + mcp->mc_ownedfp == _MC_FPOWNED_PCB) { + error = fpusetregs(td, (struct savefpu *)&mcp->mc_fpstate, + xfpustate, xfpustate_len); + } else + return (EINVAL); + return (error); +} + +void +fpstate_drop(struct thread *td) +{ + + KASSERT(PCB_USER_FPU(td->td_pcb), ("fpstate_drop: kernel-owned fpu")); + critical_enter(); + if (PCPU_GET(fpcurthread) == td) + fpudrop(); + /* + * XXX force a full drop of the fpu. The above only drops it if we + * owned it. + * + * XXX I don't much like fpugetuserregs()'s semantics of doing a full + * drop. Dropping only to the pcb matches fnsave's behaviour. + * We only need to drop to !PCB_INITDONE in sendsig(). But + * sendsig() is the only caller of fpugetuserregs()... perhaps we just + * have too many layers. + */ + clear_pcb_flags(curthread->td_pcb, + PCB_FPUINITDONE | PCB_USERFPUINITDONE); + critical_exit(); +} + +int +fill_dbregs(struct thread *td, struct dbreg *dbregs) +{ + struct pcb *pcb; + + if (td == NULL) { + dbregs->dr[0] = rdr0(); + dbregs->dr[1] = rdr1(); + dbregs->dr[2] = rdr2(); + dbregs->dr[3] = rdr3(); + dbregs->dr[6] = rdr6(); + dbregs->dr[7] = rdr7(); + } else { + pcb = td->td_pcb; + dbregs->dr[0] = pcb->pcb_dr0; + dbregs->dr[1] = pcb->pcb_dr1; + dbregs->dr[2] = pcb->pcb_dr2; + dbregs->dr[3] = pcb->pcb_dr3; + dbregs->dr[6] = pcb->pcb_dr6; + dbregs->dr[7] = pcb->pcb_dr7; + } + dbregs->dr[4] = 0; + dbregs->dr[5] = 0; + dbregs->dr[8] = 0; + dbregs->dr[9] = 0; + dbregs->dr[10] = 0; + dbregs->dr[11] = 0; + dbregs->dr[12] = 0; + dbregs->dr[13] = 0; + dbregs->dr[14] = 0; + dbregs->dr[15] = 0; + return (0); +} + +int +set_dbregs(struct thread *td, struct dbreg *dbregs) +{ + struct pcb *pcb; + int i; + + if (td == NULL) { + load_dr0(dbregs->dr[0]); + load_dr1(dbregs->dr[1]); + load_dr2(dbregs->dr[2]); + load_dr3(dbregs->dr[3]); + load_dr6(dbregs->dr[6]); + load_dr7(dbregs->dr[7]); + } else { + /* + * Don't let an illegal value for dr7 get set. Specifically, + * check for undefined settings. Setting these bit patterns + * result in undefined behaviour and can lead to an unexpected + * TRCTRAP or a general protection fault right here. + * Upper bits of dr6 and dr7 must not be set + */ + for (i = 0; i < 4; i++) { + if (DBREG_DR7_ACCESS(dbregs->dr[7], i) == 0x02) + return (EINVAL); + if (td->td_frame->tf_cs == _ucode32sel && + DBREG_DR7_LEN(dbregs->dr[7], i) == DBREG_DR7_LEN_8) + return (EINVAL); + } + if ((dbregs->dr[6] & 0xffffffff00000000ul) != 0 || + (dbregs->dr[7] & 0xffffffff00000000ul) != 0) + return (EINVAL); + + pcb = td->td_pcb; + + /* + * Don't let a process set a breakpoint that is not within the + * process's address space. If a process could do this, it + * could halt the system by setting a breakpoint in the kernel + * (if ddb was enabled). Thus, we need to check to make sure + * that no breakpoints are being enabled for addresses outside + * process's address space. + * + * XXX - what about when the watched area of the user's + * address space is written into from within the kernel + * ... wouldn't that still cause a breakpoint to be generated + * from within kernel mode? + */ + + if (DBREG_DR7_ENABLED(dbregs->dr[7], 0)) { + /* dr0 is enabled */ + if (dbregs->dr[0] >= VM_MAXUSER_ADDRESS) + return (EINVAL); + } + if (DBREG_DR7_ENABLED(dbregs->dr[7], 1)) { + /* dr1 is enabled */ + if (dbregs->dr[1] >= VM_MAXUSER_ADDRESS) + return (EINVAL); + } + if (DBREG_DR7_ENABLED(dbregs->dr[7], 2)) { + /* dr2 is enabled */ + if (dbregs->dr[2] >= VM_MAXUSER_ADDRESS) + return (EINVAL); + } + if (DBREG_DR7_ENABLED(dbregs->dr[7], 3)) { + /* dr3 is enabled */ + if (dbregs->dr[3] >= VM_MAXUSER_ADDRESS) + return (EINVAL); + } + + pcb->pcb_dr0 = dbregs->dr[0]; + pcb->pcb_dr1 = dbregs->dr[1]; + pcb->pcb_dr2 = dbregs->dr[2]; + pcb->pcb_dr3 = dbregs->dr[3]; + pcb->pcb_dr6 = dbregs->dr[6]; + pcb->pcb_dr7 = dbregs->dr[7]; + + set_pcb_flags(pcb, PCB_DBREGS); + } + + return (0); +} + +void +reset_dbregs(void) +{ + + load_dr7(0); /* Turn off the control bits first */ + load_dr0(0); + load_dr1(0); + load_dr2(0); + load_dr3(0); + load_dr6(0); +} + +/* + * Return > 0 if a hardware breakpoint has been hit, and the + * breakpoint was in user space. Return 0, otherwise. + */ +int +user_dbreg_trap(register_t dr6) +{ + u_int64_t dr7; + u_int64_t bp; /* breakpoint bits extracted from dr6 */ + int nbp; /* number of breakpoints that triggered */ + caddr_t addr[4]; /* breakpoint addresses */ + int i; + + bp = dr6 & DBREG_DR6_BMASK; + if (bp == 0) { + /* + * None of the breakpoint bits are set meaning this + * trap was not caused by any of the debug registers + */ + return 0; + } + + dr7 = rdr7(); + if ((dr7 & 0x000000ff) == 0) { + /* + * all GE and LE bits in the dr7 register are zero, + * thus the trap couldn't have been caused by the + * hardware debug registers *** 1048 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Sep 21 17:21: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 6B67D677798; Tue, 21 Sep 2021 17:21: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 4HDSrV1rJSz3NvJ; Tue, 21 Sep 2021 17:21: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 8FC7227CE6; Tue, 21 Sep 2021 17:21: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 18LHLD9W028874; Tue, 21 Sep 2021 17:21:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLDke028873; Tue, 21 Sep 2021 17:21:13 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:13 GMT Message-Id: <202109211721.18LHLDke028873@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: 9151abe32303 - main - exec_machdep.c: some style, use ANSI C definition for sys_sigreturn() 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: 9151abe323034275014dcfffb4a793bc5032bf87 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, 21 Sep 2021 17:21:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9151abe323034275014dcfffb4a793bc5032bf87 commit 9151abe323034275014dcfffb4a793bc5032bf87 Author: Konstantin Belousov AuthorDate: 2021-09-13 20:37:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 exec_machdep.c: some style, use ANSI C definition for sys_sigreturn() Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index 5cd905e1051b..1297117638d6 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -97,7 +97,7 @@ __FBSDID("$FreeBSD$"); static void get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, size_t xfpusave_len); -static int set_fpcontext(struct thread *td, mcontext_t *mcp, +static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len); /* @@ -236,11 +236,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) * state to gain improper privileges. */ int -sys_sigreturn(td, uap) - struct thread *td; - struct sigreturn_args /* { - const struct __ucontext *sigcntxp; - } */ *uap; +sys_sigreturn(struct thread *td, struct sigreturn_args *uap) { ucontext_t uc; struct pcb *pcb; @@ -938,7 +934,7 @@ user_dbreg_trap(register_t dr6) * None of the breakpoint bits are set meaning this * trap was not caused by any of the debug registers */ - return 0; + return (0); } dr7 = rdr7(); @@ -948,7 +944,7 @@ user_dbreg_trap(register_t dr6) * thus the trap couldn't have been caused by the * hardware debug registers */ - return 0; + return (0); } nbp = 0; @@ -976,12 +972,12 @@ user_dbreg_trap(register_t dr6) /* * addr[i] is in user space */ - return nbp; + return (nbp); } } /* * None of the breakpoints are in user space. */ - return 0; + return (0); } From owner-dev-commits-src-main@freebsd.org Tue Sep 21 17:21: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 0CFB2677A01; Tue, 21 Sep 2021 17:21: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 4HDSrX1XPxz3Nmt; Tue, 21 Sep 2021 17:21: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 CF01E27AFB; Tue, 21 Sep 2021 17:21: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 18LHLFK4028928; Tue, 21 Sep 2021 17:21:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLFWM028927; Tue, 21 Sep 2021 17:21:15 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:15 GMT Message-Id: <202109211721.18LHLFWM028927@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: df8dd6025af8 - main - amd64: stop using top of the thread' kernel stack for FPU user save area 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: df8dd6025af88a99d34f549fa9591a9b8f9b75b1 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, 21 Sep 2021 17:21:18 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=df8dd6025af88a99d34f549fa9591a9b8f9b75b1 commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1 Author: Konstantin Belousov AuthorDate: 2021-09-13 21:05:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 amd64: stop using top of the thread' kernel stack for FPU user save area Instead do one more allocation at the thread creation time. This frees a lot of space on the stack. Also do not use alloca() for temporal storage in signal delivery sendsig() function and signal return syscall sys_sigreturn(). This saves equal amount of space, again by the cost of one more allocation at the thread creation time. A useful experiment now would be to reduce KSTACK_PAGES. Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 4 ++-- sys/amd64/amd64/fpu.c | 2 ++ sys/amd64/amd64/machdep.c | 14 -------------- sys/amd64/amd64/vm_machdep.c | 22 +++++++++++++--------- sys/amd64/ia32/ia32_signal.c | 6 +++--- sys/amd64/include/proc.h | 2 ++ sys/kern/kern_thread.c | 2 +- 7 files changed, 23 insertions(+), 29 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index 1297117638d6..48bda05f9685 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -135,7 +135,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); - xfpusave = __builtin_alloca(xfpusave_len); + xfpusave = (char *)td->td_md.md_fpu_scratch; } else { xfpusave_len = 0; xfpusave = NULL; @@ -674,7 +674,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp) if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - sizeof(struct savefpu)) return (EINVAL); - xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); + xfpustate = (char *)td->td_md.md_fpu_scratch; ret = copyin((void *)mcp->mc_xfpustate, xfpustate, mcp->mc_xfpustate_len); if (ret != 0) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index d7936b3b1922..24986958d4ca 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -448,6 +448,8 @@ fpuinitstate(void *arg __unused) xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); } + cpu_thread_alloc(&thread0); + saveintr = intr_disable(); stop_emulating(); diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index d4e2356a9ae1..5c9b64526609 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1258,7 +1258,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) caddr_t kmdp; int gsel_tss, x; struct pcpu *pc; - struct xstate_hdr *xhdr; uint64_t cr3, rsp0; pml4_entry_t *pml4e; pdp_entry_t *pdpe; @@ -1564,19 +1563,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) msgbufinit(msgbufp, msgbufsize); fpuinit(); - /* - * Reinitialize thread0's stack base now that the xsave area size is - * known. Set up thread0's pcb save area after fpuinit calculated fpu - * save area size. Zero out the extended state header in fpu save area. - */ - set_top_of_stack_td(&thread0); - thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0); - bzero(thread0.td_pcb->pcb_save, cpu_max_ext_state_size); - if (use_xsave) { - xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) + - 1); - xhdr->xstate_bv = xsave_mask; - } /* make an initial tss so cpu can get interrupt stack on syscall! */ rsp0 = thread0.td_md.md_stack_base; /* Ensure the stack is aligned to 16 bytes */ diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 4567e6e0eb5d..e42d16d61b3a 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -90,19 +90,17 @@ void set_top_of_stack_td(struct thread *td) { td->td_md.md_stack_base = td->td_kstack + - td->td_kstack_pages * PAGE_SIZE - - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN); + td->td_kstack_pages * PAGE_SIZE; } struct savefpu * get_pcb_user_save_td(struct thread *td) { - vm_offset_t p; - - p = td->td_md.md_stack_base; - KASSERT((p % XSAVE_AREA_ALIGN) == 0, - ("Unaligned pcb_user_save area ptr %#lx td %p", p, td)); - return ((struct savefpu *)p); + KASSERT(((vm_offset_t)td->td_md.md_usr_fpu_save % + XSAVE_AREA_ALIGN) == 0, + ("Unaligned pcb_user_save area ptr %p td %p", + td->td_md.md_usr_fpu_save, td)); + return (td->td_md.md_usr_fpu_save); } struct pcb * @@ -393,6 +391,8 @@ cpu_thread_alloc(struct thread *td) set_top_of_stack_td(td); td->td_pcb = pcb = get_pcb_td(td); td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; + td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); + td->td_md.md_fpu_scratch = fpu_save_area_alloc(); pcb->pcb_save = get_pcb_user_save_pcb(pcb); if (use_xsave) { xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); @@ -404,8 +404,12 @@ cpu_thread_alloc(struct thread *td) void cpu_thread_free(struct thread *td) { - cpu_thread_clean(td); + + fpu_save_area_free(td->td_md.md_usr_fpu_save); + td->td_md.md_usr_fpu_save = NULL; + fpu_save_area_free(td->td_md.md_fpu_scratch); + td->td_md.md_fpu_scratch = NULL; } bool diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 49b5797d68fd..9b67c7001a87 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -210,7 +210,7 @@ ia32_set_mcontext(struct thread *td, struct ia32_mcontext *mcp) if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - sizeof(struct savefpu)) return (EINVAL); - xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); + xfpustate = (char *)td->td_md.md_fpu_scratch; ret = copyin(PTRIN(mcp->mc_xfpustate), xfpustate, mcp->mc_xfpustate_len); if (ret != 0) @@ -579,7 +579,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); - xfpusave = __builtin_alloca(xfpusave_len); + xfpusave = (char *)td->td_md.md_fpu_scratch; } else { xfpusave_len = 0; xfpusave = NULL; @@ -882,7 +882,7 @@ freebsd32_sigreturn(td, uap) td->td_proc->p_pid, td->td_name, xfpustate_len); return (EINVAL); } - xfpustate = __builtin_alloca(xfpustate_len); + xfpustate = (char *)td->td_md.md_fpu_scratch; error = copyin(PTRIN(ucp->uc_mcontext.mc_xfpustate), xfpustate, xfpustate_len); if (error != 0) { diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index 0f8cf50e326d..bd07f70f8d44 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -75,6 +75,8 @@ struct mdthread { int md_efirt_dis_pf; /* (k) */ struct pcb md_pcb; vm_offset_t md_stack_base; + struct savefpu *md_usr_fpu_save; + struct savefpu *md_fpu_scratch; }; struct mdproc { diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 65c5cc65c87e..62f939406374 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -91,7 +91,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0x110, "struct thread KBI td_pflags"); _Static_assert(offsetof(struct thread, td_frame) == 0x4a8, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6c0, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb8, "struct proc KBI p_flag"); From owner-dev-commits-src-main@freebsd.org Tue Sep 21 17:21: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 07C5F677820; Tue, 21 Sep 2021 17:21: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 4HDSrY1ZRpz3Npy; Tue, 21 Sep 2021 17:21: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 ED7E627D3A; Tue, 21 Sep 2021 17:21: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 18LHLGEC028953; Tue, 21 Sep 2021 17:21:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLGn6028952; Tue, 21 Sep 2021 17:21:16 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:16 GMT Message-Id: <202109211721.18LHLGn6028952@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: bd9e0f5df681 - main - amd64: eliminate td_md.md_fpu_scratch 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: bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 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, 21 Sep 2021 17:21:19 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 commit bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 Author: Konstantin Belousov AuthorDate: 2021-09-15 18:37:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 amd64: eliminate td_md.md_fpu_scratch For signal send, copyout from the user FPU save area directly. For sigreturn, we are in sleepable context and can do temporal allocation of the transient save area. We cannot copying from userspace directly to user save area because XSAVE state needs to be validated, also partial copyins can corrupt it. Requested by: jhb Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 47 +++++++++++++++++++----------------------- sys/amd64/amd64/vm_machdep.c | 3 --- sys/amd64/ia32/ia32_signal.c | 43 ++++++++++++++++---------------------- sys/amd64/include/proc.h | 1 - sys/kern/kern_thread.c | 2 +- 5 files changed, 40 insertions(+), 56 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index 48bda05f9685..168c24cbb65b 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -96,7 +96,7 @@ __FBSDID("$FreeBSD$"); #include static void get_fpcontext(struct thread *td, mcontext_t *mcp, - char *xfpusave, size_t xfpusave_len); + char **xfpusave, size_t *xfpusave_len); static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len); @@ -133,14 +133,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); - if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { - xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); - xfpusave = (char *)td->td_md.md_fpu_scratch; - } else { - xfpusave_len = 0; - xfpusave = NULL; - } - /* Save user context. */ bzero(&sf, sizeof(sf)); sf.sf_uc.uc_sigmask = *mask; @@ -150,7 +142,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs)); sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ - get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); + get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len); fpstate_drop(td); update_pcb_bases(pcb); sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; @@ -301,10 +293,11 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *uap) p->p_pid, td->td_name, xfpustate_len); return (EINVAL); } - xfpustate = __builtin_alloca(xfpustate_len); + xfpustate = (char *)fpu_save_area_alloc(); error = copyin((const void *)uc.uc_mcontext.mc_xfpustate, xfpustate, xfpustate_len); if (error != 0) { + fpu_save_area_free((struct savefpu *)xfpustate); uprintf( "pid %d (%s): sigreturn copying xfpustate failed\n", p->p_pid, td->td_name); @@ -315,6 +308,7 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *uap) xfpustate_len = 0; } ret = set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); + fpu_save_area_free((struct savefpu *)xfpustate); if (ret != 0) { uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", p->p_pid, td->td_name, ret); @@ -674,14 +668,17 @@ set_mcontext(struct thread *td, mcontext_t *mcp) if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - sizeof(struct savefpu)) return (EINVAL); - xfpustate = (char *)td->td_md.md_fpu_scratch; + xfpustate = (char *)fpu_save_area_alloc(); ret = copyin((void *)mcp->mc_xfpustate, xfpustate, mcp->mc_xfpustate_len); - if (ret != 0) + if (ret != 0) { + fpu_save_area_free((struct savefpu *)xfpustate); return (ret); + } } else xfpustate = NULL; ret = set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); + fpu_save_area_free((struct savefpu *)xfpustate); if (ret != 0) return (ret); tp->tf_r15 = mcp->mc_r15; @@ -719,26 +716,24 @@ set_mcontext(struct thread *td, mcontext_t *mcp) } static void -get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, - size_t xfpusave_len) +get_fpcontext(struct thread *td, mcontext_t *mcp, char **xfpusave, + size_t *xfpusave_len) { - size_t max_len, len; - mcp->mc_ownedfp = fpugetregs(td); bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); - if (!use_xsave || xfpusave_len == 0) + if (xfpusave == NULL) return; - max_len = cpu_max_ext_state_size - sizeof(struct savefpu); - len = xfpusave_len; - if (len > max_len) { - len = max_len; - bzero(xfpusave + max_len, len - max_len); + if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { + *xfpusave_len = 0; + *xfpusave = NULL; + } else { + mcp->mc_flags |= _MC_HASFPXSTATE; + *xfpusave_len = mcp->mc_xfpustate_len = + cpu_max_ext_state_size - sizeof(struct savefpu); + *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); } - mcp->mc_flags |= _MC_HASFPXSTATE; - mcp->mc_xfpustate_len = len; - bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); } static int diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index e42d16d61b3a..0bfcd03d6655 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -392,7 +392,6 @@ cpu_thread_alloc(struct thread *td) td->td_pcb = pcb = get_pcb_td(td); td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); - td->td_md.md_fpu_scratch = fpu_save_area_alloc(); pcb->pcb_save = get_pcb_user_save_pcb(pcb); if (use_xsave) { xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); @@ -408,8 +407,6 @@ cpu_thread_free(struct thread *td) fpu_save_area_free(td->td_md.md_usr_fpu_save); td->td_md.md_usr_fpu_save = NULL; - fpu_save_area_free(td->td_md.md_fpu_scratch); - td->td_md.md_fpu_scratch = NULL; } bool diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 9b67c7001a87..1ca19072a1dc 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -87,10 +87,8 @@ static void freebsd4_ia32_sendsig(sig_t, ksiginfo_t *, sigset_t *); static void ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, - char *xfpusave, size_t xfpusave_len) + char **xfpusave, size_t *xfpusave_len) { - size_t max_len, len; - /* * XXX Format of 64bit and 32bit FXSAVE areas differs. FXSAVE * in 32bit mode saves %cs and %ds, while on 64bit it saves @@ -101,17 +99,15 @@ ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); - if (!use_xsave || xfpusave_len == 0) - return; - max_len = cpu_max_ext_state_size - sizeof(struct savefpu); - len = xfpusave_len; - if (len > max_len) { - len = max_len; - bzero(xfpusave + max_len, len - max_len); + if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { + *xfpusave_len = 0; + *xfpusave = NULL; + } else { + mcp->mc_flags |= _MC_IA32_HASFPXSTATE; + *xfpusave_len = mcp->mc_xfpustate_len = + cpu_max_ext_state_size - sizeof(struct savefpu); + *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); } - mcp->mc_flags |= _MC_IA32_HASFPXSTATE; - mcp->mc_xfpustate_len = len; - bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); } static int @@ -210,14 +206,17 @@ ia32_set_mcontext(struct thread *td, struct ia32_mcontext *mcp) if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - sizeof(struct savefpu)) return (EINVAL); - xfpustate = (char *)td->td_md.md_fpu_scratch; + xfpustate = (char *)fpu_save_area_alloc(); ret = copyin(PTRIN(mcp->mc_xfpustate), xfpustate, mcp->mc_xfpustate_len); - if (ret != 0) + if (ret != 0) { + fpu_save_area_free((struct savefpu *)xfpustate); return (ret); + } } else xfpustate = NULL; ret = ia32_set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); + fpu_save_area_free((struct savefpu *)xfpustate); if (ret != 0) return (ret); tp->tf_gs = mcp->mc_gs; @@ -577,14 +576,6 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); - if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { - xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); - xfpusave = (char *)td->td_md.md_fpu_scratch; - } else { - xfpusave_len = 0; - xfpusave = NULL; - } - /* Save user context. */ bzero(&sf, sizeof(sf)); sf.sf_uc.uc_sigmask = *mask; @@ -613,7 +604,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sf.sf_uc.uc_mcontext.mc_fs = regs->tf_fs; sf.sf_uc.uc_mcontext.mc_gs = regs->tf_gs; sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ - ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); + ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len); fpstate_drop(td); sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase; sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase; @@ -882,10 +873,11 @@ freebsd32_sigreturn(td, uap) td->td_proc->p_pid, td->td_name, xfpustate_len); return (EINVAL); } - xfpustate = (char *)td->td_md.md_fpu_scratch; + xfpustate = (char *)fpu_save_area_alloc(); error = copyin(PTRIN(ucp->uc_mcontext.mc_xfpustate), xfpustate, xfpustate_len); if (error != 0) { + fpu_save_area_free((struct savefpu *)xfpustate); uprintf( "pid %d (%s): sigreturn copying xfpustate failed\n", td->td_proc->p_pid, td->td_name); @@ -897,6 +889,7 @@ freebsd32_sigreturn(td, uap) } ret = ia32_set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); + fpu_save_area_free((struct savefpu *)xfpustate); if (ret != 0) { uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", td->td_proc->p_pid, td->td_name, ret); diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index bd07f70f8d44..94ac69d31e65 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -76,7 +76,6 @@ struct mdthread { struct pcb md_pcb; vm_offset_t md_stack_base; struct savefpu *md_usr_fpu_save; - struct savefpu *md_fpu_scratch; }; struct mdproc { diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 62f939406374..65c5cc65c87e 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -91,7 +91,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0x110, "struct thread KBI td_pflags"); _Static_assert(offsetof(struct thread, td_frame) == 0x4a8, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6c0, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb8, "struct proc KBI p_flag"); From owner-dev-commits-src-main@freebsd.org Tue Sep 21 17:21: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 3B36467770D; Tue, 21 Sep 2021 17:21: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 4HDSrW00ZBz3Ns2; Tue, 21 Sep 2021 17:21: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 B8DE127E94; Tue, 21 Sep 2021 17:21: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 18LHLE26028898; Tue, 21 Sep 2021 17:21:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLEBt028897; Tue, 21 Sep 2021 17:21:14 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:14 GMT Message-Id: <202109211721.18LHLEBt028897@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: 0f6829488ef3 - main - linux32: add a hack to avoid redefining the type of the savefpu tag 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: 0f6829488ef32142b9ea1c0806fb5ecfe0872c02 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, 21 Sep 2021 17:21:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0f6829488ef32142b9ea1c0806fb5ecfe0872c02 commit 0f6829488ef32142b9ea1c0806fb5ecfe0872c02 Author: Konstantin Belousov AuthorDate: 2021-09-13 21:40:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 linux32: add a hack to avoid redefining the type of the savefpu tag when compiling in amd64 kernel environment with -m32. This is a temporal workaround for some future proper (but unclear) fix. Reviewed by: jhb, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/modules/linux/Makefile | 2 +- sys/x86/include/fpu.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile index 373ec3dcae91..6c95a548bffb 100644 --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -60,7 +60,7 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} .if ${MACHINE_CPUARCH} == "amd64" -VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 +VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -D__M32_BROKEN_MODULE_HACK__ -m32 .else VDSOFLAGS=-mregparm=0 .endif diff --git a/sys/x86/include/fpu.h b/sys/x86/include/fpu.h index 313a03ea55c9..bb8533d599dd 100644 --- a/sys/x86/include/fpu.h +++ b/sys/x86/include/fpu.h @@ -123,10 +123,12 @@ struct savexmm { } __aligned(16); #ifdef __i386__ +#ifndef __M32_BROKEN_MODULE_HACK__ union savefpu { struct save87 sv_87; struct savexmm sv_xmm; }; +#endif /* __M32_BROKEN_MODULE_HACK__ */ #else /* Floating point context. (amd64 fxsave/fxrstor) */ struct savefpu { From owner-dev-commits-src-main@freebsd.org Tue Sep 21 17:21:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E5336777E1; Tue, 21 Sep 2021 17:21: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 4HDSrZ4t81z3NsD; Tue, 21 Sep 2021 17:21: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 157AA27E95; Tue, 21 Sep 2021 17:21: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 18LHLHON028977; Tue, 21 Sep 2021 17:21:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHLHdK028976; Tue, 21 Sep 2021 17:21:17 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:21:17 GMT Message-Id: <202109211721.18LHLHdK028976@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: 2e79a216329f - main - amd64: consistently use uprintf() to report weird situations in sigreturn 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: 2e79a216329f62a78dbbc72256e782353e220968 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, 21 Sep 2021 17:21:21 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2e79a216329f62a78dbbc72256e782353e220968 commit 2e79a216329f62a78dbbc72256e782353e220968 Author: Konstantin Belousov AuthorDate: 2021-09-16 13:48:27 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 17:20:15 +0000 amd64: consistently use uprintf() to report weird situations in sigreturn Reviewed by: jhb Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31954 --- sys/amd64/amd64/exec_machdep.c | 5 ++--- sys/amd64/linux/linux_sysvec.c | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c index 168c24cbb65b..d605f080871a 100644 --- a/sys/amd64/amd64/exec_machdep.c +++ b/sys/amd64/amd64/exec_machdep.c @@ -197,9 +197,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) (xfpusave != NULL && copyout(xfpusave, (void *)sf.sf_uc.uc_mcontext.mc_xfpustate, xfpusave_len) != 0)) { -#ifdef DEBUG - printf("process %ld has trashed its stack\n", (long)p->p_pid); -#endif + uprintf("pid %d comm %s has trashed its stack, killing\n", + p->p_pid, p->p_comm); PROC_LOCK(p); sigexit(td, SIGILL); } diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index d6f2ec2ab832..b7aedff23536 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -556,7 +556,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * one less debugger trap, so allowing it is fairly harmless. */ if (!EFL_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { - printf("linux_rt_sigreturn: rflags = 0x%lx\n", rflags); + uprintf("pid %d comm %s linux mangled rflags %#lx\n", + p->p_pid, p->p_comm, rflags); return (EINVAL); } @@ -566,7 +567,8 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) * other selectors, invalid %eip's and invalid %esp's. */ if (!CS_SECURE(context->sc_cs)) { - printf("linux_rt_sigreturn: cs = 0x%x\n", context->sc_cs); + uprintf("pid %d comm %s linux mangled cs %#x\n", + p->p_pid, p->p_comm, context->sc_cs); ksiginfo_init_trap(&ksi); ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_OBJERR; From owner-dev-commits-src-main@freebsd.org Tue Sep 21 17:52: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 605EE67832B; Tue, 21 Sep 2021 17:52: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 4HDTXj2GwPz3jrN; Tue, 21 Sep 2021 17:52: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 2430569A; Tue, 21 Sep 2021 17:52: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 18LHqbLG069785; Tue, 21 Sep 2021 17:52:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LHqbM3069784; Tue, 21 Sep 2021 17:52:37 GMT (envelope-from git) Date: Tue, 21 Sep 2021 17:52:37 GMT Message-Id: <202109211752.18LHqbM3069784@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: bcdc599dc2a1 - main - Revert "cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use 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: bcdc599dc2a187052cb13e18f22d3f0c655f95e6 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, 21 Sep 2021 17:52:37 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bcdc599dc2a187052cb13e18f22d3f0c655f95e6 commit bcdc599dc2a187052cb13e18f22d3f0c655f95e6 Author: Mark Johnston AuthorDate: 2021-09-21 17:51:42 +0000 Commit: Mark Johnston CommitDate: 2021-09-21 17:51:42 +0000 Revert "cpuset(9): Add CPU_FOREACH_IS(SET|CLR) and modify consumers to use it" This reverts commit 9068f6ea697b1b28ad1326a4c7a9ba86f08b985e. The underlying macro needs to be reworked to avoid problems with control flow statements. Reported by: rlibby --- sys/amd64/amd64/mp_machdep.c | 11 ++++++++--- sys/amd64/vmm/io/vlapic.c | 13 ++++++++++--- sys/amd64/vmm/vmm_lapic.c | 4 +++- sys/i386/i386/mp_machdep.c | 4 +++- sys/sys/cpuset.h | 2 -- sys/x86/x86/mp_x86.c | 4 +++- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 16ec277e9c34..6c66bd622855 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -618,7 +618,7 @@ static void smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, smp_invl_cb_t curcpu_cb, enum invl_op_codes op) { - cpuset_t other_cpus; + cpuset_t other_cpus, mask1; uint32_t generation, *p_cpudone; int cpu; bool is_all; @@ -662,7 +662,10 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, /* Fence between filling smp_tlb fields and clearing scoreboard. */ atomic_thread_fence_rel(); - CPU_FOREACH_ISSET(cpu, &mask) { + mask1 = mask; + while ((cpu = CPU_FFS(&mask1)) != 0) { + cpu--; + CPU_CLR(cpu, &mask1); KASSERT(*invl_scoreboard_slot(cpu) != 0, ("IPI scoreboard is zero, initiator %d target %d", PCPU_GET(cpuid), cpu)); @@ -683,7 +686,9 @@ smp_targeted_tlb_shootdown(cpuset_t mask, pmap_t pmap, vm_offset_t addr1, ipi_selected(mask, IPI_INVLOP); } curcpu_cb(pmap, addr1, addr2); - CPU_FOREACH_ISSET(cpu, &other_cpus) { + while ((cpu = CPU_FFS(&other_cpus)) != 0) { + cpu--; + CPU_CLR(cpu, &other_cpus); p_cpudone = invl_scoreboard_slot(cpu); while (atomic_load_int(p_cpudone) != generation) ia32_pause(); diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index 4e7ddbafd447..06df1c1a87e5 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -860,7 +860,10 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32_t dest, bool phys, */ CPU_ZERO(dmask); amask = vm_active_cpus(vm); - CPU_FOREACH_ISSET(vcpuid, &amask) { + while ((vcpuid = CPU_FFS(&amask)) != 0) { + vcpuid--; + CPU_CLR(vcpuid, &amask); + vlapic = vm_lapic(vm, vcpuid); dfr = vlapic->apic_page->dfr; ldr = vlapic->apic_page->ldr; @@ -1000,7 +1003,9 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) break; } - CPU_FOREACH_ISSET(i, &dmask) { + while ((i = CPU_FFS(&dmask)) != 0) { + i--; + CPU_CLR(i, &dmask); if (mode == APIC_DELMODE_FIXED) { lapic_intr_edge(vlapic->vm, i, vec); vmm_stat_array_incr(vlapic->vm, vlapic->vcpuid, @@ -1549,7 +1554,9 @@ vlapic_deliver_intr(struct vm *vm, bool level, uint32_t dest, bool phys, */ vlapic_calcdest(vm, &dmask, dest, phys, lowprio, false); - CPU_FOREACH_ISSET(vcpuid, &dmask) { + while ((vcpuid = CPU_FFS(&dmask)) != 0) { + vcpuid--; + CPU_CLR(vcpuid, &dmask); if (delmode == IOART_DELEXINT) { vm_inject_extint(vm, vcpuid); } else { diff --git a/sys/amd64/vmm/vmm_lapic.c b/sys/amd64/vmm/vmm_lapic.c index 8191da758100..89a1ebc8eff9 100644 --- a/sys/amd64/vmm/vmm_lapic.c +++ b/sys/amd64/vmm/vmm_lapic.c @@ -87,7 +87,9 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vector) else CPU_SETOF(cpu, &dmask); error = 0; - CPU_FOREACH_ISSET(cpu, &dmask) { + while ((cpu = CPU_FFS(&dmask)) != 0) { + cpu--; + CPU_CLR(cpu, &dmask); vlapic = vm_lapic(vm, cpu); error = vlapic_trigger_lvt(vlapic, vector); if (error) diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 777aefa021b3..156702118c45 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -598,7 +598,9 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap, ipi_selected(mask, vector); } curcpu_cb(pmap, addr1, addr2); - CPU_FOREACH_ISSET(cpu, &other_cpus) { + while ((cpu = CPU_FFS(&other_cpus)) != 0) { + cpu--; + CPU_CLR(cpu, &other_cpus); p_cpudone = &cpuid_to_pcpu[cpu]->pc_smp_tlb_done; while (*p_cpudone != generation) ia32_pause(); diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h index 9ef1a65f4506..1a96bb4766ce 100644 --- a/sys/sys/cpuset.h +++ b/sys/sys/cpuset.h @@ -66,8 +66,6 @@ #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) #define CPU_FLS(p) BIT_FLS(CPU_SETSIZE, p) -#define CPU_FOREACH_ISSET(i, p) BIT_FOREACH_ISSET(CPU_SETSIZE, i, p) -#define CPU_FOREACH_ISCLR(i, p) BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p) #define CPU_COUNT(p) ((int)BIT_COUNT(CPU_SETSIZE, p)) #define CPUSET_FSET BITSET_FSET(_NCPUWORDS) #define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 09d05d3f6de4..5e9a9735b09a 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1290,7 +1290,9 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_stop_nmi_pending, &cpus); - CPU_FOREACH_ISSET(cpu, &cpus) { + while ((cpu = CPU_FFS(&cpus)) != 0) { + cpu--; + CPU_CLR(cpu, &cpus); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); ipi_send_cpu(cpu, ipi); } From owner-dev-commits-src-main@freebsd.org Tue Sep 21 20:01: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 A5D2967A30A; Tue, 21 Sep 2021 20:01: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 4HDXPG4K6kz4RPW; Tue, 21 Sep 2021 20:01: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 7610022FE; Tue, 21 Sep 2021 20:01: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 18LK1MQQ041927; Tue, 21 Sep 2021 20:01:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LK1MmF041926; Tue, 21 Sep 2021 20:01:22 GMT (envelope-from git) Date: Tue, 21 Sep 2021 20:01:22 GMT Message-Id: <202109212001.18LK1MmF041926@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: 4f917847c903 - main - fusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES 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: 4f917847c9037d9b76de188c03e13b81224431b2 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, 21 Sep 2021 20:01:22 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=4f917847c9037d9b76de188c03e13b81224431b2 commit 4f917847c9037d9b76de188c03e13b81224431b2 Author: Alan Somers AuthorDate: 2021-09-16 19:19:21 +0000 Commit: Alan Somers CommitDate: 2021-09-21 20:01:06 +0000 fusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES During VOP_GETPAGES, fusefs needs to determine the file's length, which could require a FUSE_GETATTR operation. If that fails, it's better to SIGBUS than panic. MFC after: 1 week Sponsored by: Axcient Reviewed by: markj, kib Differential Revision: https://reviews.freebsd.org/D31994 --- sys/fs/fuse/fuse_vnops.c | 20 +++--- tests/sys/fs/fusefs/read.cc | 156 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+), 11 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 1216c1252f2b..4c8c8c1d4461 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -2199,25 +2199,23 @@ fuse_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) +fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *blksz) { off_t filesize; - int blksz, err; + int err; const int biosize = fuse_iosize(vp); err = fuse_vnode_size(vp, &filesize, NULL, NULL); - KASSERT(err == 0, ("vfs_bio_getpages can't handle errors here")); - if (err) - return biosize; - - if ((off_t)lbn * biosize >= filesize) { - blksz = 0; + if (err) { + /* This will turn into a SIGBUS */ + return (EIO); + } else if ((off_t)lbn * biosize >= filesize) { + *blksz = 0; } else if ((off_t)(lbn + 1) * biosize > filesize) { - blksz = filesize - (off_t)lbn *biosize; + *blksz = filesize - (off_t)lbn *biosize; } else { - blksz = biosize; + *blksz = biosize; } - *sz = blksz; return (0); } diff --git a/tests/sys/fs/fusefs/read.cc b/tests/sys/fs/fusefs/read.cc index 22a26c2701fd..cb82d0a43b06 100644 --- a/tests/sys/fs/fusefs/read.cc +++ b/tests/sys/fs/fusefs/read.cc @@ -40,6 +40,8 @@ extern "C" { #include #include #include +#include +#include #include } @@ -103,6 +105,33 @@ class ReadAhead: public Read, } }; +class ReadSigbus: public Read +{ +public: +static jmp_buf s_jmpbuf; +static sig_atomic_t s_si_addr; + +void TearDown() { + struct sigaction sa; + + bzero(&sa, sizeof(sa)); + sa.sa_handler = SIG_DFL; + sigaction(SIGBUS, &sa, NULL); + + FuseTest::TearDown(); +} + +}; + +static void +handle_sigbus(int signo __unused, siginfo_t *info, void *uap __unused) { + ReadSigbus::s_si_addr = (sig_atomic_t)info->si_addr; + longjmp(ReadSigbus::s_jmpbuf, 1); +} + +jmp_buf ReadSigbus::s_jmpbuf; +sig_atomic_t ReadSigbus::s_si_addr; + /* AIO reads need to set the header's pid field correctly */ /* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236379 */ TEST_F(AioRead, aio_read) @@ -584,6 +613,56 @@ TEST_F(Read, mmap) leak(fd); } +/* Read of an mmap()ed file fails */ +TEST_F(ReadSigbus, mmap_eio) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + const char *CONTENTS = "abcdefgh"; + struct sigaction sa; + uint64_t ino = 42; + int fd; + ssize_t len; + size_t bufsize = strlen(CONTENTS); + void *p; + + len = getpagesize(); + + expect_lookup(RELPATH, ino, bufsize); + expect_open(ino, 0, 1); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_READ && + in.header.nodeid == ino && + in.body.read.fh == Read::FH); + }, Eq(true)), + _) + ).WillRepeatedly(Invoke(ReturnErrno(EIO))); + + fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd) << strerror(errno); + + p = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0); + ASSERT_NE(MAP_FAILED, p) << strerror(errno); + + /* Accessing the mapped page should return SIGBUS. */ + + bzero(&sa, sizeof(sa)); + sa.sa_handler = SIG_DFL; + sa.sa_sigaction = handle_sigbus; + sa.sa_flags = SA_RESETHAND | SA_SIGINFO; + ASSERT_EQ(0, sigaction(SIGBUS, &sa, NULL)) << strerror(errno); + if (setjmp(ReadSigbus::s_jmpbuf) == 0) { + atomic_signal_fence(std::memory_order::memory_order_seq_cst); + volatile char x __unused = *(volatile char*)p; + FAIL() << "shouldn't get here"; + } + + ASSERT_EQ(p, (void*)ReadSigbus::s_si_addr); + ASSERT_EQ(0, munmap(p, len)) << strerror(errno); + leak(fd); +} + /* * A read via mmap comes up short, indicating that the file was truncated * server-side. @@ -634,6 +713,83 @@ TEST_F(Read, mmap_eof) leak(fd); } +/* + * During VOP_GETPAGES, the FUSE server fails a FUSE_GETATTR operation. This + * almost certainly indicates a buggy FUSE server, and our goal should be not + * to panic. Instead, generate SIGBUS. + */ +TEST_F(ReadSigbus, mmap_getblksz_fail) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + const char *CONTENTS = "abcdefgh"; + struct sigaction sa; + Sequence seq; + uint64_t ino = 42; + int fd; + ssize_t len; + size_t bufsize = strlen(CONTENTS); + mode_t mode = S_IFREG | 0644; + void *p; + + len = getpagesize(); + + FuseTest::expect_lookup(RELPATH, ino, mode, bufsize, 1, 0); + /* Expect two GETATTR calls that succeed, followed by one that fail. */ + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_GETATTR && + in.header.nodeid == ino); + }, Eq(true)), + _) + ).Times(2) + .InSequence(seq) + .WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) { + SET_OUT_HEADER_LEN(out, attr); + out.body.attr.attr.ino = ino; + out.body.attr.attr.mode = mode; + out.body.attr.attr.size = bufsize; + out.body.attr.attr_valid = 0; + }))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_GETATTR && + in.header.nodeid == ino); + }, Eq(true)), + _) + ).InSequence(seq) + .WillRepeatedly(Invoke(ReturnErrno(EIO))); + expect_open(ino, 0, 1); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_READ); + }, Eq(true)), + _) + ).Times(0); + + fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd) << strerror(errno); + + p = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0); + ASSERT_NE(MAP_FAILED, p) << strerror(errno); + + /* Accessing the mapped page should return SIGBUS. */ + bzero(&sa, sizeof(sa)); + sa.sa_handler = SIG_DFL; + sa.sa_sigaction = handle_sigbus; + sa.sa_flags = SA_RESETHAND | SA_SIGINFO; + ASSERT_EQ(0, sigaction(SIGBUS, &sa, NULL)) << strerror(errno); + if (setjmp(ReadSigbus::s_jmpbuf) == 0) { + atomic_signal_fence(std::memory_order::memory_order_seq_cst); + volatile char x __unused = *(volatile char*)p; + FAIL() << "shouldn't get here"; + } + + ASSERT_EQ(p, (void*)ReadSigbus::s_si_addr); + ASSERT_EQ(0, munmap(p, len)) << strerror(errno); + leak(fd); +} + /* * Just as when FOPEN_DIRECT_IO is used, reads with O_DIRECT should bypass * cache and to straight to the daemon From owner-dev-commits-src-main@freebsd.org Tue Sep 21 20:03: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 0A22B67A247; Tue, 21 Sep 2021 20:03: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 4HDXRw6rS9z4RvL; Tue, 21 Sep 2021 20:03: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 CA7A82345; Tue, 21 Sep 2021 20:03: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 18LK3e4S047027; Tue, 21 Sep 2021 20:03:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LK3eWu047026; Tue, 21 Sep 2021 20:03:40 GMT (envelope-from git) Date: Tue, 21 Sep 2021 20:03:40 GMT Message-Id: <202109212003.18LK3eWu047026@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: bd84094a51c4 - main - sched_ule(4): Fix interactive threads stealing. 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: bd84094a51c4648a7c97ececdaccfb30bc832096 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, 21 Sep 2021 20:03:41 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=bd84094a51c4648a7c97ececdaccfb30bc832096 commit bd84094a51c4648a7c97ececdaccfb30bc832096 Author: Alexander Motin AuthorDate: 2021-09-21 19:56:49 +0000 Commit: Alexander Motin CommitDate: 2021-09-21 20:03:32 +0000 sched_ule(4): Fix interactive threads stealing. In scenarios when first thread in the queue can migrate to specified CPU, but later ones can't runq_steal_from() incorrectly returned NULL. MFC after: 2 weeks --- sys/kern/sched_ule.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 9bcc2a64e2b8..90f294bb0d4d 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1110,10 +1110,12 @@ again: continue; rqh = &rq->rq_queues[bit + (i << RQB_L2BPW)]; TAILQ_FOREACH(td, rqh, td_runq) { - if (first && THREAD_CAN_MIGRATE(td) && - THREAD_CAN_SCHED(td, cpu)) - return (td); - first = td; + if (first) { + if (THREAD_CAN_MIGRATE(td) && + THREAD_CAN_SCHED(td, cpu)) + return (td); + } else + first = td; } } } From owner-dev-commits-src-main@freebsd.org Tue Sep 21 20:29: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 9359867ACAF; Tue, 21 Sep 2021 20:29: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 4HDY1p3rNgz4VS5; Tue, 21 Sep 2021 20:29: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 644762A1A; Tue, 21 Sep 2021 20:29: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 18LKTYLp074542; Tue, 21 Sep 2021 20:29:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LKTYXg074541; Tue, 21 Sep 2021 20:29:34 GMT (envelope-from git) Date: Tue, 21 Sep 2021 20:29:34 GMT Message-Id: <202109212029.18LKTYXg074541@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: 680ca739458b - main - powerpc64: fix loader regression 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: 680ca739458ba8cba221ea74794c2cd9771c77f8 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, 21 Sep 2021 20:29:34 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=680ca739458ba8cba221ea74794c2cd9771c77f8 commit 680ca739458ba8cba221ea74794c2cd9771c77f8 Author: Leandro Lupori AuthorDate: 2021-09-21 20:22:42 +0000 Commit: Leandro Lupori CommitDate: 2021-09-21 20:22:42 +0000 powerpc64: fix loader regression After b4cb3fe0e39a, loader started crashing on PowerPC64, with a Program Exception (700) error. The problem was that archsw was used before being initialized, with the new mount feature. This change fixes the issue by initializing archsw earlier, before setting currdev, that triggers the mount. Reviewed by: tsoome MFC after: 1 month X-MFC-With: b4cb3fe0e39a Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D32027 --- stand/powerpc/ofw/main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/stand/powerpc/ofw/main.c b/stand/powerpc/ofw/main.c index e705871796b1..7b1ec384b6bd 100644 --- a/stand/powerpc/ofw/main.c +++ b/stand/powerpc/ofw/main.c @@ -137,6 +137,17 @@ main(int (*openfirm)(void *)) */ cons_probe(); + archsw.arch_getdev = ofw_getdev; + archsw.arch_copyin = ofw_copyin; + archsw.arch_copyout = ofw_copyout; + archsw.arch_readin = ofw_readin; +#ifdef CAS + setenv("cas", "1", 0); + archsw.arch_autoload = ppc64_autoload; +#else + archsw.arch_autoload = ofw_autoload; +#endif + /* Set up currdev variable to have hooks in place. */ env_setenv("currdev", EV_VOLATILE, "", ofw_setcurrdev, env_nounset); @@ -183,17 +194,6 @@ main(int (*openfirm)(void *)) if (!(mfmsr() & PSL_DR)) setenv("usefdt", "1", 1); - archsw.arch_getdev = ofw_getdev; - archsw.arch_copyin = ofw_copyin; - archsw.arch_copyout = ofw_copyout; - archsw.arch_readin = ofw_readin; -#ifdef CAS - setenv("cas", "1", 0); - archsw.arch_autoload = ppc64_autoload; -#else - archsw.arch_autoload = ofw_autoload; -#endif - interact(); /* doesn't return */ OF_exit(); From owner-dev-commits-src-main@freebsd.org Tue Sep 21 20:53: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 7545567B403; Tue, 21 Sep 2021 20:53:24 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (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 4HDYYJ29FMz4Yl2; Tue, 21 Sep 2021 20:53:24 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTP id SgMUmY37HczbLSmlSmFCcI; Tue, 21 Sep 2021 20:53:18 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id SmlQmh1WpcHSBSmlRmLzbG; Tue, 21 Sep 2021 20:53:18 +0000 X-Authority-Analysis: v=2.4 cv=I4EG+Psg c=1 sm=1 tr=0 ts=614a463e a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=7QKq2e-ADPsA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=WaiMuAdy-9gZHEPFDb0A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo: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 A86DE27B; Tue, 21 Sep 2021 13:53:14 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 18LKrErT005572; Tue, 21 Sep 2021 13:53:14 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202109212053.18LKrErT005572@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: Konstantin Belousov cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: bd9e0f5df681 - main - amd64: eliminate td_md.md_fpu_scratch In-reply-to: <202109211721.18LHLGn6028952@gitrepo.freebsd.org> References: <202109211721.18LHLGn6028952@gitrepo.freebsd.org> Comments: In-reply-to Konstantin Belousov message dated "Tue, 21 Sep 2021 17:21:16 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 21 Sep 2021 13:53:14 -0700 X-CMAE-Envelope: MS4xfA/nyqwnApZXKS61WWlTM62cSFVIf9mV2+a/XBnu5mqVetsske+oCNzyEMEaWGGImPmqqvG80pR7C2v/WIN+6pvD2XZnhgdRV7UMeW+6N264Pp1H9YOY zblUH2ykMdckIaxN0h3PxsB57vKT45Qhd17BWsO+ZAcdEayGq0QKZevTJtQ4c1a/9LBEXQskDg/pSfKo1vDYdx5ybD0aZLW5HwI4d7FPc47PXkR91kcWoad+ TBHbm9i4U7c0HgAAqq7+HNu14gsST876Urs4qSFiNKvLZb+aELKcCUBlb4H7ZDufRR5H1QkgIkwK3gVBIBFNgXH2J8gEAGAFJM53jSVvzUc= X-Rspamd-Queue-Id: 4HDYYJ29FMz4Yl2 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, 21 Sep 2021 20:53:24 -0000 In message <202109211721.18LHLGn6028952@gitrepo.freebsd.org>, Konstantin Belous ov writes: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=bd9e0f5df681da8b5ef05a587b4b5b07 > 572d3fc2 > > commit bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 > Author: Konstantin Belousov > AuthorDate: 2021-09-15 18:37:47 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-09-21 17:20:15 +0000 > > amd64: eliminate td_md.md_fpu_scratch > > For signal send, copyout from the user FPU save area directly. > > For sigreturn, we are in sleepable context and can do temporal > allocation of the transient save area. We cannot copying from userspace > directly to user save area because XSAVE state needs to be validated, > also partial copyins can corrupt it. > > Requested by: jhb > Reviewed by: jhb, markj > Tested by: pho > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D31954 > --- > sys/amd64/amd64/exec_machdep.c | 47 +++++++++++++++++++--------------------- > -- > sys/amd64/amd64/vm_machdep.c | 3 --- > sys/amd64/ia32/ia32_signal.c | 43 ++++++++++++++++---------------------- > sys/amd64/include/proc.h | 1 - > sys/kern/kern_thread.c | 2 +- > 5 files changed, 40 insertions(+), 56 deletions(-) > > diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c > index 48bda05f9685..168c24cbb65b 100644 > --- a/sys/amd64/amd64/exec_machdep.c > +++ b/sys/amd64/amd64/exec_machdep.c > @@ -96,7 +96,7 @@ __FBSDID("$FreeBSD$"); > #include > > static void get_fpcontext(struct thread *td, mcontext_t *mcp, > - char *xfpusave, size_t xfpusave_len); > + char **xfpusave, size_t *xfpusave_len); > static int set_fpcontext(struct thread *td, mcontext_t *mcp, > char *xfpustate, size_t xfpustate_len); > > @@ -133,14 +133,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) > regs = td->td_frame; > oonstack = sigonstack(regs->tf_rsp); > > - if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { > - xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - xfpusave = (char *)td->td_md.md_fpu_scratch; > - } else { > - xfpusave_len = 0; > - xfpusave = NULL; > - } > - > /* Save user context. */ > bzero(&sf, sizeof(sf)); > sf.sf_uc.uc_sigmask = *mask; > @@ -150,7 +142,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) > sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; > bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs)); > sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ > - get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); > + get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len); > fpstate_drop(td); > update_pcb_bases(pcb); > sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; > @@ -301,10 +293,11 @@ sys_sigreturn(struct thread *td, struct sigreturn_args > *uap) > p->p_pid, td->td_name, xfpustate_len); > return (EINVAL); > } > - xfpustate = __builtin_alloca(xfpustate_len); > + xfpustate = (char *)fpu_save_area_alloc(); > error = copyin((const void *)uc.uc_mcontext.mc_xfpustate, > xfpustate, xfpustate_len); > if (error != 0) { > + fpu_save_area_free((struct savefpu *)xfpustate); > uprintf( > "pid %d (%s): sigreturn copying xfpustate failed\n", > p->p_pid, td->td_name); > @@ -315,6 +308,7 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *u > ap) > xfpustate_len = 0; > } > ret = set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); > + fpu_save_area_free((struct savefpu *)xfpustate); > if (ret != 0) { > uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", > p->p_pid, td->td_name, ret); > @@ -674,14 +668,17 @@ set_mcontext(struct thread *td, mcontext_t *mcp) > if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - > sizeof(struct savefpu)) > return (EINVAL); > - xfpustate = (char *)td->td_md.md_fpu_scratch; > + xfpustate = (char *)fpu_save_area_alloc(); > ret = copyin((void *)mcp->mc_xfpustate, xfpustate, > mcp->mc_xfpustate_len); > - if (ret != 0) > + if (ret != 0) { > + fpu_save_area_free((struct savefpu *)xfpustate); > return (ret); > + } > } else > xfpustate = NULL; > ret = set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); > + fpu_save_area_free((struct savefpu *)xfpustate); > if (ret != 0) > return (ret); > tp->tf_r15 = mcp->mc_r15; > @@ -719,26 +716,24 @@ set_mcontext(struct thread *td, mcontext_t *mcp) > } > > static void > -get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, > - size_t xfpusave_len) > +get_fpcontext(struct thread *td, mcontext_t *mcp, char **xfpusave, > + size_t *xfpusave_len) > { > - size_t max_len, len; > - > mcp->mc_ownedfp = fpugetregs(td); > bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], > sizeof(mcp->mc_fpstate)); > mcp->mc_fpformat = fpuformat(); > - if (!use_xsave || xfpusave_len == 0) > + if (xfpusave == NULL) > return; > - max_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - len = xfpusave_len; > - if (len > max_len) { > - len = max_len; > - bzero(xfpusave + max_len, len - max_len); > + if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { > + *xfpusave_len = 0; > + *xfpusave = NULL; > + } else { > + mcp->mc_flags |= _MC_HASFPXSTATE; > + *xfpusave_len = mcp->mc_xfpustate_len = > + cpu_max_ext_state_size - sizeof(struct savefpu); > + *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); > } > - mcp->mc_flags |= _MC_HASFPXSTATE; > - mcp->mc_xfpustate_len = len; > - bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); > } > > static int > diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c > index e42d16d61b3a..0bfcd03d6655 100644 > --- a/sys/amd64/amd64/vm_machdep.c > +++ b/sys/amd64/amd64/vm_machdep.c > @@ -392,7 +392,6 @@ cpu_thread_alloc(struct thread *td) > td->td_pcb = pcb = get_pcb_td(td); > td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; > td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); > - td->td_md.md_fpu_scratch = fpu_save_area_alloc(); > pcb->pcb_save = get_pcb_user_save_pcb(pcb); > if (use_xsave) { > xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); > @@ -408,8 +407,6 @@ cpu_thread_free(struct thread *td) > > fpu_save_area_free(td->td_md.md_usr_fpu_save); > td->td_md.md_usr_fpu_save = NULL; > - fpu_save_area_free(td->td_md.md_fpu_scratch); > - td->td_md.md_fpu_scratch = NULL; > } > > bool > diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c > index 9b67c7001a87..1ca19072a1dc 100644 > --- a/sys/amd64/ia32/ia32_signal.c > +++ b/sys/amd64/ia32/ia32_signal.c > @@ -87,10 +87,8 @@ static void freebsd4_ia32_sendsig(sig_t, ksiginfo_t *, sig > set_t *); > > static void > ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, > - char *xfpusave, size_t xfpusave_len) > + char **xfpusave, size_t *xfpusave_len) > { > - size_t max_len, len; > - > /* > * XXX Format of 64bit and 32bit FXSAVE areas differs. FXSAVE > * in 32bit mode saves %cs and %ds, while on 64bit it saves > @@ -101,17 +99,15 @@ ia32_get_fpcontext(struct thread *td, struct ia32_mconte > xt *mcp, > bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], > sizeof(mcp->mc_fpstate)); > mcp->mc_fpformat = fpuformat(); > - if (!use_xsave || xfpusave_len == 0) > - return; > - max_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - len = xfpusave_len; > - if (len > max_len) { > - len = max_len; > - bzero(xfpusave + max_len, len - max_len); > + if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { > + *xfpusave_len = 0; > + *xfpusave = NULL; > + } else { > + mcp->mc_flags |= _MC_IA32_HASFPXSTATE; > + *xfpusave_len = mcp->mc_xfpustate_len = This commit causes a panic running and i386 poudriere on an amd64. Notice the ud2 machine instruction at line 107 in the disassemble portion of this reply. Unread portion of the kernel message buffer: interrupt enabled, resume, IOPL = 0 current process = 5200 (cc) trap number = 1 panic: privileged instruction fault cpuid = 3 time = 1632253591 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00e52377d0 vpanic() at vpanic+0x187/frame 0xfffffe00e5237830 panic() at panic+0x43/frame 0xfffffe00e5237890 trap_fatal() at trap_fatal+0x387/frame 0xfffffe00e52378f0 trap() at trap+0x8b/frame 0xfffffe00e5237a00 calltrap() at calltrap+0x8/frame 0xfffffe00e5237a00 --- trap 0x1, rip = 0xffffffff80a5fef1, rsp = 0xfffffe00e5237ad0, rbp = 0xfffffe00e5237af0 --- ia32_get_mcontext() at ia32_get_mcontext+0x181/frame 0xfffffe00e5237af0 freebsd32_getcontext() at freebsd32_getcontext+0x52/frame 0xfffffe00e5237df0 ia32_syscall() at ia32_syscall+0x126/frame 0xfffffe00e5237f30 int0x80_syscall_common() at int0x80_syscall_common+0x9c/frame 0xffffca38 Uptime: 8m48s Dumping 526 out of 8161 MB: (CTRL-C to abort) ..4%..13%..22%..31%..43%..52%. .61%..73%..83%..92% __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 55 __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu, (kgdb) bt #0 __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:55 #1 doadump (textdump=textdump@entry=1) at /opt/src/git-src/sys/kern/kern_shutdown.c:399 #2 0xffffffff806d417b in kern_reboot (howto=260) at /opt/src/git-src/sys/kern/kern_shutdown.c:486 #3 0xffffffff806d45f6 in vpanic (fmt=0xffffffff80a9b26c "%s", ap=) at /opt/src/git-src/sys/kern/kern_shutdown.c:919 #4 0xffffffff806d43f3 in panic (fmt=) at /opt/src/git-src/sys/kern/kern_shutdown.c:843 #5 0xffffffff80a3a587 in trap_fatal (frame=0xfffffe00e5237a10, eva=0) at /opt/src/git-src/sys/amd64/amd64/trap.c:946 #6 0xffffffff80a39a7b in trap (frame=0xfffffe00e5237a10) at /opt/src/git-src/sys/amd64/amd64/trap.c:251 #7 #8 0xffffffff80a5fef1 in ia32_get_fpcontext (td=0xfffffe00e468f3a0, mcp=0xfffffe00e5237b10, xfpusave=0x0, xfpusave_len=0x0) at /opt/src/git-src/sys/amd64/ia32/ia32_signal.c:107 #9 ia32_get_mcontext (td=td@entry=0xfffffe00e468f3a0, mcp=mcp@entry=0xfffffe00e5237b10, flags=1) at /opt/src/git-src/sys/amd64/ia32/ia32_signal.c:177 #10 0xffffffff80a5fca2 in freebsd32_getcontext (td=0xfffffe00e468f3a0, uap=0xfffffe00e468f790) at /opt/src/git-src/sys/amd64/ia32/ia32_signal.c:260 #11 0xffffffff80a61a16 in syscallenter (td=0xfffffe00e468f3a0) at /opt/src/git-src/sys/amd64/ia32/../../kern/subr_syscall.c:189 #12 ia32_syscall (frame=0xfffffe00e5237f40) at /opt/src/git-src/sys/amd64/ia32/ia32_syscall.c:218 #13 0xffffffff80a12bcf in int0x80_syscall_common () at /opt/src/git-src/sys/amd64/ia32/ia32_exception.S:77 #14 0x00000000ffffc710 in ?? () #15 0x00000000ffffc9d0 in ?? () #16 0x000000002540b9ad in ?? () #17 0x000000002526104f in ?? () #18 0x0000000000000000 in ?? () (kgdb) frame 8 #8 0xffffffff80a5fef1 in ia32_get_fpcontext (td=0xfffffe00e468f3a0, mcp=0xfffffe00e5237b10, xfpusave=0x0, xfpusave_len=0x0) at /opt/src/git-src/sys/amd64/ia32/ia32_signal.c:107 107 *xfpusave_len = mcp->mc_xfpustate_len = (kgdb) l 102 if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { 103 *xfpusave_len = 0; 104 *xfpusave = NULL; 105 } else { 106 mcp->mc_flags |= _MC_IA32_HASFPXSTATE; 107 *xfpusave_len = mcp->mc_xfpustate_len = 108 cpu_max_ext_state_size - sizeof(struct savefpu); 109 *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); 110 } 111 } (kgdb) disassemble /m Dump of assembler code for function ia32_get_mcontext: 98 mcp->mc_ownedfp = fpugetregs(td); 0xffffffff80a5fe9d <+301>: mov %r14,%rdi 0xffffffff80a5fea0 <+304>: call 0xffffffff80a16ca0 0xffffffff80a5fea5 <+309>: mov %eax,0x58(%rbx) 99 bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], 0xffffffff80a5fea8 <+312>: lea 0x60(%rbx),%r15 0xffffffff80a5feac <+316>: mov %r14,%rdi 0xffffffff80a5feaf <+319>: call 0xffffffff80a3bbc0 0xffffffff80a5feb4 <+324>: mov $0x200,%edx 0xffffffff80a5feb9 <+329>: mov %r15,%rdi 0xffffffff80a5febc <+332>: mov %rax,%rsi 0xffffffff80a5febf <+335>: call 0xffffffff80a35d20 100 sizeof(mcp->mc_fpstate)); 101 mcp->mc_fpformat = fpuformat(); 0xffffffff80a5fec4 <+340>: call 0xffffffff80a169e0 0xffffffff80a5fec9 <+345>: mov %eax,0x54(%rbx) 102 if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { 0xffffffff80a5fecc <+348>: cmpl $0x0,0x53c73d(%rip) # 0xffffffff80f9c610 0xffffffff80a5fed3 <+355>: je 0xffffffff80a5fef1 0xffffffff80a5fed5 <+357>: mov 0x5274bd(%rip),%eax # 0xffffffff80f87398 0xffffffff80a5fedb <+363>: cmp $0x200,%eax 0xffffffff80a5fee0 <+368>: jbe 0xffffffff80a5fef1 103 *xfpusave_len = 0; 104 *xfpusave = NULL; 105 } else { 106 mcp->mc_flags |= _MC_IA32_HASFPXSTATE; 0xffffffff80a5fee2 <+370>: orb $0x4,0x5c(%rbx) 107 *xfpusave_len = mcp->mc_xfpustate_len = 0xffffffff80a5feeb <+379>: mov %eax,0x26c(%rbx) => 0xffffffff80a5fef1 <+385>: ud2 0xffffffff80a5fef3 <+387>: xor %eax,%eax 0xffffffff80a5fef5 <+389>: mov $0x140,%edi 108 cpu_max_ext_state_size - sizeof(struct savefpu); 0xffffffff80a5fee6 <+374>: add $0xfffffe00,%eax 109 *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); 110 } 111 } 112 113 static int --Type for more, q to quit, c to continue without paging--q > + cpu_max_ext_state_size - sizeof(struct savefpu); > + *xfpusave = (char *)(get_pcb_user_save_td(td) + 1); > } > - mcp->mc_flags |= _MC_IA32_HASFPXSTATE; > - mcp->mc_xfpustate_len = len; > - bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len); > } > > static int > @@ -210,14 +206,17 @@ ia32_set_mcontext(struct thread *td, struct ia32_mconte > xt *mcp) > if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - > sizeof(struct savefpu)) > return (EINVAL); > - xfpustate = (char *)td->td_md.md_fpu_scratch; > + xfpustate = (char *)fpu_save_area_alloc(); > ret = copyin(PTRIN(mcp->mc_xfpustate), xfpustate, > mcp->mc_xfpustate_len); > - if (ret != 0) > + if (ret != 0) { > + fpu_save_area_free((struct savefpu *)xfpustate); > return (ret); > + } > } else > xfpustate = NULL; > ret = ia32_set_fpcontext(td, mcp, xfpustate, mcp->mc_xfpustate_len); > + fpu_save_area_free((struct savefpu *)xfpustate); > if (ret != 0) > return (ret); > tp->tf_gs = mcp->mc_gs; > @@ -577,14 +576,6 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *m > ask) > regs = td->td_frame; > oonstack = sigonstack(regs->tf_rsp); > > - if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { > - xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - xfpusave = (char *)td->td_md.md_fpu_scratch; > - } else { > - xfpusave_len = 0; > - xfpusave = NULL; > - } > - > /* Save user context. */ > bzero(&sf, sizeof(sf)); > sf.sf_uc.uc_sigmask = *mask; > @@ -613,7 +604,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *ma > sk) > sf.sf_uc.uc_mcontext.mc_fs = regs->tf_fs; > sf.sf_uc.uc_mcontext.mc_gs = regs->tf_gs; > sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ > - ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); > + ia32_get_fpcontext(td, &sf.sf_uc.uc_mcontext, &xfpusave, &xfpusave_len) > ; > fpstate_drop(td); > sf.sf_uc.uc_mcontext.mc_fsbase = td->td_pcb->pcb_fsbase; > sf.sf_uc.uc_mcontext.mc_gsbase = td->td_pcb->pcb_gsbase; > @@ -882,10 +873,11 @@ freebsd32_sigreturn(td, uap) > td->td_proc->p_pid, td->td_name, xfpustate_len); > return (EINVAL); > } > - xfpustate = (char *)td->td_md.md_fpu_scratch; > + xfpustate = (char *)fpu_save_area_alloc(); > error = copyin(PTRIN(ucp->uc_mcontext.mc_xfpustate), > xfpustate, xfpustate_len); > if (error != 0) { > + fpu_save_area_free((struct savefpu *)xfpustate); > uprintf( > "pid %d (%s): sigreturn copying xfpustate failed\n", > td->td_proc->p_pid, td->td_name); > @@ -897,6 +889,7 @@ freebsd32_sigreturn(td, uap) > } > ret = ia32_set_fpcontext(td, &ucp->uc_mcontext, xfpustate, > xfpustate_len); > + fpu_save_area_free((struct savefpu *)xfpustate); > if (ret != 0) { > uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", > td->td_proc->p_pid, td->td_name, ret); > diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h > index bd07f70f8d44..94ac69d31e65 100644 > --- a/sys/amd64/include/proc.h > +++ b/sys/amd64/include/proc.h > @@ -76,7 +76,6 @@ struct mdthread { > struct pcb md_pcb; > vm_offset_t md_stack_base; > struct savefpu *md_usr_fpu_save; > - struct savefpu *md_fpu_scratch; > }; > > struct mdproc { > diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c > index 62f939406374..65c5cc65c87e 100644 > --- a/sys/kern/kern_thread.c > +++ b/sys/kern/kern_thread.c > @@ -91,7 +91,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0x110, > "struct thread KBI td_pflags"); > _Static_assert(offsetof(struct thread, td_frame) == 0x4a8, > "struct thread KBI td_frame"); > -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6c0, > +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, > "struct thread KBI td_emuldata"); > _Static_assert(offsetof(struct proc, p_flag) == 0xb8, > "struct proc KBI p_flag"); > -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-main@freebsd.org Tue Sep 21 21:16: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 98B8E67B430; Tue, 21 Sep 2021 21:16: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 4HDZ3Y3r2cz4b72; Tue, 21 Sep 2021 21:16: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 6377533EE; Tue, 21 Sep 2021 21:16: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 18LLG9k9041133; Tue, 21 Sep 2021 21:16:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLG9xe041132; Tue, 21 Sep 2021 21:16:09 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:16:09 GMT Message-Id: <202109212116.18LLG9xe041132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: ae5a522cae7e - main - nvmecontrol: Display Metadata and Sanitize capabilities of the device MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae5a522cae7e95790e84274c4ba23bbd1e4f3033 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, 21 Sep 2021 21:16:09 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=ae5a522cae7e95790e84274c4ba23bbd1e4f3033 commit ae5a522cae7e95790e84274c4ba23bbd1e4f3033 Author: Allan Jude AuthorDate: 2021-09-21 21:14:20 +0000 Commit: Allan Jude CommitDate: 2021-09-21 21:15:55 +0000 nvmecontrol: Display Metadata and Sanitize capabilities of the device Determine if a device supports "Extended" or "Separate" metadata, and what the current metadata setting is (None, Extended, Separate) Also determine if the device supports: - Sanitize Crypto Erase - Sanitize Block Erase - Sanitize Overwrite Reviewed by: chuck Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #49 Differential Revision: https://reviews.freebsd.org/D31067 --- sbin/nvmecontrol/identify.c | 12 +++++++++++- sbin/nvmecontrol/identify_ext.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/identify.c b/sbin/nvmecontrol/identify.c index 6cd7ad0fdc2d..0d4d8003e5d2 100644 --- a/sbin/nvmecontrol/identify.c +++ b/sbin/nvmecontrol/identify.c @@ -84,7 +84,17 @@ print_namespace(struct nvme_namespace_data *nsdata) printf("Thin Provisioning: %s\n", thin_prov ? "Supported" : "Not Supported"); printf("Number of LBA Formats: %d\n", nsdata->nlbaf+1); - printf("Current LBA Format: LBA Format #%02d\n", flbas_fmt); + printf("Current LBA Format: LBA Format #%02d", flbas_fmt); + if (nsdata->lbaf[flbas_fmt] >> NVME_NS_DATA_LBAF_MS_SHIFT & NVME_NS_DATA_LBAF_MS_MASK) + printf(" %s metadata\n", nsdata->flbas >> NVME_NS_DATA_FLBAS_EXTENDED_SHIFT & + NVME_NS_DATA_FLBAS_EXTENDED_MASK ? "Extended" : "Separate"); + else + printf("\n"); + printf("Metadata Capabilities\n"); + printf(" Extended: %s\n", + nsdata->mc >> NVME_NS_DATA_MC_EXTENDED_SHIFT & NVME_NS_DATA_MC_EXTENDED_MASK ? "Supported" : "Not Supported"); + printf(" Separate: %s\n", + nsdata->mc >> NVME_NS_DATA_MC_POINTER_SHIFT & NVME_NS_DATA_MC_POINTER_MASK ? "Supported" : "Not Supported"); printf("Data Protection Caps: %s%s%s%s%s%s\n", (nsdata->dpc == 0) ? "Not Supported" : "", ((nsdata->dpc >> NVME_NS_DATA_DPC_MD_END_SHIFT) & diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c index 311c8cba09a9..50b8901b799e 100644 --- a/sbin/nvmecontrol/identify_ext.c +++ b/sbin/nvmecontrol/identify_ext.c @@ -124,6 +124,38 @@ nvme_print_controller(struct nvme_controller_data *cdata) printf("Unlimited\n"); else printf("%ld bytes\n", PAGE_SIZE * (1L << cdata->mdts)); + printf("Sanitize Crypto Erase: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_CES_SHIFT) & + NVME_CTRLR_DATA_SANICAP_CES_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize Block Erase: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_BES_SHIFT) & + NVME_CTRLR_DATA_SANICAP_BES_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize Overwrite: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_OWS_SHIFT) & + NVME_CTRLR_DATA_SANICAP_OWS_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize NDI: %s\n", + ((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_NDI_SHIFT) & + NVME_CTRLR_DATA_SANICAP_NDI_MASK) ? + "Supported" : "Not Supported"); + printf("Sanitize NODMMAS: "); + switch (((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_NODMMAS_SHIFT) & + NVME_CTRLR_DATA_SANICAP_NODMMAS_MASK)) { + case NVME_CTRLR_DATA_SANICAP_NODMMAS_UNDEF: + printf("Undefined\n"); + break; + case NVME_CTRLR_DATA_SANICAP_NODMMAS_NO: + printf("No\n"); + break; + case NVME_CTRLR_DATA_SANICAP_NODMMAS_YES: + printf("Yes\n"); + break; + default: + printf("Unknown\n"); + break; + } printf("Controller ID: 0x%04x\n", cdata->ctrlr_id); printf("Version: %d.%d.%d\n", (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff, From owner-dev-commits-src-main@freebsd.org Tue Sep 21 21:17: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 5B8F967B7BB; Tue, 21 Sep 2021 21:17: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 4HDZ4m26v8z4bDC; Tue, 21 Sep 2021 21:17: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 2897532D6; Tue, 21 Sep 2021 21:17: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 18LLHCNd041359; Tue, 21 Sep 2021 21:17:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLHCVp041358; Tue, 21 Sep 2021 21:17:12 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:17:12 GMT Message-Id: <202109212117.18LLHCVp041358@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: c2ee4dfd0497 - main - ia32_get_fpcontext(): xfpusave can be legitimately NULL 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: c2ee4dfd04970f1597eea58bb30eb93e1ed5a491 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, 21 Sep 2021 21:17:12 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c2ee4dfd04970f1597eea58bb30eb93e1ed5a491 commit c2ee4dfd04970f1597eea58bb30eb93e1ed5a491 Author: Konstantin Belousov AuthorDate: 2021-09-21 21:09:34 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 21:17:06 +0000 ia32_get_fpcontext(): xfpusave can be legitimately NULL Reported by: cy Sponsored by: The FreeBSD Foundation MFC after: 1 week Fixes: bd9e0f5df681da8b5ef05 --- sys/amd64/ia32/ia32_signal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 1ca19072a1dc..ab7100f5b9fb 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -99,6 +99,8 @@ ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); + if (xfpusave == NULL) + return; if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { *xfpusave_len = 0; *xfpusave = NULL; From owner-dev-commits-src-main@freebsd.org Tue Sep 21 21:18: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 A002367B54A; Tue, 21 Sep 2021 21:18:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4HDZ5n27jKz4bCG; Tue, 21 Sep 2021 21:18:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 18LLHhaw086263 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 22 Sep 2021 00:17:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 18LLHhaw086263 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 18LLHhmv086261; Wed, 22 Sep 2021 00:17:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 22 Sep 2021 00:17:43 +0300 From: Konstantin Belousov To: Cy Schubert Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: bd9e0f5df681 - main - amd64: eliminate td_md.md_fpu_scratch Message-ID: References: <202109211721.18LHLGn6028952@gitrepo.freebsd.org> <202109212053.18LKrErT005572@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202109212053.18LKrErT005572@slippy.cwsent.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HDZ5n27jKz4bCG X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; 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, 21 Sep 2021 21:18:06 -0000 On Tue, Sep 21, 2021 at 01:53:14PM -0700, Cy Schubert wrote: > In message <202109211721.18LHLGn6028952@gitrepo.freebsd.org>, Konstantin > Belous > ov writes: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=bd9e0f5df681da8b5ef05a587b4b5b07 > > 572d3fc2 > > > > commit bd9e0f5df681da8b5ef05a587b4b5b07572d3fc2 > > Author: Konstantin Belousov > > AuthorDate: 2021-09-15 18:37:47 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-09-21 17:20:15 +0000 > > > > amd64: eliminate td_md.md_fpu_scratch > > This commit causes a panic running and i386 poudriere on an amd64. Notice > the ud2 machine instruction at line 107 in the disassemble portion of this > reply. > > Unread portion of the kernel message buffer: > interrupt enabled, resume, IOPL = 0 > current process = 5200 (cc) > trap number = 1 > panic: privileged instruction fault > cpuid = 3 > time = 1632253591 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > 0xfffffe00e52377d0 > vpanic() at vpanic+0x187/frame 0xfffffe00e5237830 > panic() at panic+0x43/frame 0xfffffe00e5237890 > trap_fatal() at trap_fatal+0x387/frame 0xfffffe00e52378f0 > trap() at trap+0x8b/frame 0xfffffe00e5237a00 > calltrap() at calltrap+0x8/frame 0xfffffe00e5237a00 > --- trap 0x1, rip = 0xffffffff80a5fef1, rsp = 0xfffffe00e5237ad0, rbp = > 0xfffffe00e5237af0 --- > ia32_get_mcontext() at ia32_get_mcontext+0x181/frame 0xfffffe00e5237af0 > freebsd32_getcontext() at freebsd32_getcontext+0x52/frame 0xfffffe00e5237df0 > ia32_syscall() at ia32_syscall+0x126/frame 0xfffffe00e5237f30 > int0x80_syscall_common() at int0x80_syscall_common+0x9c/frame 0xffffca38 Should be fixed by c2ee4dfd0497. I converted get_fpcontext(), but forgot about same change for ia32_get_fpcontext(), sorry. Thank you for the report. From owner-dev-commits-src-main@freebsd.org Tue Sep 21 21:19: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 3D01267B987; Tue, 21 Sep 2021 21:19: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 4HDZ7d1C7Bz4bFF; Tue, 21 Sep 2021 21:19: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 08BCD30F3; Tue, 21 Sep 2021 21:19: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 18LLJeb3041664; Tue, 21 Sep 2021 21:19:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLJeEh041663; Tue, 21 Sep 2021 21:19:40 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:19:40 GMT Message-Id: <202109212119.18LLJeEh041663@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: cf0ee8738e31 - main - Drop cloudabi 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: cf0ee8738e31aa9e6fbf4dca4dac56d89226a71a 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, 21 Sep 2021 21:19:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cf0ee8738e31aa9e6fbf4dca4dac56d89226a71a commit cf0ee8738e31aa9e6fbf4dca4dac56d89226a71a Author: Konstantin Belousov AuthorDate: 2021-09-12 22:50:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 21:18:44 +0000 Drop cloudabi According to https://github.com/NuxiNL/cloudlibc: CloudABI is no longer being maintained. It was an awesome experiment, but it never got enough traction to be sustainable. There is no reason to keep it in FreeBSD. Approved by: ed (private mail) Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31923 --- Makefile.inc1 | 2 - ObsoleteFiles.inc | 3 + lib/libsysdecode/errno.c | 97 -- lib/libsysdecode/syscallnames.c | 13 - lib/libsysdecode/sysdecode.h | 2 - share/man/man4/Makefile | 3 - share/man/man4/cloudabi.4 | 123 -- sys/amd64/cloudabi32/cloudabi32_sysvec.c | 239 ---- sys/amd64/cloudabi64/cloudabi64_sysvec.c | 226 --- sys/amd64/conf/NOTES | 6 - sys/arm/cloudabi32/cloudabi32_sysvec.c | 199 --- sys/arm64/cloudabi32/cloudabi32_sysvec.c | 207 --- sys/arm64/cloudabi64/cloudabi64_sysvec.c | 191 --- sys/compat/cloudabi/cloudabi_clock.c | 135 -- sys/compat/cloudabi/cloudabi_errno.c | 123 -- sys/compat/cloudabi/cloudabi_fd.c | 475 ------- sys/compat/cloudabi/cloudabi_file.c | 763 ---------- sys/compat/cloudabi/cloudabi_futex.c | 1165 ---------------- sys/compat/cloudabi/cloudabi_mem.c | 167 --- sys/compat/cloudabi/cloudabi_proc.c | 148 -- sys/compat/cloudabi/cloudabi_proto.h | 36 - sys/compat/cloudabi/cloudabi_random.c | 53 - sys/compat/cloudabi/cloudabi_sock.c | 186 --- sys/compat/cloudabi/cloudabi_thread.c | 66 - sys/compat/cloudabi/cloudabi_util.h | 87 -- sys/compat/cloudabi/cloudabi_vdso.c | 90 -- sys/compat/cloudabi/cloudabi_vdso.lds | 51 - sys/compat/cloudabi32/Makefile | 6 - sys/compat/cloudabi32/cloudabi32_fd.c | 145 -- sys/compat/cloudabi32/cloudabi32_module.c | 184 --- sys/compat/cloudabi32/cloudabi32_poll.c | 340 ----- sys/compat/cloudabi32/cloudabi32_proto.h | 420 ------ sys/compat/cloudabi32/cloudabi32_sock.c | 128 -- sys/compat/cloudabi32/cloudabi32_syscall.h | 57 - sys/compat/cloudabi32/cloudabi32_syscalls.c | 58 - sys/compat/cloudabi32/cloudabi32_sysent.c | 66 - sys/compat/cloudabi32/cloudabi32_systrace_args.c | 1458 -------------------- sys/compat/cloudabi32/cloudabi32_thread.c | 77 -- sys/compat/cloudabi32/cloudabi32_util.h | 51 - sys/compat/cloudabi32/syscalls.conf | 15 - sys/compat/cloudabi64/Makefile | 6 - sys/compat/cloudabi64/cloudabi64_fd.c | 145 -- sys/compat/cloudabi64/cloudabi64_module.c | 184 --- sys/compat/cloudabi64/cloudabi64_poll.c | 340 ----- sys/compat/cloudabi64/cloudabi64_proto.h | 420 ------ sys/compat/cloudabi64/cloudabi64_sock.c | 128 -- sys/compat/cloudabi64/cloudabi64_syscall.h | 57 - sys/compat/cloudabi64/cloudabi64_syscalls.c | 58 - sys/compat/cloudabi64/cloudabi64_sysent.c | 66 - sys/compat/cloudabi64/cloudabi64_systrace_args.c | 1458 -------------------- sys/compat/cloudabi64/cloudabi64_thread.c | 77 -- sys/compat/cloudabi64/cloudabi64_util.h | 51 - sys/compat/cloudabi64/syscalls.conf | 15 - sys/conf/files | 25 - sys/conf/files.amd64 | 26 - sys/conf/files.arm | 15 - sys/conf/files.arm64 | 25 - sys/conf/files.i386 | 12 - sys/conf/options | 2 - sys/contrib/cloudabi/cloudabi32_types.h | 189 --- sys/contrib/cloudabi/cloudabi64_types.h | 189 --- sys/contrib/cloudabi/cloudabi_types_common.h | 428 ------ sys/contrib/cloudabi/cloudabi_vdso_aarch64.S | 431 ------ sys/contrib/cloudabi/cloudabi_vdso_armv6.S | 396 ------ .../cloudabi/cloudabi_vdso_armv6_on_64bit.S | 732 ---------- sys/contrib/cloudabi/cloudabi_vdso_i686.S | 419 ------ sys/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S | 1058 -------------- sys/contrib/cloudabi/cloudabi_vdso_x86_64.S | 449 ------ sys/contrib/cloudabi/syscalls32.master | 274 ---- sys/contrib/cloudabi/syscalls64.master | 274 ---- sys/i386/cloudabi32/cloudabi32_sysvec.c | 209 --- sys/i386/conf/NOTES | 3 - sys/kern/kern_sig.c | 19 - sys/modules/Makefile | 11 - sys/modules/cloudabi/Makefile | 10 - sys/modules/cloudabi32/Makefile | 46 - sys/modules/cloudabi64/Makefile | 38 - sys/sys/sysent.h | 1 - sys/tools/makesyscalls.lua | 6 +- usr.bin/kdump/kdump.c | 5 - usr.bin/truss/setup.c | 18 - usr.bin/truss/syscall.h | 20 - usr.bin/truss/syscalls.c | 259 +--- 83 files changed, 6 insertions(+), 16449 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 8134bb93df03..ff5911edc384 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1519,8 +1519,6 @@ makeman: .PHONY _sysent_PATH= ${TMPPATH}:/usr/libexec _sysent_dirs= sys/kern _sysent_dirs+= sys/compat/freebsd32 -_sysent_dirs+= sys/compat/cloudabi32 \ - sys/compat/cloudabi64 _sysent_dirs+= sys/amd64/linux \ sys/amd64/linux32 \ sys/arm/linux \ diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 5879ddfc3185..1a5d235624eb 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20210921: remove couldabi +OLD_FILES+=usr/share/man/man4/cloudabi.4.gz + # 20210906: stop installing {llvm,clang,lldb}-tblgen OLD_FILES+=usr/bin/llvm-tblgen OLD_FILES+=usr/bin/clang-tblgen diff --git a/lib/libsysdecode/errno.c b/lib/libsysdecode/errno.c index d66493ad739d..b235e3abf4ed 100644 --- a/lib/libsysdecode/errno.c +++ b/lib/libsysdecode/errno.c @@ -40,87 +40,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#include - -static const int cloudabi_errno_table[] = { - [CLOUDABI_E2BIG] = E2BIG, - [CLOUDABI_EACCES] = EACCES, - [CLOUDABI_EADDRINUSE] = EADDRINUSE, - [CLOUDABI_EADDRNOTAVAIL] = EADDRNOTAVAIL, - [CLOUDABI_EAFNOSUPPORT] = EAFNOSUPPORT, - [CLOUDABI_EAGAIN] = EAGAIN, - [CLOUDABI_EALREADY] = EALREADY, - [CLOUDABI_EBADF] = EBADF, - [CLOUDABI_EBADMSG] = EBADMSG, - [CLOUDABI_EBUSY] = EBUSY, - [CLOUDABI_ECANCELED] = ECANCELED, - [CLOUDABI_ECHILD] = ECHILD, - [CLOUDABI_ECONNABORTED] = ECONNABORTED, - [CLOUDABI_ECONNREFUSED] = ECONNREFUSED, - [CLOUDABI_ECONNRESET] = ECONNRESET, - [CLOUDABI_EDEADLK] = EDEADLK, - [CLOUDABI_EDESTADDRREQ] = EDESTADDRREQ, - [CLOUDABI_EDOM] = EDOM, - [CLOUDABI_EDQUOT] = EDQUOT, - [CLOUDABI_EEXIST] = EEXIST, - [CLOUDABI_EFAULT] = EFAULT, - [CLOUDABI_EFBIG] = EFBIG, - [CLOUDABI_EHOSTUNREACH] = EHOSTUNREACH, - [CLOUDABI_EIDRM] = EIDRM, - [CLOUDABI_EILSEQ] = EILSEQ, - [CLOUDABI_EINPROGRESS] = EINPROGRESS, - [CLOUDABI_EINTR] = EINTR, - [CLOUDABI_EINVAL] = EINVAL, - [CLOUDABI_EIO] = EIO, - [CLOUDABI_EISCONN] = EISCONN, - [CLOUDABI_EISDIR] = EISDIR, - [CLOUDABI_ELOOP] = ELOOP, - [CLOUDABI_EMFILE] = EMFILE, - [CLOUDABI_EMLINK] = EMLINK, - [CLOUDABI_EMSGSIZE] = EMSGSIZE, - [CLOUDABI_EMULTIHOP] = EMULTIHOP, - [CLOUDABI_ENAMETOOLONG] = ENAMETOOLONG, - [CLOUDABI_ENETDOWN] = ENETDOWN, - [CLOUDABI_ENETRESET] = ENETRESET, - [CLOUDABI_ENETUNREACH] = ENETUNREACH, - [CLOUDABI_ENFILE] = ENFILE, - [CLOUDABI_ENOBUFS] = ENOBUFS, - [CLOUDABI_ENODEV] = ENODEV, - [CLOUDABI_ENOENT] = ENOENT, - [CLOUDABI_ENOEXEC] = ENOEXEC, - [CLOUDABI_ENOLCK] = ENOLCK, - [CLOUDABI_ENOLINK] = ENOLINK, - [CLOUDABI_ENOMEM] = ENOMEM, - [CLOUDABI_ENOMSG] = ENOMSG, - [CLOUDABI_ENOPROTOOPT] = ENOPROTOOPT, - [CLOUDABI_ENOSPC] = ENOSPC, - [CLOUDABI_ENOSYS] = ENOSYS, - [CLOUDABI_ENOTCONN] = ENOTCONN, - [CLOUDABI_ENOTDIR] = ENOTDIR, - [CLOUDABI_ENOTEMPTY] = ENOTEMPTY, - [CLOUDABI_ENOTRECOVERABLE] = ENOTRECOVERABLE, - [CLOUDABI_ENOTSOCK] = ENOTSOCK, - [CLOUDABI_ENOTSUP] = ENOTSUP, - [CLOUDABI_ENOTTY] = ENOTTY, - [CLOUDABI_ENXIO] = ENXIO, - [CLOUDABI_EOVERFLOW] = EOVERFLOW, - [CLOUDABI_EOWNERDEAD] = EOWNERDEAD, - [CLOUDABI_EPERM] = EPERM, - [CLOUDABI_EPIPE] = EPIPE, - [CLOUDABI_EPROTO] = EPROTO, - [CLOUDABI_EPROTONOSUPPORT] = EPROTONOSUPPORT, - [CLOUDABI_EPROTOTYPE] = EPROTOTYPE, - [CLOUDABI_ERANGE] = ERANGE, - [CLOUDABI_EROFS] = EROFS, - [CLOUDABI_ESPIPE] = ESPIPE, - [CLOUDABI_ESRCH] = ESRCH, - [CLOUDABI_ESTALE] = ESTALE, - [CLOUDABI_ETIMEDOUT] = ETIMEDOUT, - [CLOUDABI_ETXTBSY] = ETXTBSY, - [CLOUDABI_EXDEV] = EXDEV, - [CLOUDABI_ENOTCAPABLE] = ENOTCAPABLE, -}; - int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, int error) { @@ -145,12 +64,6 @@ sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, int error) break; } #endif - case SYSDECODE_ABI_CLOUDABI32: - case SYSDECODE_ABI_CLOUDABI64: - if (error >= 0 && - (unsigned int)error < nitems(cloudabi_errno_table)) - return (cloudabi_errno_table[error]); - break; default: break; } @@ -172,16 +85,6 @@ sysdecode_freebsd_to_abi_errno(enum sysdecode_abi abi, int error) return (linux_errtbl[error]); break; #endif - case SYSDECODE_ABI_CLOUDABI32: - case SYSDECODE_ABI_CLOUDABI64: { - unsigned int i; - - for (i = 0; i < nitems(cloudabi_errno_table); i++) { - if (error == cloudabi_errno_table[i]) - return (i); - } - break; - } default: break; } diff --git a/lib/libsysdecode/syscallnames.c b/lib/libsysdecode/syscallnames.c index 897f7e0fa53b..4638438964fd 100644 --- a/lib/libsysdecode/syscallnames.c +++ b/lib/libsysdecode/syscallnames.c @@ -64,11 +64,6 @@ static #include #endif -static -#include -static -#include - const char * sysdecode_syscallname(enum sysdecode_abi abi, unsigned int code) { @@ -96,14 +91,6 @@ sysdecode_syscallname(enum sysdecode_abi abi, unsigned int code) return (linux32_syscallnames[code]); break; #endif - case SYSDECODE_ABI_CLOUDABI32: - if (code < nitems(cloudabi32_syscallnames)) - return (cloudabi32_syscallnames[code]); - break; - case SYSDECODE_ABI_CLOUDABI64: - if (code < nitems(cloudabi64_syscallnames)) - return (cloudabi64_syscallnames[code]); - break; default: break; } diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h index cdb9205f3da1..1a35d0c9d685 100644 --- a/lib/libsysdecode/sysdecode.h +++ b/lib/libsysdecode/sysdecode.h @@ -34,8 +34,6 @@ enum sysdecode_abi { SYSDECODE_ABI_FREEBSD32, SYSDECODE_ABI_LINUX, SYSDECODE_ABI_LINUX32, - SYSDECODE_ABI_CLOUDABI64, - SYSDECODE_ABI_CLOUDABI32 }; int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi _abi, int _error); diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 7146cfe7ac8f..d83f4d03d9db 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -110,7 +110,6 @@ MAN= aac.4 \ chromebook_platform.4 \ ${_chvgpio.4} \ ciss.4 \ - cloudabi.4 \ ${_coretemp.4} \ cp2112.4 \ ${_cpuctl.4} \ @@ -631,8 +630,6 @@ MLINKS+=${_bxe.4} ${_if_bxe.4} MLINKS+=cas.4 if_cas.4 MLINKS+=cdce.4 if_cdce.4 MLINKS+=cfi.4 cfid.4 -MLINKS+=cloudabi.4 cloudabi32.4 \ - cloudabi.4 cloudabi64.4 MLINKS+=crypto.4 cryptodev.4 MLINKS+=cue.4 if_cue.4 MLINKS+=cxgb.4 if_cxgb.4 diff --git a/share/man/man4/cloudabi.4 b/share/man/man4/cloudabi.4 deleted file mode 100644 index 3e3f988da4d0..000000000000 --- a/share/man/man4/cloudabi.4 +++ /dev/null @@ -1,123 +0,0 @@ -.\" Copyright (c) 2015-2017 Nuxi, https://nuxi.nl/ -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.Dd November 30, 2017 -.Dt CLOUDABI 4 -.Os -.Sh NAME -.Nm cloudabi , -.Nm cloudabi32 , -.Nm cloudabi64 -.Nd CloudABI support -.Sh SYNOPSIS -Support for 32-bit CloudABI executables can be compiled into the kernel -by adding this line to the kernel configuration file: -.Bd -ragged -offset indent -.Cd "options COMPAT_CLOUDABI32" -.Ed -.Pp -Similarly, -support for 64-bit CloudABI executables can be enabled by adding this -line: -.Bd -ragged -offset indent -.Cd "options COMPAT_CLOUDABI64" -.Ed -.Pp -CloudABI support can also be loaded at boot time from -.Xr loader.conf 5 : -.Bd -literal -offset indent -cloudabi_load="YES" -cloudabi32_load="YES" -cloudabi64_load="YES" -.Ed -.Sh DESCRIPTION -CloudABI is a POSIX-like pure capability-based runtime environment, -similar to -.Xr capsicum 4 . -It can be used to develop applications that are cross-platform, -easier to test, -and hardened against security exploits. -.Pp -Support for CloudABI on -.Fx -consists of three separate kernel modules. -The -.Nm cloudabi -kernel module implements all of the system calls that do not depend on -data structures that differ between hardware architectures. -.Pp -The -.Nm cloudabi32 -and -.Nm cloudabi64 -kernel modules provide implementations of all of the machine-dependent -system calls, -assuming that pointers stored in data structures are either 32 bits or -64 bits in size. -These modules also provide the image activators that load and start ELF -executables. -.Pp -Though the -.Nm cloudabi -module can be loaded on any architecture supported by -.Fx , -the -.Nm cloudabi32 -module is only available on amd64, arm64, armv6, armv7 and i386. -The same holds for the -.Nm cloudabi64 -module, -which is only available for amd64 and arm64. -.Pp -A full cross compilation toolchain for CloudABI is available in the -.Pa devel/cloudabi-toolchain -port. -.Pp -The -.Pa sysutils/cloudabi-utils -port provides the -.Xr cloudabi-run 1 -utility. -.Xr cloudabi-run 1 -can be used to safely execute CloudABI processes with access to a -restricted set of resources. -.Sh SEE ALSO -.Xr cloudabi-run 1 , -.Xr capsicum 4 , -.Xr linux 4 , -.Xr elf 5 -.Pp -CloudABI for FreeBSD: -.Pa https://nuxi.nl/cloudabi/freebsd/ . -.Pp -cloudlibc on GitHub: -.Pa https://github.com/NuxiNL/cloudlibc . -.Pp -The CloudABI Ports Collection on GitHub: -.Pa https://github.com/NuxiNL/cloudabi-ports . -.Sh HISTORY -CloudABI support first appeared in -.Fx 11.0 . -.Sh AUTHORS -.An Nuxi : Pa https://nuxi.nl/ . diff --git a/sys/amd64/cloudabi32/cloudabi32_sysvec.c b/sys/amd64/cloudabi32/cloudabi32_sysvec.c deleted file mode 100644 index 5bb4803ac715..000000000000 --- a/sys/amd64/cloudabi32/cloudabi32_sysvec.c +++ /dev/null @@ -1,239 +0,0 @@ -/*- - * Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include - -extern const char *cloudabi32_syscallnames[]; -extern struct sysent cloudabi32_sysent[]; - -extern unsigned long ia32_maxssiz; - -static int -cloudabi32_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) -{ - int error; - uint32_t args[2]; - - /* Place auxiliary vector and TCB on the stack. */ - error = cloudabi32_fixup(stack_base, imgp); - if (error != 0) - return (error); - - /* - * On i386, the TCB is referred to by %gs:0. Reuse the empty - * space normally used by the return address (args[0]) to store - * a single element array, containing a pointer to the TCB. %gs - * base will point to this. - * - * Also let the first argument of the entry point (args[1]) - * refer to the auxiliary vector, which is stored right after - * the TCB. - */ - args[0] = *stack_base; - args[1] = *stack_base + - roundup(sizeof(cloudabi32_tcb_t), sizeof(register_t)); - *stack_base -= roundup2(sizeof(args), sizeof(register_t)); - return (copyout(args, (void *)*stack_base, sizeof(args))); -} - -static void -cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, - uintptr_t stack) -{ - - ia32_setregs(td, imgp, stack); - (void)cpu_set_user_tls(td, TO_PTR(stack)); -} - -static int -cloudabi32_fetch_syscall_args(struct thread *td) -{ - struct trapframe *frame; - struct syscall_args *sa; - int error; - - frame = td->td_frame; - sa = &td->td_sa; - - /* Obtain system call number. */ - sa->code = frame->tf_rax; - sa->original_code = sa->code; - if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) - return (ENOSYS); - sa->callp = &cloudabi32_sysent[sa->code]; - - /* - * Fetch system call arguments. - * - * The vDSO has already made sure that the arguments are - * eight-byte aligned. Pointers and size_t parameters are - * zero-extended. This makes it possible to copy in the - * arguments directly. As long as the call doesn't use 32-bit - * data structures, we can just invoke the same system call - * implementation used by 64-bit processes. - */ - error = copyin((void *)frame->tf_rcx, sa->args, - sa->callp->sy_narg * sizeof(sa->args[0])); - if (error != 0) - return (error); - - /* Default system call return values. */ - td->td_retval[0] = 0; - td->td_retval[1] = 0; - return (0); -} - -static void -cloudabi32_set_syscall_retval(struct thread *td, int error) -{ - struct trapframe *frame = td->td_frame; - - switch (error) { - case 0: - /* - * System call succeeded. - * - * Simply copy out the 64-bit return values into the - * same buffer provided for system call arguments. The - * vDSO will copy them to the right spot, truncating - * pointers and size_t values to 32 bits. - */ - frame->tf_rax = copyout(td->td_retval, (void *)frame->tf_rcx, - sizeof(td->td_retval)) == 0 ? 0 : CLOUDABI_EFAULT; - break; - case ERESTART: - /* Restart system call. */ - frame->tf_rip -= frame->tf_err; - frame->tf_r10 = frame->tf_rcx; - set_pcb_flags(td->td_pcb, PCB_FULL_IRET); - break; - case EJUSTRETURN: - break; - default: - /* System call returned an error. */ - frame->tf_rax = cloudabi_convert_errno(error); - break; - } -} - -static void -cloudabi32_schedtail(struct thread *td) -{ - struct trapframe *frame = td->td_frame; - register_t retval[2]; - - /* Return values for processes returning from fork. */ - if ((td->td_pflags & TDP_FORKING) != 0) { - retval[0] = CLOUDABI_PROCESS_CHILD; - retval[1] = td->td_tid; - copyout(retval, (void *)frame->tf_rcx, sizeof(retval)); - } -} - -int -cloudabi32_thread_setregs(struct thread *td, - const cloudabi32_threadattr_t *attr, uint32_t tcb) -{ - stack_t stack; - uint32_t args[3]; - void *frameptr; - int error; - - /* Perform standard register initialization. */ - stack.ss_sp = TO_PTR(attr->stack); - stack.ss_size = attr->stack_len - sizeof(args); - cpu_set_upcall(td, TO_PTR(attr->entry_point), NULL, &stack); - - /* - * Copy the arguments for the thread entry point onto the stack - * (args[1] and args[2]). Similar to process startup, use the - * otherwise unused return address (args[0]) for TLS. - */ - args[0] = tcb; - args[1] = td->td_tid; - args[2] = attr->argument; - frameptr = (void *)td->td_frame->tf_rsp; - error = copyout(args, frameptr, sizeof(args)); - if (error != 0) - return (error); - - return (cpu_set_user_tls(td, frameptr)); -} - -static struct sysentvec cloudabi32_elf_sysvec = { - .sv_size = CLOUDABI32_SYS_MAXSYSCALL, - .sv_table = cloudabi32_sysent, - .sv_fixup = cloudabi32_fixup_tcb, - .sv_name = "CloudABI ELF32", - .sv_coredump = elf32_coredump, - .sv_elf_core_osabi = ELFOSABI_FREEBSD, - .sv_elf_core_abi_vendor = FREEBSD_ABI_VENDOR, - .sv_elf_core_prepare_notes = elf32_prepare_notes, - .sv_minuser = FREEBSD32_MINUSER, - .sv_maxuser = FREEBSD32_MAXUSER, - .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, - .sv_copyout_strings = cloudabi32_copyout_strings, - .sv_setregs = cloudabi32_proc_setregs, - .sv_fixlimit = ia32_fixlimit, - .sv_maxssiz = &ia32_maxssiz, - .sv_flags = SV_ABI_CLOUDABI | SV_CAPSICUM | SV_IA32 | SV_ILP32, - .sv_set_syscall_retval = cloudabi32_set_syscall_retval, - .sv_fetch_syscall_args = cloudabi32_fetch_syscall_args, - .sv_syscallnames = cloudabi32_syscallnames, - .sv_schedtail = cloudabi32_schedtail, - .sv_set_fork_retval = x86_set_fork_retval, -}; - -INIT_SYSENTVEC(elf_sysvec, &cloudabi32_elf_sysvec); - -Elf32_Brandinfo cloudabi32_brand = { - .brand = ELFOSABI_CLOUDABI, - .machine = EM_386, - .sysvec = &cloudabi32_elf_sysvec, - .flags = BI_BRAND_ONLY_STATIC, -}; diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c deleted file mode 100644 index 82c971212087..000000000000 --- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c +++ /dev/null @@ -1,226 +0,0 @@ -/*- - * Copyright (c) 2015 Nuxi, https://nuxi.nl/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include - -extern const char *cloudabi64_syscallnames[]; -extern struct sysent cloudabi64_sysent[]; - -static int -cloudabi64_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) -{ - int error; - register_t tcbptr; - - /* Place auxiliary vector and TCB on the stack. */ - error = cloudabi64_fixup(stack_base, imgp); - if (error != 0) - return (error); - - /* - * On x86-64, the TCB is referred to by %fs:0. Take some space - * from the top of the stack to store a single element array, - * containing a pointer to the TCB. %fs base will point to this. - */ - tcbptr = (register_t)*stack_base; - *stack_base -= sizeof(tcbptr); - return (copyout(&tcbptr, (void *)*stack_base, sizeof(tcbptr))); -} - -static void -cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, - uintptr_t stack) -{ - struct trapframe *regs; - - exec_setregs(td, imgp, stack); - - /* - * The stack now contains a pointer to the TCB, the TCB itself, - * and the auxiliary vector. Let %rdx point to the auxiliary - * vector, and set %fs base to the address of the TCB. - */ - regs = td->td_frame; - regs->tf_rdi = stack + sizeof(register_t) + - roundup(sizeof(cloudabi64_tcb_t), sizeof(register_t)); - (void)cpu_set_user_tls(td, TO_PTR(stack)); -} - -static int -cloudabi64_fetch_syscall_args(struct thread *td) -{ - struct trapframe *frame; - struct syscall_args *sa; - - frame = td->td_frame; - sa = &td->td_sa; - - /* Obtain system call number. */ - sa->code = frame->tf_rax; - sa->original_code = sa->code; - if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) - return (ENOSYS); - sa->callp = &cloudabi64_sysent[sa->code]; - - /* Fetch system call arguments. */ - sa->args[0] = frame->tf_rdi; - sa->args[1] = frame->tf_rsi; - sa->args[2] = frame->tf_rdx; - sa->args[3] = frame->tf_rcx; /* Actually %r10. */ - sa->args[4] = frame->tf_r8; - sa->args[5] = frame->tf_r9; - - /* Default system call return values. */ - td->td_retval[0] = 0; - td->td_retval[1] = frame->tf_rdx; - return (0); -} - -static void -cloudabi64_set_syscall_retval(struct thread *td, int error) -{ - struct trapframe *frame = td->td_frame; - - switch (error) { - case 0: - /* System call succeeded. */ - frame->tf_rax = td->td_retval[0]; - frame->tf_rdx = td->td_retval[1]; - frame->tf_rflags &= ~PSL_C; - break; - case ERESTART: - /* Restart system call. */ - frame->tf_rip -= frame->tf_err; - frame->tf_r10 = frame->tf_rcx; - set_pcb_flags(td->td_pcb, PCB_FULL_IRET); - break; - case EJUSTRETURN: - break; - default: - /* System call returned an error. */ - frame->tf_rax = cloudabi_convert_errno(error); - frame->tf_rflags |= PSL_C; - break; - } -} - -static void -cloudabi64_schedtail(struct thread *td) -{ - struct trapframe *frame = td->td_frame; - - /* Initial register values for processes returning from fork. */ - frame->tf_rax = CLOUDABI_PROCESS_CHILD; - frame->tf_rdx = td->td_tid; -} - -int -cloudabi64_thread_setregs(struct thread *td, - const cloudabi64_threadattr_t *attr, uint64_t tcb) -{ - struct trapframe *frame; - stack_t stack; - uint64_t tcbptr; - int error; - - /* - * On x86-64, the TCB is referred to by %fs:0. Take some space - * from the top of the stack to store a single element array, - * containing a pointer to the TCB. %fs base will point to this. - */ - tcbptr = rounddown(attr->stack + attr->stack_len - sizeof(tcbptr), - _Alignof(tcbptr)); - error = copyout(&tcb, (void *)tcbptr, sizeof(tcb)); - if (error != 0) - return (error); - - /* Perform standard register initialization. */ - stack.ss_sp = TO_PTR(attr->stack); - stack.ss_size = tcbptr - attr->stack; - cpu_set_upcall(td, TO_PTR(attr->entry_point), NULL, &stack); - - /* - * Pass in the thread ID of the new thread and the argument - * pointer provided by the parent thread in as arguments to the - * entry point. - */ - frame = td->td_frame; - frame->tf_rdi = td->td_tid; - frame->tf_rsi = attr->argument; - - return (cpu_set_user_tls(td, TO_PTR(tcbptr))); -} - -static struct sysentvec cloudabi64_elf_sysvec = { - .sv_size = CLOUDABI64_SYS_MAXSYSCALL, - .sv_table = cloudabi64_sysent, - .sv_fixup = cloudabi64_fixup_tcb, - .sv_name = "CloudABI ELF64", - .sv_coredump = elf64_coredump, - .sv_elf_core_osabi = ELFOSABI_FREEBSD, - .sv_elf_core_abi_vendor = FREEBSD_ABI_VENDOR, - .sv_elf_core_prepare_notes = elf64_prepare_notes, - .sv_minuser = VM_MIN_ADDRESS, - /* Keep top page reserved to work around AMD Ryzen stability issues. */ - .sv_maxuser = VM_MAXUSER_ADDRESS - PAGE_SIZE, - .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, - .sv_copyout_strings = cloudabi64_copyout_strings, - .sv_setregs = cloudabi64_proc_setregs, - .sv_flags = SV_ABI_CLOUDABI | SV_CAPSICUM | SV_LP64, - .sv_set_syscall_retval = cloudabi64_set_syscall_retval, - .sv_fetch_syscall_args = cloudabi64_fetch_syscall_args, - .sv_syscallnames = cloudabi64_syscallnames, - .sv_schedtail = cloudabi64_schedtail, - .sv_set_fork_retval = x86_set_fork_retval, -}; - -INIT_SYSENTVEC(elf_sysvec, &cloudabi64_elf_sysvec); - -Elf64_Brandinfo cloudabi64_brand = { - .brand = ELFOSABI_CLOUDABI, - .machine = EM_X86_64, - .sysvec = &cloudabi64_elf_sysvec, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_ONLY_STATIC, -}; diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index ce0a5ed3c975..ce1cf6bb76ce 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -626,12 +626,6 @@ options COMPAT_FREEBSD32 # Enable (32-bit) a.out binary support options COMPAT_AOUT -# Enable 32-bit runtime support for CloudABI binaries. -options COMPAT_CLOUDABI32 - -# Enable 64-bit runtime support for CloudABI binaries. -options COMPAT_CLOUDABI64 - ##################################################################### # ZFS support diff --git a/sys/arm/cloudabi32/cloudabi32_sysvec.c b/sys/arm/cloudabi32/cloudabi32_sysvec.c deleted file mode 100644 index 4df57b22e13d..000000000000 --- a/sys/arm/cloudabi32/cloudabi32_sysvec.c +++ /dev/null @@ -1,199 +0,0 @@ -/*- - * Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include *** 16294 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Sep 21 21:19: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 5B5D667B564; Tue, 21 Sep 2021 21:19: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 4HDZ7f28DYz4bFG; Tue, 21 Sep 2021 21:19: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 2B7D12E58; Tue, 21 Sep 2021 21:19: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 18LLJgiv041688; Tue, 21 Sep 2021 21:19:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLJgqC041687; Tue, 21 Sep 2021 21:19:42 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:19:42 GMT Message-Id: <202109212119.18LLJgqC041687@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: 397f188936c8 - main - Remove SV_CAPSICUM 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: 397f188936c8a29b6a2d4d13f0cf5681b4bcb9a3 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, 21 Sep 2021 21:19:42 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=397f188936c8a29b6a2d4d13f0cf5681b4bcb9a3 commit 397f188936c8a29b6a2d4d13f0cf5681b4bcb9a3 Author: Konstantin Belousov AuthorDate: 2021-09-13 09:49:13 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-21 21:18:44 +0000 Remove SV_CAPSICUM It was only needed for cloudabi Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31923 --- sys/kern/kern_exec.c | 4 ---- sys/sys/sysent.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index b6959dc18f50..cbe0152a8001 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -681,10 +681,6 @@ interpret: goto exec_fail_dealloc; } - /* ABI enforces the use of Capsicum. Switch into capabilities mode. */ - if (SV_PROC_FLAG(p, SV_CAPSICUM)) - sys_cap_enter(td, NULL); - /* * Copy out strings (args and env) and initialize stack base. */ diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 36d5e473142e..ad50bf56e87d 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -165,7 +165,7 @@ struct sysentvec { #define SV_IA32 0x004000 /* Intel 32-bit executable. */ #define SV_AOUT 0x008000 /* a.out executable. */ #define SV_SHP 0x010000 /* Shared page. */ -#define SV_CAPSICUM 0x020000 /* Force cap_enter() on startup. */ +#define SV_AVAIL1 0x020000 /* Unused */ #define SV_TIMEKEEP 0x040000 /* Shared page timehands. */ #define SV_ASLR 0x080000 /* ASLR allowed. */ #define SV_RNG_SEED_VER 0x100000 /* random(4) reseed generation. */ From owner-dev-commits-src-main@freebsd.org Tue Sep 21 21:21: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 D1C7567B85C; Tue, 21 Sep 2021 21:21: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 4HDZ9K5d2xz4bTP; Tue, 21 Sep 2021 21:21: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 A1AC12FED; Tue, 21 Sep 2021 21:21: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 18LLL93B053366; Tue, 21 Sep 2021 21:21:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLL9kF053365; Tue, 21 Sep 2021 21:21:09 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:21:09 GMT Message-Id: <202109212121.18LLL9kF053365@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: 2191473724fb - main - arm64: Handle thumb2 thread entry point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2191473724fbac4a7ca6da24bdc23164126ee904 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, 21 Sep 2021 21:21:09 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=2191473724fbac4a7ca6da24bdc23164126ee904 commit 2191473724fbac4a7ca6da24bdc23164126ee904 Author: Olivier Houchard AuthorDate: 2021-09-21 21:17:53 +0000 Commit: Olivier Houchard CommitDate: 2021-09-21 21:20:27 +0000 arm64: Handle thumb2 thread entry point. In cpu_set_upcall(), if the thread startup routine is a thumb routine, make sure to set PSR_T, so that the CPU will run in thumb mode. MFC After: 1 week --- sys/arm64/arm64/vm_machdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index bf7641074317..dfc2f8cb267f 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -200,9 +200,11 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, struct trapframe *tf = td->td_frame; /* 32bits processes use r13 for sp */ - if (td->td_frame->tf_spsr & PSR_M_32) + if (td->td_frame->tf_spsr & PSR_M_32) { tf->tf_x[13] = STACKALIGN((uintptr_t)stack->ss_sp + stack->ss_size); - else + if ((register_t)entry & 1) + tf->tf_spsr |= PSR_T; + } else tf->tf_sp = STACKALIGN((uintptr_t)stack->ss_sp + stack->ss_size); tf->tf_elr = (register_t)entry; tf->tf_x[0] = (register_t)arg; From owner-dev-commits-src-main@freebsd.org Tue Sep 21 21:21: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 09D0767B8E7; Tue, 21 Sep 2021 21:21: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 4HDZ9L6HtBz4bR7; Tue, 21 Sep 2021 21:21: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 B936F2FEF; Tue, 21 Sep 2021 21:21: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 18LLLAw6053397; Tue, 21 Sep 2021 21:21:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LLLAvB053396; Tue, 21 Sep 2021 21:21:10 GMT (envelope-from git) Date: Tue, 21 Sep 2021 21:21:10 GMT Message-Id: <202109212121.18LLLAvB053396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: a342ecd326ee - main - arm: Handle thumb2 thread entry point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a342ecd326ee9e021b0a4d6dc8aca1a297c606f8 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, 21 Sep 2021 21:21:11 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=a342ecd326ee9e021b0a4d6dc8aca1a297c606f8 commit a342ecd326ee9e021b0a4d6dc8aca1a297c606f8 Author: Olivier Houchard AuthorDate: 2021-09-21 21:19:46 +0000 Commit: Olivier Houchard CommitDate: 2021-09-21 21:20:27 +0000 arm: Handle thumb2 thread entry point. In cpu_set_upcall(), if the thread startup routine is a thumb routine, make sure to set PSR_T, so that the CPU will run in thumb mode. MFC After: 1 week --- sys/arm/arm/vm_machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index 03bbf75ebf71..ba44aa162e8b 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -235,6 +235,8 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, tf->tf_pc = (int)entry; tf->tf_r0 = (int)arg; tf->tf_spsr = PSR_USR32_MODE; + if ((register_t)entry & 1) + tf->tf_spsr |= PSR_T; } int From owner-dev-commits-src-main@freebsd.org Tue Sep 21 22:19: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 06C7467C1E7; Tue, 21 Sep 2021 22:19: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 4HDbSX6P2Yz4gxc; Tue, 21 Sep 2021 22:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB32C43C4; Tue, 21 Sep 2021 22:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18LMJOaQ023246; Tue, 21 Sep 2021 22:19:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18LMJOtb023245; Tue, 21 Sep 2021 22:19:24 GMT (envelope-from git) Date: Tue, 21 Sep 2021 22:19:24 GMT Message-Id: <202109212219.18LMJOtb023245@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: e745d729be60 - main - sched_ule(4): Improve long-term load balancer. 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: e745d729be60a47b49eb19c02a6864a747fb2744 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, 21 Sep 2021 22:19:25 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e745d729be60a47b49eb19c02a6864a747fb2744 commit e745d729be60a47b49eb19c02a6864a747fb2744 Author: Alexander Motin AuthorDate: 2021-09-21 22:14:22 +0000 Commit: Alexander Motin CommitDate: 2021-09-21 22:19:20 +0000 sched_ule(4): Improve long-term load balancer. Before this change long-term load balancer was unable to migrate running threads, only ones waiting on run queues. But with growing number of CPU cores it is quite typical now for system to not have many waiting threads. But same time if due to some coincidence two long-running CPU-bound threads ended up sharing same physical CPU core, they could suffer from the SMT penalty indefinitely, and the load balancer couldn't help. Improve that by teaching the load balancer to hint running threads to migrate by marking them with TDF_NEEDRESCHED and new TDF_PICKCPU flag, making sched_pickcpu() to search for better CPU later, when it is convenient. Fix CPU search logic when balancing to limit round-robin migrations in case of almost equal load to the group of physical cores. The previous code bounced threads across all the system, that should be pretty bad for caches and NUMA affinity, while additional fairness was almost invisible, diminishing with number of cores in the group. MFC after: 1 month --- sys/kern/sched_ule.c | 119 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 93 insertions(+), 26 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 90f294bb0d4d..711119c84383 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -196,6 +196,7 @@ _Static_assert(sizeof(struct thread) + sizeof(struct td_sched) <= #define SCHED_SLICE_MIN_DIVISOR 6 /* DEFAULT/MIN = ~16 ms. */ /* Flags kept in td_flags. */ +#define TDF_PICKCPU TDF_SCHED0 /* Thread should pick new CPU. */ #define TDF_SLICEEND TDF_SCHED2 /* Thread time slice is over. */ /* @@ -633,15 +634,16 @@ sched_random(void) } struct cpu_search { - cpuset_t *cs_mask; - u_int cs_prefer; + cpuset_t *cs_mask; /* The mask of allowed CPUs to choose from. */ + int cs_prefer; /* Prefer this CPU and groups including it. */ + int cs_running; /* The thread is now running at cs_prefer. */ int cs_pri; /* Min priority for low. */ int cs_limit; /* Max load for low, min load for high. */ }; struct cpu_search_res { - int cs_cpu; - int cs_load; + int cs_cpu; /* The best CPU found. */ + int cs_load; /* The load of cs_cpu. */ }; /* @@ -657,7 +659,7 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, { struct cpu_search_res lr; struct tdq *tdq; - int c, bload, l, load, total; + int c, bload, l, load, p, total; total = 0; bload = INT_MAX; @@ -668,6 +670,17 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, for (c = cg->cg_children - 1; c >= 0; c--) { load = cpu_search_lowest(&cg->cg_child[c], s, &lr); total += load; + + /* + * When balancing do not prefer SMT groups with load >1. + * It allows round-robin between SMT groups with equal + * load within parent group for more fair scheduling. + */ + if (__predict_false(s->cs_running) && + (cg->cg_child[c].cg_flags & CG_FLAG_THREAD) && + load >= 128 && (load & 128) != 0) + load += 128; + if (lr.cs_cpu >= 0 && (load < bload || (load == bload && lr.cs_load < r->cs_load))) { bload = load; @@ -684,20 +697,40 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, continue; tdq = TDQ_CPU(c); l = tdq->tdq_load; + if (c == s->cs_prefer) { + if (__predict_false(s->cs_running)) + l--; + p = 128; + } else + p = 0; load = l * 256; - if (c == s->cs_prefer) - load -= 128; - total += load; - if (l > s->cs_limit || tdq->tdq_lowpri <= s->cs_pri || + total += load - p; + + /* + * Check this CPU is acceptable. + * If the threads is already on the CPU, don't look on the TDQ + * priority, since it can be the priority of the thread itself. + */ + if (l > s->cs_limit || (tdq->tdq_lowpri <= s->cs_pri && + (!s->cs_running || c != s->cs_prefer)) || !CPU_ISSET(c, s->cs_mask)) continue; + + /* + * When balancing do not prefer CPUs with load > 1. + * It allows round-robin between CPUs with equal load + * within the CPU group for more fair scheduling. + */ + if (__predict_false(s->cs_running) && l > 0) + p = 0; + load -= sched_random() % 128; - if (load < bload) { - bload = load; + if (bload > load - p) { + bload = load - p; r->cs_cpu = c; + r->cs_load = load; } } - r->cs_load = bload; return (total); } @@ -736,9 +769,17 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, l = tdq->tdq_load; load = l * 256; total += load; - if (l < s->cs_limit || !tdq->tdq_transferable || + + /* + * Check this CPU is acceptable. + * If requested minimum load is 1, then caller must know how + * to handle running threads, not counted in tdq_transferable. + */ + if (l < s->cs_limit || (tdq->tdq_transferable == 0 && + (s->cs_limit > 1 || l > 1)) || !CPU_ISSET(c, s->cs_mask)) continue; + load -= sched_random() % 256; if (load > bload) { bload = load; @@ -756,12 +797,13 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, */ static inline int sched_lowest(const struct cpu_group *cg, cpuset_t *mask, int pri, int maxload, - int prefer) + int prefer, int running) { struct cpu_search s; struct cpu_search_res r; s.cs_prefer = prefer; + s.cs_running = running; s.cs_mask = mask; s.cs_pri = pri; s.cs_limit = maxload; @@ -788,12 +830,13 @@ static void sched_balance_group(struct cpu_group *cg) { struct tdq *tdq; + struct thread *td; cpuset_t hmask, lmask; int high, low, anylow; CPU_FILL(&hmask); for (;;) { - high = sched_highest(cg, &hmask, 2); + high = sched_highest(cg, &hmask, 1); /* Stop if there is no more CPU with transferrable threads. */ if (high == -1) break; @@ -802,10 +845,28 @@ sched_balance_group(struct cpu_group *cg) /* Stop if there is no more CPU left for low. */ if (CPU_EMPTY(&lmask)) break; - anylow = 1; tdq = TDQ_CPU(high); + if (tdq->tdq_load == 1) { + /* + * There is only one running thread. We can't move + * it from here, so tell it to pick new CPU by itself. + */ + TDQ_LOCK(tdq); + td = pcpu_find(high)->pc_curthread; + if ((td->td_flags & TDF_IDLETD) == 0 && + THREAD_CAN_MIGRATE(td)) { + td->td_flags |= TDF_NEEDRESCHED | TDF_PICKCPU; + if (high != curcpu) + ipi_cpu(high, IPI_AST); + } + TDQ_UNLOCK(tdq); + break; + } + anylow = 1; nextlow: - low = sched_lowest(cg, &lmask, -1, tdq->tdq_load - 1, high); + if (tdq->tdq_transferable == 0) + continue; + low = sched_lowest(cg, &lmask, -1, tdq->tdq_load - 1, high, 1); /* Stop if we looked well and found no less loaded CPU. */ if (anylow && low == -1) break; @@ -1227,7 +1288,7 @@ sched_pickcpu(struct thread *td, int flags) struct td_sched *ts; struct tdq *tdq; cpuset_t *mask; - int cpu, pri, self, intr; + int cpu, pri, r, self, intr; self = PCPU_GET(cpuid); ts = td_get_sched(td); @@ -1305,32 +1366,33 @@ llc: cpu = -1; mask = &td->td_cpuset->cs_mask; pri = td->td_priority; + r = TD_IS_RUNNING(td); /* * Try hard to keep interrupts within found LLC. Search the LLC for * the least loaded CPU we can run now. For NUMA systems it should * be within target domain, and it also reduces scheduling overhead. */ if (ccg != NULL && intr) { - cpu = sched_lowest(ccg, mask, pri, INT_MAX, ts->ts_cpu); + cpu = sched_lowest(ccg, mask, pri, INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_intrbind); } else /* Search the LLC for the least loaded idle CPU we can run now. */ if (ccg != NULL) { cpu = sched_lowest(ccg, mask, max(pri, PRI_MAX_TIMESHARE), - INT_MAX, ts->ts_cpu); + INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_affinity); } /* Search globally for the least loaded CPU we can run now. */ if (cpu < 0) { - cpu = sched_lowest(cpu_top, mask, pri, INT_MAX, ts->ts_cpu); + cpu = sched_lowest(cpu_top, mask, pri, INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_lowest); } /* Search globally for the least loaded CPU. */ if (cpu < 0) { - cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu); + cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu, r); if (cpu >= 0) SCHED_STAT_INC(pickcpu_lowest); } @@ -2056,7 +2118,7 @@ sched_switch(struct thread *td, int flags) struct td_sched *ts; struct mtx *mtx; int srqflag; - int cpuid, preempted; + int cpuid, pickcpu, preempted; THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -2064,11 +2126,15 @@ sched_switch(struct thread *td, int flags) tdq = TDQ_SELF(); ts = td_get_sched(td); sched_pctcpu_update(ts, 1); - ts->ts_rltick = ticks; + pickcpu = (td->td_flags & TDF_PICKCPU) != 0; + if (pickcpu) + ts->ts_rltick = ticks - affinity * MAX_CACHE_LEVELS; + else + ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; preempted = (td->td_flags & TDF_SLICEEND) == 0 && (flags & SW_PREEMPT) != 0; - td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); + td->td_flags &= ~(TDF_NEEDRESCHED | TDF_PICKCPU | TDF_SLICEEND); td->td_owepreempt = 0; tdq->tdq_owepreempt = 0; if (!TD_IS_IDLETHREAD(td)) @@ -2088,7 +2154,8 @@ sched_switch(struct thread *td, int flags) SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : SRQ_OURSELF|SRQ_YIELDING; #ifdef SMP - if (THREAD_CAN_MIGRATE(td) && !THREAD_CAN_SCHED(td, ts->ts_cpu)) + if (THREAD_CAN_MIGRATE(td) && (!THREAD_CAN_SCHED(td, ts->ts_cpu) + || pickcpu)) ts->ts_cpu = sched_pickcpu(td, 0); #endif if (ts->ts_cpu == cpuid) From owner-dev-commits-src-main@freebsd.org Wed Sep 22 02:14: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 DDB686A9682; Wed, 22 Sep 2021 02:14: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 4HDhgZ5h5wz3JN5; Wed, 22 Sep 2021 02:14: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 A2E397701; Wed, 22 Sep 2021 02:14: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 18M2EI9T047079; Wed, 22 Sep 2021 02:14:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M2EIJk047078; Wed, 22 Sep 2021 02:14:18 GMT (envelope-from git) Date: Wed, 22 Sep 2021 02:14:18 GMT Message-Id: <202109220214.18M2EIJk047078@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: 8db1669959ce - main - Fix build without SMP. 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: 8db1669959ceebdc60a7d402830663953bf32818 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, 22 Sep 2021 02:14:18 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=8db1669959ceebdc60a7d402830663953bf32818 commit 8db1669959ceebdc60a7d402830663953bf32818 Author: Alexander Motin AuthorDate: 2021-09-22 02:13:33 +0000 Commit: Alexander Motin CommitDate: 2021-09-22 02:13:33 +0000 Fix build without SMP. MFC after: 1 month --- sys/kern/sched_ule.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 711119c84383..d1e4010d2ebe 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2118,7 +2118,10 @@ sched_switch(struct thread *td, int flags) struct td_sched *ts; struct mtx *mtx; int srqflag; - int cpuid, pickcpu, preempted; + int cpuid, preempted; +#ifdef SMP + int pickcpu; +#endif THREAD_LOCK_ASSERT(td, MA_OWNED); @@ -2126,11 +2129,13 @@ sched_switch(struct thread *td, int flags) tdq = TDQ_SELF(); ts = td_get_sched(td); sched_pctcpu_update(ts, 1); +#ifdef SMP pickcpu = (td->td_flags & TDF_PICKCPU) != 0; if (pickcpu) ts->ts_rltick = ticks - affinity * MAX_CACHE_LEVELS; else ts->ts_rltick = ticks; +#endif td->td_lastcpu = td->td_oncpu; preempted = (td->td_flags & TDF_SLICEEND) == 0 && (flags & SW_PREEMPT) != 0; From owner-dev-commits-src-main@freebsd.org Wed Sep 22 07:37: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 D313F6AD595; Wed, 22 Sep 2021 07:37: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 4HDqrv5Wszz4VwQ; Wed, 22 Sep 2021 07:37: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 99F0213B63; Wed, 22 Sep 2021 07:37: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 18M7bpgZ072130; Wed, 22 Sep 2021 07:37:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M7bp8J072129; Wed, 22 Sep 2021 07:37:51 GMT (envelope-from git) Date: Wed, 22 Sep 2021 07:37:51 GMT Message-Id: <202109220737.18M7bp8J072129@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 00582fa66051 - main - pci_vendors: update to 2021.09.19 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00582fa66051cbdf263a6ce0f10c64ea17a0e9a8 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, 22 Sep 2021 07:37:51 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=00582fa66051cbdf263a6ce0f10c64ea17a0e9a8 commit 00582fa66051cbdf263a6ce0f10c64ea17a0e9a8 Author: Baptiste Daroussin AuthorDate: 2021-09-22 07:36:43 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 07:36:43 +0000 pci_vendors: update to 2021.09.19 --- share/misc/pci_vendors | 166 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 151 insertions(+), 15 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index 3e17bc47bf5f..79866ff1cd29 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2021.07.25 -# Date: 2021-07-25 03:15:02 +# Version: 2021.09.19 +# Date: 2021-09-19 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -693,10 +693,10 @@ 1000 4660 eHBA 9600-24i Tri-Mode Storage Adapter 1000 4670 eHBA 9600-16i Tri-Mode Storage Adapter 1000 4680 eHBA 9600-16e Tri-Mode Storage Adapter - 1000 4690 eHBA 9620-16i Tri-Mode Storage Adapter + 1000 4690 MegaRAID 9620-16i Tri-Mode Storage Adapter 1000 46a0 MegaRAID 9660-24i Tri-Mode Storage Adapter - 1000 46b0 MegaRAID 9665W-16i Tri-Mode Storage Adapter - 1000 46c0 MegaRAID 9680W-16e Tri-Mode Storage Adapter + 1000 46c0 eHBA 9680W-16e Tri-Mode Storage Adapter + 1000 46d0 eHBA 9600-8i8e Tri-Mode Storage Adapter 1028 2114 PERC H965 Adapter 1028 2115 PERC H965 Front 1028 2117 PERC H965 MX @@ -925,11 +925,7 @@ 1028 1ae2 PERC H755N Front 1028 1ae3 PERC H755 MX 1028 2171 PERC H750 Mini - 1028 2172 PERC H355 Adapter - 1028 2173 PERC H355 Front - 1028 2174 PERC H350 Mini 1028 2176 PERC H750 Adapter - 1028 2177 PERC H350 Adapter 1d49 060a ThinkSystem RAID 940-8i 4GB Flash PCIe Gen4 12Gb Adapter 1d49 060b ThinkSystem RAID 940-8i 8GB Flash PCIe Gen4 12Gb Adapter 1d49 060c ThinkSystem RAID 940-16i 8GB Flash PCIe Gen4 12Gb Adapter @@ -947,6 +943,10 @@ 10e4 MegaRAID 12GSAS/PCIe Unsupported SAS38xx 10e5 MegaRAID 12GSAS/PCIe SAS38xx 10e6 MegaRAID 12GSAS/PCIe Secure SAS38xx + 1028 2172 PERC H355 Adapter + 1028 2173 PERC H355 Front + 1028 2174 PERC H350 Mini + 1028 2177 PERC H350 Adapter 1d49 0505 ThinkSystem RAID 540-8i PCIe Gen4 12Gb Adapter 1d49 0506 ThinkSystem RAID 540-16i PCIe Gen4 12Gb Adapter 10e7 MegaRAID 12GSAS/PCIe Unsupported SAS38xx @@ -3700,6 +3700,7 @@ 7312 Navi 10 [Radeon Pro W5700] 7314 Navi 10 USB 731f Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] + 1002 0b36 Reference RX 5700 XT 1458 2313 Radeon RX 5700 XT Gaming OC 1682 5701 RX 5700 XT RAW II 1849 5120 Radeon RX 5600 XT @@ -3713,16 +3714,20 @@ 7388 Arcturus GL-XL 738c Arcturus GL-XL [AMD Instinct MI100] 738e Arcturus GL-XL - 73a3 Navi 21 [Radeon PRO W6800] + 73a2 Navi 21 Pro-XTA [Radeon Pro W6900X] + 73a3 Navi 21 GL-XL [Radeon PRO W6800] 73a4 Navi 21 USB + 73ab Navi 21 Pro-XLA [Radeon Pro W6800X/Radeon Pro W6800X Duo] 73af Navi 21 [Radeon RX 6900 XT] 73bf Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] + 1002 0e3a Radeon RX 6900 XT 1eae 6701 XFX Speedster MERC 319 AMD Radeon RX 6800 XT Black 73c3 Navi 22 73c4 Navi 22 USB 73df Navi 22 [Radeon RX 6700/6700 XT / 6800M] 73e0 Navi 23 - 73e1 Navi 23 + 73e1 Navi 23 WKS-XM [Radeon PRO W6600M] + 73e3 Navi 23 WKS-XL [Radeon PRO W6600] 73e4 Navi 23 USB 73ff Navi 23 [Radeon RX 6600/6600 XT/6600M] 7408 Aldebaran @@ -12250,6 +12255,7 @@ 1eae TU104M 1eb0 TU104GL [Quadro RTX 5000] 1eb1 TU104GL [Quadro RTX 4000] + 1eb4 TU104GL [T4G] 1eb5 TU104GLM [Quadro RTX 5000 Mobile / Max-Q] 1eb6 TU104GLM [Quadro RTX 4000 Mobile / Max-Q] 1eb8 TU104GL [Tesla T4] @@ -12314,8 +12320,10 @@ 20b5 GA100 [A100 PCIe 80GB] 20b6 GA100GL [PG506-232] 20b7 GA100GL [A30 PCIe] + 20bb GA100 [DRIVE A100 PROD] 20be GA100 [GRID A100A] 20bf GA100 [GRID A100B] + 20c2 GA100 [CMP 170HX] 20f1 GA100 [A100 PCIe 40GB] 2182 TU116 [GeForce GTX 1660 Ti] 2183 TU116 @@ -12332,7 +12340,7 @@ 21d1 TU116BM [GeForce GTX 1660 Ti Mobile] 2200 GA102 2204 GA102 [GeForce RTX 3090] - 2205 GA102 [GeForce RTX 3080 20GB] + 2205 GA102 [GeForce RTX 3080 Ti 20GB] 2206 GA102 [GeForce RTX 3080] 10de 1467 GA102 [GeForce RTX 3080] 10de 146d GA102 [GeForce RTX 3080 20GB] @@ -12358,6 +12366,7 @@ 10de 146b GA104 [GeForce RTX 3070] 10de 14ae GA104 [GeForce RTX 3070 16GB] 2486 GA104 [GeForce RTX 3060 Ti] + 2487 GA104 [GeForce RTX 3060] 2488 GA104 [GeForce RTX 3070 Lite Hash Rate] 2489 GA104 [GeForce RTX 3060 Ti Lite Hash Rate] 248a GA104 [CMP 70HX] @@ -12621,6 +12630,7 @@ 1028 06dc Latitude E7470 1028 06e4 XPS 15 9550 1028 06e6 Latitude 11 5175 2-in-1 + 1028 09be Latitude 7410 17aa 224f ThinkPad X1 Carbon 5th Gen 5260 RTS5260 PCI Express Card Reader 5286 RTS5286 PCI Express Card Reader @@ -12807,6 +12817,7 @@ 8812 RTL8812AE 802.11ac PCIe Wireless Network Adapter 8813 RTL8813AE 802.11ac PCIe Wireless Network Adapter 8821 RTL8821AE 802.11ac PCIe Wireless Network Adapter + 8852 RTL8852AE 802.11ax PCIe Wireless Network Adapter b723 RTL8723BE PCIe Wireless Network Adapter 10ec 8739 Dell Wireless 1801 17aa b736 Z50-75 @@ -18728,6 +18739,7 @@ 144d a801 SM963 2.5" NVMe PCIe SSD a808 NVMe SSD Controller SM981/PM981/PM983 1d49 403b Thinksystem U.2 PM983 NVMe SSD + a809 NVMe SSD Controller 980 a80a NVMe SSD Controller PM9A1/PM9A3/980PRO 0128 215a DC NVMe PM9A3 RI U.2 960GB 0128 215b DC NVMe PM9A3 RI U.2 1.92TB @@ -18737,6 +18749,7 @@ 0128 2167 DC NVMe PM9A3 RI 110M.2 1.92TB 0128 2168 DC NVMe PM9A3 RI 80M.2 480GB 0128 2169 DC NVMe PM9A3 RI 80M.2 960GB + 144d a813 General DC NVMe PM9A3 a820 NVMe SSD Controller 171X 1028 1f95 Express Flash NVMe XS1715 SSD 400GB 1028 1f96 Express Flash NVMe XS1715 SSD 800GB @@ -18829,6 +18842,7 @@ 1456 Advanced Hardware Architectures 1457 Nuera Communications Inc 1458 Gigabyte Technology Co., Ltd + 22e8 Ellesmere [Radeon RX 480] 3483 USB 3.0 Controller (VIA VL80x-based xHCI Controller) 1459 DOOIN Electronics 145a Escalate Networks Inc @@ -19813,6 +19827,7 @@ 441f BCM4361 802.11ac Dual-Band Wireless Network Controller 4420 BCM4361 802.11ac 2.4 GHz Wireless Network Controller 4421 BCM4361 802.11ac 5 GHz Wireless Network Controller + 4425 BRCM4378 Wireless Network Adapter 4430 BCM44xx CardBus iLine32 HomePNA 2.0 4432 BCM4432 CardBus 10/100BaseT 4464 BCM4364 802.11ac Wireless Network Adapter @@ -21095,7 +21110,7 @@ 0002 SiByte BCM1125H/1250 System-on-a-Chip HyperTransport 0012 SiByte BCM1280/BCM1480 System-on-a-Chip PCI-X 0014 Sibyte BCM1280/BCM1480 System-on-a-Chip HyperTransport -1677 Bernecker + Rainer +1677 B&R Industrial Automation GmbH 104e 5LS172.6 B&R Dual CAN Interface Card 12d7 5LS172.61 B&R Dual CAN Interface Card 20ad 5ACPCI.MFIO-K01 Profibus DP / K-Feldbus / COM @@ -21996,6 +22011,8 @@ 6013 R6013 ISA Bridge 6020 R6020 North Bridge 6021 R6021 Host Bridge +# Integrated in the Vortex86DX2 SoC + 6022 R6022 Host Bridge # Found in the Vortex86DX3 SoC 6023 R6023 Host Bridge # Found in the Vortex86EX SoC @@ -22947,6 +22964,7 @@ 1a22 Ambric Inc. 1a29 Fortinet, Inc. 4338 CP8 Content Processor ASIC + 43a0 CP9 Content Processor ASIC 4e36 NP6 Network Processor 4e37 NP7 Network Processor 1a2b Ascom AG @@ -23576,6 +23594,14 @@ 243b PE6110 NVMe Solid State Drive 1c5c 0100 PE6110 NVMe Solid State Drive 2839 PE8000 Series NVMe Solid State Drive + 1028 2143 DC NVMe SED PE8010 RI U.2 960GB + 1028 2144 DC NVMe PE8010 RI U.2 960GB + 1028 2145 DC NVMe SED PE8010 RI U.2 1.92TB + 1028 2146 DC NVMe PE8010 RI U.2 1.92TB + 1028 2147 DC NVMe SED PE8010 RI U.2 3.84TB + 1028 2148 DC NVMe PE8010 RI U.2 3.84TB + 1028 2149 DC NVMe SED PE8010 RI U.2 7.68TB + 1028 214a DC NVMe PE8010 RI U.2 7.68TB 1c5c 0100 PE8000 Series NVMe Solid State Drive 1c5f Beijing Memblaze Technology Co. Ltd. 000d PBlaze5 520/526 @@ -23628,6 +23654,16 @@ 1cc1 ADATA Technology Co., Ltd. 8201 XPG SX8200 Pro PCIe Gen3x4 M.2 2280 Solid State Drive 1cc4 Union Memory (Shenzhen) + 1203 NVMe SSD Controller UHXXXa series + 1cc4 a121 NVMe SSD UHXXXa series U.2 960GB + 1cc4 a122 NVMe SSD UHXXXa series U.2 1920GB + 1cc4 a123 NVMe SSD UHXXXa series U.2 3840GB + 1cc4 a124 NVMe SSD UHXXXa series U.2 7680GB + 1cc4 a125 NVMe SSD UHXXXa series U.2 15360GB + 1cc4 a211 NVMe SSD UHXXXa series U.2 800GB + 1cc4 a212 NVMe SSD UHXXXa series U.2 1600GB + 1cc4 a213 NVMe SSD UHXXXa series U.2 3200GB + 1cc4 a214 NVMe SSD UHXXXa series U.2 6400GB 17ab NVMe 256G SSD device 1cc5 Embedded Intelligence, Inc. 0100 CAN-PCIe-02 @@ -23670,6 +23706,7 @@ 0100 ExaDISK FX1 1cf0 Akitio 1cf7 Subspace Dynamics +1cfa Corsair Memory, Inc 1d00 Pure Storage 1d05 Tongfang Hongkong Limited 1d0f Amazon.com, Inc. @@ -23816,6 +23853,7 @@ 101b AR-ARK-SRIOV-FX1 [Arkville 64B Primary Physical Function] 101c AR-ARK-SRIOV-VF [Arkville Virtual Function] 101d AR-ARK-NIC [Arkville ArkNIC Kernel Path Device] + 101e AR-ARKA-FX1 [Arkville 64B DPDK Data Mover for Agilex R-Tile] 4200 A5PL-E1-10GETI [10 GbE Ethernet Traffic Instrument] 1d72 Xiaomi 1d78 DERA Storage @@ -23844,6 +23882,8 @@ 0100 RK3399 PCI Express Root Port 1808 RK1808 Neural Network Processor Card 3566 RK3568 Remote Signal Processor +1d89 YEESTOR Microelectronics Co., Ltd + 0280 PCIe NVMe SSD 1d8f Enyx 1d92 Abaco Systems Inc. 1d93 YADRO @@ -23894,15 +23934,40 @@ 1000 HL-2000 AI Training Accelerator [Gaudi] # PCIe accelerator card for Deep Learning training tasks with secured firmware 1010 HL-2000 AI Training Accelerator [Gaudi secured] +1dad Fungible 1db2 ATP ELECTRONICS INC +1db7 Phytium Technology Co., Ltd. + dc20 [X100 Series] + dc21 VPU Controller [X100 Series] + dc22 DC Controller [X100 Series] + dc23 I2S/DMA Controller [X100 Series] + dc26 SATA Controller [X100 Series] + dc27 USB Controller [X100 Series] + dc29 NANDFLASH Controller [X100 Series] + dc2b I2S Controller [X100 Series] + dc2c SPIM Controller [X100 Series] + dc2d CAN Controller [X100 Series] + dc2e UART Controller [X100 Series] + dc2f PWM Controller [X100 Series] + dc30 MIO Controller [X100 Series] + dc31 GPIO Controller [X100 Series] + dc32 SMBUS Controller [X100 Series] + dc34 PS2 Controller [X100 Series] + dc35 LPC Controller [X100 Series] + dc36 LDMA Controller [X100 Series] + dc38 LSD_CFG Controller [X100 Series] + dc3a SWITCH Controller [X100 Series] + dc3c GPU_DMA Controller [X100 Series] 1dbb NGD Systems, Inc. 1dbf Guizhou Huaxintong Semiconductor Technology Co., Ltd 0401 StarDragon4800 PCI Express Root Port 1dc5 FADU Inc. 1dcd Liqid Inc. +1dcf Beijing Sinead Technology Co., Ltd. 1dd8 Pensando Systems 0002 DSC2 Elba Upstream Port 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1000 DSC Capri Upstream Port 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23926,6 +23991,7 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1002 DSC Ethernet Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23938,6 +24004,7 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1003 DSC Ethernet Controller VF 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23950,6 +24017,7 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1004 DSC Management Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23962,6 +24030,7 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card 1007 DSC Storage Accelerator 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB @@ -23974,6 +24043,8 @@ 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1dd8 4014 DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 5001 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card + 1dd8 5003 DSC2-200 50/100/200G 2-port 32G RAM 64G eMMC G2 Services Card +1ddd Thorlabs 1de0 Groq # rename due to conflict with a term in use by another company for an entirely different product. 0000 TSP100 Tensor Streaming Processor @@ -24108,6 +24179,10 @@ 0001 T10 [CloudBlazer] 0002 T11 [CloudBlazer] 0003 T10(QSFP-DD) [CloudBlazer] + 0021 T20(32GB) [CloudBlazer] + 0022 T20(64GB) [CloudBlazer] + 0023 T21(32GB) [CloudBlazer] + 0024 T21(64GB) [CloudBlazer] 8011 I10 [CloudBlazer] 8012 I10L [CloudBlazer] # nee Thinci, Inc @@ -24174,6 +24249,16 @@ 1e7c Brainchip Inc bca1 AKD1000 Neural Network Coprocessor [Akida] 1e81 Ramaxel Technology(Shenzhen) Limited + 1203 NVMe SSD Controller UHXXXa series + 1e81 a121 NVMe SSD UHXXXa series U.2 960GB + 1e81 a122 NVMe SSD UHXXXa series U.2 1920GB + 1e81 a123 NVMe SSD UHXXXa series U.2 3840GB  + 1e81 a124 NVMe SSD UHXXXa series U.2 7680GB  + 1e81 a125 NVMe SSD UHXXXa series U.2 15360GB + 1e81 a211 NVMe SSD UHXXXa series U.2 800GB  + 1e81 a212 NVMe SSD UHXXXa series U.2 1600GB  + 1e81 a213 NVMe SSD UHXXXa series U.2 3200GB  + 1e81 a214 NVMe SSD UHXXXa series U.2 6400GB  1e85 Heitec AG 1e89 ID Quantique SA 0002 Quantis-PCIe-40M @@ -24185,6 +24270,7 @@ 2a16 Cloud Intelligent Inference Controller 1ea7 Intelliprop, Inc 223a Typhon+ PCIe to Gen-Z Bridge + 224a IPA-PE224A CXL to Gen-Z Bridge [Sphinx] 1eab Hefei DATANG Storage Technology Co.,LTD. 300a NVMe SSD Controller 300A 300b NVMe SSD Controller 300B @@ -24209,6 +24295,7 @@ 5220 IG5220-Based NVMe SSD 5236 IG5236-Based NVMe SSD 5636 IG5636-Based NVMe SSD +1fab Unifabrix Ltd. # nee Tumsan Oy 1fc0 Ascom (Finland) Oy 0300 E2200 Dual E1/Rawpipe Card @@ -24685,7 +24772,9 @@ 0010 [mvHYPERION-16R16/-32R16] 16 Video Channel PCI Express x4 Frame Grabber 0020 [mvHYPERION-HD-SDI] HD-SDI PCI Express x4 Frame Grabber 0030 [mvHYPERION-HD-SDI-Merger] HD-SDI PCI Express x4 Frame Grabber + 7012 [mvBlueNAOS BVS CA-BN] PCIe Gen1 x2 Camera 7014 [mvBlueNAOS BVS CA-BN] PCIe Gen1 x4 Camera + 7022 [mvBlueNAOS BVS CA-BN] PCIe Gen2 x2 Camera 7024 [mvBlueNAOS BVS CA-BN] PCIe Gen2 x4 Camera 4ddc ILC Data Device Corp 0100 DD-42924I5-300 (ARINC 429 Data Bus) @@ -25130,8 +25219,11 @@ 0176 3rd Gen Core processor Graphics Controller 0201 Arctic Sound 0284 Comet Lake PCH-LP LPC Premium Controller/eSPI Controller + 1028 09be Latitude 7410 02a3 Comet Lake PCH-LP SMBus Host Controller + 1028 09be Latitude 7410 02a4 Comet Lake SPI (flash) Controller + 1028 09be Latitude 7410 02a6 Comet Lake North Peak 02b0 Comet Lake PCI Express Root Port #9 02b1 Comet Lake PCI Express Root Port #10 @@ -25140,14 +25232,21 @@ 02b8 Comet Lake PCI Express Root Port #1 02bc Comet Lake PCI Express Root Port #5 02c5 Comet Lake Serial IO I2C Host Controller + 1028 09be Latitude 7410 02c8 Comet Lake PCH-LP cAVS + 1028 09be Latitude 7410 02d3 Comet Lake SATA AHCI Controller 02e0 Comet Lake Management Engine Interface + 1028 09be Latitude 7410 02e8 Serial IO I2C Host Controller + 1028 09be Latitude 7410 02e9 Comet Lake Serial IO I2C Host Controller + 1028 09be Latitude 7410 02ea Comet Lake PCH-LP LPSS: I2C Controller #2 02ed Comet Lake PCH-LP USB 3.1 xHCI Host Controller + 1028 09be Latitude 7410 02ef Comet Lake PCH-LP Shared SRAM + 1028 09be Latitude 7410 02f0 Comet Lake PCH-LP CNVi WiFi 8086 0034 Wireless-AC 9560 160MHz 8086 0070 Wi-Fi 6 AX201 160MHz @@ -25155,7 +25254,9 @@ 8086 4070 Wi-Fi 6 AX201 160MHz 02f5 Comet Lake PCH-LP SCS3 02f9 Comet Lake Thermal Subsytem + 1028 09be Latitude 7410 02fc Comet Lake Integrated Sensor Solution + 1028 09be Latitude 7410 0309 80303 I/O Processor PCI-to-PCI Bridge 030d 80312 I/O Companion Chip PCI-to-PCI Bridge 0326 6700/6702PXH I/OxAPIC Interrupt Controller A @@ -25270,7 +25371,8 @@ 0703 CE Media Processor Media Control Unit 1 0704 CE Media Processor Video Capture Interface 0707 CE Media Processor SPI Slave - 0708 CE Media Processor 4100 + 0708 Atom Processor CE 4100 + 0709 Atom Processor CE 4200 0800 Moorestown SPI Ctrl 0 0801 Moorestown SPI Ctrl 1 0802 Moorestown I2C 0 @@ -25556,6 +25658,7 @@ 8086 8370 Dual Band Wireless AC 3160 # PowerVR SGX 545 08cf Atom Processor Z2760 Integrated Graphics Controller + 0931 Atom Processor CE 2600 [Puma 6] 0934 Quark SoC X1000 I2C Controller and GPIO Controller 0935 Quark SoC X1000 SPI Controller 0936 Quark SoC X1000 HS-UART @@ -25796,6 +25899,7 @@ 103c 1998 EliteDesk 800 G1 17aa 220e ThinkPad T440p 17aa 309f ThinkCentre M83 + 0c40 Atom Processor CE 5300 0c46 Atom Processor S1200 PCI Express Root Port 1 0c47 Atom Processor S1200 PCI Express Root Port 2 0c48 Atom Processor S1200 PCI Express Root Port 3 @@ -26027,7 +26131,7 @@ 0f0a Atom Processor Z36xxx/Z37xxx Series LPIO1 HSUART Controller #1 0f0c Atom Processor Z36xxx/Z37xxx Series LPIO1 HSUART Controller #2 0f0e Atom Processor Z36xxx/Z37xxx Series LPIO1 SPI Controller - 0f12 Atom Processor E3800 Series SMBus Controller + 0f12 Atom Processor E3800/CE2700 Series SMBus Controller 0f14 Atom Processor Z36xxx/Z37xxx Series SDIO Controller 0f15 Atom Processor Z36xxx/Z37xxx Series SDIO Controller 0f16 Atom Processor Z36xxx/Z37xxx Series SDIO Controller @@ -26534,6 +26638,7 @@ 103c 2159 Ethernet 10Gb 2-port 562i Adapter 108e 7b11 Ethernet Server Adapter X520-2 1170 004c 82599 DP 10G Mezzanine Adapter + 1374 1a08 PE310G4SPI9/PE310G4SPI9L/PE310G4SPI9LA Quad Port Fiber 10 Gigabit Ethernet PCI Express Server Adapter 15d9 0611 AOC-STGN-i2S 1734 11a9 10 Gigabit Dual Port Network Connection 17aa 1071 ThinkServer X520-2 AnyFabric @@ -27299,7 +27404,9 @@ 15e9 JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 2C 2018] 15ea JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] 15eb JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] + 1028 09be Latitude 7410 15ec JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 4C 2018] + 1028 09be Latitude 7410 15ef JHL7540 Thunderbolt 3 Bridge [Titan Ridge DD 2018] 15f0 JHL7540 Thunderbolt 3 USB Controller [Titan Ridge DD 2018] 15f2 Ethernet Controller I225-LM @@ -27396,6 +27503,7 @@ 1028 06dc Latitude E7470 1028 06e4 XPS 15 9550 1028 06e6 Latitude 11 5175 2-in-1 + 1028 09be Latitude 7410 103c 825b OMEN-17-w001nv 17aa 225d ThinkPad T480 1904 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers @@ -27418,6 +27526,7 @@ 103c 825b OMEN-17-w001nv 1911 Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model 1028 0869 Vostro 3470 + 1028 09be Latitude 7410 1462 7a72 H270 PC MATE 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen @@ -30434,6 +30543,13 @@ 2b66 Xeon Processor E7 Product Family SMI Physical Port 1: Misc control/status 2b68 Xeon Processor E7 Product Family Last Level Cache Coherence Engine 8 2b6c Xeon Processor E7 Product Family Last Level Cache Coherence Engine 9 + 2b80 Atom CE2700 Series [Puma 7] + 2b98 Puma 7 Trusted Execution Engine + 2bb5 Puma 7 xHCI Controller +# Synopsys DesignWare Core SuperSpeed USB 3.0 Controller + 2bb7 Puma 7 USB Device Controller (OTG) + 2bdc Puma 7 Thermal + 2be2 Puma 7 Security Processor 2c01 Xeon 5500/Core i7 QuickPath Architecture System Address Decoder 2c10 Xeon 5500/Core i7 QPI Link 0 2c11 Xeon 5500/Core i7 QPI Physical 0 @@ -30604,6 +30720,7 @@ 2e61 CE Media Processor Video Display Controller 2e62 CE Media Processor Video Processing Unit 2e63 CE Media Processor HDMI Tx Interface + 2e64 Atom CE2600/3100/4100/4200/5300 Security Processor 2e65 CE Media Processor Expansion Bus Interface 2e66 CE Media Processor UART 2e67 CE Media Processor General Purpose I/Os @@ -31722,6 +31839,7 @@ 4905 DG1 [Iris Xe MAX Graphics] 4906 DG1 [Iris Xe Pod] 4907 SG1 [Server GPU SG-18M] + 193d 4000 UN-GPU-XG310-32GB-FHFL 4908 DG1 [Iris Xe Graphics] 4c3d Volume Management Device NVMe RAID Controller 4c8a RocketLake-S GT1 [UHD Graphics 750] @@ -32512,10 +32630,12 @@ 9a68 TigerLake-H GT1 [UHD Graphics] 9b41 CometLake-U GT2 [UHD Graphics] 1028 09bd Latitude 7310 + 1028 09be Latitude 7410 9b44 10th Gen Core Processor Host Bridge/DRAM Registers 9b53 Comet Lake-S 6c Host Bridge/DRAM Controller 9b54 10th Gen Core Processor Host Bridge/DRAM Registers 9b61 Comet Lake-U v1 4c Host Bridge/DRAM Controller + 1028 09be Latitude 7410 9b63 10th Gen Core Processor Host Bridge/DRAM Registers 9b64 10th Gen Core Processor Host Bridge/DRAM Registers 9bc4 CometLake-H GT2 [UHD Graphics] @@ -33592,6 +33712,8 @@ 152d 8a24 QS-8236-16i 152d 8a36 QS-8240-24i 152d 8a37 QS-8242-24i + 1590 0294 SR932i-p Gen10+ + 1590 02dc SR416i-a Gen10+ 193d 1104 RAID P2404-Mf-4i-2GB 193d 1105 RAID P4408-Mf-8i-2GB 193d 1106 RAID P2404-Mf-4i-1GB @@ -33648,6 +33770,20 @@ 9005 1302 SmartHBA 2100-8i8e 9005 1303 SmartHBA 2100-24i 9005 1380 SmartRAID 3154-16i + 9005 1400 SmartRAID Ultra 3258p-16i /e + 9005 1402 HBA Ultra 1200p-16i + 9005 1410 HBA Ultra 1200-16e + 9005 1430 SmartRAID Ultra 3254-16e /e + 9005 1441 HBA Ultra 1200p-32i + 9005 1450 SmartRAID Ultra 3258p-32i /e + 9005 1462 HBA 1200-8i + 9005 1471 SmartRAID 3254-16i /e + 9005 1472 SmartRAID 3258-16i /e + 9005 14a0 SmartRAID 3254-8i + 9005 14a1 SmartRAID 3204-8i + 9005 14a2 SmartRAID 3252-8i + 9005 14c0 SmartHBA 2200-16i + 9005 14c1 HBA 1200-16i 0410 AIC-9410W SAS (Razor HBA RAID) 9005 0410 ASC-48300(Spirit RAID) 9005 0411 ASC-58300 (Oakmont RAID) From owner-dev-commits-src-main@freebsd.org Wed Sep 22 08:22: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 2EA8B6AE31C; Wed, 22 Sep 2021 08:22: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 4HDrrp0rmgz4b4P; Wed, 22 Sep 2021 08:22: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 F1CF51481D; Wed, 22 Sep 2021 08:22: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 18M8MnxU039724; Wed, 22 Sep 2021 08:22:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M8Mn4C039723; Wed, 22 Sep 2021 08:22:49 GMT (envelope-from git) Date: Wed, 22 Sep 2021 08:22:49 GMT Message-Id: <202109220822.18M8Mn4C039723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 91f764172e19 - main - libedit: import snapshot 2021-09-10 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91f764172e197c82efa97a66cfbc13d2c744b02b 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, 22 Sep 2021 08:22:50 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=91f764172e197c82efa97a66cfbc13d2c744b02b commit 91f764172e197c82efa97a66cfbc13d2c744b02b Merge: 00582fa66051 30f4a9aee1c1 Author: Baptiste Daroussin AuthorDate: 2021-09-22 08:19:43 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 08:19:43 +0000 libedit: import snapshot 2021-09-10 contrib/libedit/ChangeLog | 6 + contrib/libedit/TEST/fuzz1.c | 63 +++++++ contrib/libedit/editline.3 | 18 +- contrib/libedit/el.c | 17 +- contrib/libedit/el.h | 15 +- contrib/libedit/eln.c | 6 +- contrib/libedit/filecomplete.c | 7 +- contrib/libedit/histedit.h | 3 +- contrib/libedit/map.c | 8 +- contrib/libedit/read.c | 6 +- contrib/libedit/readline.c | 366 ++++++++++++++++++++++-------------- contrib/libedit/readline/readline.h | 19 +- contrib/libedit/refresh.c | 20 +- contrib/libedit/terminal.c | 7 +- contrib/libedit/tty.c | 12 +- contrib/libedit/tty.h | 4 +- contrib/libedit/vi.c | 9 +- 17 files changed, 396 insertions(+), 190 deletions(-) diff --cc contrib/libedit/ChangeLog index 000000000000,35c9205a43d8..35c9205a43d8 mode 000000,100644..100644 --- a/contrib/libedit/ChangeLog +++ b/contrib/libedit/ChangeLog diff --cc contrib/libedit/TEST/fuzz1.c index 000000000000,e31d26538885..e31d26538885 mode 000000,100644..100644 --- a/contrib/libedit/TEST/fuzz1.c +++ b/contrib/libedit/TEST/fuzz1.c From owner-dev-commits-src-main@freebsd.org Wed Sep 22 08:27: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 C712D6AE3C8; Wed, 22 Sep 2021 08:27: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 4HDryf510wz4ZpG; Wed, 22 Sep 2021 08:27: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 8BD4B14642; Wed, 22 Sep 2021 08:27: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 18M8Rsmm040182; Wed, 22 Sep 2021 08:27:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M8RsVJ040181; Wed, 22 Sep 2021 08:27:54 GMT (envelope-from git) Date: Wed, 22 Sep 2021 08:27:54 GMT Message-Id: <202109220827.18M8RsVJ040181@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 908b8e32f9de - main - sh: remove emacs improvements that are now defaults in libedit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 908b8e32f9deb55441fac75b8d1e3865e3d5302f 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, 22 Sep 2021 08:27:54 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=908b8e32f9deb55441fac75b8d1e3865e3d5302f commit 908b8e32f9deb55441fac75b8d1e3865e3d5302f Author: Baptiste Daroussin AuthorDate: 2021-09-22 08:27:10 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 08:27:10 +0000 sh: remove emacs improvements that are now defaults in libedit --- bin/sh/histedit.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 1a1e11e6f885..938df284a06c 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -203,8 +203,6 @@ bad: el_set(el, EL_EDITOR, "vi"); else if (Eflag) { el_set(el, EL_EDITOR, "emacs"); - el_set(el, EL_BIND, "^R", "em-inc-search-prev", NULL); - el_set(el, EL_BIND, "^W", "ed-delete-prev-word", NULL); } el_set(el, EL_BIND, "^I", "sh-complete", NULL); el_source(el, NULL); From owner-dev-commits-src-main@freebsd.org Wed Sep 22 09:01: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 E63846AEB35; Wed, 22 Sep 2021 09:01: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 4HDsjy62h6z4g6y; Wed, 22 Sep 2021 09:01: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 AF492148EA; Wed, 22 Sep 2021 09:01: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 18M91wqt092503; Wed, 22 Sep 2021 09:01:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M91waT092502; Wed, 22 Sep 2021 09:01:58 GMT (envelope-from git) Date: Wed, 22 Sep 2021 09:01:58 GMT Message-Id: <202109220901.18M91waT092502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 9413dfd331e7 - main - sh: reset sh bindings on bind -e, bind -v MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9413dfd331e705a1d7909fe41f06a30e43c442f7 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, 22 Sep 2021 09:01:59 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=9413dfd331e705a1d7909fe41f06a30e43c442f7 commit 9413dfd331e705a1d7909fe41f06a30e43c442f7 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-19 20:17:01 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-22 08:54:51 +0000 sh: reset sh bindings on bind -e, bind -v Until this change, any bindings set in histedit() were lost on calls to bindcmd(). Only bind -e and bind -v call libedit's keymacro_reset(). Currently you cannot fool libedit/map.c:map_bind() by trying something like bind -le as when p[0] == '-', it does a switch statement on p[1]. --- bin/sh/histedit.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 938df284a06c..37b62cef5746 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -559,6 +559,13 @@ bindcmd(int argc, char **argv) fclose(out); + if (argc > 1 && argv[1][0] == '-' && + memchr("ve", argv[1][1], 2) != NULL) { + Vflag = argv[1][1] == 'v'; + Eflag = !Vflag; + histedit(); + } + INTON; return ret; From owner-dev-commits-src-main@freebsd.org Wed Sep 22 09:11: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 1A2626AEB63; Wed, 22 Sep 2021 09:11: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 4HDswh07Ktz4gTb; Wed, 22 Sep 2021 09:11: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 D97CF15118; Wed, 22 Sep 2021 09:11: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 18M9BFOn002450; Wed, 22 Sep 2021 09:11:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M9BFjB002449; Wed, 22 Sep 2021 09:11:15 GMT (envelope-from git) Date: Wed, 22 Sep 2021 09:11:15 GMT Message-Id: <202109220911.18M9BFjB002449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: fbe95b885f34 - main - dma: import snapshot 2021-07-10 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbe95b885f3431b1d8003545b32e8ffa88f2d16b 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, 22 Sep 2021 09:11:16 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=fbe95b885f3431b1d8003545b32e8ffa88f2d16b commit fbe95b885f3431b1d8003545b32e8ffa88f2d16b Merge: 9413dfd331e7 16a84834c279 Author: Baptiste Daroussin AuthorDate: 2021-09-22 09:09:27 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 09:10:58 +0000 dma: import snapshot 2021-07-10 contrib/dma/Makefile | 2 +- contrib/dma/VERSION | 2 +- contrib/dma/conf.c | 20 +++- contrib/dma/crypto.c | 43 ++++++- contrib/dma/dfcompat.c | 6 +- contrib/dma/dma.8 | 17 ++- contrib/dma/dma.c | 38 +++--- contrib/dma/dma.conf | 6 +- contrib/dma/dma.h | 17 ++- contrib/dma/dns.c | 5 - contrib/dma/get-version.sh | 0 contrib/dma/local.c | 5 +- contrib/dma/mail.c | 40 +++++-- contrib/dma/net.c | 284 ++++++++++++++++++++++++++++++++------------- contrib/dma/spool.c | 2 + contrib/dma/util.c | 20 ++++ 16 files changed, 378 insertions(+), 129 deletions(-) diff --cc contrib/dma/Makefile index aed2ef7246cf,000000000000..8cae5b28f98b mode 100644,000000..100644 --- a/contrib/dma/Makefile +++ b/contrib/dma/Makefile @@@ -1,111 -1,0 +1,111 @@@ +# +# Depending on your operating system, you might want to influence +# the conditional inclusion of some helper functions: +# +# Define HAVE_* (in caps) if your system already provides: +# reallocf +# strlcpy +# getprogname +# + +SH?= sh + +version= $(shell ${SH} get-version.sh) +debversion= $(shell ${SH} get-version.sh | sed -Ee 's/^v//;s/[.]([[:digit:]]+)[.](g[[:xdigit:]]+)$$/+\1+\2/') + +CC?= gcc +CFLAGS?= -O -pipe +LDADD?= -lssl -lcrypto -lresolv + - CFLAGS+= -Wall -DDMA_VERSION='"${version}"' -DLIBEXEC_PATH='"${LIBEXEC}"' -DCONF_PATH='"${CONFDIR}"' ++CFLAGS+= -Wall -Wno-format-truncation -DDMA_VERSION='"${version}"' -DLIBEXEC_PATH='"${LIBEXEC}"' -DCONF_PATH='"${CONFDIR}"' + +INSTALL?= install -p +CHGRP?= chgrp +CHMOD?= chmod + +PREFIX?= /usr/local +SBIN?= ${PREFIX}/sbin +LIBEXEC?= ${PREFIX}/lib +CONFDIR?= /etc/dma +MAN?= ${PREFIX}/share/man +VAR?= /var +DMASPOOL?= ${VAR}/spool/dma +VARMAIL?= ${VAR}/mail +SYMLINK?= -s # or empty to create hard link + +YACC?= yacc +LEX?= lex +LN?= ln + +OBJS= aliases_parse.o aliases_scan.o base64.o conf.o crypto.o +OBJS+= dma.o dns.o local.o mail.o net.o spool.o util.o +OBJS+= dfcompat.o + +all: dma dma-mbox-create + +clean: + -rm -f .depend dma dma-mbox-create *.[do] + -rm -f aliases_parse.[ch] aliases_scan.c + +install: all + ${INSTALL} -d ${DESTDIR}${SBIN} + ${INSTALL} -d ${DESTDIR}${MAN}/man8 ${DESTDIR}${LIBEXEC} + ${INSTALL} -m 2755 -o root -g mail dma ${DESTDIR}${SBIN} + ${INSTALL} -m 4754 -o root -g mail dma-mbox-create ${DESTDIR}${LIBEXEC} + ${INSTALL} -m 0644 dma.8 ${DESTDIR}${MAN}/man8/ + +sendmail-link: + cd ${DESTDIR}${SBIN} && ${LN} ${SYMLINK} dma sendmail + +mailq-link: + cd ${DESTDIR}${SBIN} && ${LN} ${SYMLINK} dma mailq + +install-spool-dirs: + ${INSTALL} -d -m 2775 -o root -g mail ${DESTDIR}${DMASPOOL} + ${INSTALL} -d -m 2775 -o root -g mail ${DESTDIR}${VARMAIL} + +permissions: + -${CHGRP} mail ${DESTDIR}${VARMAIL}/* + -${CHMOD} g+w ${DESTDIR}${VARMAIL}/* + -${CHMOD} 660 ${DESTDIR}${DMASPOOL}/flush + +install-etc: + ${INSTALL} -d ${DESTDIR}${CONFDIR} + @if [ -e ${DESTDIR}${CONFDIR}/dma.conf ]; then \ + echo "Not overwriting ${DESTDIR}${CONFDIR}/dma.conf."; \ + else \ + echo ${INSTALL} -m 644 -o root -g mail dma.conf ${DESTDIR}${CONFDIR}; \ + ${INSTALL} -m 644 -o root -g mail dma.conf ${DESTDIR}${CONFDIR}; \ + fi + @if [ -e ${DESTDIR}${CONFDIR}/auth.conf ]; then \ + echo "Not overwriting ${DESTDIR}${CONFDIR}/auth.conf."; \ + else \ + echo ${INSTALL} -m 640 -o root -g mail auth.conf ${DESTDIR}${CONFDIR}; \ + ${INSTALL} -m 640 -o root -g mail auth.conf ${DESTDIR}${CONFDIR}; \ + fi + +aliases_parse.c: aliases_parse.y + ${YACC} -d -o aliases_parse.c aliases_parse.y + +aliases_scan.c: aliases_scan.l + ${LEX} -t aliases_scan.l > aliases_scan.c + +.SUFFIXES: .c .o + +.c.o: + ${CC} ${CFLAGS} ${CPPFLAGS} -include dfcompat.h -o $@ -c $< + +dma: ${OBJS} + ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD} + + +dch: + dch --release-heuristic changelog -v ${debversion} + + +ppa: + @if [ -z '${DEB_DIST}' ]; then echo "please set DEB_DIST to build"; exit 1; fi + dch -v "${debversion}~${DEB_DIST}" -D ${DEB_DIST} "${DEB_DIST} build" -b + debuild -S -sa + ver=$$(dpkg-parsechangelog -n1 | awk '$$1 == "Version:" { print $$2 }'); \ + dput ppa:corecode/dma ../dma_$${ver}_source.changes diff --cc contrib/dma/conf.c index b8a6a2e2cbd7,000000000000..13cfac7a6de4 mode 100644,000000..100644 --- a/contrib/dma/conf.c +++ b/contrib/dma/conf.c @@@ -1,245 -1,0 +1,261 @@@ +/* + * Copyright (c) 2008 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthias Schmidt , University of Marburg, + * Germany. + * + * 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 DragonFly Project 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 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 HOLDERS 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 +#include +#include +#include +#include +#include +#include + +#include "dma.h" + +#define DP ": \t" +#define EQS " \t" + + +/* + * Remove trailing \n's + */ +void +trim_line(char *line) +{ + size_t linelen; + char *p; + + if ((p = strchr(line, '\n'))) + *p = (char)0; + + /* Escape leading dot in every case */ + linelen = strlen(line); + if (line[0] == '.') { + if ((linelen + 2) > 1000) { + syslog(LOG_CRIT, "Cannot escape leading dot. Buffer overflow"); + exit(EX_DATAERR); + } + memmove((line + 1), line, (linelen + 1)); + line[0] = '.'; + } +} + +static void +chomp(char *str) +{ + size_t len = strlen(str); + + if (len == 0) + return; + if (str[len - 1] == '\n') + str[len - 1] = 0; +} + +/* + * Read the SMTP authentication config file + * + * file format is: + * user|host:password + * + * A line starting with # is treated as comment and ignored. + */ +void +parse_authfile(const char *path) +{ + char line[2048]; + struct authuser *au; + FILE *a; + char *data; + int lineno = 0; + + a = fopen(path, "r"); + if (a == NULL) { + errlog(EX_NOINPUT, "can not open auth file `%s'", path); + /* NOTREACHED */ + } + + while (!feof(a)) { + if (fgets(line, sizeof(line), a) == NULL) + break; + lineno++; + + chomp(line); + + /* We hit a comment */ + if (*line == '#') + continue; + /* Ignore empty lines */ + if (*line == 0) + continue; + + au = calloc(1, sizeof(*au)); + if (au == NULL) + errlog(EX_OSERR, "calloc()"); + + data = strdup(line); + au->login = strsep(&data, "|"); + au->host = strsep(&data, DP); + au->password = data; + + if (au->login == NULL || + au->host == NULL || + au->password == NULL) { + errlogx(EX_CONFIG, "syntax error in authfile %s:%d", path, lineno); + /* NOTREACHED */ + } + + SLIST_INSERT_HEAD(&authusers, au, next); + } + + fclose(a); +} + +/* + * XXX TODO + * Check for bad things[TM] + */ +void +parse_conf(const char *config_path) +{ + char *word; + char *data; + FILE *conf; + char line[2048]; + int lineno = 0; + + conf = fopen(config_path, "r"); + if (conf == NULL) { + /* Don't treat a non-existing config file as error */ + if (errno == ENOENT) + return; + errlog(EX_NOINPUT, "can not open config `%s'", config_path); + /* NOTREACHED */ + } + + while (!feof(conf)) { + if (fgets(line, sizeof(line), conf) == NULL) + break; + lineno++; + + chomp(line); + + /* We hit a comment */ + if (strchr(line, '#')) + *strchr(line, '#') = 0; + + data = line; + word = strsep(&data, EQS); + + /* Ignore empty lines */ + if (word == NULL || *word == 0) + continue; + + if (data != NULL && *data != 0) + data = strdup(data); + else + data = NULL; + + if (strcmp(word, "SMARTHOST") == 0 && data != NULL) + config.smarthost = data; + else if (strcmp(word, "PORT") == 0 && data != NULL) + config.port = atoi(data); + else if (strcmp(word, "ALIASES") == 0 && data != NULL) + config.aliases = data; + else if (strcmp(word, "SPOOLDIR") == 0 && data != NULL) + config.spooldir = data; + else if (strcmp(word, "AUTHPATH") == 0 && data != NULL) + config.authpath= data; + else if (strcmp(word, "CERTFILE") == 0 && data != NULL) + config.certfile = data; + else if (strcmp(word, "MAILNAME") == 0 && data != NULL) + config.mailname = data; + else if (strcmp(word, "MASQUERADE") == 0 && data != NULL) { + char *user = NULL, *host = NULL; + if (strrchr(data, '@')) { + host = strrchr(data, '@'); + *host = 0; + host++; + user = data; + } else { + host = data; + } + if (host && *host == 0) + host = NULL; + if (user && *user == 0) + user = NULL; + config.masquerade_host = host; + config.masquerade_user = user; + } else if (strcmp(word, "STARTTLS") == 0 && data == NULL) + config.features |= STARTTLS; - else if (strcmp(word, "OPPORTUNISTIC_TLS") == 0 && data == NULL) ++ else if (strcmp(word, "FINGERPRINT") == 0) { ++ if (strlen(data) != SHA256_DIGEST_LENGTH * 2) { ++ errlogx(EX_CONFIG, "invalid sha256 fingerprint length"); ++ } ++ unsigned char *fingerprint = malloc(SHA256_DIGEST_LENGTH); ++ if (fingerprint == NULL) { ++ errlogx(EX_CONFIG, "fingerprint allocation failed"); ++ } ++ unsigned int i; ++ for (i = 0; i < SHA256_DIGEST_LENGTH; i++) { ++ if(sscanf(data + 2 * i, "%02hhx", &fingerprint[i]) != 1) { ++ errlogx(EX_CONFIG, "failed to read fingerprint"); ++ } ++ } ++ free(data); ++ config.fingerprint = fingerprint; ++ } else if (strcmp(word, "OPPORTUNISTIC_TLS") == 0 && data == NULL) + config.features |= TLS_OPP; + else if (strcmp(word, "SECURETRANSFER") == 0 && data == NULL) - config.features |= SECURETRANS; ++ config.features |= SECURETRANSFER; + else if (strcmp(word, "DEFER") == 0 && data == NULL) + config.features |= DEFER; + else if (strcmp(word, "INSECURE") == 0 && data == NULL) + config.features |= INSECURE; + else if (strcmp(word, "FULLBOUNCE") == 0 && data == NULL) + config.features |= FULLBOUNCE; + else if (strcmp(word, "NULLCLIENT") == 0 && data == NULL) + config.features |= NULLCLIENT; + else { + errlogx(EX_CONFIG, "syntax error in %s:%d", config_path, lineno); + /* NOTREACHED */ + } + } + + if ((config.features & NULLCLIENT) && config.smarthost == NULL) { + errlogx(EX_CONFIG, "%s: NULLCLIENT requires SMARTHOST", config_path); + /* NOTREACHED */ + } + + fclose(conf); +} diff --cc contrib/dma/dma.8 index cadf899e50fc,a906f75447f2..e0f5e79ff47d --- a/contrib/dma/dma.8 +++ b/contrib/dma/dma.8 @@@ -305,10 -313,10 +313,11 @@@ will send all mails a setting it to .Ql percolator will send all mails as -.Ql Sm off Va username @percolator . +.Sm off +.Ql Va username @percolator . .Sm on .It Ic NULLCLIENT Xo + (boolean, default=commented) .Xc Bypass aliases and local delivery, and instead forward all mails to the defined diff --cc contrib/dma/dma.c index b553c0fa0eef,ae0018a243d2..72115ae2b55e --- a/contrib/dma/dma.c +++ b/contrib/dma/dma.c @@@ -596,8 -595,11 +595,11 @@@ skipopts if (read_aliases() != 0) errlog(EX_SOFTWARE, "could not parse aliases file `%s'", config.aliases); + if (newaliases) + return(0); + if ((sender = set_from(&queue, sender)) == NULL) - errlog(EX_SOFTWARE, NULL); + errlog(EX_SOFTWARE, "set_from()"); if (newspoolf(&queue) != 0) errlog(EX_CANTCREAT, "can not create temp file in `%s'", config.spooldir); diff --cc contrib/dma/get-version.sh index d9691ac37c95,d9691ac37c95..d9691ac37c95 mode 100755,100644..100644 --- a/contrib/dma/get-version.sh +++ b/contrib/dma/get-version.sh diff --cc contrib/dma/mail.c index ad928272e1a1,000000000000..48c8ee6d4dd2 mode 100644,000000..100644 --- a/contrib/dma/mail.c +++ b/contrib/dma/mail.c @@@ -1,492 -1,0 +1,518 @@@ +/* + * Copyright (c) 2008-2014, Simon Schubert <2@0x2c.org>. + * Copyright (c) 2008 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Simon Schubert <2@0x2c.org>. + * + * 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 DragonFly Project 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 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 HOLDERS 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 +#include +#include ++#include +#include +#include +#include + +#include "dma.h" + +#define MAX_LINE_RFC822 1000 + +void +bounce(struct qitem *it, const char *reason) +{ + struct queue bounceq; + char line[1000]; + size_t pos; + int error; + + /* Don't bounce bounced mails */ + if (it->sender[0] == 0) { + syslog(LOG_INFO, "can not bounce a bounce message, discarding"); + exit(EX_SOFTWARE); + } + + bzero(&bounceq, sizeof(bounceq)); + LIST_INIT(&bounceq.queue); + bounceq.sender = ""; + if (add_recp(&bounceq, it->sender, EXPAND_WILDCARD) != 0) + goto fail; + + if (newspoolf(&bounceq) != 0) + goto fail; + + syslog(LOG_ERR, "delivery failed, bouncing as %s", bounceq.id); + setlogident("%s", bounceq.id); + + error = fprintf(bounceq.mailf, + "Received: from MAILER-DAEMON\n" + "\tid %s\n" - "\tby %s (%s);\n" ++ "\tby %s (%s on %s);\n" + "\t%s\n" + "X-Original-To: <%s>\n" + "From: MAILER-DAEMON <>\n" + "To: %s\n" + "Subject: Mail delivery failed\n" + "Message-Id: <%s@%s>\n" + "Date: %s\n" + "\n" + "This is the %s at %s.\n" + "\n" + "There was an error delivering your mail to <%s>.\n" + "\n" + "%s\n" + "\n" + "%s\n" + "\n", + bounceq.id, - hostname(), VERSION, ++ hostname(), VERSION, systemhostname(), + rfc822date(), + it->addr, + it->sender, + bounceq.id, hostname(), + rfc822date(), + VERSION, hostname(), + it->addr, + reason, + config.features & FULLBOUNCE ? + "Original message follows." : + "Message headers follow."); + if (error < 0) + goto fail; + + if (fseek(it->mailf, 0, SEEK_SET) != 0) + goto fail; + if (config.features & FULLBOUNCE) { + while ((pos = fread(line, 1, sizeof(line), it->mailf)) > 0) { + if (fwrite(line, 1, pos, bounceq.mailf) != pos) + goto fail; + } + } else { + while (!feof(it->mailf)) { + if (fgets(line, sizeof(line), it->mailf) == NULL) + break; + if (line[0] == '\n') + break; + if (fwrite(line, strlen(line), 1, bounceq.mailf) != 1) + goto fail; + } + } + + if (linkspool(&bounceq) != 0) + goto fail; + /* bounce is safe */ + + delqueue(it); + + run_queue(&bounceq); + /* NOTREACHED */ + +fail: + syslog(LOG_CRIT, "error creating bounce: %m"); + delqueue(it); + exit(EX_IOERR); +} + +struct parse_state { + char addr[1000]; + int pos; + + enum { + NONE = 0, + START, + MAIN, + EOL, + QUIT + } state; + int comment; + int quote; + int brackets; + int esc; +}; + +/* + * Simplified RFC2822 header/address parsing. + * We copy escapes and quoted strings directly, since + * we have to pass them like this to the mail server anyways. + * XXX local addresses will need treatment + */ +static int +parse_addrs(struct parse_state *ps, char *s, struct queue *queue) +{ + char *addr; + +again: + switch (ps->state) { + case NONE: + return (-1); + + case START: + /* init our data */ + bzero(ps, sizeof(*ps)); + + /* skip over header name */ + while (*s != ':') + s++; + s++; + ps->state = MAIN; + break; + + case MAIN: + /* all fine */ + break; + + case EOL: + switch (*s) { + case ' ': + case '\t': - s++; - /* continue */ ++ ps->state = MAIN; + break; + + default: + ps->state = QUIT; + if (ps->pos != 0) + goto newaddr; + return (0); + } ++ break; + + case QUIT: + return (0); + } + + for (; *s != 0; s++) { + if (ps->esc) { + ps->esc = 0; + + switch (*s) { + case '\r': + case '\n': + goto err; + + default: + goto copy; + } + } + + if (ps->quote) { + switch (*s) { + case '"': + ps->quote = 0; + goto copy; + + case '\\': + ps->esc = 1; + goto copy; + + case '\r': + case '\n': + goto eol; + + default: + goto copy; + } + } + + switch (*s) { + case '(': + ps->comment++; + break; + + case ')': + if (ps->comment) + ps->comment--; + else + goto err; + goto skip; + + case '"': + ps->quote = 1; + goto copy; + + case '\\': + ps->esc = 1; + goto copy; + + case '\r': + case '\n': + goto eol; + } + + if (ps->comment) + goto skip; + + switch (*s) { + case ' ': + case '\t': + /* ignore whitespace */ + goto skip; + + case '<': + /* this is the real address now */ + ps->brackets = 1; + ps->pos = 0; + goto skip; + + case '>': + if (!ps->brackets) + goto err; + ps->brackets = 0; + + s++; + goto newaddr; + + case ':': + /* group - ignore */ + ps->pos = 0; + goto skip; + + case ',': + case ';': + /* + * Next address, copy previous one. + * However, we might be directly after + * a
, or have two consecutive + * commas. + * Skip the comma unless there is + * really something to copy. + */ + if (ps->pos == 0) + goto skip; + s++; + goto newaddr; + + default: + goto copy; + } + +copy: + if (ps->comment) + goto skip; + + if (ps->pos + 1 == sizeof(ps->addr)) + goto err; + ps->addr[ps->pos++] = *s; + +skip: + ; + } + +eol: + ps->state = EOL; + return (0); + +err: + ps->state = QUIT; + return (-1); + +newaddr: + ps->addr[ps->pos] = 0; + ps->pos = 0; + addr = strdup(ps->addr); + if (addr == NULL) + errlog(EX_SOFTWARE, "strdup"); + + if (add_recp(queue, addr, EXPAND_WILDCARD) != 0) + errlogx(EX_DATAERR, "invalid recipient `%s'", addr); + + goto again; +} + +static int +writeline(struct queue *queue, const char *line, ssize_t linelen) +{ + ssize_t len; + + while (linelen > 0) { + len = linelen; + if (linelen > MAX_LINE_RFC822) { + len = MAX_LINE_RFC822 - 10; + } + + if (fwrite(line, len, 1, queue->mailf) != 1) + return (-1); + + if (linelen <= MAX_LINE_RFC822) + break; + + if (fwrite("\n", 1, 1, queue->mailf) != 1) + return (-1); + + line += MAX_LINE_RFC822 - 10; + linelen = strlen(line); + } + return (0); +} + +int +readmail(struct queue *queue, int nodot, int recp_from_header) +{ + struct parse_state parse_state; + char *line = NULL; + ssize_t linelen; + size_t linecap = 0; + char newline[MAX_LINE_RFC822]; + size_t error; + int had_headers = 0; + int had_from = 0; + int had_messagid = 0; + int had_date = 0; ++ int had_first_line = 0; ++ int had_last_line = 0; + int nocopy = 0; + int ret = -1; + + parse_state.state = NONE; + + error = fprintf(queue->mailf, + "Received: from %s (uid %d)\n" + "\t(envelope-from %s)\n" + "\tid %s\n" - "\tby %s (%s);\n" ++ "\tby %s (%s on %s);\n" + "\t%s\n", + username, useruid, + queue->sender, + queue->id, - hostname(), VERSION, ++ hostname(), VERSION, systemhostname(), + rfc822date()); + if ((ssize_t)error < 0) + return (-1); + + while (!feof(stdin)) { + newline[0] = '\0'; + if ((linelen = getline(&line, &linecap, stdin)) <= 0) + break; - ++ if (had_last_line) ++ errlogx(EX_DATAERR, "bad mail input format:" ++ " from %s (uid %d) (envelope-from %s)", ++ username, useruid, queue->sender); ++ linelen = strlen(line); ++ if (linelen == 0 || line[linelen - 1] != '\n') { ++ /* ++ * This line did not end with a newline character. ++ * If we fix it, it better be the last line of ++ * the file. ++ */ ++ line[linelen] = '\n'; ++ line[linelen + 1] = 0; ++ had_last_line = 1; ++ } ++ if (!had_first_line) { ++ /* ++ * Ignore a leading RFC-976 From_ or >From_ line mistakenly ++ * inserted by some programs. ++ */ ++ if (strprefixcmp(line, "From ") == 0 || strprefixcmp(line, ">From ") == 0) ++ continue; ++ had_first_line = 1; ++ } + if (!had_headers) { + if (linelen > MAX_LINE_RFC822) { + /* XXX also split headers */ + errlogx(EX_DATAERR, "bad mail input format:" + " from %s (uid %d) (envelope-from %s)", + username, useruid, queue->sender); + } + /* + * Unless this is a continuation, switch of + * the Bcc: nocopy flag. + */ + if (!(line[0] == ' ' || line[0] == '\t')) + nocopy = 0; + + if (strprefixcmp(line, "Date:") == 0) + had_date = 1; + else if (strprefixcmp(line, "Message-Id:") == 0) + had_messagid = 1; + else if (strprefixcmp(line, "From:") == 0) + had_from = 1; + else if (strprefixcmp(line, "Bcc:") == 0) + nocopy = 1; + + if (parse_state.state != NONE) { + if (parse_addrs(&parse_state, line, queue) < 0) { + errlogx(EX_DATAERR, "invalid address in header\n"); + /* NOTREACHED */ + } + } + + if (recp_from_header && ( + strprefixcmp(line, "To:") == 0 || + strprefixcmp(line, "Cc:") == 0 || + strprefixcmp(line, "Bcc:") == 0)) { + parse_state.state = START; + if (parse_addrs(&parse_state, line, queue) < 0) { + errlogx(EX_DATAERR, "invalid address in header\n"); + /* NOTREACHED */ + } + } + } + + if (strcmp(line, "\n") == 0 && !had_headers) { + had_headers = 1; + while (!had_date || !had_messagid || !had_from) { + if (!had_date) { + had_date = 1; + snprintf(newline, sizeof(newline), "Date: %s\n", rfc822date()); + } else if (!had_messagid) { + /* XXX msgid, assign earlier and log? */ + had_messagid = 1; + snprintf(newline, sizeof(newline), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", + (uintmax_t)time(NULL), + queue->id, + (uintmax_t)random(), + hostname()); + } else if (!had_from) { + had_from = 1; + snprintf(newline, sizeof(newline), "From: <%s>\n", queue->sender); + } + if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) + goto fail; + } + strlcpy(newline, "\n", sizeof(newline)); + } + if (!nodot && linelen == 2 && line[0] == '.') + break; + if (!nocopy) { + if (newline[0]) { + if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) + goto fail; + } else { + if (writeline(queue, line, linelen) != 0) + goto fail; + } + } + } + + ret = 0; +fail: + free(line); + return (ret); *** 1 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Sep 22 09:12: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 4853D6AF015; Wed, 22 Sep 2021 09:12:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDsxn1fh0z4gtn; Wed, 22 Sep 2021 09:12:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1847F1512D; Wed, 22 Sep 2021 09:12:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18M9CDdK004307; Wed, 22 Sep 2021 09:12:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18M9CD32004306; Wed, 22 Sep 2021 09:12:13 GMT (envelope-from git) Date: Wed, 22 Sep 2021 09:12:13 GMT Message-Id: <202109220912.18M9CD32004306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: c96da1994587 - main - dma: make the version exposed reflect the new version MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c96da19945877319c36731391a9c067c48539194 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, 22 Sep 2021 09:12:13 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c96da19945877319c36731391a9c067c48539194 commit c96da19945877319c36731391a9c067c48539194 Author: Baptiste Daroussin AuthorDate: 2021-09-22 09:12:04 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-22 09:12:04 +0000 dma: make the version exposed reflect the new version --- libexec/dma/Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/dma/Makefile.inc b/libexec/dma/Makefile.inc index 8e88f832ee99..5e953921259d 100644 --- a/libexec/dma/Makefile.inc +++ b/libexec/dma/Makefile.inc @@ -7,7 +7,7 @@ DMA_SOURCES= ${SRCTOP}/contrib/dma CFLAGS+= -I${DMA_SOURCES} \ -DHAVE_REALLOCF -DHAVE_STRLCPY -DHAVE_GETPROGNAME \ -DCONF_PATH='"/etc/dma"' \ - -DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.11+"' \ + -DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.13+"' \ -DDMA_ROOT_USER='"mailnull"' \ -DDMA_GROUP='"mail"' BINGRP= mail From owner-dev-commits-src-main@freebsd.org Wed Sep 22 12:08: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 AF59A669B8A; Wed, 22 Sep 2021 12:08: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 4HDxrz4ZGLz52xY; Wed, 22 Sep 2021 12:08: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 78AD316FF5; Wed, 22 Sep 2021 12:08: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 18MC8JYO033337; Wed, 22 Sep 2021 12:08:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MC8J5a033335; Wed, 22 Sep 2021 12:08:19 GMT (envelope-from git) Date: Wed, 22 Sep 2021 12:08:19 GMT Message-Id: <202109221208.18MC8J5a033335@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: cd9254a7d330 - main - ObsoleteFiles.inc: Add sponge(1) command and man-page 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: cd9254a7d330758f0322b967709b09f7b43cf843 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, 22 Sep 2021 12:08:19 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=cd9254a7d330758f0322b967709b09f7b43cf843 commit cd9254a7d330758f0322b967709b09f7b43cf843 Author: Stefan Eßer AuthorDate: 2021-09-22 11:59:01 +0000 Commit: Stefan Eßer CommitDate: 2021-09-22 12:08:04 +0000 ObsoleteFiles.inc: Add sponge(1) command and man-page The sponge command has been imported on 2017-12-05 but the import has been reverted the next day. A script failed and I found that it was due to the left-over broken sponge binary in base being prefered over the port version. To prevent a known non-working binary to persist in /usr/bin, I'm adding sponge to the obsolete files list even though it could only be installed on a single day in 2017. I do not plan to MFC this change since the issue will only exist on systems installed from -CURRENT sources in 2017, and I do assume that such systems are not running -STABLE today --- ObsoleteFiles.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 1a5d235624eb..111fced8ce20 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -7595,6 +7595,9 @@ OLD_FILES+=tests/sys/geom/class/eli/onetime_d_test.sh OLD_DIRS+=etc/skel # 20171208: Remove basename_r(3) OLD_FILES+=usr/share/man/man3/basename_r.3.gz +# 20171206: Remove sponge(1) +OLD_FILES+=usr/bin/sponge +OLD_FILES+=usr/share/man/man1/sponge.1.gz # 20171204: Move fdformat man page from volume 1 to volume 8. OLD_FILES+=usr/share/man/man1/fdformat.1.gz # 20171203: libproc version bump From owner-dev-commits-src-main@freebsd.org Wed Sep 22 12:44: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 E5ADF66A29E; Wed, 22 Sep 2021 12:44: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 4HDyg54wdcz56gX; Wed, 22 Sep 2021 12:44: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 898001777C; Wed, 22 Sep 2021 12:44: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 18MCins0085372; Wed, 22 Sep 2021 12:44:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MCinjK085371; Wed, 22 Sep 2021 12:44:49 GMT (envelope-from git) Date: Wed, 22 Sep 2021 12:44:49 GMT Message-Id: <202109221244.18MCinjK085371@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: 884f38590c3c - main - Fix false device_set_unit() error. 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: 884f38590c3cc0b1a2c00904c1f1f6c791376308 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, 22 Sep 2021 12:44:50 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=884f38590c3cc0b1a2c00904c1f1f6c791376308 commit 884f38590c3cc0b1a2c00904c1f1f6c791376308 Author: Alexander Motin AuthorDate: 2021-09-22 12:42:36 +0000 Commit: Alexander Motin CommitDate: 2021-09-22 12:44:39 +0000 Fix false device_set_unit() error. It should silently succeed if the current unit number is the same as requested, not fail immediately. MFC after: 1 week --- sys/kern/subr_bus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 1f580f455dc0..5e1b561155bb 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -3145,6 +3145,8 @@ device_set_unit(device_t dev, int unit) devclass_t dc; int err; + if (unit == dev->unit) + return (0); dc = device_get_devclass(dev); if (unit < dc->maxunit && dc->devices[unit]) return (EBUSY); From owner-dev-commits-src-main@freebsd.org Wed Sep 22 16:22: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 96C8766D79B; Wed, 22 Sep 2021 16:22:39 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (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 4HF3VQ3QMfz4V7j; Wed, 22 Sep 2021 16:22:38 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x12f.google.com with SMTP id z24so14334928lfu.13; Wed, 22 Sep 2021 09:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aowu8g3Cl4FEk0wT7lIKGyg1V7ZbWqkQrGXDIgbuisw=; b=pvQoQPawzJneitkwYr3FrlXgCO7BpXhKDufToTRJsDuXYCZAYcJdhXXYzivGQi2Gpb NZy+tjB9vAdeM5VZlEvw1Vy0li1XviaUFNETR+8qqhqckWnFS1kjmRvai04FBpVzp0w6 /F8JTKd+3cCvXs1sdrAvqEWhl3AAD2skgg/kkfAZpqknfg0GF8I+893wRFKdNaJ9hT5u DKF1gx0mjSeigjYz77ng2btaGBxsBYptw0Eg8/3mnJfX0/y8y7sNUOzplnAh780Qq1oH CfsY4MtQiel95OT3YktecbNi+ANddF1vPCqzO8OdMfiJbPR+YCNXMbnZ9OAzdI/1buZc eZwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aowu8g3Cl4FEk0wT7lIKGyg1V7ZbWqkQrGXDIgbuisw=; b=eFNJlIF62QA7gx5Obm9/abe6mx3ygDFT0Wg0/0YwYoJQNXlj8aNqN821udx/ZjGQAv ko01powwB8eLzcV+DfBVeGHoBSq8U1xXcWaQIt3kalwwseuSUFIBEEQ34j3O0xmrgVS3 H2oT1DklMr0MP/CnL1b8VRh798rf+UvPWZa9Oz9kak/pH3UgpzfTAwPt3AjEXDtH3v1X AO6gZihZeJ6w/kpIz1xMhpa7G/7ZZzoN56nXWHE1iyn9UDPlowqxEET3eWq6c1EZ5dPf hkNibVNCUbS+NFRbkw5SGUpZnjSg/84RMhsJhRPHnHTLTBIBKvyYuad6zkg2tqmy3uJe GIrw== X-Gm-Message-State: AOAM533Qmvgf3wbsn94VPxSnwLBp45SoNX1vWSpT+NVHRKZRqLCQsN4u mclUVBtNrVOvEBisQWXaTuK2rYEORbWWwG2vMVXXn0La X-Google-Smtp-Source: ABdhPJxCbsocIHbUCUaNTabp6jiPTGhddgyh1JPAvneDl5Z6gvBiM9KIXWcVEJ/NcEjd6eLwN/WgoyF0tS4rpYyPkJ4= X-Received: by 2002:a2e:a231:: with SMTP id i17mr63151ljm.233.1632327712671; Wed, 22 Sep 2021 09:21:52 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:2f18:0:0:0:0:0 with HTTP; Wed, 22 Sep 2021 09:21:51 -0700 (PDT) In-Reply-To: <202109130801.18D81odG012720@gitrepo.freebsd.org> References: <202109130801.18D81odG012720@gitrepo.freebsd.org> From: Mateusz Guzik Date: Wed, 22 Sep 2021 18:21:51 +0200 Message-ID: Subject: Re: git: d00c1f7f2f4a - main - sdhci: add sysctls to dump sdhci registers and capabilites To: Wojciech Macek Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HF3VQ3QMfz4V7j X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=pvQoQPaw; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::12f as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::12f:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 22 Sep 2021 16:22:39 -0000 This crashes the kernel when called from sdhci_timeout: panic: malloc(M_WAITOK) with sleeping prohibited panic() at panic+0x1b3/frame 0xfffffe0063a6c8a0 malloc_dbg() at malloc_dbg+0x3df/frame 0xfffffe0063a6c8f0 malloc() at malloc+0xab/frame 0xfffffe0063a6c9c0 sbuf_new() at sbuf_new+0x769/frame 0xfffffe0063a6ca70 sdhci_timeout() at sdhci_timeout+0xec/frame 0xfffffe0063a6cb00 softclock_call_cc() at softclock_call_cc+0x9b5/frame 0xfffffe0063a6ccb0 softclock() at softclock+0x338/frame 0xfffffe0063a6cd50 ithread_loop() at ithread_loop+0x6d4/frame 0xfffffe0063a6cea0 fork_exit() at fork_exit+0x1c9/frame 0xfffffe0063a6cf30 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0063a6cf30 --- trap 0x800001, rip = 0xa5ee00000000000, rsp = 0, rbp = 0xfffffe0000000000 --- Previous iteraton of the code was using printf which avoids memory alloc to begin with. On 9/13/21, Wojciech Macek wrote: > The branch main has been updated by wma: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=d00c1f7f2f4a811d5c756cbb0d585c56661839f7 > > commit d00c1f7f2f4a811d5c756cbb0d585c56661839f7 > Author: Bartlomiej Grzesik > AuthorDate: 2021-09-13 08:00:25 +0000 > Commit: Wojciech Macek > CommitDate: 2021-09-13 08:00:25 +0000 > > sdhci: add sysctls to dump sdhci registers and capabilites > > Add sysctls dev.sdhci.X.slotY.dumpregs and dev.sdhci.X.slotY.dumpcaps > which dumps sdhci registers or capabilities. > > Obtained from: Semihalf > Reviewed by: mw > Differential revision: https://reviews.freebsd.org/D31406 > --- > sys/dev/sdhci/sdhci.c | 223 > +++++++++++++++++++++++++++++++++++++------------- > 1 file changed, 165 insertions(+), 58 deletions(-) > > diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c > index 573e6949b57e..09df5e972ab6 100644 > --- a/sys/dev/sdhci/sdhci.c > +++ b/sys/dev/sdhci/sdhci.c > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > > #include > #include > @@ -134,11 +135,18 @@ static int sdhci_cam_update_ios(struct sdhci_slot > *slot); > /* helper routines */ > static int sdhci_dma_alloc(struct sdhci_slot *slot, uint32_t caps); > static void sdhci_dma_free(struct sdhci_slot *slot); > +static void sdhci_dumpcaps(struct sdhci_slot *slot); > +static void sdhci_dumpcaps_buf(struct sdhci_slot *slot, struct sbuf *s); > static void sdhci_dumpregs(struct sdhci_slot *slot); > +static void sdhci_dumpregs_buf(struct sdhci_slot *slot, struct sbuf *s); > +static int sdhci_syctl_dumpcaps(SYSCTL_HANDLER_ARGS); > +static int sdhci_syctl_dumpregs(SYSCTL_HANDLER_ARGS); > static void sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, > int error); > static int slot_printf(const struct sdhci_slot *slot, const char * fmt, > ...) > __printflike(2, 3); > +static int slot_sprintf(const struct sdhci_slot *slot, struct sbuf *s, > + const char * fmt, ...) __printflike(3, 4); > static uint32_t sdhci_tuning_intmask(const struct sdhci_slot *slot); > > #define SDHCI_LOCK(_slot) mtx_lock(&(_slot)->mtx) > @@ -202,40 +210,156 @@ slot_printf(const struct sdhci_slot *slot, const char > * fmt, ...) > return (retval); > } > > -static void > -sdhci_dumpregs(struct sdhci_slot *slot) > +static int > +slot_sprintf(const struct sdhci_slot *slot, struct sbuf *s, > + const char * fmt, ...) > { > + va_list ap; > + int retval; > > - slot_printf(slot, > - "============== REGISTER DUMP ==============\n"); > + retval = sbuf_printf(s, "%s-slot%d: ", device_get_nameunit(slot->bus), > slot->num); > > - slot_printf(slot, "Sys addr: 0x%08x | Version: 0x%08x\n", > + va_start(ap, fmt); > + retval += sbuf_vprintf(s, fmt, ap); > + va_end(ap); > + > + return (retval); > +} > + > +static void > +sdhci_dumpregs_buf(struct sdhci_slot *slot, struct sbuf *s) > +{ > + slot_sprintf(slot, s, "============== REGISTER DUMP ==============\n"); > + > + slot_sprintf(slot, s, "Sys addr: 0x%08x | Version: 0x%08x\n", > RD4(slot, SDHCI_DMA_ADDRESS), RD2(slot, SDHCI_HOST_VERSION)); > - slot_printf(slot, "Blk size: 0x%08x | Blk cnt: 0x%08x\n", > + slot_sprintf(slot, s, "Blk size: 0x%08x | Blk cnt: 0x%08x\n", > RD2(slot, SDHCI_BLOCK_SIZE), RD2(slot, SDHCI_BLOCK_COUNT)); > - slot_printf(slot, "Argument: 0x%08x | Trn mode: 0x%08x\n", > + slot_sprintf(slot, s, "Argument: 0x%08x | Trn mode: 0x%08x\n", > RD4(slot, SDHCI_ARGUMENT), RD2(slot, SDHCI_TRANSFER_MODE)); > - slot_printf(slot, "Present: 0x%08x | Host ctl: 0x%08x\n", > + slot_sprintf(slot, s, "Present: 0x%08x | Host ctl: 0x%08x\n", > RD4(slot, SDHCI_PRESENT_STATE), RD1(slot, SDHCI_HOST_CONTROL)); > - slot_printf(slot, "Power: 0x%08x | Blk gap: 0x%08x\n", > + slot_sprintf(slot, s, "Power: 0x%08x | Blk gap: 0x%08x\n", > RD1(slot, SDHCI_POWER_CONTROL), RD1(slot, SDHCI_BLOCK_GAP_CONTROL)); > - slot_printf(slot, "Wake-up: 0x%08x | Clock: 0x%08x\n", > + slot_sprintf(slot, s, "Wake-up: 0x%08x | Clock: 0x%08x\n", > RD1(slot, SDHCI_WAKE_UP_CONTROL), RD2(slot, SDHCI_CLOCK_CONTROL)); > - slot_printf(slot, "Timeout: 0x%08x | Int stat: 0x%08x\n", > + slot_sprintf(slot, s, "Timeout: 0x%08x | Int stat: 0x%08x\n", > RD1(slot, SDHCI_TIMEOUT_CONTROL), RD4(slot, SDHCI_INT_STATUS)); > - slot_printf(slot, "Int enab: 0x%08x | Sig enab: 0x%08x\n", > + slot_sprintf(slot, s, "Int enab: 0x%08x | Sig enab: 0x%08x\n", > RD4(slot, SDHCI_INT_ENABLE), RD4(slot, SDHCI_SIGNAL_ENABLE)); > - slot_printf(slot, "AC12 err: 0x%08x | Host ctl2:0x%08x\n", > + slot_sprintf(slot, s, "AC12 err: 0x%08x | Host ctl2:0x%08x\n", > RD2(slot, SDHCI_ACMD12_ERR), RD2(slot, SDHCI_HOST_CONTROL2)); > - slot_printf(slot, "Caps: 0x%08x | Caps2: 0x%08x\n", > + slot_sprintf(slot, s, "Caps: 0x%08x | Caps2: 0x%08x\n", > RD4(slot, SDHCI_CAPABILITIES), RD4(slot, SDHCI_CAPABILITIES2)); > - slot_printf(slot, "Max curr: 0x%08x | ADMA err: 0x%08x\n", > + slot_sprintf(slot, s, "Max curr: 0x%08x | ADMA err: 0x%08x\n", > RD4(slot, SDHCI_MAX_CURRENT), RD1(slot, SDHCI_ADMA_ERR)); > - slot_printf(slot, "ADMA addr:0x%08x | Slot int: 0x%08x\n", > + slot_sprintf(slot, s, "ADMA addr:0x%08x | Slot int: 0x%08x\n", > RD4(slot, SDHCI_ADMA_ADDRESS_LO), RD2(slot, SDHCI_SLOT_INT_STATUS)); > > - slot_printf(slot, > - "===========================================\n"); > + slot_sprintf(slot, s, "===========================================\n"); > +} > + > +static void > +sdhci_dumpregs(struct sdhci_slot *slot) > +{ > + struct sbuf s; > + > + sbuf_new(&s, NULL, 1024, SBUF_AUTOEXTEND); > + sbuf_set_drain(&s, &sbuf_printf_drain, NULL); > + sdhci_dumpregs_buf(slot, &s); > + sbuf_finish(&s); > + sbuf_delete(&s); > +} > + > +static int > +sdhci_syctl_dumpregs(SYSCTL_HANDLER_ARGS) > +{ > + struct sdhci_slot *slot = arg1; > + struct sbuf s; > + > + sbuf_new_for_sysctl(&s, NULL, 1024, req); > + sbuf_putc(&s, '\n'); > + sdhci_dumpregs_buf(slot, &s); > + sbuf_finish(&s); > + sbuf_delete(&s); > + > + return (0); > +} > + > +static void > +sdhci_dumpcaps_buf(struct sdhci_slot *slot, struct sbuf *s) > +{ > + int host_caps = slot->host.caps; > + int caps = slot->caps; > + > + slot_sprintf(slot, s, > + "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", > + slot->max_clk / 1000000, > + (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", > + (host_caps & MMC_CAP_8_BIT_DATA) ? "8bits" : > + ((host_caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), > + (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", > + (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", > + ((caps & SDHCI_CAN_VDD_180) && > + (slot->opt & SDHCI_SLOT_EMBEDDED)) ? " 1.8V" : "", > + (host_caps & MMC_CAP_SIGNALING_180) ? " 1.8V" : "", > + (host_caps & MMC_CAP_SIGNALING_120) ? " 1.2V" : "", > + (host_caps & MMC_CAP_DRIVER_TYPE_A) ? "A" : "", > + (host_caps & MMC_CAP_DRIVER_TYPE_C) ? "C" : "", > + (host_caps & MMC_CAP_DRIVER_TYPE_D) ? "D" : "", > + (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO", > + (slot->opt & SDHCI_SLOT_EMBEDDED) ? "embedded" : > + (slot->opt & SDHCI_NON_REMOVABLE) ? "non-removable" : > + "removable"); > + if (host_caps & (MMC_CAP_MMC_DDR52 | MMC_CAP_MMC_HS200 | > + MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) > + slot_sprintf(slot, s, "eMMC:%s%s%s%s\n", > + (host_caps & MMC_CAP_MMC_DDR52) ? " DDR52" : "", > + (host_caps & MMC_CAP_MMC_HS200) ? " HS200" : "", > + (host_caps & MMC_CAP_MMC_HS400) ? " HS400" : "", > + ((host_caps & > + (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) == > + (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) ? > + " HS400ES" : ""); > + if (host_caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | > + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104)) > + slot_sprintf(slot, s, "UHS-I:%s%s%s%s%s\n", > + (host_caps & MMC_CAP_UHS_SDR12) ? " SDR12" : "", > + (host_caps & MMC_CAP_UHS_SDR25) ? " SDR25" : "", > + (host_caps & MMC_CAP_UHS_SDR50) ? " SDR50" : "", > + (host_caps & MMC_CAP_UHS_SDR104) ? " SDR104" : "", > + (host_caps & MMC_CAP_UHS_DDR50) ? " DDR50" : ""); > + if (slot->opt & SDHCI_TUNING_SUPPORTED) > + slot_sprintf(slot, s, > + "Re-tuning count %d secs, mode %d\n", > + slot->retune_count, slot->retune_mode + 1); > +} > + > +static void > +sdhci_dumpcaps(struct sdhci_slot *slot) > +{ > + struct sbuf s; > + > + sbuf_new(&s, NULL, 1024, SBUF_AUTOEXTEND); > + sbuf_set_drain(&s, &sbuf_printf_drain, NULL); > + sdhci_dumpcaps_buf(slot, &s); > + sbuf_finish(&s); > + sbuf_delete(&s); > +} > + > +static int > +sdhci_syctl_dumpcaps(SYSCTL_HANDLER_ARGS) > +{ > + struct sdhci_slot *slot = arg1; > + struct sbuf s; > + > + sbuf_new_for_sysctl(&s, NULL, 1024, req); > + sbuf_putc(&s, '\n'); > + sdhci_dumpcaps_buf(slot, &s); > + sbuf_finish(&s); > + sbuf_delete(&s); > + > + return (0); > } > > static void > @@ -799,6 +923,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, > int num) > kobj_method_t *kobj_method; > uint32_t caps, caps2, freq, host_caps; > int err; > + char node_name[8]; > + struct sysctl_oid *node_oid; > > SDHCI_LOCK_INIT(slot); > > @@ -1047,46 +1173,7 @@ no_tuning: > } > > if (bootverbose || sdhci_debug) { > - slot_printf(slot, > - "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", > - slot->max_clk / 1000000, > - (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", > - (host_caps & MMC_CAP_8_BIT_DATA) ? "8bits" : > - ((host_caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), > - (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", > - (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", > - ((caps & SDHCI_CAN_VDD_180) && > - (slot->opt & SDHCI_SLOT_EMBEDDED)) ? " 1.8V" : "", > - (host_caps & MMC_CAP_SIGNALING_180) ? " 1.8V" : "", > - (host_caps & MMC_CAP_SIGNALING_120) ? " 1.2V" : "", > - (host_caps & MMC_CAP_DRIVER_TYPE_A) ? "A" : "", > - (host_caps & MMC_CAP_DRIVER_TYPE_C) ? "C" : "", > - (host_caps & MMC_CAP_DRIVER_TYPE_D) ? "D" : "", > - (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO", > - (slot->opt & SDHCI_SLOT_EMBEDDED) ? "embedded" : > - (slot->opt & SDHCI_NON_REMOVABLE) ? "non-removable" : > - "removable"); > - if (host_caps & (MMC_CAP_MMC_DDR52 | MMC_CAP_MMC_HS200 | > - MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) > - slot_printf(slot, "eMMC:%s%s%s%s\n", > - (host_caps & MMC_CAP_MMC_DDR52) ? " DDR52" : "", > - (host_caps & MMC_CAP_MMC_HS200) ? " HS200" : "", > - (host_caps & MMC_CAP_MMC_HS400) ? " HS400" : "", > - ((host_caps & > - (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) == > - (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) ? > - " HS400ES" : ""); > - if (host_caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | > - MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104)) > - slot_printf(slot, "UHS-I:%s%s%s%s%s\n", > - (host_caps & MMC_CAP_UHS_SDR12) ? " SDR12" : "", > - (host_caps & MMC_CAP_UHS_SDR25) ? " SDR25" : "", > - (host_caps & MMC_CAP_UHS_SDR50) ? " SDR50" : "", > - (host_caps & MMC_CAP_UHS_SDR104) ? " SDR104" : "", > - (host_caps & MMC_CAP_UHS_DDR50) ? " DDR50" : ""); > - if (slot->opt & SDHCI_TUNING_SUPPORTED) > - slot_printf(slot, "Re-tuning count %d secs, mode %d\n", > - slot->retune_count, slot->retune_mode + 1); > + sdhci_dumpcaps(slot); > sdhci_dumpregs(slot); > } > > @@ -1110,6 +1197,26 @@ no_tuning: > > sdhci_init(slot); > > + snprintf(node_name, sizeof(node_name), "slot%d", slot->num); > + > + node_oid = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), > + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > + OID_AUTO, node_name, CTLFLAG_RW, 0, "slot specific node"); > + > + node_oid = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), > + SYSCTL_CHILDREN(node_oid), OID_AUTO, "debug", CTLFLAG_RW, 0, > + "Debugging node"); > + > + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(node_oid), > + OID_AUTO, "dumpregs", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, > + slot, 0, &sdhci_syctl_dumpregs, > + "A", "Dump SDHCI registers"); > + > + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(node_oid), > + OID_AUTO, "dumpcaps", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, > + slot, 0, &sdhci_syctl_dumpcaps, > + "A", "Dump SDHCI capabilites"); > + > return (0); > } > > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Wed Sep 22 18:03: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 4753866F427; Wed, 22 Sep 2021 18:03: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 4HF5l31MHvz4ngq; Wed, 22 Sep 2021 18:03: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 0E7DE1BF64; Wed, 22 Sep 2021 18:03: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 18MI3hIO013392; Wed, 22 Sep 2021 18:03:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MI3gdA013391; Wed, 22 Sep 2021 18:03:42 GMT (envelope-from git) Date: Wed, 22 Sep 2021 18:03:42 GMT Message-Id: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 903873ce15600fc02a0ea42cbf888cff232b411d 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, 22 Sep 2021 18:03:43 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=903873ce15600fc02a0ea42cbf888cff232b411d commit 903873ce15600fc02a0ea42cbf888cff232b411d Author: Hans Petter Selasky AuthorDate: 2021-09-22 13:42:51 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 17:43:56 +0000 Implement and use new mixer(3) library for FreeBSD. Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements This project was part of Google Summer of Code 2021. Submitted by: christos@ Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- lib/Makefile | 1 + lib/libmixer/Makefile | 8 + lib/libmixer/mixer.3 | 540 +++++++++++++++++++++++++++ lib/libmixer/mixer.c | 493 +++++++++++++++++++++++++ lib/libmixer/mixer.h | 123 +++++++ usr.sbin/mixer/Makefile | 9 +- usr.sbin/mixer/mixer.8 | 306 +++++++++------- usr.sbin/mixer/mixer.c | 723 ++++++++++++++++++++++--------------- usr.sbin/mixer/tests/Makefile | 5 - usr.sbin/mixer/tests/mixer_test.sh | 123 ------- 10 files changed, 1787 insertions(+), 544 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 1e375bb456e6..038763bfcba8 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -69,6 +69,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ liblzma \ libmemstat \ libmd \ + libmixer \ libmt \ lib80211 \ libnetbsd \ diff --git a/lib/libmixer/Makefile b/lib/libmixer/Makefile new file mode 100644 index 000000000000..12081ee3835b --- /dev/null +++ b/lib/libmixer/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +LIB= mixer +SRCS= ${LIB}.c +INCS= ${LIB}.h +MAN= ${LIB}.3 + +.include diff --git a/lib/libmixer/mixer.3 b/lib/libmixer/mixer.3 new file mode 100644 index 000000000000..f97a88bb79a0 --- /dev/null +++ b/lib/libmixer/mixer.3 @@ -0,0 +1,540 @@ +.\"- +.\" Copyright (c) 2021 Christos Margiolis +.\" +.\" Permission is hereby granted, free of charge, to any person obtaining a copy +.\" of this software and associated documentation files (the "Software"), to deal +.\" in the Software without restriction, including without limitation the rights +.\" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +.\" copies of the Software, and to permit persons to whom the Software is +.\" furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +.\" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +.\" THE SOFTWARE. +.\" +.\" $FreeBSD$ +.\" + +.Dd June 30, 2021 +.Dt mixer 3 +.Os +.Sh NAME +.Nm mixer_open , +.Nm mixer_close , +.Nm mixer_get_dev , +.Nm mixer_get_dev_byname , +.Nm mixer_add_ctl , +.Nm mixer_add_ctl_s , +.Nm mixer_remove_ctl , +.Nm mixer_get_ctl , +.Nm mixer_get_ctl_byname , +.Nm mixer_set_vol , +.Nm mixer_set_mute , +.Nm mixer_mod_recsrc , +.Nm mixer_get_dunit , +.Nm mixer_set_dunit , +.Nm mixer_get_mode, +.Nm mixer_get_nmixers , +.Nm MIX_ISDEV , +.Nm MIX_ISMUTE , +.Nm MIX_ISREC , +.Nm MIX_ISRECSRC , +.Nm MIX_VOLNORM , +.Nm MIX_VOLDENORM +.Nd interface to OSS mixers +.Sh LIBRARY +Mixer library (libmixer, -lmixer) +.Sh SYNOPSIS +.In mixer.h +.Ft struct mixer * +.Fn mixer_open "const char *name" +.Ft int +.Fn mixer_close "struct mixer *m" +.Ft struct mix_dev * +.Fn mixer_get_dev "struct mixer *m" "int devno" +.Ft struct mix_dev * +.Fn mixer_get_dev_byname "struct mixer *m" "name" +.Ft int +.Fn mixer_add_ctl "struct mix_dev *parent" "int id" "const char *name" \ + "int (*mod)(struct mix_dev *d, void *p)" \ + "int (*print)(struct mix_dev *d, void *p) +.Ft int +.Fn mixer_add_ctl_s "mix_ctl_t *ctl" +.Ft int +.Fn mixer_remove_ctl "mix_ctl_t *ctl" +.Ft mix_ctl_t * +.Fn mixer_get_ctl "struct mix_dev *d" "int id" +.Ft mix_ctl_t * +.Fn mixer_get_ctl_byname "struct mix_dev *d" "const char *name" +.Ft int +.Fn mixer_set_vol "struct mixer *m" "mix_volume_t vol" +.Ft int +.Fn mixer_set_mute "struct mixer *m" "int opt" +.Ft int +.Fn mixer_mod_recsrc "struct mixer *m" "int opt" +.Ft int +.Fn mixer_get_dunit "void" +.Ft int +.Fn mixer_set_dunit "struct mixer *m" "int unit" +.Ft int +.Fn mixer_get_mode "int unit" +.Ft int +.Fn mixer_get_nmixers "void" +.Ft int +.Fn MIX_ISDEV "struct mixer *m" "int devno" +.Ft int +.Fn MIX_ISMUTE "struct mixer *m" "int devno" +.Ft int +.Fn MIX_ISREC "struct mixer *m" "int devno" +.Ft int +.Fn MIX_ISRECSRC "struct mixer *m" "int devno" +.Ft float +.Fn MIX_VOLNORM "int v" +.Ft int +.Fn MIX_VOLDENORM "float v" +.Sh DESCRIPTION +The +.Nm mixer +library allows userspace programs to access and manipulate OSS sound mixers in +a simple way. +.Ss Mixer +.Pp +A mixer is described by the following structure: +.Bd -literal +struct mixer { + TAILQ_HEAD(, mix_dev) devs; /* device list */ + struct mix_dev *dev; /* selected device */ + oss_mixerinfo mi; /* mixer info */ + oss_card_info ci; /* audio card info */ + char name[NAME_MAX]; /* mixer name (e.g /dev/mixer0) */ + int fd; /* file descriptor */ + int unit; /* audio card unit */ + int ndev; /* number of devices */ + int devmask; /* supported devices */ +#define MIX_MUTE 0x01 +#define MIX_UNMUTE 0x02 +#define MIX_TOGGLEMUTE 0x04 + int mutemask; /* muted devices */ + int recmask; /* recording devices */ +#define MIX_ADDRECSRC 0x01 +#define MIX_REMOVERECSRC 0x02 +#define MIX_SETRECSRC 0x04 +#define MIX_TOGGLERECSRC 0x08 + int recsrc; /* recording sources */ +#define MIX_MODE_MIXER 0x01 +#define MIX_MODE_PLAY 0x02 +#define MIX_MODE_REC 0x04 + int mode; /* dev.pcm.X.mode sysctl */ + int f_default; /* default mixer flag */ +}; +.Ed +.Pp +The fields are follows: +.Bl -tag -width "f_default" +.It Fa devs +A tail queue structure containing all supported mixer devices. +.It Fa dev +A pointer to the currently selected device. The device is one of the elements in +.Ar devs . +.It Fa mi +OSS information about the mixer. Look at the definition of the +.Ft oss_mixerinfo +structure in +.In sys/soundcard.h +to see its fields. +.It Fa ci +OSS audio card information. This structure is also defined in +.In sys/soundcard.h . +.It Fa name +Path to the mixer (e.g /dev/mixer0). +.It Fa fd +File descriptor returned when the mixer is opened in +.Fn mixer_open . +.It Fa unit +Audio card unit. Since each mixer device maps to a pcmX device, +.Ar unit +is always equal to the number of that pcmX device. For example, if the audio +device's number is 0 (i.e pcm0), then +.Ar unit +is 0 as well. This number is useful when checking if the mixer's audio +card is the default one. +.It Fa ndev +Number of devices in +.Ar devs . +.It Fa devmask +Bit mask containing all supported devices for the mixer. For example +if device 10 is supported, then the 10th bit in the mask will be set. By default, +.Fn mixer_open +stores only the supported devices in devs, so it's very unlikely this mask will +be needed. +.It Fa mutemask +Bit mask containing all muted devices. The logic is the same as with +.Ar devmask . +.It Fa recmask +Bit mask containing all recording devices. Again, same logic as with the +other masks. +.It Fa recsrc +Bit mask containing all recording sources. Yes, same logic again. +.It Fa mode +Bit mask containing the supported modes for this audio device. It holds the value +of the +.Ar dev.pcm.X.mode +sysctl. +.It Fa f_default +Flag which tells whether the mixer's audio card is the default one. +.El +.Ss Mixer device +.Pp +Each mixer device stored in a mixer is described as follows: +.Bd -literal +struct mix_dev { + struct mixer *parent_mixer; /* parent mixer */ + char name[NAME_MAX]; /* device name (e.g "vol") */ + int devno; /* device number */ + struct mix_volume { +#define MIX_VOLMIN 0.0f +#define MIX_VOLMAX 1.0f +#define MIX_VOLNORM(v) ((v) / 100.0f) +#define MIX_VOLDENORM(v) ((int)((v) * 100.0f + 0.5f)) + float left; /* left volume */ + float right; /* right volume */ + } vol; + int nctl; /* number of controls */ + TAILQ_HEAD(, mix_ctl) ctls; /* control list */ + TAILQ_ENTRY(mix_dev) devs; +}; +.Ed +.Pp +The fields are follows: +.Bl -tag -width "parent_mixer" +.It Fa parent_mixer +Pointer to the mixer the device is attached to. +.It Fa name +Device name given by the OSS API. Devices can have one of the following names: +.Bd -ragged +vol, bass, treble, synth, pcm, speaker, line, mic, cd, mix, +pcm2, rec, igain, ogain, line1, line2, line3, dig1, dig2, dig3, +phin, phout, video, radio, and monitor. +.Ed +.It Fa devno +Device's index in the SOUND_MIXER_NRDEVICES macro defined in +.In sys/soundcard.h . +This number is used to check against the masks defined in the +.Ar mixer +structure. +.It Fa left, right +Left and right-ear volumes. Although the OSS API stores volumes in integers from +0-100, we normalize them to 32-bit floating point numbers. However, the volumes +can be denormalized using the +.Ar MIX_VOLDENORM +macro if needed. +.It Fa nctl +Number of user-defined mixer controls associated with the device. +.It Fa ctls +A tail queue containing user-defined mixer controls. +.El +.Ss User-defined mixer controls +.Pp +Each mixer device can have user-defined controls. The control structure +is defined as follows: +.Bd -literal +struct mix_ctl { + struct mix_dev *parent_dev; /* parent device */ + int id; /* control id */ + char name[NAME_MAX]; /* control name */ + int (*mod)(struct mix_dev *, void *); /* modify control values */ + int (*print)(struct mix_dev *, void *); /* print control */ + TAILQ_ENTRY(mix_ctl) ctls; +}; +.Ed +.Pp +The fields are follows: +.Bl -tag -width "parent_dev" +.It Fa parent_dev +Pointer to the device the control is attached to. +.It Fa id +Control ID assigned by the caller. Even though the library will +report it, care has to be taken to not give a control the same ID in case +the caller has to choose controls using their ID. +.It Fa name +Control name. As with +.Ar id , +the caller has to make sure the same name is not used more than once. +.It Fa mod +Function pointer to a control modification function. As in +.Xr mixer 8 , +each mixer control's values can be modified. For example, if we have a +volume control, the +.Ar mod +function will be responsible for handling volume changes. +.It Fa print +Function pointer to a control print function. +.El +.Ss Opening and closing the mixer +.Pp +The application must first call the +.Fn mixer_open +function to obtain a handle to the device, which is used as an argument +in most other functions and macros. The parameter +.Ar name +specifies the path to the mixer. OSS mixers are stored under +.Ar /dev/mixerN +where +.Ar N +is the number of the mixer device. Each device maps to an actual +.Ar pcm +audio card, so +.Ar /dev/mixer0 +is the mixer for +.Ar pcm0 , +and so on. If +.Ar name +is +.Ar NULL +or +.Ar /dev/mixer , +.Fn mixer_open +opens the default mixer (hw.snd.defaul_unit). +.Pp +The +.Fn mixer_close +function frees resources and closes the mixer device. It's a good practice to +always call it when the application is done using the mixer. +.Ss Manipulating the mixer +.Pp +The +.Fn mixer_get_dev +and +.Fn mixer_get_dev_byname +functions select a mixer device, either by its number or by its name +respectively. The mixer structure keeps a list of all the devices, but only +one can be manipulated at a time. Each time a new device is to be manipulated, +one of the two functions has to be called. +.Pp +The +.Fn mixer_set_vol +function changes the volume of the selected mixer device. The +.Ar vol +parameter is a structure that stores the left and right volumes of a given +device. The allowed volume values are between MIX_VOLMIN (0.0) and +MIX_VOLMAX (1.0). +.Pp +The +.Fn mixer_set_mute +function modifies the mute of a selected device. The +.Ar opt +parameter has to be one of the following options: +.Bl -tag -width MIX_TOGGLEMUTE -offset indent +.It Dv MIX_MUTE +Mute the device. +.It Dv MIX_UNMUTE +Unmute the device. +.It Dv MIX_TOGGLEMUTE +Toggle the device's mute (e.g mute if unmuted and unmute if muted). +.El +.Pp +The +.Fn mixer_mod_recsrc +function modifies a recording device. The selected device has to be +a recording device, otherwise the function will fail. The +.Ar opt +parameter has to be one of the following options: +.Bl -tag -width MIX_REMOVERECSRC -offset indent +.It Dv MIX_ADDRECSRC +Add device to the recording sources. +.It Dv MIX_REMOVERECSRC +Remove device from the recording sources. +.It Dv MIX_SETRECSRC +Set device as the only recording source. +.It Dv MIX_TOGGLERECSRC +Toggle device from the recording sources. +.El +.Pp +The +.Fn mixer_get_dunit +and +.Fn mixer_set_dunit +functions get and set the default audio card in the system. Although this is +not really a mixer feature, it's useful to have instead of having to use +the +.Xr sysctl 3 +controls. +.Pp +The +.Fn mixer_get_mode +function returns the playback/recording mode of the audio device the mixer +belongs to. The available values are the following: +.Bl -tag -width "MIX_STATUS_PLAY | MIX_STATUS_REC" -offset indent +.It Dv MIX_STATUS_NONE +Neither playback nor recording. +.It Dv MIX_STATUS_PLAY +Playback. +.It Dv MIX_STATUS_REC +Recording. +.It Dv MIX_STATUS_PLAY | MIX_STATUS_REC +Playback and recording. +.El +.Pp +The +.Fn mixer_get_nmixers +function returns the total number of mixer devices in the system. +.Pp +The +.Fn MIX_ISDEV +macro checks if a device is actually a valid device for a given mixer. It's very +unlikely that this macro will ever be needed since the library stores only +valid devices by default. +.Pp +The +.Fn MIX_ISMUTE +macro checks if a device is muted. +.Pp +The +.Fn MIX_ISREC +macro checks if a device is a recording device. +.Pp +The +.Fn MIX_ISRECSRC +macro checks if a device is a recording source. +.Pp +The +.Fn MIX_VOLNORM +macro normalizes a value to 32-bit floating point number. It's used +to normalize the volumes read from the OSS API. +.Pp +The +.Fn MIX_VOLDENORM +macro denormalizes the left and right volumes stores in the +.Ft mix_dev +structure. +.Ss Defining and using mixer controls +.Pp +The +.Fn mix_add_ctl +function creates a control and attaches it to the device specified in the +.Ar parent +argument. +.Pp +The +.Fn mix_add_ctl_s +function does the same thing as with +.Fn mix_add_ctl +but the caller passes a +.Ft mix_ctl_t * +structure instead of each field as a seperate argument. +.Pp +The +.Fn mixer_remove_ctl +functions removes a control from the device its attached to. +.Pp +The +.Fn mixer_get_ctl +function searches for a control in the device specified in the +.Ar d +argument and returns a pointer to it. The search is done using the control's ID. +.Pp +The +.Fn mixer_get_ctl_byname +function is the same as with +.Fn mixer_get_ctl +but the search is done using the control's name. +.Sh RETURN VALUES +.Pp +The +.Fn mixer_open +function returns the newly created handle on success and NULL on failure. +.Pp +The +.Fn mixer_close , +.Fn mixer_set_vol , +.Fn mixer_set_mute , +.Fn mixer_mod_recsrc , +.Fn mixer_get_dunut , +.Fn mixer_set_dunit +and +.Fn mixer_get_nmixers +functions return 0 or positive values on success and -1 on failure. +.Pp +The +.Fn mixer_get_dev +and +.Fn mixer_get_dev_byname +functions return the selected device on success and NULL on failure. +.Pp +All functions set the value of +.Ar errno +on failure. +.Sh EXAMPLES +.Ss Change the volume of a device +.Bd -literal +struct mixer *m; +mix_volume_t vol; +char *mix_name, *dev_name; + +mix_name = ...; +if ((m = mixer_open(mix_name)) == NULL) + err(1, "mixer_open: %s", mix_name); + +dev_name = ...; +if ((m->dev = mixer_get_dev_byname(m, dev_name)) < 0) + err(1, "unknown device: %s", dev_name); + +vol.left = ...; +vol.right = ....; +if (mixer_set_vol(m, vol) < 0) + warn("cannot change volume"); + +(void)mixer_close(m); +.Ed +.Ss Mute all unmuted devices +.Bd -literal +struct mixer *m; +struct mix_dev *dp; + +if ((m = mixer_open(NULL)) == NULL) /* Open the default mixer. */ + err(1, "mixer_open"); +TAILQ_FOREACH(dp, &m->devs, devs) { + m->dev = dp; /* Select device. */ + if (M_ISMUTE(m, dp->devno)) + continue; + if (mixer_set_mute(m, MIX_MUTE) < 0) + warn("cannot mute device: %s", dp->name); +} + +(void)mixer_close(m); +.Ed +.Ss Print all recording sources' names and volumes +.Bd -literal +struct mixer *m; +struct mix_dev *dp; + +char *mix_name, *dev_name; + +mix_name = ...; +if ((m = mixer_open(mix_name)) == NULL) + err(1, "mixer_open: %s", mix_name); + +TAILQ_FOREACH(dp, &m->devs, devs) { + if (M_ISRECSRC(m, dp->devno)) + printf("%s\\t%.2f:%.2f\\n", + dp->name, dp->vol.left, dp->vol.right); +} + +(void)mixer_close(m); +.Ed +.Sh SEE ALSO +.Xr mixer 8 , +.Xr sound 4 , +.Xr sysctl 3 , +.Xr queue 3 +and +.Xr errno 2 +.Sh AUTHORS +.An Christos Margiolis Aq Mt christos@margiolis.net diff --git a/lib/libmixer/mixer.c b/lib/libmixer/mixer.c new file mode 100644 index 000000000000..b10d5c6607cf --- /dev/null +++ b/lib/libmixer/mixer.c @@ -0,0 +1,493 @@ +/*- + * Copyright (c) 2021 Christos Margiolis + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "mixer.h" + +#define BASEPATH "/dev/mixer" + +static int _mixer_readvol(struct mixer *, struct mix_dev *); + +/* + * Fetch volume from the device. + */ +static int +_mixer_readvol(struct mixer *m, struct mix_dev *dev) +{ + int v; + + if (ioctl(m->fd, MIXER_READ(dev->devno), &v) < 0) + return (-1); + dev->vol.left = MIX_VOLNORM(v & 0x00ff); + dev->vol.right = MIX_VOLNORM((v >> 8) & 0x00ff); + + return (0); +} + +/* + * Open a mixer device in `/dev/mixerN`, where N is the number of the mixer. + * Each device maps to an actual pcm audio card, so `/dev/mixer0` is the + * mixer for pcm0, and so on. + * + * @param name path to mixer device. NULL or "/dev/mixer" for the + * the default mixer (i.e `hw.snd.default_unit`). + */ +struct mixer * +mixer_open(const char *name) +{ + struct mixer *m = NULL; + struct mix_dev *dp; + const char *names[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; + int i; + + if ((m = calloc(1, sizeof(struct mixer))) == NULL) + goto fail; + + if (name != NULL) { + /* `name` does not start with "/dev/mixer". */ + if (strncmp(name, BASEPATH, strlen(BASEPATH)) != 0) { + errno = EINVAL; + goto fail; + } + /* `name` is "/dev/mixer" so, we'll use the default unit. */ + if (strncmp(name, BASEPATH, strlen(name)) == 0) + goto dunit; + m->unit = strtol(name + strlen(BASEPATH), NULL, 10); + (void)strlcpy(m->name, name, sizeof(m->name)); + } else { +dunit: + if ((m->unit = mixer_get_dunit()) < 0) + goto fail; + (void)snprintf(m->name, sizeof(m->name), "/dev/mixer%d", m->unit); + } + + if ((m->fd = open(m->name, O_RDWR)) < 0) + goto fail; + + m->devmask = m->recmask = m->recsrc = 0; + m->f_default = m->unit == mixer_get_dunit(); + m->mode = mixer_get_mode(m->unit); + /* The unit number _must_ be set before the ioctl. */ + m->mi.dev = m->unit; + m->ci.card = m->unit; + if (ioctl(m->fd, SNDCTL_MIXERINFO, &m->mi) < 0 || + ioctl(m->fd, SNDCTL_CARDINFO, &m->ci) < 0 || + ioctl(m->fd, SOUND_MIXER_READ_DEVMASK, &m->devmask) < 0 || + ioctl(m->fd, SOUND_MIXER_READ_MUTE, &m->mutemask) < 0 || + ioctl(m->fd, SOUND_MIXER_READ_RECMASK, &m->recmask) < 0 || + ioctl(m->fd, SOUND_MIXER_READ_RECSRC, &m->recsrc) < 0) + goto fail; + + TAILQ_INIT(&m->devs); + for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { + if (!MIX_ISDEV(m, i)) + continue; + if ((dp = calloc(1, sizeof(struct mix_dev))) == NULL) + goto fail; + dp->parent_mixer = m; + dp->devno = i; + dp->nctl = 0; + if (_mixer_readvol(m, dp) < 0) + goto fail; + (void)strlcpy(dp->name, names[i], sizeof(dp->name)); + TAILQ_INIT(&dp->ctls); + TAILQ_INSERT_TAIL(&m->devs, dp, devs); + m->ndev++; + } + + /* The default device is always "vol". */ + m->dev = TAILQ_FIRST(&m->devs); + + return (m); +fail: + if (m != NULL) + (void)mixer_close(m); + + return (NULL); +} + +/* + * Free resources and close the mixer. + */ +int +mixer_close(struct mixer *m) +{ + struct mix_dev *dp; + int r; + + r = close(m->fd); + while (!TAILQ_EMPTY(&m->devs)) { + dp = TAILQ_FIRST(&m->devs); + TAILQ_REMOVE(&m->devs, dp, devs); + while (!TAILQ_EMPTY(&dp->ctls)) + (void)mixer_remove_ctl(TAILQ_FIRST(&dp->ctls)); + free(dp); + } + free(m); + + return (r); +} + +/* + * Select a mixer device. The mixer structure keeps a list of all the devices + * the mixer has, but only one can be manipulated at a time -- this is what + * the `dev` in the mixer structure field is for. Each time a device is to be + * manipulated, `dev` has to point to it first. + * + * The caller must manually assign the return value to `m->dev`. + */ +struct mix_dev * +mixer_get_dev(struct mixer *m, int dev) +{ + struct mix_dev *dp; + + if (dev < 0 || dev >= m->ndev) { + errno = ERANGE; + return (NULL); + } + TAILQ_FOREACH(dp, &m->devs, devs) { + if (dp->devno == dev) + return (dp); + } + errno = EINVAL; + + return (NULL); +} + +/* + * Select a device by name. + * + * @param name device name (e.g vol, pcm, ...) + */ +struct mix_dev * +mixer_get_dev_byname(struct mixer *m, const char *name) +{ + struct mix_dev *dp; + + TAILQ_FOREACH(dp, &m->devs, devs) { + if (!strncmp(dp->name, name, sizeof(dp->name))) + return (dp); + } + errno = EINVAL; + + return (NULL); +} + +/* + * Add a mixer control to a device. + */ +int +mixer_add_ctl(struct mix_dev *parent_dev, int id, const char *name, + int (*mod)(struct mix_dev *, void *), + int (*print)(struct mix_dev *, void *)) +{ + struct mix_dev *dp; + mix_ctl_t *ctl, *cp; + + /* XXX: should we accept NULL name? */ + if (parent_dev == NULL) { + errno = EINVAL; + return (-1); + } + if ((ctl = calloc(1, sizeof(mix_ctl_t))) == NULL) + return (-1); + ctl->parent_dev = parent_dev; + ctl->id = id; + if (name != NULL) + (void)strlcpy(ctl->name, name, sizeof(ctl->name)); + ctl->mod = mod; + ctl->print = print; + dp = ctl->parent_dev; + /* Make sure the same ID or name doesn't exist already. */ + TAILQ_FOREACH(cp, &dp->ctls, ctls) { + if (!strncmp(cp->name, name, sizeof(cp->name)) || cp->id == id) { + errno = EINVAL; + return (-1); + } + } + TAILQ_INSERT_TAIL(&dp->ctls, ctl, ctls); + dp->nctl++; + + return (0); +} + +/* + * Same as `mixer_add_ctl`. + */ +int +mixer_add_ctl_s(mix_ctl_t *ctl) +{ + if (ctl == NULL) + return (-1); + + return (mixer_add_ctl(ctl->parent_dev, ctl->id, ctl->name, + ctl->mod, ctl->print)); +} + +/* + * Remove a mixer control from a device. + */ +int +mixer_remove_ctl(mix_ctl_t *ctl) +{ + struct mix_dev *p; + + if (ctl == NULL) { + errno = EINVAL; + return (-1); + } + p = ctl->parent_dev; + if (!TAILQ_EMPTY(&p->ctls)) { + TAILQ_REMOVE(&p->ctls, ctl, ctls); + free(ctl); + } + + return (0); +} + +/* + * Get a mixer control by id. + */ +mix_ctl_t * +mixer_get_ctl(struct mix_dev *d, int id) +{ + mix_ctl_t *cp; + + TAILQ_FOREACH(cp, &d->ctls, ctls) { + if (cp->id == id) + return (cp); + } + errno = EINVAL; + + return (NULL); +} + +/* + * Get a mixer control by name. + */ +mix_ctl_t * +mixer_get_ctl_byname(struct mix_dev *d, const char *name) +{ + mix_ctl_t *cp; + + TAILQ_FOREACH(cp, &d->ctls, ctls) { + if (!strncmp(cp->name, name, sizeof(cp->name))) + return (cp); + } + errno = EINVAL; + + return (NULL); +} + +/* + * Change the mixer's left and right volume. The allowed volume values are + * between MIX_VOLMIN and MIX_VOLMAX. The `ioctl` for volume change requires + * an integer value between 0 and 100 stored as `lvol | rvol << 8` -- for + * that reason, we de-normalize the 32-bit float volume value, before + * we pass it to the `ioctl`. + * + * Volume clumping should be done by the caller. + */ +int +mixer_set_vol(struct mixer *m, mix_volume_t vol) +{ + int v; + + if (vol.left < MIX_VOLMIN || vol.left > MIX_VOLMAX || + vol.right < MIX_VOLMIN || vol.right > MIX_VOLMAX) { + errno = ERANGE; + return (-1); + } + v = MIX_VOLDENORM(vol.left) | MIX_VOLDENORM(vol.right) << 8; + if (ioctl(m->fd, MIXER_WRITE(m->dev->devno), &v) < 0) + return (-1); + if (_mixer_readvol(m, m->dev) < 0) + return (-1); + + return (0); +} + +/* + * Manipulate a device's mute. + * + * @param opt MIX_MUTE mute device + * MIX_UNMUTE unmute device + * MIX_TOGGLEMUTE toggle device's mute + */ +int +mixer_set_mute(struct mixer *m, int opt) +{ + switch (opt) { + case MIX_MUTE: + m->mutemask |= (1 << m->dev->devno); + break; + case MIX_UNMUTE: + m->mutemask &= ~(1 << m->dev->devno); + break; + case MIX_TOGGLEMUTE: + m->mutemask ^= (1 << m->dev->devno); + break; + default: + errno = EINVAL; + return (-1); + } + if (ioctl(m->fd, SOUND_MIXER_WRITE_MUTE, &m->mutemask) < 0) + return (-1); + if (ioctl(m->fd, SOUND_MIXER_READ_MUTE, &m->mutemask) < 0) + return (-1); + + return 0; +} + +/* + * Modify a recording device. The selected device has to be a recording device, + * otherwise the function will fail. + * + * @param opt MIX_ADDRECSRC add device to recording sources + * MIX_REMOVERECSRC remove device from recording sources *** 1550 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Sep 22 18:03: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 82A3166F42A; Wed, 22 Sep 2021 18:03: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 4HF5l42Kpdz4njQ; Wed, 22 Sep 2021 18:03: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 316FC1C20F; Wed, 22 Sep 2021 18:03: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 18MI3iR7013420; Wed, 22 Sep 2021 18:03:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MI3iFZ013419; Wed, 22 Sep 2021 18:03:44 GMT (envelope-from git) Date: Wed, 22 Sep 2021 18:03:44 GMT Message-Id: <202109221803.18MI3iFZ013419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 0e94a3069138 - main - UPDATING: Add new entry about mixer(8) usage. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e94a30691385595ef03cc6861f0b67371ff90ef 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, 22 Sep 2021 18:03:44 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=0e94a30691385595ef03cc6861f0b67371ff90ef commit 0e94a30691385595ef03cc6861f0b67371ff90ef Author: Hans Petter Selasky AuthorDate: 2021-09-22 14:47:25 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 17:44:43 +0000 UPDATING: Add new entry about mixer(8) usage. Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index 3993b4a681bb..d6eae6c23ede 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,11 @@ 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".) +202010922: + As of commit 903873ce1560, the mixer(8) utility has got a slightly + new syntax. Please confirm to the mixer(8) manual page for more + information. + 20210911: As of commit 55089ef4f8bb, the global variable nfs_maxcopyrange has been deleted from the nfscommon.ko. As such, nfsd.ko must be built From owner-dev-commits-src-main@freebsd.org Wed Sep 22 18:59: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 33E2F66FF8B; Wed, 22 Sep 2021 18:59: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 4HF6zm0zhbz4s6Y; Wed, 22 Sep 2021 18:59: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 01E6C1CC38; Wed, 22 Sep 2021 18:59: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 18MIxl1I079215; Wed, 22 Sep 2021 18:59:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MIxl06079214; Wed, 22 Sep 2021 18:59:47 GMT (envelope-from git) Date: Wed, 22 Sep 2021 18:59:47 GMT Message-Id: <202109221859.18MIxl06079214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 8fc722a572b8 - main - mixer(8): Compile fix for when the "char" type is unsigned. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8fc722a572b8af5afde4a4515a7ff3784360e471 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, 22 Sep 2021 18:59:48 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8fc722a572b8af5afde4a4515a7ff3784360e471 commit 8fc722a572b8af5afde4a4515a7ff3784360e471 Author: Hans Petter Selasky AuthorDate: 2021-09-22 18:56:34 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 18:58:47 +0000 mixer(8): Compile fix for when the "char" type is unsigned. Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- usr.sbin/mixer/mixer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index 3bbb8eebf93f..c32b87fdb7f0 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -63,7 +63,7 @@ main(int argc, char *argv[]) char *p, *bufp, *devstr, *ctlstr, *valstr = NULL; int dunit, i, n, pall = 1; int aflag = 0, dflag = 0, oflag = 0, sflag = 0; - char ch; + int ch; while ((ch = getopt(argc, argv, "ad:f:os")) != -1) { switch (ch) { From owner-dev-commits-src-main@freebsd.org Wed Sep 22 20:02: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 DAC50670DD2; Wed, 22 Sep 2021 20:02: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 4HF8Ms5lgDz3FPt; Wed, 22 Sep 2021 20:02: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 A60631D94C; Wed, 22 Sep 2021 20:02: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 18MK2HW6072195; Wed, 22 Sep 2021 20:02:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MK2HsQ072194; Wed, 22 Sep 2021 20:02:17 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:02:17 GMT Message-Id: <202109222002.18MK2HsQ072194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: db6ba1e0c585 - main - mixer(3) and mixer(8): Update manual pages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db6ba1e0c585d37469c3bc74238b7fc4ea249274 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, 22 Sep 2021 20:02:17 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=db6ba1e0c585d37469c3bc74238b7fc4ea249274 commit db6ba1e0c585d37469c3bc74238b7fc4ea249274 Author: Hans Petter Selasky AuthorDate: 2021-09-22 20:01:12 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 20:01:40 +0000 mixer(3) and mixer(8): Update manual pages. - Use correct e-mail address. - Set FreeBSD 14.0 as introduction for the updated mixer(8) utility. Submitted by: christos@ Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- lib/libmixer/mixer.3 | 4 ++-- usr.sbin/mixer/mixer.8 | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libmixer/mixer.3 b/lib/libmixer/mixer.3 index f97a88bb79a0..b541c94af779 100644 --- a/lib/libmixer/mixer.3 +++ b/lib/libmixer/mixer.3 @@ -22,7 +22,7 @@ .\" $FreeBSD$ .\" -.Dd June 30, 2021 +.Dd September 22, 2021 .Dt mixer 3 .Os .Sh NAME @@ -537,4 +537,4 @@ TAILQ_FOREACH(dp, &m->devs, devs) { and .Xr errno 2 .Sh AUTHORS -.An Christos Margiolis Aq Mt christos@margiolis.net +.An Christos Margiolis Aq Mt christos@FreeBSD.org diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8 index 39b30b53d529..3a0a70932ba9 100644 --- a/usr.sbin/mixer/mixer.8 +++ b/usr.sbin/mixer/mixer.8 @@ -22,7 +22,7 @@ .\" $FreeBSD$ .\" -.Dd June 30, 2021 +.Dd September 22, 2021 .Dt mixer 8 .Os .Sh NAME @@ -240,6 +240,6 @@ information to a file and retrieve back later The .Nm utility first appeared in FreeBSD 2.0.5 and was rewritten completely in -FreeBSD 12.2. \" FIXME: replace 12.2 with proper version. +FreeBSD 14.0. .Sh AUTHORS -.An Christos Margiolis Aq Mt christos@margiolis.net +.An Christos Margiolis Aq Mt christos@FreeBSD.org From owner-dev-commits-src-main@freebsd.org Wed Sep 22 20:10: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 326E9670E76; Wed, 22 Sep 2021 20:10: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 4HF8Y00gSzz3Gvk; Wed, 22 Sep 2021 20:10: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 E73A71DD9D; Wed, 22 Sep 2021 20:10: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 18MKABmS076463; Wed, 22 Sep 2021 20:10:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MKABhW076456; Wed, 22 Sep 2021 20:10:11 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:10:11 GMT Message-Id: <202109222010.18MKABhW076456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 624a34b87b27 - main - rc.d/mixer: Use -o flag instead of -s flag to get current mixer state. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 624a34b87b2757cb33b33a5b40821990c8bce673 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, 22 Sep 2021 20:10:12 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=624a34b87b2757cb33b33a5b40821990c8bce673 commit 624a34b87b2757cb33b33a5b40821990c8bce673 Author: Hans Petter Selasky AuthorDate: 2021-09-22 20:09:23 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-22 20:09:36 +0000 rc.d/mixer: Use -o flag instead of -s flag to get current mixer state. Submitted by: christos@ Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- libexec/rc/rc.d/mixer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/mixer b/libexec/rc/rc.d/mixer index d815fb75425e..c8cd544779cd 100755 --- a/libexec/rc/rc.d/mixer +++ b/libexec/rc/rc.d/mixer @@ -58,7 +58,7 @@ mixer_save() dev="/dev/${1}" if [ -r ${dev} ]; then - /usr/sbin/mixer -f ${dev} -s > /var/db/${1}-state 2>/dev/null + /usr/sbin/mixer -f ${dev} -o > /var/db/${1}-state 2>/dev/null fi } From owner-dev-commits-src-main@freebsd.org Wed Sep 22 20:19: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 6CF91671506; Wed, 22 Sep 2021 20:19: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 4HF8lp2Wrfz3HGj; Wed, 22 Sep 2021 20:19: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 369C31DFFB; Wed, 22 Sep 2021 20:19: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 18MKJYhT085756; Wed, 22 Sep 2021 20:19:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MKJYCu085755; Wed, 22 Sep 2021 20:19:34 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:19:34 GMT Message-Id: <202109222019.18MKJYCu085755@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: e36d0e86e328 - main - Revert "linux32: add a hack to avoid redefining the type of the savefpu tag" 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: e36d0e86e3282cde5a12b6a623e6deefaabfd0c4 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, 22 Sep 2021 20:19:34 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e36d0e86e3282cde5a12b6a623e6deefaabfd0c4 commit e36d0e86e3282cde5a12b6a623e6deefaabfd0c4 Author: Konstantin Belousov AuthorDate: 2021-09-22 18:54:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-22 20:17:47 +0000 Revert "linux32: add a hack to avoid redefining the type of the savefpu tag" This reverts commit 0f6829488ef32142b9ea1c0806fb5ecfe0872c02. Also it changes the type of md_usr_fpu_save struct mdthread member to void *, which is what uncovered this trouble. Now the save area is untyped, but since it is hidden behind accessors, it is not too significant. Since apparently there are consumers affected outside the tree, this hack is better than one from the reverted revision. PR: 258678 Reported by: cy Reviewed by: cy, kevans, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32060 --- sys/amd64/include/proc.h | 2 +- sys/modules/linux/Makefile | 2 +- sys/x86/include/fpu.h | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index 94ac69d31e65..6b0d0e66d0ee 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -75,7 +75,7 @@ struct mdthread { int md_efirt_dis_pf; /* (k) */ struct pcb md_pcb; vm_offset_t md_stack_base; - struct savefpu *md_usr_fpu_save; + void *md_usr_fpu_save; }; struct mdproc { diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile index 6c95a548bffb..373ec3dcae91 100644 --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -60,7 +60,7 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} .if ${MACHINE_CPUARCH} == "amd64" -VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -D__M32_BROKEN_MODULE_HACK__ -m32 +VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32 .else VDSOFLAGS=-mregparm=0 .endif diff --git a/sys/x86/include/fpu.h b/sys/x86/include/fpu.h index bb8533d599dd..313a03ea55c9 100644 --- a/sys/x86/include/fpu.h +++ b/sys/x86/include/fpu.h @@ -123,12 +123,10 @@ struct savexmm { } __aligned(16); #ifdef __i386__ -#ifndef __M32_BROKEN_MODULE_HACK__ union savefpu { struct save87 sv_87; struct savexmm sv_xmm; }; -#endif /* __M32_BROKEN_MODULE_HACK__ */ #else /* Floating point context. (amd64 fxsave/fxrstor) */ struct savefpu { From owner-dev-commits-src-main@freebsd.org Wed Sep 22 20:25: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 771DA671348; Wed, 22 Sep 2021 20:25: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 4HF8tr2cpxz3HsD; Wed, 22 Sep 2021 20:25: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 361311DE38; Wed, 22 Sep 2021 20:25: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 18MKPeWA098593; Wed, 22 Sep 2021 20:25:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MKPe1i098592; Wed, 22 Sep 2021 20:25:40 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:25:40 GMT Message-Id: <202109222025.18MKPe1i098592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: c866d0c798a2 - main - sh: improve command completion MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c866d0c798a20b8f0a92df524f4ddd0d81511c88 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, 22 Sep 2021 20:25:40 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=c866d0c798a20b8f0a92df524f4ddd0d81511c88 commit c866d0c798a20b8f0a92df524f4ddd0d81511c88 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-22 16:23:29 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-22 20:23:32 +0000 sh: improve command completion When there are many matches, find the longest common substring starting from the beginning of each command and use that to replace input. As an example: on my system, llv will be autocompleted to llvm- and another will print all matching llvm commands. --- bin/sh/histedit.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 37b62cef5746..4e82f7497850 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -596,7 +596,7 @@ static char const char *dirname; char **matches = NULL; size_t i = 0, size = 16, uniq; - size_t curpos = end - start; + size_t curpos = end - start, lcstring = -1; if (start > 0 || memchr("/.~", text[0], 3) != NULL) return (NULL); @@ -652,11 +652,20 @@ out: if (i > 1) { qsort_s(matches + 1, i, sizeof(matches[0]), comparator, (void *)(intptr_t)curpos); - for (size_t k = 2; k <= i; k++) - if (strcmp(matches[uniq] + curpos, matches[k] + curpos) == 0) + for (size_t k = 2; k <= i; k++) { + const char *l = matches[uniq] + curpos; + const char *r = matches[k] + curpos; + size_t common = 0; + + while (*l != '\0' && *r != '\0' && *l == *r) + (void)l++, r++, common++; + if (common < lcstring) + lcstring = common; + if (*l == *r) free(matches[k]); else matches[++uniq] = matches[k]; + } } matches[uniq + 1] = NULL; /* @@ -668,7 +677,12 @@ out: * string in matches[0] which is the reason to copy the full name of the * only match. */ - matches[0] = strdup(uniq == 1 ? matches[1] : text); + if (uniq == 1) + matches[0] = strdup(matches[1]); + else if (lcstring != (size_t)-1) + matches[0] = strndup(matches[1], curpos + lcstring); + else + matches[0] = strdup(text); if (matches[0] == NULL) { for (size_t k = 1; k <= uniq; k++) free(matches[k]); From owner-dev-commits-src-main@freebsd.org Wed Sep 22 20:25: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 847D8671792; Wed, 22 Sep 2021 20:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HF8ts3Cppz3J7Y; Wed, 22 Sep 2021 20:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FE5B1E204; Wed, 22 Sep 2021 20:25:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18MKPfZx098617; Wed, 22 Sep 2021 20:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MKPfLc098616; Wed, 22 Sep 2021 20:25:41 GMT (envelope-from git) Date: Wed, 22 Sep 2021 20:25:41 GMT Message-Id: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 1f82fb383410 - main - sh: try to avoid overwriting HISTFILE produced by other shells MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f82fb3834105fd8f1186b1c6d719d8a24738180 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, 22 Sep 2021 20:25:41 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=1f82fb3834105fd8f1186b1c6d719d8a24738180 commit 1f82fb3834105fd8f1186b1c6d719d8a24738180 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-22 16:42:41 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-22 20:23:32 +0000 sh: try to avoid overwriting HISTFILE produced by other shells If an attempt to load history from an existing history file was unsuccessful, do not try to save command history to that file on exit. --- bin/sh/histedit.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 4e82f7497850..96511b87b451 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -70,6 +71,7 @@ __FBSDID("$FreeBSD$"); History *hist; /* history cookie */ EditLine *el; /* editline cookie */ int displayhist; +static int savehist; static FILE *el_in, *el_out; static char *fc_replace(const char *, char *, char *); @@ -103,7 +105,7 @@ histsave(void) int fd; FILE *f; - if ((histfile = get_histfile()) == NULL) + if (!savehist || (histfile = get_histfile()) == NULL) return; INTOFF; asprintf(&histtmpname, "%s.XXXXXXXXXX", histfile); @@ -134,7 +136,9 @@ histload(void) if ((histfile = get_histfile()) == NULL) return; - history(hist, &he, H_LOAD, histfile); + errno = 0; + if (history(hist, &he, H_LOAD, histfile) != -1 || errno == ENOENT) + savehist = 1; } /* From owner-dev-commits-src-main@freebsd.org Wed Sep 22 22:25: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 52B6E672AE8; Wed, 22 Sep 2021 22:25: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 4HFCYM1cRzz3jsh; Wed, 22 Sep 2021 22:25: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 140C11F93B; Wed, 22 Sep 2021 22:25: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 18MMPgH7059414; Wed, 22 Sep 2021 22:25:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MMPgSr059413; Wed, 22 Sep 2021 22:25:42 GMT (envelope-from git) Date: Wed, 22 Sep 2021 22:25:42 GMT Message-Id: <202109222225.18MMPgSr059413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: 9bab18b8616b - main - libsysdecode: Decode FreeBSD32 syscalls on arm64. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9bab18b8616bad4fa0adcd0e291903c55263640e 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, 22 Sep 2021 22:25:43 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=9bab18b8616bad4fa0adcd0e291903c55263640e commit 9bab18b8616bad4fa0adcd0e291903c55263640e Author: Olivier Houchard AuthorDate: 2021-09-22 22:22:30 +0000 Commit: Olivier Houchard CommitDate: 2021-09-22 22:24:50 +0000 libsysdecode: Decode FreeBSD32 syscalls on arm64. Add aarch64 to the list of architectures that can run 32bits FreeBSD binaries, so that truss works correctly with an arm32 binary. The same should probably be done with mips. MFC After: 1 week --- lib/libsysdecode/syscallnames.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libsysdecode/syscallnames.c b/lib/libsysdecode/syscallnames.c index 4638438964fd..fcc14886f39f 100644 --- a/lib/libsysdecode/syscallnames.c +++ b/lib/libsysdecode/syscallnames.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); static #include -#if defined(__amd64__) || defined(__powerpc64__) +#if defined(__amd64__) || defined(__powerpc64__) || defined(__aarch64__) static #include #endif @@ -73,7 +73,7 @@ sysdecode_syscallname(enum sysdecode_abi abi, unsigned int code) if (code < nitems(syscallnames)) return (syscallnames[code]); break; -#if defined(__amd64__) || defined(__powerpc64__) +#if defined(__amd64__) || defined(__powerpc64__) || defined(__aarch64__) case SYSDECODE_ABI_FREEBSD32: if (code < nitems(freebsd32_syscallnames)) return (freebsd32_syscallnames[code]); From owner-dev-commits-src-main@freebsd.org Wed Sep 22 23:05: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 6F655674016; Wed, 22 Sep 2021 23:05: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 4HFDRc2Smvz3ltH; Wed, 22 Sep 2021 23:05: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 341681FFD8; Wed, 22 Sep 2021 23:05: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 18MN5mhm013140; Wed, 22 Sep 2021 23:05:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MN5mxe013139; Wed, 22 Sep 2021 23:05:48 GMT (envelope-from git) Date: Wed, 22 Sep 2021 23:05:48 GMT Message-Id: <202109222305.18MN5mxe013139@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: ebbc3140ca0d - main - truss: Decode correctly 64bits arguments on 32bits arm. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd 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, 22 Sep 2021 23:05:48 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd commit ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd Author: Olivier Houchard AuthorDate: 2021-09-22 22:45:42 +0000 Commit: Olivier Houchard CommitDate: 2021-09-22 23:04:16 +0000 truss: Decode correctly 64bits arguments on 32bits arm. When decoding 32bits arm syscall, make sure we account for the padding when decoding 64bits args. Do it too when using a 64bits truss on a 32bits binary. MFC After: 1 week PR: 256199 --- usr.bin/truss/syscalls.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index f7657f30b583..9cd53e71cc9b 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -792,11 +792,14 @@ print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp, * decoding arguments. */ static void -quad_fixup(struct syscall_decode *sc) +quad_fixup(struct procabi *abi, struct syscall_decode *sc) { int offset, prev; u_int i; +#ifndef __aarch64__ + (void)abi; +#endif offset = 0; prev = -1; for (i = 0; i < sc->nargs; i++) { @@ -810,17 +813,20 @@ quad_fixup(struct syscall_decode *sc) switch (sc->args[i].type & ARG_MASK) { case Quad: case QuadHex: -#ifdef __powerpc__ +#if defined(__powerpc__) || defined(__arm__) || defined(__aarch64__) /* - * 64-bit arguments on 32-bit powerpc must be + * 64-bit arguments on 32-bit powerpc and arm must be * 64-bit aligned. If the current offset is * not aligned, the calling convention inserts * a 32-bit pad argument that should be skipped. */ - if (sc->args[i].offset % 2 == 1) { - sc->args[i].offset++; - offset++; - } +#ifdef __aarch64__ + if (abi->pointer_size == sizeof(uint32_t)) +#endif + if (sc->args[i].offset % 2 == 1) { + sc->args[i].offset++; + offset++; + } #endif offset++; default: @@ -854,7 +860,7 @@ add_syscall(struct procabi *abi, u_int number, struct syscall *sc) * procabi instead. */ if (abi->pointer_size == 4) - quad_fixup(&sc->decode); + quad_fixup(abi, &sc->decode); if (number < nitems(abi->syscalls)) { assert(abi->syscalls[number] == NULL); From owner-dev-commits-src-main@freebsd.org Wed Sep 22 23:14: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 2582E673C5C for ; Wed, 22 Sep 2021 23:14:29 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.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 4HFDdc6WLvz3mmM for ; Wed, 22 Sep 2021 23:14:28 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f45.google.com with SMTP id d21so11503419wra.12 for ; Wed, 22 Sep 2021 16:14:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=tDBx0p+5weOTWVbCd/zRsgUMEklRVtaxcLO5zjkGz+w=; b=iEVCftS3L0Msfhcr9OqmgUQBusVmv3bjntJGaKW52l9+7KSXkqgBKZrDtRSXFFL6k7 58Jt5zAv0Bcl9eMM8l5jaf2gCZE8sfZ1ab43xQXxV1Pp+W4JBtTeI3pgC3iYY2dGXS/C ++7+Vtz9bXVI5W94V+knsAazQE6YSdLKP6TZT/xDUVXq3E1Z8tLQCJH3qlhPov0APS6X o0Iv2pFfRKvNEjaafmnyiDwk6yPZWaOBgKx9EDFCZv6UZba/KyMfPURXZ7hG6nZ0UhUe tPu6VFHTpBWHPrrjyNK0HN4Mb8IQ3wk4PMerjs9Tfm/fExPIfe8puQQNmIjoqo7lBvNH fpjA== X-Gm-Message-State: AOAM533bulOqHtzAVGO5DQTUeSl7iSn4I0ynL2ahFd0SPDA4U5KhqS+h BqjpcsyN0thsOWqkVYi8MvFgASVa5aH7GQ== X-Google-Smtp-Source: ABdhPJz7HyQl094o3sWrWAoTSGjFCg2Uct0vGhgpeCmRJ7CHS7Nsx3vbf563hkhoIjwgYmbsPobbNw== X-Received: by 2002:a5d:440d:: with SMTP id z13mr1545340wrq.433.1632352461991; Wed, 22 Sep 2021 16:14:21 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id i27sm7385868wmb.40.2021.09.22.16.14.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Sep 2021 16:14:21 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: ebbc3140ca0d - main - truss: Decode correctly 64bits arguments on 32bits arm. From: Jessica Clarke In-Reply-To: <202109222305.18MN5mxe013139@gitrepo.freebsd.org> Date: Thu, 23 Sep 2021 00:14:21 +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: <06FE486C-5D06-43FD-B64F-EFF902040BD3@freebsd.org> References: <202109222305.18MN5mxe013139@gitrepo.freebsd.org> To: Olivier Houchard X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HFDdc6WLvz3mmM 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, 22 Sep 2021 23:14:29 -0000 On 23 Sep 2021, at 00:05, Olivier Houchard wrote: >=20 > The branch main has been updated by cognet: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Debbc3140ca0d7eee154f7a67ccdae7d3= d88d13fd >=20 > commit ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd > Author: Olivier Houchard > AuthorDate: 2021-09-22 22:45:42 +0000 > Commit: Olivier Houchard > CommitDate: 2021-09-22 23:04:16 +0000 >=20 > truss: Decode correctly 64bits arguments on 32bits arm. >=20 > When decoding 32bits arm syscall, make sure we account for the = padding when > decoding 64bits args. Do it too when using a 64bits truss on a = 32bits binary. >=20 > MFC After: 1 week > PR: 256199 > --- > usr.bin/truss/syscalls.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) >=20 > diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c > index f7657f30b583..9cd53e71cc9b 100644 > --- a/usr.bin/truss/syscalls.c > +++ b/usr.bin/truss/syscalls.c > @@ -792,11 +792,14 @@ print_mask_arg32(bool (*decoder)(FILE *, = uint32_t, uint32_t *), FILE *fp, > * decoding arguments. > */ > static void > -quad_fixup(struct syscall_decode *sc) > +quad_fixup(struct procabi *abi, struct syscall_decode *sc) > { > int offset, prev; > u_int i; >=20 > +#ifndef __aarch64__ > + (void)abi; > +#endif > offset =3D 0; > prev =3D -1; > for (i =3D 0; i < sc->nargs; i++) { > @@ -810,17 +813,20 @@ quad_fixup(struct syscall_decode *sc) > switch (sc->args[i].type & ARG_MASK) { > case Quad: > case QuadHex: > -#ifdef __powerpc__ > +#if defined(__powerpc__) || defined(__arm__) || defined(__aarch64__) > /* > - * 64-bit arguments on 32-bit powerpc must be > + * 64-bit arguments on 32-bit powerpc and arm = must be > * 64-bit aligned. If the current offset is > * not aligned, the calling convention inserts > * a 32-bit pad argument that should be skipped. > */ > - if (sc->args[i].offset % 2 =3D=3D 1) { > - sc->args[i].offset++; > - offset++; > - } > +#ifdef __aarch64__ > + if (abi->pointer_size =3D=3D sizeof(uint32_t)) Why? The caller already checks this, it doesn=E2=80=99t need to be = checked again. You even had to update that caller to pass the ABI and the patch clearly shows the check there. Also, please put changes like this up for review in future, arichardson@ did a bunch of work getting non-native ABI support into truss with input from myself, so if you find you need anything other than things like adding to ifdefs then that=E2=80=99s news to us because = we=E2=80=99ve tested it with freebsd32, and downstream in CheriBSD with our added freebsd64 ABI (which is what you think of as normal 64-bit, but we add a new ABI for memory safety that is the native ABI, so we exercise even more weird cases than upstream can). Please revert everything other than adding to the existing ifdef and updating the comment. Jess > +#endif > + if (sc->args[i].offset % 2 =3D=3D 1) { > + sc->args[i].offset++; > + offset++; > + } > #endif > offset++; > default: > @@ -854,7 +860,7 @@ add_syscall(struct procabi *abi, u_int number, = struct syscall *sc) > * procabi instead. > */ > if (abi->pointer_size =3D=3D 4) > - quad_fixup(&sc->decode); > + quad_fixup(abi, &sc->decode); >=20 > if (number < nitems(abi->syscalls)) { > assert(abi->syscalls[number] =3D=3D NULL); From owner-dev-commits-src-main@freebsd.org Wed Sep 22 23:20: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 0B0C2674614; Wed, 22 Sep 2021 23:20: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 4HFDn56y3mz3nH8; Wed, 22 Sep 2021 23:20: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 CE87C1FFFA; Wed, 22 Sep 2021 23:20: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 18MNKvwG035119; Wed, 22 Sep 2021 23:20:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MNKvK9035118; Wed, 22 Sep 2021 23:20:57 GMT (envelope-from git) Date: Wed, 22 Sep 2021 23:20:57 GMT Message-Id: <202109222320.18MNKvK9035118@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: b31c5a253213 - main - Eliminate an unnecessary rerun request in fsck_ffs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b31c5a25321363ab95c1642dffc6e92319dc42ce 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, 22 Sep 2021 23:20:58 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=b31c5a25321363ab95c1642dffc6e92319dc42ce commit b31c5a25321363ab95c1642dffc6e92319dc42ce Author: Kirk McKusick AuthorDate: 2021-09-22 23:16:39 +0000 Commit: Kirk McKusick CommitDate: 2021-09-22 23:20:19 +0000 Eliminate an unnecessary rerun request in fsck_ffs. When fsck_ffs is running in preen mode and finds a zero-length directory, it deletes that directory. In doing this operation, it unnecessary set its internal flag saying that fsck_ffs needed to be rerun. This patch deletes the rerun request for this case. Reported by: Mark Johnson PR: 246962 MFC after: 1 week Sponsored by: Netflix --- sbin/fsck_ffs/dir.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index e806f113ff16..42ecf4112253 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -132,7 +132,6 @@ dirscan(struct inodesc *idesc) (size_t)dsize); dirty(bp); sbdirty(); - rerun = 1; } if (n & STOP) return (n); From owner-dev-commits-src-main@freebsd.org Wed Sep 22 23:27: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 29842674B9B; Wed, 22 Sep 2021 23:27: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 4HFDx00Vc5z3pmc; Wed, 22 Sep 2021 23:27: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 E53762042C; Wed, 22 Sep 2021 23:27: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 18MNRlGr040306; Wed, 22 Sep 2021 23:27:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MNRlAi040305; Wed, 22 Sep 2021 23:27:47 GMT (envelope-from git) Date: Wed, 22 Sep 2021 23:27:47 GMT Message-Id: <202109222327.18MNRlAi040305@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: f4b7018af11a - main - truss: Decode correctly 64bits arguments on 32bits arm. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4b7018af11a1ab3edfcce8bc0bfa521364cdeb0 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, 22 Sep 2021 23:27:48 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=f4b7018af11a1ab3edfcce8bc0bfa521364cdeb0 commit f4b7018af11a1ab3edfcce8bc0bfa521364cdeb0 Author: Olivier Houchard AuthorDate: 2021-09-22 23:23:07 +0000 Commit: Olivier Houchard CommitDate: 2021-09-22 23:26:42 +0000 truss: Decode correctly 64bits arguments on 32bits arm. Mostly revert ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd. We don't need to special-case anything for arm64, the check for the pointer size is already done for us, just keep the bits about having arm and arm64 having to add padding for 32bits binaries. MFC after: 1 week --- usr.bin/truss/syscalls.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 9cd53e71cc9b..128ae624cf5f 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -792,14 +792,11 @@ print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp, * decoding arguments. */ static void -quad_fixup(struct procabi *abi, struct syscall_decode *sc) +quad_fixup(struct syscall_decode *sc) { int offset, prev; u_int i; -#ifndef __aarch64__ - (void)abi; -#endif offset = 0; prev = -1; for (i = 0; i < sc->nargs; i++) { @@ -820,13 +817,10 @@ quad_fixup(struct procabi *abi, struct syscall_decode *sc) * not aligned, the calling convention inserts * a 32-bit pad argument that should be skipped. */ -#ifdef __aarch64__ - if (abi->pointer_size == sizeof(uint32_t)) -#endif - if (sc->args[i].offset % 2 == 1) { - sc->args[i].offset++; - offset++; - } + if (sc->args[i].offset % 2 == 1) { + sc->args[i].offset++; + offset++; + } #endif offset++; default: @@ -860,7 +854,7 @@ add_syscall(struct procabi *abi, u_int number, struct syscall *sc) * procabi instead. */ if (abi->pointer_size == 4) - quad_fixup(abi, &sc->decode); + quad_fixup(&sc->decode); if (number < nitems(abi->syscalls)) { assert(abi->syscalls[number] == NULL); From owner-dev-commits-src-main@freebsd.org Wed Sep 22 23:28:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC28E674B18; Wed, 22 Sep 2021 23:28:56 +0000 (UTC) (envelope-from cognet@ci0.org) Received: from kanar.ci0.org (kanar.ci0.org [IPv6:2001:bc8:35e6::1]) (using TLSv1.3 with cipher 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 "sd-143795", Issuer "sd-143795" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFDyJ4867z3q6b; Wed, 22 Sep 2021 23:28:56 +0000 (UTC) (envelope-from cognet@ci0.org) Received: from kanar.ci0.org (localhost [127.0.0.1]) by kanar.ci0.org (8.16.1/8.16.1) with ESMTPS id 18MNRR2I067003 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 23 Sep 2021 01:27:27 +0200 (CEST) (envelope-from cognet@ci0.org) Received: (from doginou@localhost) by kanar.ci0.org (8.16.1/8.16.1/Submit) id 18MNRRQk067002; Thu, 23 Sep 2021 01:27:27 +0200 (CEST) (envelope-from cognet@ci0.org) X-Authentication-Warning: kanar.ci0.org: doginou set sender to cognet@ci0.org using -f Date: Thu, 23 Sep 2021 01:27:27 +0200 From: Olivier Houchard To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: ebbc3140ca0d - main - truss: Decode correctly 64bits arguments on 32bits arm. Message-ID: References: <202109222305.18MN5mxe013139@gitrepo.freebsd.org> <06FE486C-5D06-43FD-B64F-EFF902040BD3@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <06FE486C-5D06-43FD-B64F-EFF902040BD3@freebsd.org> X-Rspamd-Queue-Id: 4HFDyJ4867z3q6b 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, 22 Sep 2021 23:28:56 -0000 On Thu, Sep 23, 2021 at 12:14:21AM +0100, Jessica Clarke wrote: > On 23 Sep 2021, at 00:05, Olivier Houchard wrote: > > > > The branch main has been updated by cognet: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd > > > > commit ebbc3140ca0d7eee154f7a67ccdae7d3d88d13fd > > Author: Olivier Houchard > > AuthorDate: 2021-09-22 22:45:42 +0000 > > Commit: Olivier Houchard > > CommitDate: 2021-09-22 23:04:16 +0000 > > > > truss: Decode correctly 64bits arguments on 32bits arm. > > > > When decoding 32bits arm syscall, make sure we account for the padding when > > decoding 64bits args. Do it too when using a 64bits truss on a 32bits binary. > > > > MFC After: 1 week > > PR: 256199 > > --- > > usr.bin/truss/syscalls.c | 22 ++++++++++++++-------- > > 1 file changed, 14 insertions(+), 8 deletions(-) > > > > diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c > > index f7657f30b583..9cd53e71cc9b 100644 > > --- a/usr.bin/truss/syscalls.c > > +++ b/usr.bin/truss/syscalls.c > > @@ -792,11 +792,14 @@ print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp, > > * decoding arguments. > > */ > > static void > > -quad_fixup(struct syscall_decode *sc) > > +quad_fixup(struct procabi *abi, struct syscall_decode *sc) > > { > > int offset, prev; > > u_int i; > > > > +#ifndef __aarch64__ > > + (void)abi; > > +#endif > > offset = 0; > > prev = -1; > > for (i = 0; i < sc->nargs; i++) { > > @@ -810,17 +813,20 @@ quad_fixup(struct syscall_decode *sc) > > switch (sc->args[i].type & ARG_MASK) { > > case Quad: > > case QuadHex: > > -#ifdef __powerpc__ > > +#if defined(__powerpc__) || defined(__arm__) || defined(__aarch64__) > > /* > > - * 64-bit arguments on 32-bit powerpc must be > > + * 64-bit arguments on 32-bit powerpc and arm must be > > * 64-bit aligned. If the current offset is > > * not aligned, the calling convention inserts > > * a 32-bit pad argument that should be skipped. > > */ > > - if (sc->args[i].offset % 2 == 1) { > > - sc->args[i].offset++; > > - offset++; > > - } > > +#ifdef __aarch64__ > > + if (abi->pointer_size == sizeof(uint32_t)) > > Why? The caller already checks this, it doesn???t need to be checked > again. You even had to update that caller to pass the ABI and the patch > clearly shows the check there. > > Also, please put changes like this up for review in future, > arichardson@ did a bunch of work getting non-native ABI support into > truss with input from myself, so if you find you need anything other > than things like adding to ifdefs then that???s news to us because we???ve > tested it with freebsd32, and downstream in CheriBSD with our added > freebsd64 ABI (which is what you think of as normal 64-bit, but we add > a new ABI for memory safety that is the native ABI, so we exercise even > more weird cases than upstream can). > > Please revert everything other than adding to the existing ifdef and > updating the comment. > Oops, apologizes, it's just that I am an idiot. It is now reverted to a hopefully more sane state. Olivier From owner-dev-commits-src-main@freebsd.org Thu Sep 23 00:03: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 E6421675563; Thu, 23 Sep 2021 00:03: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 4HFFjj60DSz3s2j; Thu, 23 Sep 2021 00:03: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 ADD6C20E2E; Thu, 23 Sep 2021 00:03: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 18N035ht093530; Thu, 23 Sep 2021 00:03:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N0350X093529; Thu, 23 Sep 2021 00:03:05 GMT (envelope-from git) Date: Thu, 23 Sep 2021 00:03:05 GMT Message-Id: <202109230003.18N0350X093529@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: b5f90655ea37 - main - sysdecode.3: Remove documentation of CloudABI ABIs. 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: b5f90655ea37dc01e48002f83f85c6e3fc7565d8 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, 23 Sep 2021 00:03:06 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b5f90655ea37dc01e48002f83f85c6e3fc7565d8 commit b5f90655ea37dc01e48002f83f85c6e3fc7565d8 Author: John Baldwin AuthorDate: 2021-09-23 00:02:17 +0000 Commit: John Baldwin CommitDate: 2021-09-23 00:02:17 +0000 sysdecode.3: Remove documentation of CloudABI ABIs. Fixes: cf0ee8738e31 Drop cloudabi --- lib/libsysdecode/sysdecode.3 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/libsysdecode/sysdecode.3 b/lib/libsysdecode/sysdecode.3 index 41faca95e7e1..f5437e9b1c84 100644 --- a/lib/libsysdecode/sysdecode.3 +++ b/lib/libsysdecode/sysdecode.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 26, 2018 +.Dd September 22, 2021 .Dt SYSDECODE 3 .Os .Sh NAME @@ -47,7 +47,7 @@ The supported ABIs are named by the .Vt enum sysdecode_abi enumeration. .Pp -.Bl -tag -width "Li SYSDECODE_ABI_CLOUDABI64" -compact +.Bl -tag -width "Li SYSDECODE_ABI_FREEBSD32" -compact .It Li SYSDECODE_ABI_FREEBSD Native FreeBSD binaries. Supported on all platforms. @@ -60,12 +60,6 @@ Supported on amd64, i386, and arm64. .It Li SYSDECODE_ABI_LINUX32 32-bit Linux binaries. Supported on amd64. -.It Li SYSDECODE_ABI_CLOUDABI32 -32-bit CloudABI binaries. -Supported on all platforms. -.It Li SYSDECODE_ABI_CLOUDABI64 -64-bit CloudABI binaries. -Supported on all platforms. .It Li SYSDECODE_ABI_UNKNOWN A placeholder for use when the ABI is not known. .El From owner-dev-commits-src-main@freebsd.org Thu Sep 23 00:51: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 37EE5676329; Thu, 23 Sep 2021 00:51: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 4HFGnj18sjz3vyJ; Thu, 23 Sep 2021 00:51: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 08FB2216B8; Thu, 23 Sep 2021 00:51: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 18N0pa17058787; Thu, 23 Sep 2021 00:51:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N0paPH058786; Thu, 23 Sep 2021 00:51:36 GMT (envelope-from git) Date: Thu, 23 Sep 2021 00:51:36 GMT Message-Id: <202109230051.18N0paPH058786@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: 3fcbde5e883a - main - tests/sys/fs/fusefs/read.cc: fix build on powerpc64 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: 3fcbde5e883a253f631082b128dcdf77c840d4c0 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, 23 Sep 2021 00:51:37 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3fcbde5e883a253f631082b128dcdf77c840d4c0 commit 3fcbde5e883a253f631082b128dcdf77c840d4c0 Author: Konstantin Belousov AuthorDate: 2021-09-22 22:47:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-23 00:51:10 +0000 tests/sys/fs/fusefs/read.cc: fix build on powerpc64 There sig_atomic_t is shorter than void *. As result, it cannot keep pointer. Assigning to void * is actually safe for us in a signal handler. Reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Fixes: 4f917847c9037d Differential revision: https://reviews.freebsd.org/D32064 --- tests/sys/fs/fusefs/read.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/sys/fs/fusefs/read.cc b/tests/sys/fs/fusefs/read.cc index cb82d0a43b06..3cba564affcf 100644 --- a/tests/sys/fs/fusefs/read.cc +++ b/tests/sys/fs/fusefs/read.cc @@ -109,7 +109,7 @@ class ReadSigbus: public Read { public: static jmp_buf s_jmpbuf; -static sig_atomic_t s_si_addr; +static void *s_si_addr; void TearDown() { struct sigaction sa; @@ -125,12 +125,12 @@ void TearDown() { static void handle_sigbus(int signo __unused, siginfo_t *info, void *uap __unused) { - ReadSigbus::s_si_addr = (sig_atomic_t)info->si_addr; + ReadSigbus::s_si_addr = info->si_addr; longjmp(ReadSigbus::s_jmpbuf, 1); } jmp_buf ReadSigbus::s_jmpbuf; -sig_atomic_t ReadSigbus::s_si_addr; +void *ReadSigbus::s_si_addr; /* AIO reads need to set the header's pid field correctly */ /* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236379 */ @@ -658,7 +658,7 @@ TEST_F(ReadSigbus, mmap_eio) FAIL() << "shouldn't get here"; } - ASSERT_EQ(p, (void*)ReadSigbus::s_si_addr); + ASSERT_EQ(p, ReadSigbus::s_si_addr); ASSERT_EQ(0, munmap(p, len)) << strerror(errno); leak(fd); } @@ -785,7 +785,7 @@ TEST_F(ReadSigbus, mmap_getblksz_fail) FAIL() << "shouldn't get here"; } - ASSERT_EQ(p, (void*)ReadSigbus::s_si_addr); + ASSERT_EQ(p, ReadSigbus::s_si_addr); ASSERT_EQ(0, munmap(p, len)) << strerror(errno); leak(fd); } From owner-dev-commits-src-main@freebsd.org Thu Sep 23 02:50:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A1DF6775D6; Thu, 23 Sep 2021 02:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFKQJ088Mz4b7d; Thu, 23 Sep 2021 02:50:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7FEB23045; Thu, 23 Sep 2021 02:49: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 18N2nxvp006713; Thu, 23 Sep 2021 02:49:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N2nxtA006712; Thu, 23 Sep 2021 02:49:59 GMT (envelope-from git) Date: Thu, 23 Sep 2021 02:49:59 GMT Message-Id: <202109230249.18N2nxtA006712@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 88741a40c8fb - main - check-links.sh: treat PIE executable as elf files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88741a40c8fb515489b3ef61eba221fd7c8bef1b 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, 23 Sep 2021 02:50:00 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=88741a40c8fb515489b3ef61eba221fd7c8bef1b commit 88741a40c8fb515489b3ef61eba221fd7c8bef1b Author: Baptiste Daroussin AuthorDate: 2021-09-23 02:48:50 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-23 02:49:57 +0000 check-links.sh: treat PIE executable as elf files --- tools/build/check-links.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build/check-links.sh b/tools/build/check-links.sh index 06aa8d31d28e..7dc96fa5f082 100755 --- a/tools/build/check-links.sh +++ b/tools/build/check-links.sh @@ -49,7 +49,7 @@ fi mime=$(file -L --mime-type $1) isbin=0 case $mime in -*application/x-executable) isbin=1 ;; +*application/x-executable|*application/x-pie-executable) isbin=1 ;; *application/x-sharedlib);; *) echo "Not an elf file" >&2 ; exit 1;; esac From owner-dev-commits-src-main@freebsd.org Thu Sep 23 04:14: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 2ADDE678736; Thu, 23 Sep 2021 04:14: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 4HFMHg0TWPz4kVB; Thu, 23 Sep 2021 04:14: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 E45F524167; Thu, 23 Sep 2021 04:14: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 18N4EMos027401; Thu, 23 Sep 2021 04:14:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N4EMe4027400; Thu, 23 Sep 2021 04:14:22 GMT (envelope-from git) Date: Thu, 23 Sep 2021 04:14:22 GMT Message-Id: <202109230414.18N4EMe4027400@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: 319b15000300 - main - pmc: intr pmc.soft(3) update 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: 319b150003001fa09cb4a97452c57340ce42db35 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, 23 Sep 2021 04:14:23 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=319b150003001fa09cb4a97452c57340ce42db35 commit 319b150003001fa09cb4a97452c57340ce42db35 Author: Wojciech Macek AuthorDate: 2021-09-22 07:52:42 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 04:13:58 +0000 pmc: intr pmc.soft(3) update Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: mhorne Differential revision: https://reviews.freebsd.org/D32055 --- lib/libpmc/pmc.soft.3 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/libpmc/pmc.soft.3 b/lib/libpmc/pmc.soft.3 index a3cd4f01e607..68dd4f36b0d0 100644 --- a/lib/libpmc/pmc.soft.3 +++ b/lib/libpmc/pmc.soft.3 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2013 +.Dd September 23, 2021 .Dt PMC.SOFT 3 .Os .Sh NAME @@ -63,6 +63,18 @@ Hard clock ticks. Stat clock ticks. .It Li CLOCK.PROF Profiling clock ticks. +.It Li INTR.ALL +Interrupt filter executed +.It Li INTR.FILTER +Interrupt filter returned FILTER_HANDLED. +.It Li INTR.ITHREAD +Interrupt filter returned FILTER_SCHEDULE_ITHREAD. +.It Li INTR.SCHEDULE +Ithread scheduled. +.It Li INTR.STRAY +Interrupt filter returned FILTER_STRAY. +.It Li INTR.WAITING +Ithread not scheduled, already active. .It Li LOCK.FAILED Lock acquisition failed. .It Li PAGE_FAULT.ALL From owner-dev-commits-src-main@freebsd.org Thu Sep 23 05:17: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 23D42679422; Thu, 23 Sep 2021 05:17: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 4HFNhV0VC1z4rFT; Thu, 23 Sep 2021 05:17: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 E4A21251E9; Thu, 23 Sep 2021 05:17: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 18N5HTuk006760; Thu, 23 Sep 2021 05:17:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N5HTH7006759; Thu, 23 Sep 2021 05:17:29 GMT (envelope-from git) Date: Thu, 23 Sep 2021 05:17:29 GMT Message-Id: <202109230517.18N5HTH7006759@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: 7bc13692a2d6 - main - hwpmc: fix performance issues 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: 7bc13692a2d6b33b4e80bb9ad70d5eede6b148af 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, 23 Sep 2021 05:17:30 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=7bc13692a2d6b33b4e80bb9ad70d5eede6b148af commit 7bc13692a2d6b33b4e80bb9ad70d5eede6b148af Author: Wojciech Macek AuthorDate: 2021-09-20 11:08:32 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 05:15:42 +0000 hwpmc: fix performance issues Differential revision: https://reviews.freebsd.org/D32025 Avoid using atomics as it_wait is guarded by td_lock. Report threshold calculation is done only if at least one PMC hook is installed Fixes: * avoid unnecessary branching (if frame != null ...) by having PMC_HOOK_INSTALLED_ANY condition on the top of them, which should hint the core not to execute speculatively anything which us underneath; * access intr_hwpmc_waiting_report_threshold cacheline only if at least one hook is loaded; --- sys/kern/kern_intr.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 19401877dfbd..4e6e575a9fc9 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -107,6 +107,7 @@ static int intr_hwpmc_waiting_report_threshold = 1; SYSCTL_INT(_hw, OID_AUTO, intr_hwpmc_waiting_report_threshold, CTLFLAG_RWTUN, &intr_hwpmc_waiting_report_threshold, 1, "Threshold for reporting number of events in a workq"); +#define PMC_HOOK_INSTALLED_ANY() __predict_false(pmc_hook != NULL) #endif static TAILQ_HEAD(, intr_event) event_list = TAILQ_HEAD_INITIALIZER(event_list); @@ -131,6 +132,14 @@ PMC_SOFT_DEFINE( , , intr, filter); PMC_SOFT_DEFINE( , , intr, stray); PMC_SOFT_DEFINE( , , intr, schedule); PMC_SOFT_DEFINE( , , intr, waiting); + +#define PMC_SOFT_CALL_INTR_HLPR(event, frame) \ +do { \ + if (frame != NULL) \ + PMC_SOFT_CALL_TF( , , intr, event, frame); \ + else \ + PMC_SOFT_CALL( , , intr, event); \ +} while (0) #endif /* Map an interrupt type to an ithread priority. */ @@ -1005,11 +1014,9 @@ intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame) thread_lock(td); if (TD_AWAITING_INTR(td)) { #ifdef HWPMC_HOOKS - atomic_set_int(&it->it_waiting, 0); - if (frame != NULL) - PMC_SOFT_CALL_TF( , , intr, schedule, frame); - else - PMC_SOFT_CALL( , , intr, schedule); + it->it_waiting = 0; + if (PMC_HOOK_INSTALLED_ANY()) + PMC_SOFT_CALL_INTR_HLPR(schedule, frame); #endif CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, td->td_proc->p_pid, td->td_name); @@ -1017,14 +1024,10 @@ intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame) sched_add(td, SRQ_INTR); } else { #ifdef HWPMC_HOOKS - atomic_add_int(&it->it_waiting, 1); - - if (atomic_load_int(&it->it_waiting) >= intr_hwpmc_waiting_report_threshold) { - if (frame != NULL) - PMC_SOFT_CALL_TF( , , intr, waiting, frame); - else - PMC_SOFT_CALL( , , intr, waiting); - } + it->it_waiting++; + if (PMC_HOOK_INSTALLED_ANY() && + (it->it_waiting >= intr_hwpmc_waiting_report_threshold)) + PMC_SOFT_CALL_INTR_HLPR(waiting, frame); #endif CTR5(KTR_INTR, "%s: pid %d (%s): it_need %d, state %d", __func__, td->td_proc->p_pid, td->td_name, it->it_need, TD_GET_STATE(td)); From owner-dev-commits-src-main@freebsd.org Thu Sep 23 06:03: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 167A4679768; Thu, 23 Sep 2021 06:03: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 4HFPjc066Fz4v44; Thu, 23 Sep 2021 06:03: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 D7B1A25D17; Thu, 23 Sep 2021 06:03: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 18N63VV8073466; Thu, 23 Sep 2021 06:03:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N63VTu073465; Thu, 23 Sep 2021 06:03:31 GMT (envelope-from git) Date: Thu, 23 Sep 2021 06:03:31 GMT Message-Id: <202109230603.18N63VTu073465@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6895cade9421 - main - kern: random: drop read_rate and associated functionality MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6895cade9421238abf541f24fb9327ebd19e94ff 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, 23 Sep 2021 06:03:32 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6895cade9421238abf541f24fb9327ebd19e94ff commit 6895cade9421238abf541f24fb9327ebd19e94ff Author: Kyle Evans AuthorDate: 2021-09-20 04:59:09 +0000 Commit: Kyle Evans CommitDate: 2021-09-23 06:03:01 +0000 kern: random: drop read_rate and associated functionality Refer to discussion in PR 230808 for a less incomplete discussion, but the gist of this change is that we currently collect orders of magnitude more entropy than we need. The excess comes from bytes being read out of /dev/*random. The default rate at which we collect entropy without the read_rate increase is already more than we need to recover from a compromise of an internal state. Reviewed by: #csprng (cem, delphij, markm) Differential Revision: https://reviews.freebsd.org/D32021 --- sys/dev/random/random_harvestq.c | 18 ++---------------- sys/dev/random/random_harvestq.h | 2 -- sys/dev/random/randomdev.c | 2 -- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index 6838cf23fb2e..74a75aa20e3f 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -75,8 +75,6 @@ __FBSDID("$FreeBSD$"); static void random_kthread(void); static void random_sources_feed(void); -static u_int read_rate; - /* * Random must initialize much earlier than epoch, but we can initialize the * epoch code before SMP starts. Prior to SMP, we can safely bypass @@ -231,7 +229,7 @@ random_sources_feed(void) uint32_t entropy[HARVESTSIZE]; struct epoch_tracker et; struct random_sources *rrs; - u_int i, n, local_read_rate; + u_int i, n; bool rse_warm; rse_warm = epoch_inited; @@ -240,15 +238,10 @@ random_sources_feed(void) * Step over all of live entropy sources, and feed their output * to the system-wide RNG. */ - local_read_rate = atomic_readandclear_32(&read_rate); - /* Perform at least one read per round */ - local_read_rate = MAX(local_read_rate, 1); - /* But not exceeding RANDOM_KEYSIZE_WORDS */ - local_read_rate = MIN(local_read_rate, RANDOM_KEYSIZE_WORDS); if (rse_warm) epoch_enter_preempt(rs_epoch, &et); CK_LIST_FOREACH(rrs, &source_list, rrs_entries) { - for (i = 0; i < p_random_alg_context->ra_poolcount*local_read_rate; i++) { + for (i = 0; i < p_random_alg_context->ra_poolcount; i++) { n = rrs->rrs_source->rs_read(entropy, sizeof(entropy)); KASSERT((n <= sizeof(entropy)), ("%s: rs_read returned too much data (%u > %zu)", __func__, n, sizeof(entropy))); /* @@ -272,13 +265,6 @@ random_sources_feed(void) explicit_bzero(entropy, sizeof(entropy)); } -void -read_rate_increment(u_int chunk) -{ - - atomic_add_32(&read_rate, chunk); -} - /* ARGSUSED */ static int random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS) diff --git a/sys/dev/random/random_harvestq.h b/sys/dev/random/random_harvestq.h index c7005cde4f22..a6a69889412a 100644 --- a/sys/dev/random/random_harvestq.h +++ b/sys/dev/random/random_harvestq.h @@ -42,8 +42,6 @@ struct harvest_event { uint8_t he_source; /* origin of the entropy */ }; -void read_rate_increment(u_int); - #define RANDOM_HARVEST_INIT_LOCK(x) mtx_init(&harvest_context.hc_mtx, "entropy harvest mutex", NULL, MTX_SPIN) #define RANDOM_HARVEST_LOCK(x) mtx_lock_spin(&harvest_context.hc_mtx) #define RANDOM_HARVEST_UNLOCK(x) mtx_unlock_spin(&harvest_context.hc_mtx) diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index 114246415aa6..4b032cd3feb9 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -187,7 +187,6 @@ int if (error != 0) return (error); - read_rate_increment(howmany(uio->uio_resid + 1, sizeof(uint32_t))); total_read = 0; /* Easy to deal with the trivial 0 byte case. */ @@ -286,7 +285,6 @@ void (void)randomdev_wait_until_seeded(SEEDWAIT_UNINTERRUPTIBLE); } - read_rate_increment(roundup2(len, sizeof(uint32_t))); p_random_alg_context->ra_read(random_buf, len); } From owner-dev-commits-src-main@freebsd.org Thu Sep 23 06:03: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 3D8D867A062; Thu, 23 Sep 2021 06:03: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 4HFPjd1FDWz4tn7; Thu, 23 Sep 2021 06:03: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 0C3DD25C4F; Thu, 23 Sep 2021 06:03: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 18N63Wxn073490; Thu, 23 Sep 2021 06:03:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N63WMY073489; Thu, 23 Sep 2021 06:03:32 GMT (envelope-from git) Date: Thu, 23 Sep 2021 06:03:32 GMT Message-Id: <202109230603.18N63WMY073489@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 5e79bba562bc - main - kern: random: collect ~16x less from fast-entropy sources MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e79bba562bc303eed669dbd0d391b6c6a9c289b 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, 23 Sep 2021 06:03:33 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5e79bba562bc303eed669dbd0d391b6c6a9c289b commit 5e79bba562bc303eed669dbd0d391b6c6a9c289b Author: Kyle Evans AuthorDate: 2021-09-20 05:46:21 +0000 Commit: Kyle Evans CommitDate: 2021-09-23 06:03:02 +0000 kern: random: collect ~16x less from fast-entropy sources Previously, we were collecting at a base rate of: 64 bits x 32 pools x 10 Hz = 2.5 kB/s This change drops it to closer to 64-ish bits per pool per second, to work a little better with entropy providers in virtualized environments without compromising the security goals of Fortuna. Reviewed by: #csprng (cem, delphij, markm) Differential Revision: https://reviews.freebsd.org/D32021 --- sys/dev/random/random_harvestq.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index 74a75aa20e3f..46c069126949 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -72,6 +72,13 @@ __FBSDID("$FreeBSD$"); #define _RANDOM_HARVEST_UMA_OFF (1u << RANDOM_UMA) #endif +/* + * Note that random_sources_feed() will also use this to try and split up + * entropy into a subset of pools per iteration with the goal of feeding + * HARVESTSIZE into every pool at least once per second. + */ +#define RANDOM_KTHREAD_HZ 10 + static void random_kthread(void); static void random_sources_feed(void); @@ -199,7 +206,8 @@ random_kthread(void) } } /* XXX: FIX!! This is a *great* place to pass hardware/live entropy to random(9) */ - tsleep_sbt(&harvest_context.hc_kthread_proc, 0, "-", SBT_1S/10, 0, C_PREL(1)); + tsleep_sbt(&harvest_context.hc_kthread_proc, 0, "-", + SBT_1S/RANDOM_KTHREAD_HZ, 0, C_PREL(1)); } random_kthread_control = -1; wakeup(&harvest_context.hc_kthread_proc); @@ -229,11 +237,23 @@ random_sources_feed(void) uint32_t entropy[HARVESTSIZE]; struct epoch_tracker et; struct random_sources *rrs; - u_int i, n; + u_int i, n, npools; bool rse_warm; rse_warm = epoch_inited; + /* + * Evenly-ish distribute pool population across the second based on how + * frequently random_kthread iterates. + * + * For Fortuna, the math currently works out as such: + * + * 64 bits * 4 pools = 256 bits per iteration + * 256 bits * 10 Hz = 2560 bits per second, 320 B/s + * + */ + npools = howmany(p_random_alg_context->ra_poolcount, RANDOM_KTHREAD_HZ); + /* * Step over all of live entropy sources, and feed their output * to the system-wide RNG. @@ -241,7 +261,7 @@ random_sources_feed(void) if (rse_warm) epoch_enter_preempt(rs_epoch, &et); CK_LIST_FOREACH(rrs, &source_list, rrs_entries) { - for (i = 0; i < p_random_alg_context->ra_poolcount; i++) { + for (i = 0; i < npools; i++) { n = rrs->rrs_source->rs_read(entropy, sizeof(entropy)); KASSERT((n <= sizeof(entropy)), ("%s: rs_read returned too much data (%u > %zu)", __func__, n, sizeof(entropy))); /* From owner-dev-commits-src-main@freebsd.org Thu Sep 23 07:50: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 B824467ADB3; Thu, 23 Sep 2021 07:50: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 4HFS4w2rsSz3M6l; Thu, 23 Sep 2021 07:50: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 2CA082718E; Thu, 23 Sep 2021 07:50: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 18N7oO6P015513; Thu, 23 Sep 2021 07:50:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N7oODN015512; Thu, 23 Sep 2021 07:50:24 GMT (envelope-from git) Date: Thu, 23 Sep 2021 07:50:24 GMT Message-Id: <202109230750.18N7oODN015512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 90f6610b1975 - main - UPDATING: Fix spelling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90f6610b197550d841bcc13b7c2a90be627443b5 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, 23 Sep 2021 07:50:24 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=90f6610b197550d841bcc13b7c2a90be627443b5 commit 90f6610b197550d841bcc13b7c2a90be627443b5 Author: Hans Petter Selasky AuthorDate: 2021-09-23 07:49:01 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-23 07:49:45 +0000 UPDATING: Fix spelling. Submitted by: gljennjohn@gmail.com Differential Revision: https://reviews.freebsd.org/D31636 Sponsored by: NVIDIA Networking --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index d6eae6c23ede..4b41612dfbc3 100644 --- a/UPDATING +++ b/UPDATING @@ -29,7 +29,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: 202010922: As of commit 903873ce1560, the mixer(8) utility has got a slightly - new syntax. Please confirm to the mixer(8) manual page for more + new syntax. Please refer to the mixer(8) manual page for more information. 20210911: From owner-dev-commits-src-main@freebsd.org Thu Sep 23 08:43: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 6E0CC67BE11; Thu, 23 Sep 2021 08:43: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 4HFTG82Rrkz3jww; Thu, 23 Sep 2021 08:43: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 34AFC27B66; Thu, 23 Sep 2021 08:43: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 18N8hSAt085867; Thu, 23 Sep 2021 08:43:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N8hS2w085866; Thu, 23 Sep 2021 08:43:28 GMT (envelope-from git) Date: Thu, 23 Sep 2021 08:43:28 GMT Message-Id: <202109230843.18N8hS2w085866@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: d2c233176f44 - main - sh: Add -o verify to use O_VERIFY when sourcing scripts 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: d2c233176f44944ef3ed941a60010839340c06a7 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, 23 Sep 2021 08:43:28 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=d2c233176f44944ef3ed941a60010839340c06a7 commit d2c233176f44944ef3ed941a60010839340c06a7 Author: Stephane Rochoy AuthorDate: 2021-09-23 08:40:59 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 08:43:09 +0000 sh: Add -o verify to use O_VERIFY when sourcing scripts Add -o verify to sh to make it use O_VERIFY when sourcing scripts and reading profiles. Useful in conjunction with mac_veriexec to help protect at least some parts of the boot sequence, e.g., /etc/rc*. Differential revision: https://reviews.freebsd.org/D30464 Reviewed by: jilles, sjg Obtained from: Stormshield --- bin/sh/exec.c | 2 +- bin/sh/histedit.c | 2 +- bin/sh/input.c | 12 ++++++++++-- bin/sh/input.h | 2 +- bin/sh/main.c | 12 ++++++++---- bin/sh/main.h | 2 +- bin/sh/options.c | 2 +- bin/sh/options.h | 4 +++- bin/sh/sh.1 | 5 +++++ 9 files changed, 31 insertions(+), 12 deletions(-) diff --git a/bin/sh/exec.c b/bin/sh/exec.c index e3779b097e1d..43095a252a35 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -418,7 +418,7 @@ find_command(const char *name, struct cmdentry *entry, int act, if (!S_ISREG(statb.st_mode)) continue; if (opt) { /* this is a %func directory */ - readcmdfile(fullname); + readcmdfile(fullname, -1 /* verify */); if ((cmdp = cmdlookup(name, 0)) == NULL || cmdp->cmdtype != CMDFUNCTION) error("%s not defined in %s", name, fullname); stunalloc(fullname); diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 96511b87b451..3c113333f4c8 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -447,7 +447,7 @@ histcmd(int argc, char **argv __unused) editcmd = stalloc(strlen(editor) + strlen(editfile) + 2); sprintf(editcmd, "%s %s", editor, editfile); evalstring(editcmd, 0); /* XXX - should use no JC command */ - readcmdfile(editfile); /* XXX - should read back - quick tst */ + readcmdfile(editfile, 0 /* verify */); /* XXX - should read back - quick tst */ unlink(editfile); } diff --git a/bin/sh/input.c b/bin/sh/input.c index a8d048fc4890..3933287524a4 100644 --- a/bin/sh/input.c +++ b/bin/sh/input.c @@ -352,17 +352,25 @@ popstring(void) /* * Set the input to take input from a file. If push is set, push the * old input onto the stack first. + * About verify: + * -1: Obey verifyflag + * 0: Do not verify + * 1: Do verify */ void -setinputfile(const char *fname, int push) +setinputfile(const char *fname, int push, int verify) { int e; int fd; int fd2; + int oflags = O_RDONLY | O_CLOEXEC; + + if (verify == 1 || (verify == -1 && verifyflag)) + oflags |= O_VERIFY; INTOFF; - if ((fd = open(fname, O_RDONLY | O_CLOEXEC)) < 0) { + if ((fd = open(fname, oflags)) < 0) { e = errno; errorwithstatus(e == ENOENT || e == ENOTDIR ? 127 : 126, "cannot open %s: %s", fname, strerror(e)); diff --git a/bin/sh/input.h b/bin/sh/input.h index 71046b9731c3..edb622b6ec2e 100644 --- a/bin/sh/input.h +++ b/bin/sh/input.h @@ -53,7 +53,7 @@ int preadbuffer(void); int preadateof(void); void pungetc(void); void pushstring(const char *, int, struct alias *); -void setinputfile(const char *, int); +void setinputfile(const char *, int, int); void setinputfd(int, int); void setinputstring(const char *, int); void popfile(void); diff --git a/bin/sh/main.c b/bin/sh/main.c index b0a5fac6fd4e..bc87440807b2 100644 --- a/bin/sh/main.c +++ b/bin/sh/main.c @@ -253,12 +253,16 @@ read_profile(const char *name) { int fd; const char *expandedname; + int oflags = O_RDONLY | O_CLOEXEC; + + if (verifyflag) + oflags |= O_VERIFY; expandedname = expandstr(name); if (expandedname == NULL) return; INTOFF; - if ((fd = open(expandedname, O_RDONLY | O_CLOEXEC)) >= 0) + if ((fd = open(expandedname, oflags)) >= 0) setinputfd(fd, 1); INTON; if (fd < 0) @@ -274,9 +278,9 @@ read_profile(const char *name) */ void -readcmdfile(const char *name) +readcmdfile(const char *name, int verify) { - setinputfile(name, 1); + setinputfile(name, 1, verify); cmdloop(0); popfile(); } @@ -331,7 +335,7 @@ dotcmd(int argc, char **argv) filename = argc > 2 && strcmp(argv[1], "--") == 0 ? argv[2] : argv[1]; fullname = find_dot_file(filename); - setinputfile(fullname, 1); + setinputfile(fullname, 1, -1 /* verify */); commandname = fullname; cmdloop(0); popfile(); diff --git a/bin/sh/main.h b/bin/sh/main.h index ff0a1c61fa22..d12c7ab77fed 100644 --- a/bin/sh/main.h +++ b/bin/sh/main.h @@ -39,4 +39,4 @@ extern int rootpid; /* pid of main shell */ extern int rootshell; /* true if we aren't a child of the main shell */ extern struct jmploc main_handler; /* top level exception handler */ -void readcmdfile(const char *); +void readcmdfile(const char *, int); diff --git a/bin/sh/options.c b/bin/sh/options.c index 73d79ca9a74f..97171d32bff1 100644 --- a/bin/sh/options.c +++ b/bin/sh/options.c @@ -112,7 +112,7 @@ procargs(int argc, char **argv) arg0 = argv[0]; if (sflag == 0 && minusc == NULL) { scriptname = *argptr++; - setinputfile(scriptname, 0); + setinputfile(scriptname, 0, -1 /* verify */); commandname = arg0 = scriptname; } /* POSIX 1003.2: first arg after -c cmd is $0, remainder $1... */ diff --git a/bin/sh/options.h b/bin/sh/options.h index 500d4ad5a903..7c9c4513aa33 100644 --- a/bin/sh/options.h +++ b/bin/sh/options.h @@ -68,9 +68,10 @@ struct shparam { #define hflag optval[18] #define nologflag optval[19] #define pipefailflag optval[20] +#define verifyflag optval[21] #define NSHORTOPTS 19 -#define NOPTS 21 +#define NOPTS 22 extern char optval[NOPTS]; extern const char optletter[NSHORTOPTS]; @@ -99,6 +100,7 @@ static const unsigned char optname[] = "\010trackall" "\005nolog" "\010pipefail" + "\006verify" ; #endif diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index ca3faeff13af..c49230133f9f 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -355,6 +355,11 @@ if a command such as in the pipeline terminates with status 0 without reading its input completely. This option only has a long name. +.It Li verify +Set +.Dv O_VERIFY +when sourcing files or loading profiles. See also +.Xr mac_veriexec 4 . .El .Pp The From owner-dev-commits-src-main@freebsd.org Thu Sep 23 08:55: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 92D4167B77C; Thu, 23 Sep 2021 08:55: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 4HFTWd3X07z3lsW; Thu, 23 Sep 2021 08:55: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 59EB728197; Thu, 23 Sep 2021 08:55: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 18N8t9NM099693; Thu, 23 Sep 2021 08:55:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N8t9k5099692; Thu, 23 Sep 2021 08:55:09 GMT (envelope-from git) Date: Thu, 23 Sep 2021 08:55:09 GMT Message-Id: <202109230855.18N8t9k5099692@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: 492bf4fdad4d - main - veriexec: Fix veriexec -i's confusion between loaded and locked states 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: 492bf4fdad4dbb96b82d88e12918e61042f71661 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, 23 Sep 2021 08:55:09 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=492bf4fdad4dbb96b82d88e12918e61042f71661 commit 492bf4fdad4dbb96b82d88e12918e61042f71661 Author: Stephane Rochoy AuthorDate: 2021-09-23 08:53:56 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 08:53:56 +0000 veriexec: Fix veriexec -i's confusion between loaded and locked states Calling veriexec -i locked return the state of loaded and vice-versa. Differential revision: https://reviews.freebsd.org/D30952 Reviewed by: sjg,imp Obtained from: Stromshield --- sbin/veriexec/veriexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/veriexec/veriexec.c b/sbin/veriexec/veriexec.c index c1facbd4a9fa..1eb7a9af7d6f 100644 --- a/sbin/veriexec/veriexec.c +++ b/sbin/veriexec/veriexec.c @@ -91,7 +91,7 @@ main(int argc, char *argv[]) ctl = VERIEXEC_STATE_ENFORCE; break; case 'l': /* loaded/locked */ - ctl = (strncmp(optarg, "lock", 4)) ? + ctl = (strncmp(optarg, "lock", 4) == 0) ? VERIEXEC_STATE_LOCKED : VERIEXEC_STATE_LOADED; break; From owner-dev-commits-src-main@freebsd.org Thu Sep 23 08:58: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 D24E767BFA8; Thu, 23 Sep 2021 08:58: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 4HFTbC5SyRz3nNT; Thu, 23 Sep 2021 08:58: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 98FAC28198; Thu, 23 Sep 2021 08:58: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 18N8wF7g000120; Thu, 23 Sep 2021 08:58:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18N8wFBQ000119; Thu, 23 Sep 2021 08:58:15 GMT (envelope-from git) Date: Thu, 23 Sep 2021 08:58:15 GMT Message-Id: <202109230858.18N8wFBQ000119@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: 0b92a7fe47a5 - main - LACP: Do not wait response for marker messages not sent 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: 0b92a7fe47a5f7148a494514bfa530ddc6b496bf 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, 23 Sep 2021 08:58:15 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=0b92a7fe47a5f7148a494514bfa530ddc6b496bf commit 0b92a7fe47a5f7148a494514bfa530ddc6b496bf Author: Arnaud Ysmal AuthorDate: 2021-09-23 08:57:11 +0000 Commit: Wojciech Macek CommitDate: 2021-09-23 08:57:11 +0000 LACP: Do not wait response for marker messages not sent The error returned when a marker message can not be emitted on a port is not handled. This cause the lacp to block all emissions until the timeout of 3 seconds is reached. To fix this issue, I just clear the LACP_PORT_MARK flag when the packet could not be emitted. Differential revision: https://reviews.freebsd.org/D30467 Obtained from: Stormshield --- sys/net/ieee8023ad_lacp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net/ieee8023ad_lacp.c b/sys/net/ieee8023ad_lacp.c index bdc6113ce2a0..cf07890e051f 100644 --- a/sys/net/ieee8023ad_lacp.c +++ b/sys/net/ieee8023ad_lacp.c @@ -919,7 +919,8 @@ lacp_suppress_distributing(struct lacp_softc *lsc, struct lacp_aggregator *la) /* send a marker frame down each port to verify the queues are empty */ LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) { lp->lp_flags |= LACP_PORT_MARK; - lacp_xmit_marker(lp); + if (lacp_xmit_marker(lp) != 0) + lp->lp_flags &= ~LACP_PORT_MARK; } /* set a timeout for the marker frames */ From owner-dev-commits-src-main@freebsd.org Thu Sep 23 12:17: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 B86AD67E5F5; Thu, 23 Sep 2021 12:17: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 4HFZ1g4c4hz4YtQ; Thu, 23 Sep 2021 12:17: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 7D9F62AAB3; Thu, 23 Sep 2021 12:17: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 18NCHxbA065509; Thu, 23 Sep 2021 12:17:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NCHxcI065508; Thu, 23 Sep 2021 12:17:59 GMT (envelope-from git) Date: Thu, 23 Sep 2021 12:17:59 GMT Message-Id: <202109231217.18NCHxcI065508@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: 414499b3f911 - main - sctp: Cleanup stream schedulers. 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: 414499b3f911812d49a8c9af05102c0dc37ff878 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, 23 Sep 2021 12:17:59 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=414499b3f911812d49a8c9af05102c0dc37ff878 commit 414499b3f911812d49a8c9af05102c0dc37ff878 Author: Michael Tuexen AuthorDate: 2021-09-23 12:16:56 +0000 Commit: Michael Tuexen CommitDate: 2021-09-23 12:16:56 +0000 sctp: Cleanup stream schedulers. No functional change intended. MFC after: 1 week --- sys/netinet/sctp_output.c | 2 +- sys/netinet/sctp_ss_functions.c | 208 +++++++++++++++++----------------------- sys/netinet/sctp_structs.h | 21 ++-- sys/netinet/sctp_usrreq.c | 4 +- 4 files changed, 106 insertions(+), 129 deletions(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 36339ac0f2b1..cad15be7a57b 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12176,7 +12176,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, * initializing the new stuff. */ SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, false); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); /* FIX ME FIX ME */ diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 9d877568bcf1..ff108eb0eb33 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -54,6 +54,7 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc) uint16_t i; SCTP_TCB_SEND_LOCK_ASSERT(stcb); + asoc->ss_data.locked_on_sending = NULL; asoc->ss_data.last_out_stream = NULL; TAILQ_INIT(&asoc->ss_data.out.wheel); @@ -72,7 +73,7 @@ sctp_ss_default_init(struct sctp_tcb *stcb, struct sctp_association *asoc) static void sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values SCTP_UNUSED) + bool clear_values SCTP_UNUSED) { SCTP_TCB_SEND_LOCK_ASSERT(stcb); @@ -80,9 +81,8 @@ sctp_ss_default_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq; strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); - strq->ss_params.rr.next_spoke.tqe_next = NULL; - strq->ss_params.rr.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); + strq->ss_params.scheduled = false; } asoc->ss_data.last_out_stream = NULL; return; @@ -99,8 +99,7 @@ sctp_ss_default_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, stcb->asoc.ss_data.last_out_stream = strq; } } - strq->ss_params.rr.next_spoke.tqe_next = NULL; - strq->ss_params.rr.next_spoke.tqe_prev = NULL; + strq->ss_params.scheduled = false; return; } @@ -112,23 +111,18 @@ sctp_ss_default_add(struct sctp_tcb *stcb, struct sctp_association *asoc, SCTP_TCB_SEND_LOCK_ASSERT(stcb); /* Add to wheel if not already on it and stream queue not empty */ - if (!TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.rr.next_spoke.tqe_next == NULL) && - (strq->ss_params.rr.next_spoke.tqe_prev == NULL)) { + if (!TAILQ_EMPTY(&strq->outqueue) && !strq->ss_params.scheduled) { TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, - strq, ss_params.rr.next_spoke); + strq, ss_params.ss.rr.next_spoke); + strq->ss_params.scheduled = true; } return; } -static int +static bool sctp_ss_default_is_empty(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc) { - if (TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { - return (1); - } else { - return (0); - } + return (TAILQ_EMPTY(&asoc->ss_data.out.wheel)); } static void @@ -142,13 +136,11 @@ sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, * Remove from wheel if stream queue is empty and actually is on the * wheel */ - if (TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.rr.next_spoke.tqe_next != NULL || - strq->ss_params.rr.next_spoke.tqe_prev != NULL)) { + if (TAILQ_EMPTY(&strq->outqueue) && strq->ss_params.scheduled) { if (asoc->ss_data.last_out_stream == strq) { asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, sctpwheel_listhead, - ss_params.rr.next_spoke); + ss_params.ss.rr.next_spoke); if (asoc->ss_data.last_out_stream == NULL) { asoc->ss_data.last_out_stream = TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead); @@ -157,9 +149,8 @@ sctp_ss_default_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, asoc->ss_data.last_out_stream = NULL; } } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); - strq->ss_params.rr.next_spoke.tqe_next = NULL; - strq->ss_params.rr.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); + strq->ss_params.scheduled = false; } return; } @@ -179,7 +170,7 @@ default_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { - strq = TAILQ_NEXT(strqt, ss_params.rr.next_spoke); + strq = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); if (strq == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } @@ -257,24 +248,24 @@ sctp_ss_default_set_value(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_associa return (-1); } -static int +static bool sctp_ss_default_is_user_msgs_incomplete(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc) { struct sctp_stream_out *strq; struct sctp_stream_queue_pending *sp; if (asoc->stream_queue_cnt != 1) { - return (0); + return (false); } strq = asoc->ss_data.locked_on_sending; if (strq == NULL) { - return (0); + return (false); } sp = TAILQ_FIRST(&strq->outqueue); if (sp == NULL) { - return (0); + return (false); } - return (!sp->msg_is_complete); + return (sp->msg_is_complete == 0); } /* @@ -290,22 +281,21 @@ sctp_ss_rr_add(struct sctp_tcb *stcb, struct sctp_association *asoc, SCTP_TCB_SEND_LOCK_ASSERT(stcb); - if (!TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.rr.next_spoke.tqe_next == NULL) && - (strq->ss_params.rr.next_spoke.tqe_prev == NULL)) { + if (!TAILQ_EMPTY(&strq->outqueue) && !strq->ss_params.scheduled) { if (TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { - TAILQ_INSERT_HEAD(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); + TAILQ_INSERT_HEAD(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); } else { strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); while (strqt != NULL && (strqt->sid < strq->sid)) { - strqt = TAILQ_NEXT(strqt, ss_params.rr.next_spoke); + strqt = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); } if (strqt != NULL) { - TAILQ_INSERT_BEFORE(strqt, strq, ss_params.rr.next_spoke); + TAILQ_INSERT_BEFORE(strqt, strq, ss_params.ss.rr.next_spoke); } else { - TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.rr.next_spoke); + TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.ss.rr.next_spoke); } } + strq->ss_params.scheduled = true; } return; } @@ -334,7 +324,7 @@ rrp_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { - strq = TAILQ_NEXT(strqt, ss_params.rr.next_spoke); + strq = TAILQ_NEXT(strqt, ss_params.ss.rr.next_spoke); if (strq == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } @@ -372,7 +362,7 @@ rrp_again: */ static void sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values) + bool clear_values) { SCTP_TCB_SEND_LOCK_ASSERT(stcb); @@ -381,11 +371,10 @@ sctp_ss_prio_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); if (clear_values) { - strq->ss_params.prio.priority = 0; + strq->ss_params.ss.prio.priority = 0; } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.prio.next_spoke); - strq->ss_params.prio.next_spoke.tqe_next = NULL; - strq->ss_params.prio.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke); + strq->ss_params.scheduled = false; } asoc->ss_data.last_out_stream = NULL; return; @@ -402,12 +391,11 @@ sctp_ss_prio_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, st stcb->asoc.ss_data.last_out_stream = strq; } } - strq->ss_params.prio.next_spoke.tqe_next = NULL; - strq->ss_params.prio.next_spoke.tqe_prev = NULL; + strq->ss_params.scheduled = false; if (with_strq != NULL) { - strq->ss_params.prio.priority = with_strq->ss_params.prio.priority; + strq->ss_params.ss.prio.priority = with_strq->ss_params.ss.prio.priority; } else { - strq->ss_params.prio.priority = 0; + strq->ss_params.ss.prio.priority = 0; } return; } @@ -421,22 +409,21 @@ sctp_ss_prio_add(struct sctp_tcb *stcb, struct sctp_association *asoc, SCTP_TCB_SEND_LOCK_ASSERT(stcb); /* Add to wheel if not already on it and stream queue not empty */ - if (!TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.prio.next_spoke.tqe_next == NULL) && - (strq->ss_params.prio.next_spoke.tqe_prev == NULL)) { + if (!TAILQ_EMPTY(&strq->outqueue) && !strq->ss_params.scheduled) { if (TAILQ_EMPTY(&asoc->ss_data.out.wheel)) { - TAILQ_INSERT_HEAD(&asoc->ss_data.out.wheel, strq, ss_params.prio.next_spoke); + TAILQ_INSERT_HEAD(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke); } else { strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); - while (strqt != NULL && strqt->ss_params.prio.priority < strq->ss_params.prio.priority) { - strqt = TAILQ_NEXT(strqt, ss_params.prio.next_spoke); + while (strqt != NULL && strqt->ss_params.ss.prio.priority < strq->ss_params.ss.prio.priority) { + strqt = TAILQ_NEXT(strqt, ss_params.ss.prio.next_spoke); } if (strqt != NULL) { - TAILQ_INSERT_BEFORE(strqt, strq, ss_params.prio.next_spoke); + TAILQ_INSERT_BEFORE(strqt, strq, ss_params.ss.prio.next_spoke); } else { - TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.prio.next_spoke); + TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke); } } + strq->ss_params.scheduled = true; } return; } @@ -451,12 +438,11 @@ sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, * Remove from wheel if stream queue is empty and actually is on the * wheel */ - if (TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.prio.next_spoke.tqe_next != NULL || - strq->ss_params.prio.next_spoke.tqe_prev != NULL)) { + if (TAILQ_EMPTY(&strq->outqueue) && strq->ss_params.scheduled) { if (asoc->ss_data.last_out_stream == strq) { - asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, sctpwheel_listhead, - ss_params.prio.next_spoke); + asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, + sctpwheel_listhead, + ss_params.ss.prio.next_spoke); if (asoc->ss_data.last_out_stream == NULL) { asoc->ss_data.last_out_stream = TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead); @@ -465,9 +451,8 @@ sctp_ss_prio_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, asoc->ss_data.last_out_stream = NULL; } } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.prio.next_spoke); - strq->ss_params.prio.next_spoke.tqe_next = NULL; - strq->ss_params.prio.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.prio.next_spoke); + strq->ss_params.scheduled = false; } return; } @@ -487,9 +472,9 @@ prio_again: if (strqt == NULL) { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { - strqn = TAILQ_NEXT(strqt, ss_params.prio.next_spoke); + strqn = TAILQ_NEXT(strqt, ss_params.ss.prio.next_spoke); if (strqn != NULL && - strqn->ss_params.prio.priority == strqt->ss_params.prio.priority) { + strqn->ss_params.ss.prio.priority == strqt->ss_params.ss.prio.priority) { strq = strqn; } else { strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); @@ -528,7 +513,7 @@ sctp_ss_prio_get_value(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_associatio if (strq == NULL) { return (-1); } - *value = strq->ss_params.prio.priority; + *value = strq->ss_params.ss.prio.priority; return (1); } @@ -539,7 +524,7 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, if (strq == NULL) { return (-1); } - strq->ss_params.prio.priority = value; + strq->ss_params.ss.prio.priority = value; sctp_ss_prio_remove(stcb, asoc, strq, NULL); sctp_ss_prio_add(stcb, asoc, strq, NULL); return (1); @@ -551,7 +536,7 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, */ static void sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values) + bool clear_values) { SCTP_TCB_SEND_LOCK_ASSERT(stcb); @@ -560,11 +545,10 @@ sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, strq = TAILQ_FIRST(&asoc->ss_data.out.wheel); if (clear_values) { - strq->ss_params.fb.rounds = -1; + strq->ss_params.ss.fb.rounds = -1; } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.fb.next_spoke); - strq->ss_params.fb.next_spoke.tqe_next = NULL; - strq->ss_params.fb.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.fb.next_spoke); + strq->ss_params.scheduled = false; } asoc->ss_data.last_out_stream = NULL; return; @@ -581,12 +565,11 @@ sctp_ss_fb_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, stru stcb->asoc.ss_data.last_out_stream = strq; } } - strq->ss_params.fb.next_spoke.tqe_next = NULL; - strq->ss_params.fb.next_spoke.tqe_prev = NULL; + strq->ss_params.scheduled = false; if (with_strq != NULL) { - strq->ss_params.fb.rounds = with_strq->ss_params.fb.rounds; + strq->ss_params.ss.fb.rounds = with_strq->ss_params.ss.fb.rounds; } else { - strq->ss_params.fb.rounds = -1; + strq->ss_params.ss.fb.rounds = -1; } return; } @@ -597,12 +580,11 @@ sctp_ss_fb_add(struct sctp_tcb *stcb, struct sctp_association *asoc, { SCTP_TCB_SEND_LOCK_ASSERT(stcb); - if (!TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.fb.next_spoke.tqe_next == NULL) && - (strq->ss_params.fb.next_spoke.tqe_prev == NULL)) { - if (strq->ss_params.fb.rounds < 0) - strq->ss_params.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; - TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.fb.next_spoke); + if (!TAILQ_EMPTY(&strq->outqueue) && !strq->ss_params.scheduled) { + if (strq->ss_params.ss.fb.rounds < 0) + strq->ss_params.ss.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; + TAILQ_INSERT_TAIL(&asoc->ss_data.out.wheel, strq, ss_params.ss.fb.next_spoke); + strq->ss_params.scheduled = true; } return; } @@ -617,12 +599,11 @@ sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, * Remove from wheel if stream queue is empty and actually is on the * wheel */ - if (TAILQ_EMPTY(&strq->outqueue) && - (strq->ss_params.fb.next_spoke.tqe_next != NULL || - strq->ss_params.fb.next_spoke.tqe_prev != NULL)) { + if (TAILQ_EMPTY(&strq->outqueue) && strq->ss_params.scheduled) { if (asoc->ss_data.last_out_stream == strq) { - asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, sctpwheel_listhead, - ss_params.fb.next_spoke); + asoc->ss_data.last_out_stream = TAILQ_PREV(asoc->ss_data.last_out_stream, + sctpwheel_listhead, + ss_params.ss.fb.next_spoke); if (asoc->ss_data.last_out_stream == NULL) { asoc->ss_data.last_out_stream = TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead); @@ -631,9 +612,8 @@ sctp_ss_fb_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, asoc->ss_data.last_out_stream = NULL; } } - TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.fb.next_spoke); - strq->ss_params.fb.next_spoke.tqe_next = NULL; - strq->ss_params.fb.next_spoke.tqe_prev = NULL; + TAILQ_REMOVE(&asoc->ss_data.out.wheel, strq, ss_params.ss.fb.next_spoke); + strq->ss_params.scheduled = false; } return; } @@ -651,7 +631,7 @@ sctp_ss_fb_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, TAILQ_FIRST(&asoc->ss_data.out.wheel) == TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead)) { strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); } else { - strqt = TAILQ_NEXT(asoc->ss_data.last_out_stream, ss_params.fb.next_spoke); + strqt = TAILQ_NEXT(asoc->ss_data.last_out_stream, ss_params.ss.fb.next_spoke); } do { if ((strqt != NULL) && @@ -660,13 +640,14 @@ sctp_ss_fb_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, (net == NULL || (TAILQ_FIRST(&strqt->outqueue) && TAILQ_FIRST(&strqt->outqueue)->net == NULL) || (net != NULL && TAILQ_FIRST(&strqt->outqueue) && TAILQ_FIRST(&strqt->outqueue)->net != NULL && TAILQ_FIRST(&strqt->outqueue)->net == net))))) { - if ((strqt->ss_params.fb.rounds >= 0) && (strq == NULL || - strqt->ss_params.fb.rounds < strq->ss_params.fb.rounds)) { + if ((strqt->ss_params.ss.fb.rounds >= 0) && + ((strq == NULL) || + (strqt->ss_params.ss.fb.rounds < strq->ss_params.ss.fb.rounds))) { strq = strqt; } } if (strqt != NULL) { - strqt = TAILQ_NEXT(strqt, ss_params.fb.next_spoke); + strqt = TAILQ_NEXT(strqt, ss_params.ss.fb.next_spoke); } else { strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); } @@ -693,16 +674,16 @@ sctp_ss_fb_scheduled(struct sctp_tcb *stcb, struct sctp_nets *net SCTP_UNUSED, } else { stcb->asoc.ss_data.locked_on_sending = NULL; } - subtract = strq->ss_params.fb.rounds; - TAILQ_FOREACH(strqt, &asoc->ss_data.out.wheel, ss_params.fb.next_spoke) { - strqt->ss_params.fb.rounds -= subtract; - if (strqt->ss_params.fb.rounds < 0) - strqt->ss_params.fb.rounds = 0; + subtract = strq->ss_params.ss.fb.rounds; + TAILQ_FOREACH(strqt, &asoc->ss_data.out.wheel, ss_params.ss.fb.next_spoke) { + strqt->ss_params.ss.fb.rounds -= subtract; + if (strqt->ss_params.ss.fb.rounds < 0) + strqt->ss_params.ss.fb.rounds = 0; } if (TAILQ_FIRST(&strq->outqueue)) { - strq->ss_params.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; + strq->ss_params.ss.fb.rounds = TAILQ_FIRST(&strq->outqueue)->length; } else { - strq->ss_params.fb.rounds = -1; + strq->ss_params.ss.fb.rounds = -1; } asoc->ss_data.last_out_stream = strq; return; @@ -754,7 +735,7 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc) static void sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values SCTP_UNUSED) + bool clear_values SCTP_UNUSED) { struct sctp_stream_queue_pending *sp; @@ -763,8 +744,7 @@ sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, while (!TAILQ_EMPTY(&asoc->ss_data.out.list)) { sp = TAILQ_FIRST(&asoc->ss_data.out.list); TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); - sp->ss_next.tqe_next = NULL; - sp->ss_next.tqe_prev = NULL; + sp->scheduled = false; } asoc->ss_data.last_out_stream = NULL; return; @@ -781,8 +761,7 @@ sctp_ss_fcfs_init_stream(struct sctp_tcb *stcb, struct sctp_stream_out *strq, st stcb->asoc.ss_data.last_out_stream = strq; } } - strq->ss_params.fb.next_spoke.tqe_next = NULL; - strq->ss_params.fb.next_spoke.tqe_prev = NULL; + strq->ss_params.scheduled = false; return; } @@ -792,21 +771,17 @@ sctp_ss_fcfs_add(struct sctp_tcb *stcb, struct sctp_association *asoc, { SCTP_TCB_SEND_LOCK_ASSERT(stcb); - if (sp && (sp->ss_next.tqe_next == NULL) && - (sp->ss_next.tqe_prev == NULL)) { + if (!sp->scheduled) { TAILQ_INSERT_TAIL(&asoc->ss_data.out.list, sp, ss_next); + sp->scheduled = true; } return; } -static int +static bool sctp_ss_fcfs_is_empty(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc) { - if (TAILQ_EMPTY(&asoc->ss_data.out.list)) { - return (1); - } else { - return (0); - } + return (TAILQ_EMPTY(&asoc->ss_data.out.list)); } static void @@ -815,12 +790,9 @@ sctp_ss_fcfs_remove(struct sctp_tcb *stcb, struct sctp_association *asoc, { SCTP_TCB_SEND_LOCK_ASSERT(stcb); - if (sp && - ((sp->ss_next.tqe_next != NULL) || - (sp->ss_next.tqe_prev != NULL))) { + if (sp->scheduled) { TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); - sp->ss_next.tqe_next = NULL; - sp->ss_next.tqe_prev = NULL; + sp->scheduled = false; } return; } diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index 2f0ae4c45b24..026e3319dd23 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -505,6 +505,7 @@ struct sctp_queued_to_read { /* sinfo structure Pluse more */ * the user is in the explict MSG_EOR mode * and wrote some data, but has not completed * sending. + * ss_next and scheduled are only used by the FCFS stream scheduler. */ struct sctp_stream_queue_pending { struct mbuf *data; @@ -529,6 +530,7 @@ struct sctp_stream_queue_pending { uint8_t put_last_out; uint8_t discard_rest; uint8_t processing; + bool scheduled; }; /* @@ -588,10 +590,13 @@ struct ss_fb { * This union holds all parameters per stream * necessary for different stream schedulers. */ -union scheduling_parameters { - struct ss_rr rr; - struct ss_prio prio; - struct ss_fb fb; +struct scheduling_parameters { + union { + struct ss_rr rr; + struct ss_prio prio; + struct ss_fb fb; + } ss; + bool scheduled; }; /* States for outgoing streams */ @@ -604,7 +609,7 @@ union scheduling_parameters { /* This struct is used to track the traffic on outbound streams */ struct sctp_stream_out { struct sctp_streamhead outqueue; - union scheduling_parameters ss_params; + struct scheduling_parameters ss_params; uint32_t chunks_on_queues; /* send queue and sent queue */ #if defined(SCTP_DETAILED_STR_STATS) uint32_t abandoned_unsent[SCTP_PR_SCTP_MAX + 1]; @@ -731,11 +736,11 @@ struct sctp_cc_functions { struct sctp_ss_functions { void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc); void (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values); + bool clear_values); void (*sctp_ss_init_stream) (struct sctp_tcb *stcb, struct sctp_stream_out *strq, struct sctp_stream_out *with_strq); void (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); - int (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc); + bool (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc); void (*sctp_ss_remove_from_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb, @@ -748,7 +753,7 @@ struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb, struct sctp_stream_out *strq, uint16_t *value); int (*sctp_ss_set_value) (struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_stream_out *strq, uint16_t value); - int (*sctp_ss_is_user_msgs_incomplete) (struct sctp_tcb *stcb, struct sctp_association *asoc); + bool (*sctp_ss_is_user_msgs_incomplete) (struct sctp_tcb *stcb, struct sctp_association *asoc); }; /* used to save ASCONF chunks for retransmission */ diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 65037f0734ea..b2d23bffb9fd 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -4043,7 +4043,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); @@ -4066,7 +4066,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); SCTP_TCB_SEND_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1); + stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true); stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value]; stcb->asoc.stream_scheduling_module = av->assoc_value; stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); From owner-dev-commits-src-main@freebsd.org Thu Sep 23 13:51: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 C07CB67F2FC; Thu, 23 Sep 2021 13:51: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 4HFc5y4vWJz4hjS; Thu, 23 Sep 2021 13:51: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 7DF382C2F9; Thu, 23 Sep 2021 13:51: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 18NDpoPV096780; Thu, 23 Sep 2021 13:51:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NDpo6a096779; Thu, 23 Sep 2021 13:51:50 GMT (envelope-from git) Date: Thu, 23 Sep 2021 13:51:50 GMT Message-Id: <202109231351.18NDpo6a096779@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: dbc7ca594515 - main - vt: bound buffer access in redraw optimization 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: dbc7ca59451561a179f9852642e13ef024169d84 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, 23 Sep 2021 13:51:50 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=dbc7ca59451561a179f9852642e13ef024169d84 commit dbc7ca59451561a179f9852642e13ef024169d84 Author: Ed Maste AuthorDate: 2021-09-22 18:41:00 +0000 Commit: Ed Maste CommitDate: 2021-09-23 13:51:36 +0000 vt: bound buffer access in redraw optimization PR: 248628 Reported by: oleg Reviewed by: cem, oleg (both earlier) Fixes: ee97b2336aa4 ("Speed up vt(4) by keeping...") MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32059 --- sys/dev/vt/hw/fb/vt_fb.c | 6 ++++++ sys/dev/vt/hw/vga/vt_vga.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c index bdf2bbfcc7ce..2f6c4c3939d5 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -354,6 +354,9 @@ vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg); z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn && (vd->vd_drawn[z] == c) && vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) @@ -404,6 +407,9 @@ vt_fb_invalidate_text(struct vt_device *vd, const term_rect_t *area) for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col; ++col) { z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn) vd->vd_drawn[z] = 0; if (vd->vd_drawnfg) diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index 88a9b1c47338..563867399e53 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -888,6 +888,9 @@ vga_bitblt_text_txtmode(struct vt_device *vd, const struct vt_window *vw, &fg, &bg); z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn && (vd->vd_drawn[z] == c) && vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) @@ -941,6 +944,9 @@ vga_invalidate_text(struct vt_device *vd, const term_rect_t *area) col < area->tr_end.tp_col; ++col) { z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; + if (z >= PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * + PIXEL_WIDTH(VT_FB_MAX_WIDTH)) + continue; if (vd->vd_drawn) vd->vd_drawn[z] = 0; if (vd->vd_drawnfg) From owner-dev-commits-src-main@freebsd.org Thu Sep 23 14:57:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8C0C6A889A; Thu, 23 Sep 2021 14:57:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFdZD4c6Nz4rHL; Thu, 23 Sep 2021 14:57:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79ACA2CEA8; Thu, 23 Sep 2021 14:57:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18NEvuux077702; Thu, 23 Sep 2021 14:57:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NEvuYN077701; Thu, 23 Sep 2021 14:57:56 GMT (envelope-from git) Date: Thu, 23 Sep 2021 14:57:56 GMT Message-Id: <202109231457.18NEvuYN077701@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: fd69939e79a6 - main - tcp: Two bugs in rack one of which can lead to a panic. 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: fd69939e79a65d0dea766ac05e4d8b7335819ae1 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, 23 Sep 2021 14:57:56 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=fd69939e79a65d0dea766ac05e4d8b7335819ae1 commit fd69939e79a65d0dea766ac05e4d8b7335819ae1 Author: Randall Stewart AuthorDate: 2021-09-23 14:54:23 +0000 Commit: Randall Stewart CommitDate: 2021-09-23 14:54:23 +0000 tcp: Two bugs in rack one of which can lead to a panic. In extensive testing in NF we have found two issues inside the rack stack. 1) An incorrect offset is being generated by the fast send path when a fast send is initiated on the end of the socket buffer and before the fast send runs, the sb_compress macro adds data to the trailing socket. This fools the fast send code into thinking the sb offset changed and it miscalculates a "updated offset". It should only do that when the mbuf in question got smaller.. i.e. an ack was processed. This can lead to a panic deref'ing a NULL mbuf if that packet is ever retransmitted. At the best case it leads to invalid data being sent to the client which usually terminates the connection. The fix is to have the proper logic (that is in the rsm fast path) to make sure we only update the offset when the mbuf shrinks. 2) The other issue is more bothersome. The timestamp check in rack needs to use the msec timestamp when comparing the timestamp echo to now. It was using a microsecond timestamp which ends up giving error prone results but causes only small harm in trying to identify which send to use in RTT calculations if its a retransmit. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D32062 --- sys/netinet/tcp_stacks/rack.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 947f9f619929..23b1ff1fc584 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -9176,6 +9176,7 @@ more: if ((rsm->r_flags & RACK_TO_REXT) && (tp->t_flags & TF_RCVD_TSTMP) && (to->to_flags & TOF_TS) && + (to->to_tsecr != 0) && (tp->t_flags & TF_PREVVALID)) { /* * We can use the timestamp to see @@ -13321,7 +13322,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb struct timespec ts; struct tcp_rack *rack; struct tcp_ackent *ae; - uint32_t tiwin, us_cts, cts, acked, acked_amount, high_seq, win_seq, the_win, win_upd_ack; + uint32_t tiwin, ms_cts, cts, acked, acked_amount, high_seq, win_seq, the_win, win_upd_ack; int cnt, i, did_out, ourfinisacked = 0; int win_up_req = 0; struct tcpopt to_holder, *to = NULL; @@ -13381,13 +13382,14 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb the_win = tp->snd_wnd; win_seq = tp->snd_wl1; win_upd_ack = tp->snd_wl2; - cts = us_cts = tcp_tv_to_usectick(tv); + cts = tcp_tv_to_usectick(tv); + ms_cts = tcp_tv_to_mssectick(tv); segsiz = ctf_fixed_maxseg(tp); if ((rack->rc_gp_dyn_mul) && (rack->use_fixed_rate == 0) && (rack->rc_always_pace)) { /* Check in on probertt */ - rack_check_probe_rtt(rack, us_cts); + rack_check_probe_rtt(rack, cts); } for (i = 0; i < cnt; i++) { #ifdef TCP_ACCOUNTING @@ -13424,8 +13426,8 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb * non RFC1323 RTT calculation. Normalize timestamp if syncookies * were used when this connection was established. */ - if (TSTMP_GT(ae->ts_echo, cts)) - ae->ts_echo = 0; + if (TSTMP_GT(ae->ts_echo, ms_cts)) + to->to_tsecr = 0; if (tp->ts_recent && TSTMP_LT(ae->ts_value, tp->ts_recent)) { if (ctf_ts_check_ac(tp, (ae->flags & 0xff))) { @@ -13524,7 +13526,6 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb the_win = tiwin; } else { /* Case A */ - if (SEQ_GT(ae->ack, tp->snd_max)) { /* * We just send an ack since the incoming @@ -13564,7 +13565,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb } rack_process_to_cumack(tp, rack, ae->ack, cts, to); if (rack->rc_dsack_round_seen) { - /* Is the dsack roound over? */ + /* Is the dsack round over? */ if (SEQ_GEQ(ae->ack, rack->r_ctl.dsack_round_end)) { /* Yes it is */ rack->rc_dsack_round_seen = 0; @@ -13687,7 +13688,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb rack_ack_received(tp, rack, high_seq, nsegs, CC_ACK, recovery); SOCKBUF_LOCK(&so->so_snd); - mfree = sbcut_locked(&so->so_snd, acked); + mfree = sbcut_locked(&so->so_snd, acked_amount); tp->snd_una = high_seq; /* Note we want to hold the sb lock through the sendmap adjust */ rack_adjust_sendmap(rack, &so->so_snd, tp->snd_una); @@ -13962,7 +13963,12 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, #endif int32_t thflags, retval, did_out = 0; int32_t way_out = 0; - uint32_t cts; + /* + * cts - is the current time from tv (caller gets ts) in microseconds. + * ms_cts - is the current time from tv in milliseconds. + * us_cts - is the time that LRO or hardware actually got the packet in microseconds. + */ + uint32_t cts, us_cts, ms_cts; uint32_t tiwin; struct timespec ts; struct tcpopt to; @@ -13973,19 +13979,19 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, int ack_val_set = 0xf; #endif int nsegs; - uint32_t us_cts; /* * tv passed from common code is from either M_TSTMP_LRO or * tcp_get_usecs() if no LRO m_pkthdr timestamp is present. */ rack = (struct tcp_rack *)tp->t_fb_ptr; - cts = tcp_tv_to_usectick(tv); if (m->m_flags & M_ACKCMP) { return (rack_do_compressed_ack_processing(tp, so, m, nxt_pkt, tv)); } if (m->m_flags & M_ACKCMP) { panic("Impossible reach m has ackcmp? m:%p tp:%p", m, tp); } + cts = tcp_tv_to_usectick(tv); + ms_cts = tcp_tv_to_mssectick(tv); nsegs = m->m_pkthdr.lro_nsegs; counter_u64_add(rack_proc_non_comp_ack, 1); thflags = th->th_flags; @@ -14238,7 +14244,7 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, */ if ((to.to_flags & TOF_TS) && (to.to_tsecr != 0)) { to.to_tsecr -= tp->ts_offset; - if (TSTMP_GT(to.to_tsecr, cts)) + if (TSTMP_GT(to.to_tsecr, ms_cts)) to.to_tsecr = 0; } @@ -15571,7 +15577,7 @@ rack_fo_m_copym(struct tcp_rack *rack, int32_t *plen, soff = rack->r_ctl.fsb.off; m = rack->r_ctl.fsb.m; - if (rack->r_ctl.fsb.o_m_len != m->m_len) { + if (rack->r_ctl.fsb.o_m_len > m->m_len) { /* * The mbuf had the front of it chopped off by an ack * we need to adjust the soff/off by that difference. @@ -15580,6 +15586,12 @@ rack_fo_m_copym(struct tcp_rack *rack, int32_t *plen, delta = rack->r_ctl.fsb.o_m_len - m->m_len; soff -= delta; + } else if (rack->r_ctl.fsb.o_m_len < m->m_len) { + /* + * The mbuf was expanded probably by + * a m_compress. Just update o_m_len. + */ + rack->r_ctl.fsb.o_m_len = m->m_len; } KASSERT(soff >= 0, ("%s, negative off %d", __FUNCTION__, soff)); KASSERT(*plen >= 0, ("%s, negative len %d", __FUNCTION__, *plen)); From owner-dev-commits-src-main@freebsd.org Thu Sep 23 15:44: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 C1E316A8B6C; Thu, 23 Sep 2021 15:44: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 4HFfcQ4jNfz4vnw; Thu, 23 Sep 2021 15:44: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 813C32DB00; Thu, 23 Sep 2021 15:44: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 18NFissU043837; Thu, 23 Sep 2021 15:44:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NFis4A043836; Thu, 23 Sep 2021 15:44:54 GMT (envelope-from git) Date: Thu, 23 Sep 2021 15:44:54 GMT Message-Id: <202109231544.18NFis4A043836@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: 1ca931a540cb - main - tcp: Rack compressed ack path updates the recv window too easily 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: 1ca931a540cbb1891f535832ee6ef40ae3ed3910 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, 23 Sep 2021 15:44:54 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=1ca931a540cbb1891f535832ee6ef40ae3ed3910 commit 1ca931a540cbb1891f535832ee6ef40ae3ed3910 Author: Randall Stewart AuthorDate: 2021-09-23 15:43:29 +0000 Commit: Randall Stewart CommitDate: 2021-09-23 15:43:29 +0000 tcp: Rack compressed ack path updates the recv window too easily The compressed ack path of rack is not following proper procedures in updating the peers window. It should be checking the seq and ack values before updating and instead it is blindly updating the values. This could in theory get the wrong window in the connection for some length of time. Reviewed by: tuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D32082 --- sys/netinet/tcp_stacks/rack.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 23b1ff1fc584..2369a1c368bf 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -13116,10 +13116,28 @@ rack_timer_audit(struct tcpcb *tp, struct tcp_rack *rack, struct sockbuf *sb) static void rack_do_win_updates(struct tcpcb *tp, struct tcp_rack *rack, uint32_t tiwin, uint32_t seq, uint32_t ack, uint32_t cts, uint32_t high_seq) { - tp->snd_wnd = tiwin; - rack_validate_fo_sendwin_up(tp, rack); - tp->snd_wl1 = seq; - tp->snd_wl2 = ack; + if ((SEQ_LT(tp->snd_wl1, seq) || + (tp->snd_wl1 == seq && (SEQ_LT(tp->snd_wl2, ack) || + (tp->snd_wl2 == ack && tiwin > tp->snd_wnd))))) { + /* keep track of pure window updates */ + if ((tp->snd_wl2 == ack) && (tiwin > tp->snd_wnd)) + KMOD_TCPSTAT_INC(tcps_rcvwinupd); + tp->snd_wnd = tiwin; + rack_validate_fo_sendwin_up(tp, rack); + tp->snd_wl1 = seq; + tp->snd_wl2 = ack; + if (tp->snd_wnd > tp->max_sndwnd) + tp->max_sndwnd = tp->snd_wnd; + rack->r_wanted_output = 1; + } else if ((tp->snd_wl2 == ack) && (tiwin < tp->snd_wnd)) { + tp->snd_wnd = tiwin; + rack_validate_fo_sendwin_up(tp, rack); + tp->snd_wl1 = seq; + tp->snd_wl2 = ack; + } else { + /* Not a valid win update */ + return; + } if (tp->snd_wnd > tp->max_sndwnd) tp->max_sndwnd = tp->snd_wnd; if (tp->snd_wnd < (tp->snd_max - high_seq)) { @@ -13324,8 +13342,8 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb struct tcp_ackent *ae; uint32_t tiwin, ms_cts, cts, acked, acked_amount, high_seq, win_seq, the_win, win_upd_ack; int cnt, i, did_out, ourfinisacked = 0; - int win_up_req = 0; struct tcpopt to_holder, *to = NULL; + int win_up_req = 0; int nsegs = 0; int under_pacing = 1; int recovery = 0; @@ -13519,11 +13537,11 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb rack_strike_dupack(rack); } else if (ae->ack_val_set == ACK_RWND) { /* Case C */ - win_up_req = 1; win_upd_ack = ae->ack; win_seq = ae->seq; the_win = tiwin; + rack_do_win_updates(tp, rack, the_win, win_seq, win_upd_ack, cts, high_seq); } else { /* Case A */ if (SEQ_GT(ae->ack, tp->snd_max)) { @@ -13540,10 +13558,10 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb nsegs++; /* If the window changed setup to update */ if (tiwin != tp->snd_wnd) { - win_up_req = 1; win_upd_ack = ae->ack; win_seq = ae->seq; the_win = tiwin; + rack_do_win_updates(tp, rack, the_win, win_seq, win_upd_ack, cts, high_seq); } #ifdef TCP_ACCOUNTING /* Account for the acks */ @@ -13592,9 +13610,6 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb ts_val = get_cyclecount(); #endif acked_amount = acked = (high_seq - tp->snd_una); - if (win_up_req) { - rack_do_win_updates(tp, rack, the_win, win_seq, win_upd_ack, cts, high_seq); - } if (acked) { if (rack->sack_attack_disable == 0) rack_do_decay(rack); From owner-dev-commits-src-main@freebsd.org Thu Sep 23 16:23: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 9DC826A96B5; Thu, 23 Sep 2021 16:23:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFgSz3rxsz3DYZ; Thu, 23 Sep 2021 16:23:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632414211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=adDkN9Wk999uM39cPvLm51S9v8FTl+cs+gLZt9n0KY4=; b=g5xVnOqzBFFAV1lEVLpU79uQnHVl2Po3IEe1y0sD6FwpZyarWqf0d7yFxkLnwYad+c1oJv h19K48Utk8TvwELx1io7j0owgjEj4NNqq3+UjEeDId8RjAXb/7fbGI883LDZ7LLCkDpcmj kKrHY0tezO+PEBgzoDBJK/CKGH850t9CORldoHisyXBUO1DKtsU3uq0M2CoLaStt6XB8Uw GyiftUVyJhVOgl5kztev1iQiFWFJrU35cAgT6nfqIlSC3jshhIWHeo+mPnyDXiMwH1inp2 B2FiA+jwKxfufy765M9zD4lxFy3QGJF/1IZPow1kgq0IIJdt+HkpnII1ij6pQQ== Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 5D67116A5F; Thu, 23 Sep 2021 16:23:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 4B9C620F44; Thu, 23 Sep 2021 09:23:30 -0700 (PDT) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id JNy0BPu-xFZu; Thu, 23 Sep 2021 09:23:27 -0700 (PDT) Subject: Re: git: 1f82fb383410 - main - sh: try to avoid overwriting HISTFILE produced by other shells DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 8A89520F37 To: Piotr Pawel Stefaniak , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <64a1af40-882e-fc3e-5210-80984eed8d88@FreeBSD.org> Date: Thu, 23 Sep 2021 09:23:25 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KkhpetGmvybu6qMllpWx93cspjkPYHnaJ" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632414211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=adDkN9Wk999uM39cPvLm51S9v8FTl+cs+gLZt9n0KY4=; b=m1GDQp5wjVNrm1H9MaDicCURrZ5PHqnovpSgAEfOYyOsrBhPc8aoMhlqigNQyokbbFCWK6 /A3840elUzMi/0pVMeOmsAGC/yJlwSuWQygE0SEiLwuDCxScRnx+WceXmQtSYhYKH15Hc1 nCQtcvMtipPIZikqjMcKOl7VZReAF2tovEkgoxMVYVvo0k1Y5x1uKcdHnU8CqMunHio933 vpJ/givBPCKqnFAE0WCqBqidg+KJmUwuGmxxOP6KS5u+/LOdZXlBOqVLKvtA3JS8+BTcaD Lj15Ln9fQNqFr872/UhiZV5/kw0engf9ee3GY7WfUIu6NCAYL/WvKc7qn7+daw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1632414211; a=rsa-sha256; cv=none; b=w3/7wt81gf5P5+mA3iqyyw7l5R9G/6CoEqrsRXqB5J3Osx6l90kS6hIWZAkfvTziitk1Ri dXg+We3f/4iVwrEVmM2ZR1KwRZgSkqktMU3S7S6Sp4Wy05/9rpC846Suw35kPH2xG9PTmx p+I7FWlZ9VoljmSj2R9qsikBU1WUAJg70fZ47mtdNVGdsnyGD2ckcsjaTKjMSHy+d3dNRi Or1fvzmZWPaqOV+HuFk2EhstnpLJbTquIf8R0Jdr+SLHuQHw01V+MxuGalRAsuGcJbfE4m oHybl8lLhWATcTWh0nUUTiUAMxe0Muh0KR/LXtM6/jlgNlz5Wp8BYIN7stMYLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 16:23:31 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KkhpetGmvybu6qMllpWx93cspjkPYHnaJ Content-Type: multipart/mixed; boundary="aG7ZQ8lpv1tF6tNFM9whhjPKbKeaj3LQs"; protected-headers="v1" From: Bryan Drewery To: Piotr Pawel Stefaniak , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <64a1af40-882e-fc3e-5210-80984eed8d88@FreeBSD.org> Subject: Re: git: 1f82fb383410 - main - sh: try to avoid overwriting HISTFILE produced by other shells References: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> In-Reply-To: <202109222025.18MKPfLc098616@gitrepo.freebsd.org> --aG7ZQ8lpv1tF6tNFM9whhjPKbKeaj3LQs Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 9/22/2021 1:25 PM, Piotr Pawel Stefaniak wrote: > The branch main has been updated by pstef: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D1f82fb3834105fd8f1186b1c= 6d719d8a24738180 >=20 > commit 1f82fb3834105fd8f1186b1c6d719d8a24738180 > Author: Piotr Pawel Stefaniak > AuthorDate: 2021-09-22 16:42:41 +0000 > Commit: Piotr Pawel Stefaniak > CommitDate: 2021-09-22 20:23:32 +0000 >=20 > sh: try to avoid overwriting HISTFILE produced by other shells > =20 > If an attempt to load history from an existing history file was > unsuccessful, do not try to save command history to that file on ex= it. Thank you! --=20 Bryan Drewery --aG7ZQ8lpv1tF6tNFM9whhjPKbKeaj3LQs-- --KkhpetGmvybu6qMllpWx93cspjkPYHnaJ Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAmFMqf0FAwAAAAAACgkQNddxu25Gl8+c FAgAolePJJ69Du7/IxU2Bz7pA5WMDGbe95BzTSSQ/sgucLMFo8i3tFpghq9x5vcBbnG7a3ZRyI+J vrOAZzLBbQw4161+WdJNul6zqLbySgK56CSsItgbEncwyVz4wx/txQTbx7eQfXxiVIh3+KWuO4AP l7Bku/xUx5vgQ9Cbv0Qd7s/c7g4txoXTWGt4OhnABYSNLXwef7wOjlukiIZ6VLWH9GOiVpUPG0ds Qp6IkwJUon7Nvua9h1MI1WhwZWVrk06MSx4+8bv1JohedTtvUzLDIg6RpObBLH8FsZston5GXSWO ffFmxMfzl/zRJIHX0kC+51THdY3iPSHu2PeTW6eWtQ== =a5U/ -----END PGP SIGNATURE----- --KkhpetGmvybu6qMllpWx93cspjkPYHnaJ-- From owner-dev-commits-src-main@freebsd.org Thu Sep 23 18:31: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 1FB856AB196; Thu, 23 Sep 2021 18:31: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 4HFkJz05Swz3p8B; Thu, 23 Sep 2021 18:31: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 D80382FF81; Thu, 23 Sep 2021 18:31:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18NIVkrH069672; Thu, 23 Sep 2021 18:31:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NIVkt8069671; Thu, 23 Sep 2021 18:31:46 GMT (envelope-from git) Date: Thu, 23 Sep 2021 18:31:46 GMT Message-Id: <202109231831.18NIVkt8069671@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: ef50d5fbc39f - main - x86: Add NUMA nodes into CPU topology. 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: ef50d5fbc39fc39970eab1234222b5ac1d9ba74c 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, 23 Sep 2021 18:31:47 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ef50d5fbc39fc39970eab1234222b5ac1d9ba74c commit ef50d5fbc39fc39970eab1234222b5ac1d9ba74c Author: Alexander Motin AuthorDate: 2021-09-23 17:41:02 +0000 Commit: Alexander Motin CommitDate: 2021-09-23 18:31:38 +0000 x86: Add NUMA nodes into CPU topology. Depending on hardware, NUMA nodes may match last level caches, or they may be above them (AMD Zen 2/3) or below (Intel Xeon w/ SNC). This information is provided by ACPI instead of CPUID, and it is provided for each CPU individually instead of mask widths, but this code should be able to properly handle all the above cases. This change should immediately allow idle stealing in sched_ule(4) to prefer load from NUMA-local CPUs to remote ones when the node does not match LLC. Later we may think of how to better handle it on sched_pickcpu() side. MFC after: 1 month --- sys/kern/sched_ule.c | 2 ++ sys/sys/smp.h | 1 + sys/x86/x86/mp_x86.c | 82 +++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 72 insertions(+), 13 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index d1e4010d2ebe..49199b6f319f 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -3098,6 +3098,8 @@ sysctl_kern_sched_topology_spec_internal(struct sbuf *sb, struct cpu_group *cg, sbuf_printf(sb, "THREAD group"); if ((cg->cg_flags & CG_FLAG_SMT) != 0) sbuf_printf(sb, "SMT group"); + if ((cg->cg_flags & CG_FLAG_NODE) != 0) + sbuf_printf(sb, "NUMA node"); sbuf_printf(sb, "\n"); } diff --git a/sys/sys/smp.h b/sys/sys/smp.h index cee1199015a7..1da557212ae2 100644 --- a/sys/sys/smp.h +++ b/sys/sys/smp.h @@ -107,6 +107,7 @@ typedef struct cpu_group *cpu_group_t; #define CG_FLAG_HTT 0x01 /* Schedule the alternate core last. */ #define CG_FLAG_SMT 0x02 /* New age htt, less crippled. */ #define CG_FLAG_THREAD (CG_FLAG_HTT | CG_FLAG_SMT) /* Any threading. */ +#define CG_FLAG_NODE 0x04 /* NUMA node. */ /* * Convenience routines for building and traversing topologies. diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index 5e9a9735b09a..54ca82a2c90d 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_acpi.h" #ifdef __i386__ #include "opt_apic.h" #endif @@ -83,6 +84,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DEV_ACPI +#include +#include +#endif + static MALLOC_DEFINE(M_CPUS, "cpus", "CPU items"); /* lock region used by kernel profiling */ @@ -502,13 +508,16 @@ topo_probe(void) int type; int subtype; int id_shift; - } topo_layers[MAX_CACHE_LEVELS + 4]; + } topo_layers[MAX_CACHE_LEVELS + 5]; struct topo_node *parent; struct topo_node *node; int layer; int nlayers; int node_id; int i; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + int d, domain; +#endif if (cpu_topo_probed) return; @@ -583,6 +592,31 @@ topo_probe(void) topo_layers[nlayers].id_shift = 0; nlayers++; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + if (vm_ndomains > 1) { + for (layer = 0; layer < nlayers; ++layer) { + for (i = 0; i <= max_apic_id; ++i) { + if ((i & ((1 << topo_layers[layer].id_shift) - 1)) == 0) + domain = -1; + if (!cpu_info[i].cpu_present) + continue; + d = acpi_pxm_get_cpu_locality(i); + if (domain >= 0 && domain != d) + break; + domain = d; + } + if (i > max_apic_id) + break; + } + KASSERT(layer < nlayers, ("NUMA domain smaller than PU")); + memmove(&topo_layers[layer+1], &topo_layers[layer], + sizeof(*topo_layers) * (nlayers - layer)); + topo_layers[layer].type = TOPO_TYPE_NODE; + topo_layers[layer].subtype = CG_SHARE_NONE; + nlayers++; + } +#endif + topo_init_root(&topo_root); for (i = 0; i <= max_apic_id; ++i) { if (!cpu_info[i].cpu_present) @@ -590,7 +624,12 @@ topo_probe(void) parent = &topo_root; for (layer = 0; layer < nlayers; ++layer) { - node_id = i >> topo_layers[layer].id_shift; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + if (topo_layers[layer].type == TOPO_TYPE_NODE) { + node_id = acpi_pxm_get_cpu_locality(i); + } else +#endif + node_id = i >> topo_layers[layer].id_shift; parent = topo_add_node_by_hwid(parent, node_id, topo_layers[layer].type, topo_layers[layer].subtype); @@ -599,7 +638,12 @@ topo_probe(void) parent = &topo_root; for (layer = 0; layer < nlayers; ++layer) { - node_id = boot_cpu_id >> topo_layers[layer].id_shift; +#if defined(DEV_ACPI) && MAXMEMDOM > 1 + if (topo_layers[layer].type == TOPO_TYPE_NODE) + node_id = acpi_pxm_get_cpu_locality(boot_cpu_id); + else +#endif + node_id = boot_cpu_id >> topo_layers[layer].id_shift; node = topo_find_node_by_hwid(parent, node_id, topo_layers[layer].type, topo_layers[layer].subtype); @@ -774,14 +818,18 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) int i; KASSERT(root->type == TOPO_TYPE_SYSTEM || root->type == TOPO_TYPE_CACHE || - root->type == TOPO_TYPE_GROUP, + root->type == TOPO_TYPE_NODE || root->type == TOPO_TYPE_GROUP, ("x86topo_add_sched_group: bad type: %u", root->type)); CPU_COPY(&root->cpuset, &cg_root->cg_mask); cg_root->cg_count = root->cpu_count; - if (root->type == TOPO_TYPE_SYSTEM) + if (root->type == TOPO_TYPE_CACHE) + cg_root->cg_level = root->subtype; + else cg_root->cg_level = CG_SHARE_NONE; + if (root->type == TOPO_TYPE_NODE) + cg_root->cg_flags = CG_FLAG_NODE; else - cg_root->cg_level = root->subtype; + cg_root->cg_flags = 0; /* * Check how many core nodes we have under the given root node. @@ -802,7 +850,7 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) if (cg_root->cg_level != CG_SHARE_NONE && root->cpu_count > 1 && ncores < 2) - cg_root->cg_flags = CG_FLAG_SMT; + cg_root->cg_flags |= CG_FLAG_SMT; /* * Find out how many cache nodes we have under the given root node. @@ -814,10 +862,18 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) nchildren = 0; node = root; while (node != NULL) { - if ((node->type != TOPO_TYPE_GROUP && - node->type != TOPO_TYPE_CACHE) || - (root->type != TOPO_TYPE_SYSTEM && - CPU_CMP(&node->cpuset, &root->cpuset) == 0)) { + if (CPU_CMP(&node->cpuset, &root->cpuset) == 0) { + if (node->type == TOPO_TYPE_CACHE && + cg_root->cg_level < node->subtype) + cg_root->cg_level = node->subtype; + if (node->type == TOPO_TYPE_NODE) + cg_root->cg_flags |= CG_FLAG_NODE; + node = topo_next_node(root, node); + continue; + } + if (node->type != TOPO_TYPE_GROUP && + node->type != TOPO_TYPE_NODE && + node->type != TOPO_TYPE_CACHE) { node = topo_next_node(root, node); continue; } @@ -842,9 +898,9 @@ x86topo_add_sched_group(struct topo_node *root, struct cpu_group *cg_root) i = 0; while (node != NULL) { if ((node->type != TOPO_TYPE_GROUP && + node->type != TOPO_TYPE_NODE && node->type != TOPO_TYPE_CACHE) || - (root->type != TOPO_TYPE_SYSTEM && - CPU_CMP(&node->cpuset, &root->cpuset) == 0)) { + CPU_CMP(&node->cpuset, &root->cpuset) == 0) { node = topo_next_node(root, node); continue; } From owner-dev-commits-src-main@freebsd.org Thu Sep 23 19:14:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61F506ABE44; Thu, 23 Sep 2021 19:14:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFlG5277Yz3sVm; Thu, 23 Sep 2021 19:14: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 2888E770; Thu, 23 Sep 2021 19:14: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 18NJELok023087; Thu, 23 Sep 2021 19:14:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NJELZU023086; Thu, 23 Sep 2021 19:14:21 GMT (envelope-from git) Date: Thu, 23 Sep 2021 19:14:21 GMT Message-Id: <202109231914.18NJELZU023086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f555b39e6bb7 - main - man: reset OPTIND before parsing args MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb 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, 23 Sep 2021 19:14:21 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb commit f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb Author: Kyle Evans AuthorDate: 2021-09-22 19:58:19 +0000 Commit: Kyle Evans CommitDate: 2021-09-23 19:13:34 +0000 man: reset OPTIND before parsing args From jilles: POSIX requires that a script set `OPTIND=1` before using different sets of parameters with `getopts`, or the results will be unspecified. The specific problem observed here is that we would execute `man -f` or `man -k` without cleaning up state from man_parse_args()' `getopts` loop. FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit the second getopts loop, rendering the following shift harmless; other /bin/sh implementations will leave it at what we came into the loop at (e.g., bash as /bin/sh), shifting off any keywords that we had. Input from: jilles Reviewed by: allanjude, bapt, imp Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32063 --- usr.bin/man/man.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index f31c464fcc8f..084f4a06829b 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -243,6 +243,7 @@ is_newer() { manpath_parse_args() { local cmd_arg + OPTIND=1 while getopts 'Ldq' cmd_arg; do case "${cmd_arg}" in L) Lflag=Lflag ;; @@ -426,6 +427,7 @@ man_display_page_groff() { if [ -n "$MANROFFSEQ" ]; then set -- -$MANROFFSEQ + OPTIND=1 while getopts 'egprtv' preproc_arg; do case "${preproc_arg}" in e) pipeline="$pipeline | $EQN" ;; @@ -545,6 +547,7 @@ man_find_and_display() { man_parse_args() { local IFS cmd_arg + OPTIND=1 while getopts 'M:P:S:adfhkm:op:tw' cmd_arg; do case "${cmd_arg}" in M) MANPATH=$OPTARG ;; @@ -933,6 +936,7 @@ trim() { # Parse commandline args for whatis and apropos. whatis_parse_args() { local cmd_arg + OPTIND=1 while getopts 'd' cmd_arg; do case "${cmd_arg}" in d) debug=$(( $debug + 1 )) ;; From owner-dev-commits-src-main@freebsd.org Thu Sep 23 19:42: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 27FC06AC177; Thu, 23 Sep 2021 19:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFlt00Mv4z4Rbx; Thu, 23 Sep 2021 19:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2391F1F; Thu, 23 Sep 2021 19:41: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 18NJfxUL062033; Thu, 23 Sep 2021 19:41:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NJfxOJ062032; Thu, 23 Sep 2021 19:41:59 GMT (envelope-from git) Date: Thu, 23 Sep 2021 19:41:59 GMT Message-Id: <202109231941.18NJfxOJ062032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: d5ad2f2a67df - main - e1000: fix K1 configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d5ad2f2a67df54ac40148cca21e726bc61a48982 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, 23 Sep 2021 19:42:00 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d5ad2f2a67df54ac40148cca21e726bc61a48982 commit d5ad2f2a67df54ac40148cca21e726bc61a48982 Author: Wenzhuo Lu AuthorDate: 2015-10-16 02:51:09 +0000 Commit: Kevin Bowling CommitDate: 2021-09-23 19:41:37 +0000 e1000: fix K1 configuration This patch is for the following updates to the K1 configurations: Tx idle period for entering K1 should be 128 ns. Minimum Tx idle period in K1 should be 256 ns. Signed-off-by: Wenzhuo Lu PR: 258153 Reviewed by: erj Tested by: iron.udjin@gmail.com Approved by: imp Obtained from: DPDK (6f934fa24dfd437c90ead96bc7598ee77a117ede) MFC after: 1 week --- sys/dev/e1000/e1000_ich8lan.c | 45 ++++++++++++++++++++++++++++++++++++++++++- sys/dev/e1000/e1000_ich8lan.h | 1 + sys/dev/e1000/e1000_phy.h | 7 +++++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 4209595a911c..3f3e2307f83f 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1728,7 +1728,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (ret_val) return ret_val; } - /* Clear link partner's EEE ability */ hw->dev_spec.ich8lan.eee_lp_ability = 0; @@ -1749,6 +1748,9 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; E1000_WRITE_REG(hw, E1000_FEXTNVM6, fextnvm6); + + /* Configure K0s minimum time */ + e1000_configure_k0s_lpt(hw, K1_ENTRY_LATENCY, K1_MIN_TIME); } if (!link) @@ -6144,3 +6146,44 @@ release: } } +/** + * e1000_configure_k0s_lpt - Configure K0s power state + * @hw: pointer to the HW structure + * @entry_latency: Tx idle period for entering K0s - valid values are 0 to 3. + * 0 corresponds to 128ns, each value over 0 doubles the duration. + * @min_time: Minimum Tx idle period allowed - valid values are 0 to 4. + * 0 corresponds to 128ns, each value over 0 doubles the duration. + * + * Configure the K1 power state based on the provided parameter. + * Assumes semaphore already acquired. + * + * Success returns 0, Failure returns: + * -E1000_ERR_PHY (-2) in case of access error + * -E1000_ERR_PARAM (-4) in case of parameters error + **/ +s32 e1000_configure_k0s_lpt(struct e1000_hw *hw, u8 entry_latency, u8 min_time) +{ + s32 ret_val; + u16 kmrn_reg = 0; + + DEBUGFUNC("e1000_configure_k0s_lpt"); + + if (entry_latency > 3 || min_time > 4) + return -E1000_ERR_PARAM; + + ret_val = e1000_read_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K0S_CTRL, + &kmrn_reg); + if (ret_val) + return ret_val; + + /* for now don't touch the latency */ + kmrn_reg &= ~(E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_MASK); + kmrn_reg |= ((min_time << E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT)); + + ret_val = e1000_write_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K0S_CTRL, + kmrn_reg); + if (ret_val) + return ret_val; + + return E1000_SUCCESS; +} diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index caff11cbb899..dfa7684f27b7 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -337,6 +337,7 @@ void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw); u32 e1000_resume_workarounds_pchlan(struct e1000_hw *hw); s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); +s32 e1000_configure_k0s_lpt(struct e1000_hw *hw, u8 entry_latency, u8 min_time); void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw); s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable); s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data); diff --git a/sys/dev/e1000/e1000_phy.h b/sys/dev/e1000/e1000_phy.h index 38c8f9b466ce..3a5b231b8bce 100644 --- a/sys/dev/e1000/e1000_phy.h +++ b/sys/dev/e1000/e1000_phy.h @@ -281,6 +281,13 @@ s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, #define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 #define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002 /* enable K1 */ #define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */ +#define E1000_KMRNCTRLSTA_K0S_CTRL 0x1E /* Kumeran K0s Control */ +#define E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_SHIFT 0 +#define E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT 4 +#define E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_MASK \ + (3 << E1000_KMRNCTRLSTA_K0S_CTRL_ENTRY_LTNCY_SHIFT) +#define E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_MASK \ + (7 << E1000_KMRNCTRLSTA_K0S_CTRL_MIN_TIME_SHIFT) #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Ctrl */ From owner-dev-commits-src-main@freebsd.org Thu Sep 23 19:49:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C00416ACAB1; Thu, 23 Sep 2021 19:49:50 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) (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 4HFm321gbTz4SRj; Thu, 23 Sep 2021 19:49:50 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x129.google.com with SMTP id b20so30756974lfv.3; Thu, 23 Sep 2021 12:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=XiJw4+GFywfOxX/Q6qdOST9xQ20TtUjHiJ6sfqNR+6M=; b=NQA51JuU3Fr83LF+0Drfm25eW6G2EeRxjqPvcUHx85MQJZ48DUVj7n+/cRU9r57mh7 IOunsRbBWsCvcU3b2kHe8GwhRY0ZHs6Ezuoix4RZggoeh/kEocMMkIO9oIochcbSC2J8 RC6SLNo4T5NwAJIfnJk+IkC0IvpmeSKf+7qXG12YepGpclqTFHPN114MVBhZhBW1Y3b2 ePnzjjPk7wcrPDFbgdRsKcrI+0Hw+YLVr9ORZxaikrJFXs06gG9UJH4BfYJGKeIuMnHL AhAeXf/H+huoKmLchM0H6oAfgg6gz87q6cY2fNi9lxh9wLMsFuO409/bWa+wHj4rfZ7j oAEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=XiJw4+GFywfOxX/Q6qdOST9xQ20TtUjHiJ6sfqNR+6M=; b=BXyozgW2qsJFH/Ch9X5JnEDHYUYIiB3j7XSCBhh4dScaVlu+2fZNh9fn5qikDOakXs X6WrH+ZUhL22Y6uhEzJH4Z1hcaHPeEOFiDBVmqa21KNiE+43uJvQqhddU+O9PVrKUeGR yp2DLEA1DL3EDJlBxsXdLiIBiPVvsqEkSa563y5dzMGBtPrUg2HNhi+ff3kWDJJVwQp4 WqIUY4OZA9FT6kYMIAVH8Kei8DMcgf553fHA8NbRV8JkOvEAitbze6RjsZkkpNC3LUhf VUczbgZZNVFhF38+7FYMtL47HSV453btPgoCOCSfXmUBj97p7gijPifR9sJAFijOwtKg wc/g== X-Gm-Message-State: AOAM533YhuKLp05d2XxvhTPqwSQMGW6obE3Bw2TZ5jmTK+tnrxiR6M23 pGlXa5mTYeXBkE5RwFJvLPiWZFScCFm6Hy8qeMpuyANx X-Google-Smtp-Source: ABdhPJzOYWzRZfYArTxw4NQWtwu1WUKu2qm0zTb90/s4/rlzci9i+oNIE24q4hgfuRfwIxlfgRVttVRu971H+l8RvtM= X-Received: by 2002:a19:ee12:: with SMTP id g18mr5692456lfb.300.1632426588797; Thu, 23 Sep 2021 12:49:48 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:2f18:0:0:0:0:0 with HTTP; Thu, 23 Sep 2021 12:49:47 -0700 (PDT) In-Reply-To: <202109211721.18LHLFWM028927@gitrepo.freebsd.org> References: <202109211721.18LHLFWM028927@gitrepo.freebsd.org> From: Mateusz Guzik Date: Thu, 23 Sep 2021 21:49:47 +0200 Message-ID: Subject: Re: git: df8dd6025af8 - main - amd64: stop using top of the thread' kernel stack for FPU user save area To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HFm321gbTz4SRj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=NQA51JuU; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::129 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::129:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 23 Sep 2021 19:49:50 -0000 On 9/21/21, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=df8dd6025af88a99d34f549fa9591a9b8f9b75b1 > > commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1 > Author: Konstantin Belousov > AuthorDate: 2021-09-13 21:05:47 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-09-21 17:20:15 +0000 > > amd64: stop using top of the thread' kernel stack for FPU user save > area > This causes KASAN to crash on boot: panic: ASan: Invalid access, 192-byte read at 0xffffffff84105f40, UseAfterScope(f8) cpuid = 0 time = 1 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0xa5/frame 0xffffffff841056f0 kdb_backtrace() at kdb_backtrace+0xc9/frame 0xffffffff84105850 vpanic() at vpanic+0x248/frame 0xffffffff84105930 panic() at panic+0xb5/frame 0xffffffff841059f0 kasan_memmove() at kasan_memmove+0x313/frame 0xffffffff84105ac0 cpu_fork() at cpu_fork+0x19b/frame 0xffffffff84105b30 vm_forkproc() at vm_forkproc+0x18f/frame 0xffffffff84105b90 fork1() at fork1+0x1ff4/frame 0xffffffff84105d10 kproc_create() at kproc_create+0x166/frame 0xffffffff84105eb0 audit_worker_init() at audit_worker_init+0x41/frame 0xffffffff84105ed0 mi_startup() at mi_startup+0x340/frame 0xffffffff84105ff0 btext() at btext+0x22 > Instead do one more allocation at the thread creation time. This frees > a lot of space on the stack. > > Also do not use alloca() for temporal storage in signal delivery > sendsig() > function and signal return syscall sys_sigreturn(). This saves equal > amount of space, again by the cost of one more allocation at the thread > creation time. > > A useful experiment now would be to reduce KSTACK_PAGES. > > Reviewed by: jhb, markj > Tested by: pho > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D31954 > --- > sys/amd64/amd64/exec_machdep.c | 4 ++-- > sys/amd64/amd64/fpu.c | 2 ++ > sys/amd64/amd64/machdep.c | 14 -------------- > sys/amd64/amd64/vm_machdep.c | 22 +++++++++++++--------- > sys/amd64/ia32/ia32_signal.c | 6 +++--- > sys/amd64/include/proc.h | 2 ++ > sys/kern/kern_thread.c | 2 +- > 7 files changed, 23 insertions(+), 29 deletions(-) > > diff --git a/sys/amd64/amd64/exec_machdep.c > b/sys/amd64/amd64/exec_machdep.c > index 1297117638d6..48bda05f9685 100644 > --- a/sys/amd64/amd64/exec_machdep.c > +++ b/sys/amd64/amd64/exec_machdep.c > @@ -135,7 +135,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) > > if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { > xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - xfpusave = __builtin_alloca(xfpusave_len); > + xfpusave = (char *)td->td_md.md_fpu_scratch; > } else { > xfpusave_len = 0; > xfpusave = NULL; > @@ -674,7 +674,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp) > if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - > sizeof(struct savefpu)) > return (EINVAL); > - xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); > + xfpustate = (char *)td->td_md.md_fpu_scratch; > ret = copyin((void *)mcp->mc_xfpustate, xfpustate, > mcp->mc_xfpustate_len); > if (ret != 0) > diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c > index d7936b3b1922..24986958d4ca 100644 > --- a/sys/amd64/amd64/fpu.c > +++ b/sys/amd64/amd64/fpu.c > @@ -448,6 +448,8 @@ fpuinitstate(void *arg __unused) > xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); > } > > + cpu_thread_alloc(&thread0); > + > saveintr = intr_disable(); > stop_emulating(); > > diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c > index d4e2356a9ae1..5c9b64526609 100644 > --- a/sys/amd64/amd64/machdep.c > +++ b/sys/amd64/amd64/machdep.c > @@ -1258,7 +1258,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > caddr_t kmdp; > int gsel_tss, x; > struct pcpu *pc; > - struct xstate_hdr *xhdr; > uint64_t cr3, rsp0; > pml4_entry_t *pml4e; > pdp_entry_t *pdpe; > @@ -1564,19 +1563,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > msgbufinit(msgbufp, msgbufsize); > fpuinit(); > > - /* > - * Reinitialize thread0's stack base now that the xsave area size is > - * known. Set up thread0's pcb save area after fpuinit calculated fpu > - * save area size. Zero out the extended state header in fpu save area. > - */ > - set_top_of_stack_td(&thread0); > - thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0); > - bzero(thread0.td_pcb->pcb_save, cpu_max_ext_state_size); > - if (use_xsave) { > - xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) + > - 1); > - xhdr->xstate_bv = xsave_mask; > - } > /* make an initial tss so cpu can get interrupt stack on syscall! */ > rsp0 = thread0.td_md.md_stack_base; > /* Ensure the stack is aligned to 16 bytes */ > diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c > index 4567e6e0eb5d..e42d16d61b3a 100644 > --- a/sys/amd64/amd64/vm_machdep.c > +++ b/sys/amd64/amd64/vm_machdep.c > @@ -90,19 +90,17 @@ void > set_top_of_stack_td(struct thread *td) > { > td->td_md.md_stack_base = td->td_kstack + > - td->td_kstack_pages * PAGE_SIZE - > - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN); > + td->td_kstack_pages * PAGE_SIZE; > } > > struct savefpu * > get_pcb_user_save_td(struct thread *td) > { > - vm_offset_t p; > - > - p = td->td_md.md_stack_base; > - KASSERT((p % XSAVE_AREA_ALIGN) == 0, > - ("Unaligned pcb_user_save area ptr %#lx td %p", p, td)); > - return ((struct savefpu *)p); > + KASSERT(((vm_offset_t)td->td_md.md_usr_fpu_save % > + XSAVE_AREA_ALIGN) == 0, > + ("Unaligned pcb_user_save area ptr %p td %p", > + td->td_md.md_usr_fpu_save, td)); > + return (td->td_md.md_usr_fpu_save); > } > > struct pcb * > @@ -393,6 +391,8 @@ cpu_thread_alloc(struct thread *td) > set_top_of_stack_td(td); > td->td_pcb = pcb = get_pcb_td(td); > td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; > + td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); > + td->td_md.md_fpu_scratch = fpu_save_area_alloc(); > pcb->pcb_save = get_pcb_user_save_pcb(pcb); > if (use_xsave) { > xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); > @@ -404,8 +404,12 @@ cpu_thread_alloc(struct thread *td) > void > cpu_thread_free(struct thread *td) > { > - > cpu_thread_clean(td); > + > + fpu_save_area_free(td->td_md.md_usr_fpu_save); > + td->td_md.md_usr_fpu_save = NULL; > + fpu_save_area_free(td->td_md.md_fpu_scratch); > + td->td_md.md_fpu_scratch = NULL; > } > > bool > diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c > index 49b5797d68fd..9b67c7001a87 100644 > --- a/sys/amd64/ia32/ia32_signal.c > +++ b/sys/amd64/ia32/ia32_signal.c > @@ -210,7 +210,7 @@ ia32_set_mcontext(struct thread *td, struct > ia32_mcontext *mcp) > if (mcp->mc_xfpustate_len > cpu_max_ext_state_size - > sizeof(struct savefpu)) > return (EINVAL); > - xfpustate = __builtin_alloca(mcp->mc_xfpustate_len); > + xfpustate = (char *)td->td_md.md_fpu_scratch; > ret = copyin(PTRIN(mcp->mc_xfpustate), xfpustate, > mcp->mc_xfpustate_len); > if (ret != 0) > @@ -579,7 +579,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t > *mask) > > if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { > xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); > - xfpusave = __builtin_alloca(xfpusave_len); > + xfpusave = (char *)td->td_md.md_fpu_scratch; > } else { > xfpusave_len = 0; > xfpusave = NULL; > @@ -882,7 +882,7 @@ freebsd32_sigreturn(td, uap) > td->td_proc->p_pid, td->td_name, xfpustate_len); > return (EINVAL); > } > - xfpustate = __builtin_alloca(xfpustate_len); > + xfpustate = (char *)td->td_md.md_fpu_scratch; > error = copyin(PTRIN(ucp->uc_mcontext.mc_xfpustate), > xfpustate, xfpustate_len); > if (error != 0) { > diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h > index 0f8cf50e326d..bd07f70f8d44 100644 > --- a/sys/amd64/include/proc.h > +++ b/sys/amd64/include/proc.h > @@ -75,6 +75,8 @@ struct mdthread { > int md_efirt_dis_pf; /* (k) */ > struct pcb md_pcb; > vm_offset_t md_stack_base; > + struct savefpu *md_usr_fpu_save; > + struct savefpu *md_fpu_scratch; > }; > > struct mdproc { > diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c > index 65c5cc65c87e..62f939406374 100644 > --- a/sys/kern/kern_thread.c > +++ b/sys/kern/kern_thread.c > @@ -91,7 +91,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == > 0x110, > "struct thread KBI td_pflags"); > _Static_assert(offsetof(struct thread, td_frame) == 0x4a8, > "struct thread KBI td_frame"); > -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, > +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6c0, > "struct thread KBI td_emuldata"); > _Static_assert(offsetof(struct proc, p_flag) == 0xb8, > "struct proc KBI p_flag"); > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Thu Sep 23 19:56: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 8695F6AC9ED; Thu, 23 Sep 2021 19:56:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (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 4HFmBh3DHxz4SkZ; Thu, 23 Sep 2021 19:56:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x735.google.com with SMTP id f130so25317482qke.6; Thu, 23 Sep 2021 12:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Pl2I8+3Ws+8/ONyGOYuOszrFjYUxcpQIOF1aFxlQIO8=; b=VIY6B4OoaBFUFERugOrXnJX32ErUXG0kPNO/n87th65XeJSSqoFajX8V6+7w5CbgXu mcPBOhvdnSiYXQ1FjK2Qn9rszNz9ioyJNR/bbXBVe1p84Un+5fErF98MtV8lcpxjEHEl sWforFCMuc41FwX3ZWj6I+c6Gbqh406rCKIeVg3jOvduTBcKne1efoyMKUGcW9P7b0rw cIlK2QS/a6e4OGzdptHwMwPhV6/CFoGEPidjCurTVnx5k8qK1fOeogzAqmb56iXcXSWn OihZjX8sGtZ7WwQnII82Ej/UJ7o5k+aN2FOVblCD/zv8T1N/Iik7z6Jv5Uo62b964BOn 9iLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=Pl2I8+3Ws+8/ONyGOYuOszrFjYUxcpQIOF1aFxlQIO8=; b=xDPA59dasQ9fyk70xTJGRJqPe9k/s7VynZkaMVD7R7Skeo0a7LcJhgQeExLVmOy6Vv ldKr3pvObjEt7Ihq7kVPrc82X2dGkaJXfG9PVA6CtGeROgzvcR+r5Ds57/Ba/MGOlWfU lT8S2r3KGBU53fC473f8qeP6qdRw7CbcRc4eeMcWpATE3qGK/28UZU1aHR1PPFfs59gH puJqfbAyhXkSi5MQx/lHSBPoDfIsz3HGi1fqKX7aVgxhvIgjKjSpbVYCANSFBGLf9aiL YRX8dXnjsDdU+diCMYn8WqtkOXNiivpJklpkVQWmUMdq0rkbEQtErMHgCzGmsS+SHabt /XOg== X-Gm-Message-State: AOAM5326ucFPGgTeY+EZTNVXC7pz5ovh8tn/ws3j6IYoxKPbfD+X55lY r3JzWfs2pXd+KKEvWloTW2sXIDfhtPqtBw== X-Google-Smtp-Source: ABdhPJwJ+enNRNO2PT39zOO5Jz9mEYkwcubcMHiS26tP0oS+S8h83Fhi+eEyAJ7ueQN+3mh5YT0Fnw== X-Received: by 2002:a37:bb07:: with SMTP id l7mr6806984qkf.123.1632426982510; Thu, 23 Sep 2021 12:56:22 -0700 (PDT) Received: from nuc ([142.126.175.192]) by smtp.gmail.com with ESMTPSA id d17sm4140983qte.0.2021.09.23.12.56.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Sep 2021 12:56:21 -0700 (PDT) Sender: Mark Johnston Date: Thu, 23 Sep 2021 15:56:22 -0400 From: Mark Johnston To: Mateusz Guzik Cc: Konstantin Belousov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: df8dd6025af8 - main - amd64: stop using top of the thread' kernel stack for FPU user save area Message-ID: References: <202109211721.18LHLFWM028927@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HFmBh3DHxz4SkZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 19:56:28 -0000 On Thu, Sep 23, 2021 at 09:49:47PM +0200, Mateusz Guzik wrote: > On 9/21/21, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=df8dd6025af88a99d34f549fa9591a9b8f9b75b1 > > > > commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1 > > Author: Konstantin Belousov > > AuthorDate: 2021-09-13 21:05:47 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-09-21 17:20:15 +0000 > > > > amd64: stop using top of the thread' kernel stack for FPU user save > > area > > > > This causes KASAN to crash on boot: > > panic: ASan: Invalid access, 192-byte read at 0xffffffff84105f40, Try grabbing https://reviews.freebsd.org/D32057 From owner-dev-commits-src-main@freebsd.org Thu Sep 23 19: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 742D26AC8EC; Thu, 23 Sep 2021 19: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 4HFmCx2Knpz4SjH; Thu, 23 Sep 2021 19: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 2FCD9C46; Thu, 23 Sep 2021 19: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 18NJvXR6077416; Thu, 23 Sep 2021 19: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 18NJvXeC077415; Thu, 23 Sep 2021 19:57:33 GMT (envelope-from git) Date: Thu, 23 Sep 2021 19:57:33 GMT Message-Id: <202109231957.18NJvXeC077415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: cb13059663e4 - main - pf: fix pagefault in pf_getstatus() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb13059663e455b3fc69c293dadec53c164490dc 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, 23 Sep 2021 19:57:33 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cb13059663e455b3fc69c293dadec53c164490dc commit cb13059663e455b3fc69c293dadec53c164490dc Author: Kristof Provost AuthorDate: 2021-09-23 08:39:49 +0000 Commit: Kristof Provost CommitDate: 2021-09-23 19:56:59 +0000 pf: fix pagefault in pf_getstatus() We can't copyout() while holding a lock, in case it triggers a page fault. Release the lock before copyout, which is safe because we've already copied all the data into the nvlist. PR: 258601 Reviewed by: mjg MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D32076 --- sys/netpfil/pf/pf_ioctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index e7e37d5a6d5a..3242c51a2c66 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5006,11 +5006,14 @@ pf_getstatus(struct pfioc_nv *nv) else if (nv->size < nv->len) ERROUT(ENOSPC); + PF_RULES_RUNLOCK(); error = copyout(nvlpacked, nv->data, nv->len); + goto done; #undef ERROUT errout: PF_RULES_RUNLOCK(); +done: free(nvlpacked, M_NVLIST); nvlist_destroy(nvc); nvlist_destroy(nvl); From owner-dev-commits-src-main@freebsd.org Thu Sep 23 20:06:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF6ED6AD151; Thu, 23 Sep 2021 20:06:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFmQ14hwsz4VNf; Thu, 23 Sep 2021 20:06:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632427577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JDhCGMB56RKOy0VkTd7niwAG2so4Oh2gyzMFBtwkkeQ=; b=NvhARjB+dAeha2gG4xrRMKUuBaercq646dUNHD0LxovgEQk1lQyg5Sq8iC1Aodn87X4H2E fPyE8zOZQuxumUHA9Y/0wowlVzEb0Fkkwt/tYtPWNGaKNdXpzqQiseMlgNLm6D+tv+RZJv KF3KtiJ+EsYTdTGM0NdGY+3VczKku1EscWAqqBPJwjCA4nbWAgZdm9yKlM4hjOrQ1DRHms gkrx7633R7303SW97+sO0HJHzB6UoitBMEnWv/fcJFY/KR2ebZr5s+dh2Lz6z2SSdGs9mg LJSOFK9zqr4vASHajK1DOPPLhy4Sa6nhKEblUwpA3Ww0FglObPtuusk6NXOx7Q== Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 6221717A01; Thu, 23 Sep 2021 20:06:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 7836D214B8; Thu, 23 Sep 2021 13:06:16 -0700 (PDT) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id kyAA-_PZ1_Bh; Thu, 23 Sep 2021 13:06:13 -0700 (PDT) Subject: Re: git: f555b39e6bb7 - main - man: reset OPTIND before parsing args DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 3C4E7214AC To: Kyle Evans , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109231914.18NJELZU023086@gitrepo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <33438d0b-1925-8d44-83bb-62054b141635@FreeBSD.org> Date: Thu, 23 Sep 2021 13:06:12 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109231914.18NJELZU023086@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XInPtLUnSy9zfyorvKeTTNAg8D5LojOC5" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632427577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JDhCGMB56RKOy0VkTd7niwAG2so4Oh2gyzMFBtwkkeQ=; b=JbmvAB6qK3K4C9uQ+a4gn+V1Ch1HGMe3IKLjA7Mx3XWfaFGV2vp82VchXnLsIA4I3M5is/ OJzs+kBV654jAljcDt6gqR5k9feEYokTiIw2wEIFPioo7bu06eAv8BqpQLG2cmtxrv3/Ku iwjuRlvGHdFQVeGkFEl/uCpA4cTlHajdmoOqFzSu4p3cojY3RHCy49IRWP3xa6nIKBjSM5 GNdjenj5mOZnPBzhi8apK7QdnlJvyJ47NHXp52YmL2EqRkOApEfOc74u//WvJtTQOSZeIZ CWh4xc1zKzYqGM8cxSIHXVl5fTWAxUDyMeKnYGMMShhwedRCjVLHFKl8cRWQYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1632427577; a=rsa-sha256; cv=none; b=o7GG0zYAmW/BPNfL9ztHnVfSptBDRLADcxA+L0Y0fQAoBiP5e0nKxjUyu6Zx9gxl/Q9tnu 1KJR3OnML1U0xrEVBy/VGoJS/uoprfcHHLxem8BQe2px8+2UU6XDSivGif1eeFxuCeIZ1v Fe1Y2EP3Y8bd0YPwomPmJ+4A1lw5u7Eba8ipps74RQqdocbIBkmh+Jly29BQ63aaY3hgDQ m8d1IocR0MUCqTFpkryYfBzutD2aAMleYKhq3vj1dI7/WPAgCJEZiJbEA/s/9JXc4oboal PhCtNAJPdWMma+lozSks5Gzy/pwxAfxkH4rhr0UTK4/DG1E7vqzbTo+wMq3MMA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 20:06:17 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XInPtLUnSy9zfyorvKeTTNAg8D5LojOC5 Content-Type: multipart/mixed; boundary="mCNiFLnztWUqqQQdqoZG1wz328xTcPbXV"; protected-headers="v1" From: Bryan Drewery To: Kyle Evans , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <33438d0b-1925-8d44-83bb-62054b141635@FreeBSD.org> Subject: Re: git: f555b39e6bb7 - main - man: reset OPTIND before parsing args References: <202109231914.18NJELZU023086@gitrepo.freebsd.org> In-Reply-To: <202109231914.18NJELZU023086@gitrepo.freebsd.org> --mCNiFLnztWUqqQQdqoZG1wz328xTcPbXV Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 9/23/2021 12:14 PM, Kyle Evans wrote: > The branch main has been updated by kevans: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Df555b39e6bb7cbfbe1905e90= f64c4dfc4456fabb >=20 > commit f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb > Author: Kyle Evans > AuthorDate: 2021-09-22 19:58:19 +0000 > Commit: Kyle Evans > CommitDate: 2021-09-23 19:13:34 +0000 >=20 > man: reset OPTIND before parsing args > =20 > From jilles: POSIX requires that a script set `OPTIND=3D1` before u= sing > different sets of parameters with `getopts`, or the results will be= > unspecified. > =20 > The specific problem observed here is that we would execute `man -f= ` or > `man -k` without cleaning up state from man_parse_args()' `getopts`= > loop. FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit th= e > second getopts loop, rendering the following shift harmless; other > /bin/sh implementations will leave it at what we came into the loop= at > (e.g., bash as /bin/sh), shifting off any keywords that we had. > =20 > Input from: jilles > Reviewed by: allanjude, bapt, imp > Sponsored by: Klara, Inc. > Differential Revision: https://reviews.freebsd.org/D32063 > --- > usr.bin/man/man.sh | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh > index f31c464fcc8f..084f4a06829b 100755 > --- a/usr.bin/man/man.sh > +++ b/usr.bin/man/man.sh > @@ -243,6 +243,7 @@ is_newer() { > manpath_parse_args() { > local cmd_arg > =20 > + OPTIND=3D1 > while getopts 'Ldq' cmd_arg; do > case "${cmd_arg}" in > L) Lflag=3DLflag ;; Not that it matters much but since this script makes use of 'local', OPTIND and OPTARG might as well be in the list as well. --=20 Bryan Drewery --mCNiFLnztWUqqQQdqoZG1wz328xTcPbXV-- --XInPtLUnSy9zfyorvKeTTNAg8D5LojOC5 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAmFM3jQFAwAAAAAACgkQNddxu25Gl8// fAf+O3YXbK0GFvjhmxxzbVODUS2kQAq/UlrYfcNxWsxd0xGlqSbdu+N2Ky5bsnDqVJ4f8kUlnDwa OSlDhox/c4STZBBnTHZPTrS6wHnon2QQbQpdFyEKgInRtSf3TfvChbHU2kkQIiPcr5uWEgSg4TwV GnzvAKhccr/iEy8Vo7x/mIuqoJKyVwNamSNzQcy15hwDue4/PkG4Bu5QKRtMJidBJ3w0Wi84GQ6I GAGb8leIiCSvuanNucPXMso5OwaJcCU+Qb/uIIwTok4x2Bm+mibmzu+bOGap6Jl1Uase/F19+tho hY4YVViWEQyMgB3NPe9vTi8cV0nTtMjS8z108Jyr3g== =X6MU -----END PGP SIGNATURE----- --XInPtLUnSy9zfyorvKeTTNAg8D5LojOC5-- From owner-dev-commits-src-main@freebsd.org Thu Sep 23 20:06: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 844C46AD15D; Thu, 23 Sep 2021 20:06:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (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 4HFmQg36chz4VKk; Thu, 23 Sep 2021 20:06:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x130.google.com with SMTP id b20so30948775lfv.3; Thu, 23 Sep 2021 13:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CcihJp2kvRcbsJ6/bvBwLyanDY/36LBwphRYaZT3tUA=; b=K6OyHf0QjAwY+LZoI3BWRw5AnDl8Mua9Tb9dVKLeYtxgc0sy9CKPAFV/lT8QVF/f8g LHFyyGDHzUlU+uHYAoN8ekBY4c7XvZoJkduDanZOLYMlT7xVgga6i32ecce6gbxeuR7M 1jIuXiccZlrBLIk5u1hJFGUXGeBbGa9/NSwTYmpetYd0MGzeJ6rAKHFjeQ8TTsqhpalX ZFD8PakWFUL7Q+OKiVmuG+iC/AjlPZu6glvO2hv0Z05zuG5LMSo8Il/RNe/52gLVc3Mz 0O7A6xewKJkOqPLPSmRNcaZTqXUR6yuwAvKaoGWK7/rC7W2rxuIoi9PpUCG6z6WmUKsz k74A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CcihJp2kvRcbsJ6/bvBwLyanDY/36LBwphRYaZT3tUA=; b=6N0N0lmYOjodTTvP5mqvoEXumAc0YRZQiGzRc4ft21B4JWmmCb637N6GdwK06eQqpV MtzY+5rn3xi0vtjIwzsM8B7Tnsq3lc/LaFqMRDIzubqMDdsXf+inpnWzpCXHKeOePWl4 wsUyK4bEThwL/MTjP2KGPwTCSk3FOoqvp0RkirfV4LOxbVOQ+zP8qEfRbiwKaND/BooS cRW0Z+RBJiUbr0CO0ovfRj9kiy8+wR8jVqwJOSqZ/kaKrHsXxdfuzk6S7pvFNmk6ohSZ 3KcK1VT0nW/i/SrtY/6uGBeWX+lXA4J6sfSD1cnDB44uIWhBffP5nDQMfmq8Nie+c9Aa p3NA== X-Gm-Message-State: AOAM531QcoQDtjA6idi86pbIhqZnMEKPKqUNp2omVoIUCxD9ghNP2W7C AQEp8yuv/WDbquwLT9GQNrBy+rwS5rj1kJS3+QPOUoAQ X-Google-Smtp-Source: ABdhPJyIwzauJnbVmBFnbx9D/xNQiXTMUj1mD3gFP7MHffHgknQoM7wlsTZeI9f5omrhEqAk64tin9rn5Hx8zdPqaXs= X-Received: by 2002:a2e:a231:: with SMTP id i17mr7092597ljm.233.1632427610226; Thu, 23 Sep 2021 13:06:50 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:2f18:0:0:0:0:0 with HTTP; Thu, 23 Sep 2021 13:06:49 -0700 (PDT) In-Reply-To: References: <202109211721.18LHLFWM028927@gitrepo.freebsd.org> From: Mateusz Guzik Date: Thu, 23 Sep 2021 22:06:49 +0200 Message-ID: Subject: Re: git: df8dd6025af8 - main - amd64: stop using top of the thread' kernel stack for FPU user save area To: Mark Johnston Cc: Konstantin Belousov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HFmQg36chz4VKk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 20:06:51 -0000 On 9/23/21, Mark Johnston wrote: > On Thu, Sep 23, 2021 at 09:49:47PM +0200, Mateusz Guzik wrote: >> On 9/21/21, Konstantin Belousov wrote: >> > The branch main has been updated by kib: >> > >> > URL: >> > https://cgit.FreeBSD.org/src/commit/?id=df8dd6025af88a99d34f549fa9591a9b8f9b75b1 >> > >> > commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1 >> > Author: Konstantin Belousov >> > AuthorDate: 2021-09-13 21:05:47 +0000 >> > Commit: Konstantin Belousov >> > CommitDate: 2021-09-21 17:20:15 +0000 >> > >> > amd64: stop using top of the thread' kernel stack for FPU user save >> > area >> > >> >> This causes KASAN to crash on boot: >> >> panic: ASan: Invalid access, 192-byte read at 0xffffffff84105f40, > > Try grabbing https://reviews.freebsd.org/D32057 > This indeed takes care of it, thanks. -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Fri Sep 24 00:15: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 32FE26AFBEE; Fri, 24 Sep 2021 00:15: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 4HFsx50xDMz3BnF; Fri, 24 Sep 2021 00:15: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 0040D42F6; Fri, 24 Sep 2021 00:15:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O0F4L0022163; Fri, 24 Sep 2021 00:15:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0F4BS022162; Fri, 24 Sep 2021 00:15:04 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:15:04 GMT Message-Id: <202109240015.18O0F4BS022162@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: 502dc84a8b67 - main - nvme: Use shared timeout rather than timeout per transaction 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: 502dc84a8b6703e7c0626739179a3cdffdd22d81 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, 24 Sep 2021 00:15:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=502dc84a8b6703e7c0626739179a3cdffdd22d81 commit 502dc84a8b6703e7c0626739179a3cdffdd22d81 Author: Warner Losh AuthorDate: 2021-09-23 22:31:32 +0000 Commit: Warner Losh CommitDate: 2021-09-23 22:42:08 +0000 nvme: Use shared timeout rather than timeout per transaction Keep track of the approximate time commands are 'due' and the next deadline for a command. twice a second, wake up to see if any commands have entered timeout. If so, quiessce and then enter a recovery mode half the timeout further in the future to allow the ISR to complete. Once we exit recovery mode, we go back to operations as normal. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28583 --- sys/dev/nvme/nvme_ctrlr.c | 8 +- sys/dev/nvme/nvme_private.h | 16 +++- sys/dev/nvme/nvme_qpair.c | 173 ++++++++++++++++++++++++++++---------------- 3 files changed, 131 insertions(+), 66 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 833bf328584a..39cde3f065dd 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -232,7 +232,8 @@ nvme_ctrlr_post_failed_request(struct nvme_controller *ctrlr, mtx_lock(&ctrlr->lock); STAILQ_INSERT_TAIL(&ctrlr->fail_req, req, stailq); mtx_unlock(&ctrlr->lock); - taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->fail_req_task); + if (!ctrlr->is_dying) + taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->fail_req_task); } static void @@ -435,7 +436,8 @@ nvme_ctrlr_reset(struct nvme_controller *ctrlr) */ return; - taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->reset_task); + if (!ctrlr->is_dying) + taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->reset_task); } static int @@ -1481,6 +1483,8 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) { int gone, i; + ctrlr->is_dying = true; + if (ctrlr->resource == NULL) goto nores; if (!mtx_initialized(&ctrlr->adminq.lock)) diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index fba1b406e9ce..02cecaf03a97 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -151,7 +151,7 @@ struct nvme_tracker { TAILQ_ENTRY(nvme_tracker) tailq; struct nvme_request *req; struct nvme_qpair *qpair; - struct callout timer; + sbintime_t deadline; bus_dmamap_t payload_dma_map; uint16_t cid; @@ -159,6 +159,12 @@ struct nvme_tracker { bus_addr_t prp_bus_addr; }; +enum nvme_recovery { + RECOVERY_NONE = 0, /* Normal operations */ + RECOVERY_START, /* Deadline has passed, start recovering */ + RECOVERY_RESET, /* This pass, initiate reset of controller */ + RECOVERY_WAITING, /* waiting for the reset to complete */ +}; struct nvme_qpair { struct nvme_controller *ctrlr; uint32_t id; @@ -170,6 +176,11 @@ struct nvme_qpair { struct resource *res; void *tag; + struct callout timer; + sbintime_t deadline; + bool timer_armed; + enum nvme_recovery recovery_state; + uint32_t num_entries; uint32_t num_trackers; uint32_t sq_tdbl_off; @@ -201,8 +212,6 @@ struct nvme_qpair { struct nvme_tracker **act_tr; - bool is_enabled; - struct mtx lock __aligned(CACHE_LINE_SIZE); } __aligned(CACHE_LINE_SIZE); @@ -305,6 +314,7 @@ struct nvme_controller { uint32_t notification_sent; bool is_failed; + bool is_dying; STAILQ_HEAD(, nvme_request) fail_req; /* Host Memory Buffer */ diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 71718acff66f..7a17a057f319 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -452,7 +452,6 @@ nvme_qpair_complete_tracker(struct nvme_tracker *tr, } mtx_lock(&qpair->lock); - callout_stop(&tr->timer); if (retry) { req->retries++; @@ -544,7 +543,7 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) * progress. Ignore the interrupt - any I/O that was associated with * this interrupt will get retried when the reset is complete. */ - if (!qpair->is_enabled) + if (qpair->recovery_state != RECOVERY_NONE) return (false); bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, @@ -739,6 +738,10 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->cpl_bus_addr = queuemem_phys + cmdsz; prpmem_phys = queuemem_phys + cmdsz + cplsz; + callout_init(&qpair->timer, 1); + qpair->timer_armed = false; + qpair->recovery_state = RECOVERY_NONE; + /* * Calcuate the stride of the doorbell register. Many emulators set this * value to correspond to a cache line. However, some hardware has set @@ -776,7 +779,6 @@ nvme_qpair_construct(struct nvme_qpair *qpair, DOMAINSET_PREF(qpair->domain), M_ZERO | M_WAITOK); bus_dmamap_create(qpair->dma_tag_payload, 0, &tr->payload_dma_map); - callout_init(&tr->timer, 1); tr->cid = i; tr->qpair = qpair; tr->prp = (uint64_t *)prp_list; @@ -835,6 +837,8 @@ nvme_qpair_destroy(struct nvme_qpair *qpair) { struct nvme_tracker *tr; + callout_drain(&qpair->timer); + if (qpair->tag) { bus_teardown_intr(qpair->ctrlr->dev, qpair->res, qpair->tag); qpair->tag = NULL; @@ -914,65 +918,101 @@ nvme_io_qpair_destroy(struct nvme_qpair *qpair) } static void -nvme_abort_complete(void *arg, const struct nvme_completion *status) +nvme_qpair_timeout(void *arg) { - struct nvme_tracker *tr = arg; + struct nvme_qpair *qpair = arg; + struct nvme_controller *ctrlr = qpair->ctrlr; + struct nvme_tracker *tr; + struct nvme_tracker *tr_temp; + sbintime_t now; + bool idle; + uint32_t csts; + uint8_t cfs; - /* - * If cdw0 == 1, the controller was not able to abort the command - * we requested. We still need to check the active tracker array, - * to cover race where I/O timed out at same time controller was - * completing the I/O. - */ - if (status->cdw0 == 1 && tr->qpair->act_tr[tr->cid] != NULL) { + mtx_lock(&qpair->lock); + idle = TAILQ_EMPTY(&qpair->outstanding_tr); +again: + switch (qpair->recovery_state) { + case RECOVERY_NONE: + if (idle) + break; + now = getsbinuptime(); + TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) { + if (now > tr->deadline && tr->deadline != 0) { + /* + * We're now passed our earliest deadline. We + * need to do expensive things to cope, but next + * time. Flag that and close the door to any + * further processing. + */ + qpair->recovery_state = RECOVERY_START; + nvme_printf(ctrlr, "RECOVERY_START %jd vs %jd\n", + (uintmax_t)now, (uintmax_t)tr->deadline); + break; + } + } + break; + case RECOVERY_START: /* - * An I/O has timed out, and the controller was unable to - * abort it for some reason. Construct a fake completion - * status, and then complete the I/O's tracker manually. + * Read csts to get value of cfs - controller fatal status. + * If no fatal status, try to call the completion routine, and + * if completes transactions, report a missed interrupt and + * return (this may need to be rate limited). Otherwise, if + * aborts are enabled and the controller is not reporting + * fatal status, abort the command. Otherwise, just reset the + * controller and hope for the best. */ - nvme_printf(tr->qpair->ctrlr, - "abort command failed, aborting command manually\n"); - nvme_qpair_manual_complete_tracker(tr, - NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, 0, ERROR_PRINT_ALL); + csts = nvme_mmio_read_4(ctrlr, csts); + cfs = (csts >> NVME_CSTS_REG_CFS_SHIFT) & NVME_CSTS_REG_CFS_MASK; + if (cfs) { + nvme_printf(ctrlr, "Controller in fatal status, resetting\n"); + qpair->recovery_state = RECOVERY_RESET; + goto again; + } + mtx_unlock(&qpair->lock); + if (nvme_qpair_process_completions(qpair)) { + nvme_printf(ctrlr, "Completions present in output without an interrupt\n"); + qpair->recovery_state = RECOVERY_NONE; + } else { + nvme_printf(ctrlr, "timeout with nothing complete, resetting\n"); + qpair->recovery_state = RECOVERY_RESET; + mtx_lock(&qpair->lock); + goto again; + } + mtx_lock(&qpair->lock); + break; + case RECOVERY_RESET: + /* + * If we get here due to a possible surprise hot-unplug event, + * then we let nvme_ctrlr_reset confirm and fail the + * controller. + */ + nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", + cfs ? " and fatal error status" : ""); + nvme_printf(ctrlr, "RECOVERY_WAITING\n"); + qpair->recovery_state = RECOVERY_WAITING; + nvme_ctrlr_reset(ctrlr); + break; + case RECOVERY_WAITING: + nvme_printf(ctrlr, "waiting\n"); + break; } -} - -static void -nvme_timeout(void *arg) -{ - struct nvme_tracker *tr = arg; - struct nvme_qpair *qpair = tr->qpair; - struct nvme_controller *ctrlr = qpair->ctrlr; - uint32_t csts; - uint8_t cfs; /* - * Read csts to get value of cfs - controller fatal status. - * If no fatal status, try to call the completion routine, and - * if completes transactions, report a missed interrupt and - * return (this may need to be rate limited). Otherwise, if - * aborts are enabled and the controller is not reporting - * fatal status, abort the command. Otherwise, just reset the - * controller and hope for the best. + * Rearm the timeout. */ - csts = nvme_mmio_read_4(ctrlr, csts); - cfs = (csts >> NVME_CSTS_REG_CFS_SHIFT) & NVME_CSTS_REG_CFS_MASK; - if (cfs == 0 && nvme_qpair_process_completions(qpair)) { - nvme_printf(ctrlr, "Missing interrupt\n"); - return; - } - if (ctrlr->enable_aborts && cfs == 0) { - nvme_printf(ctrlr, "Aborting command due to a timeout.\n"); - nvme_ctrlr_cmd_abort(ctrlr, tr->cid, qpair->id, - nvme_abort_complete, tr); + if (!idle) { + callout_schedule(&qpair->timer, hz / 2); } else { - nvme_printf(ctrlr, "Resetting controller due to a timeout%s.\n", - (csts == NVME_GONE) ? " and possible hot unplug" : - (cfs ? " and fatal error status" : "")); - nvme_ctrlr_reset(ctrlr); + qpair->timer_armed = false; } + mtx_unlock(&qpair->lock); } +/* + * Submit the tracker to the hardware. Must already be in the + * outstanding queue when called. + */ void nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) { @@ -989,12 +1029,17 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) if (req->timeout) { if (req->cb_fn == nvme_completion_poll_cb) - timeout = hz; + timeout = 1; else - timeout = ctrlr->timeout_period * hz; - callout_reset_on(&tr->timer, timeout, nvme_timeout, tr, - qpair->cpu); - } + timeout = ctrlr->timeout_period; + tr->deadline = getsbinuptime() + timeout * SBT_1S; + if (!qpair->timer_armed) { + qpair->timer_armed = true; + callout_reset_on(&qpair->timer, hz / 2, + nvme_qpair_timeout, qpair, qpair->cpu); + } + } else + tr->deadline = SBT_MAX; /* Copy the command from the tracker to the submission queue. */ memcpy(&qpair->cmd[qpair->sq_tail], &req->cmd, sizeof(req->cmd)); @@ -1069,7 +1114,7 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) tr = TAILQ_FIRST(&qpair->free_tr); req->qpair = qpair; - if (tr == NULL || !qpair->is_enabled) { + if (tr == NULL || qpair->recovery_state != RECOVERY_NONE) { /* * No tracker is available, or the qpair is disabled due to * an in-progress controller-level reset or controller @@ -1096,6 +1141,8 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) TAILQ_REMOVE(&qpair->free_tr, tr, tailq); TAILQ_INSERT_TAIL(&qpair->outstanding_tr, tr, tailq); + if (!qpair->timer_armed) + tr->deadline = SBT_MAX; tr->req = req; switch (req->type) { @@ -1164,8 +1211,9 @@ nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) static void nvme_qpair_enable(struct nvme_qpair *qpair) { + mtx_assert(&qpair->lock, MA_OWNED); - qpair->is_enabled = true; + qpair->recovery_state = RECOVERY_NONE; } void @@ -1208,7 +1256,9 @@ nvme_admin_qpair_enable(struct nvme_qpair *qpair) NVME_SC_ABORTED_BY_REQUEST, DO_NOT_RETRY, ERROR_PRINT_ALL); } + mtx_lock(&qpair->lock); nvme_qpair_enable(qpair); + mtx_unlock(&qpair->lock); } void @@ -1251,12 +1301,13 @@ nvme_io_qpair_enable(struct nvme_qpair *qpair) static void nvme_qpair_disable(struct nvme_qpair *qpair) { - struct nvme_tracker *tr; + struct nvme_tracker *tr, *tr_temp; - qpair->is_enabled = false; mtx_lock(&qpair->lock); - TAILQ_FOREACH(tr, &qpair->outstanding_tr, tailq) - callout_stop(&tr->timer); + qpair->recovery_state = RECOVERY_WAITING; + TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) { + tr->deadline = SBT_MAX; + } mtx_unlock(&qpair->lock); } From owner-dev-commits-src-main@freebsd.org Fri Sep 24 00:18: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 AFF596B0013; Fri, 24 Sep 2021 00:18: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 4HFt1G49MDz3Byv; Fri, 24 Sep 2021 00:18: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 6AFDD4C87; Fri, 24 Sep 2021 00:18: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 18O0Ig8s022551; Fri, 24 Sep 2021 00:18:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0Ig0s022550; Fri, 24 Sep 2021 00:18:42 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:18:42 GMT Message-Id: <202109240018.18O0Ig0s022550@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: 45c2c7c484de - main - aio_aqueue(): avoid ucred leak on failure path 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: 45c2c7c484de7747014492b17ff89e323ee66496 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, 24 Sep 2021 00:18:42 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=45c2c7c484de7747014492b17ff89e323ee66496 commit 45c2c7c484de7747014492b17ff89e323ee66496 Author: Konstantin Belousov AuthorDate: 2021-09-24 00:14:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 00:18:34 +0000 aio_aqueue(): avoid ucred leak on failure path PR: 258698 Submitted by: sigsys@gmail.com MFC after: 1 week --- sys/kern/vfs_aio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 87c45bf2c078..d06b18140e71 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1713,7 +1713,7 @@ no_kqueue: else error = fo_aio_queue(fp, job); if (error) - goto err3; + goto err4; AIO_LOCK(ki); job->jobflags &= ~KAIOCB_QUEUEING; @@ -1734,6 +1734,8 @@ no_kqueue: AIO_UNLOCK(ki); return (0); +err4: + crfree(job->cred); err3: if (fp) fdrop(fp, td); From owner-dev-commits-src-main@freebsd.org Fri Sep 24 00:32: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 95B176AFD66; Fri, 24 Sep 2021 00:32: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 4HFtKF3mKPz3Dm3; Fri, 24 Sep 2021 00:32: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 612034EBD; Fri, 24 Sep 2021 00:32: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 18O0WXci048082; Fri, 24 Sep 2021 00:32:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0WXS2048081; Fri, 24 Sep 2021 00:32:33 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:32:33 GMT Message-Id: <202109240032.18O0WXS2048081@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: 701a99939fbf - main - libsysdecode: Permit _ in VM_PROT_(.*) names. 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: 701a99939fbf2007f1df03cb9f67be88455d31cc 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, 24 Sep 2021 00:32:33 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=701a99939fbf2007f1df03cb9f67be88455d31cc commit 701a99939fbf2007f1df03cb9f67be88455d31cc Author: Nathaniel Wesley Filardo AuthorDate: 2021-09-24 00:31:39 +0000 Commit: John Baldwin CommitDate: 2021-09-24 00:31:39 +0000 libsysdecode: Permit _ in VM_PROT_(.*) names. CheriBSD defines additional protection flags which use underscores such as VM_PROT_READ_CAP and VM_PROT_WRITE_CAP. Obtained from: CheriBSD Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D30017 --- lib/libsysdecode/mktables | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 3d152a3a2646..cb5a763ddece 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -147,7 +147,7 @@ gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/ gen_table "thrcreateflags" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" gen_table "umtxop" "UMTX_OP_[[:alnum:]][[:alnum:]_]*[[:space:]]+[0-9]+" "sys/umtx.h" gen_table "umtxopflags" "UMTX_OP__[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" -gen_table "vmprot" "VM_PROT_[A-Z]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)" "vm/vm.h" +gen_table "vmprot" "VM_PROT_[A-Z_]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)" "vm/vm.h" gen_table "vmresult" "KERN_[A-Z_]+[[:space:]]+[0-9]+" "vm/vm_param.h" gen_table "wait6opt" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h" gen_table "seekwhence" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h" From owner-dev-commits-src-main@freebsd.org Fri Sep 24 00:32: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 D09676B029E; Fri, 24 Sep 2021 00:32: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 4HFtKG4g09z3F0d; Fri, 24 Sep 2021 00:32: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 7C13C4A7F; Fri, 24 Sep 2021 00:32: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 18O0WYtJ048108; Fri, 24 Sep 2021 00:32:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O0WYKM048107; Fri, 24 Sep 2021 00:32:34 GMT (envelope-from git) Date: Fri, 24 Sep 2021 00:32:34 GMT Message-Id: <202109240032.18O0WYKM048107@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: 0321a7990b27 - main - kqueue: Add EV_KEEPUDATA flag 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: 0321a7990b277702fa0b4f8366121bf53d03cb64 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, 24 Sep 2021 00:32:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0321a7990b277702fa0b4f8366121bf53d03cb64 commit 0321a7990b277702fa0b4f8366121bf53d03cb64 Author: Nathaniel Wesley Filardo AuthorDate: 2021-09-24 00:31:39 +0000 Commit: John Baldwin CommitDate: 2021-09-24 00:31:39 +0000 kqueue: Add EV_KEEPUDATA flag When this flag is set, operations that update an existing kevent will not change the udata field. This can be used to NOTE_TRIGGER or EV_{EN,DIS}ABLE events without overwriting the stashed pointer. Reviewed by: Domagoj Stolfa Obtained from: CheriBSD Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D30286 --- lib/libc/sys/kqueue.2 | 17 ++++++++++- sys/kern/kern_event.c | 10 ++++++- sys/sys/event.h | 1 + tests/sys/kqueue/libkqueue/user.c | 60 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index ed737c626ef8..3ded4ae3d8f7 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 7, 2021 +.Dd September 23, 2021 .Dt KQUEUE 2 .Os .Sh NAME @@ -262,6 +262,21 @@ Filters may set this flag to indicate filter-specific EOF condition. See .Sx RETURN VALUES below. +.It Dv EV_KEEPUDATA +Causes +.Fn kevent +to leave unchanged any +.Fa udata +associated with an existing event. This allows other aspects of the +event to be modified without requiring the caller to know the +.Fa udata +value presently associated. +This is especially useful with +.Dv NOTE_TRIGGER +or flags like +.Dv EV_ENABLE. +This flag may not be used with +.Dv EV_ADD. .El .Pp The predefined system filters are listed below. diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index db505b234268..5fa5bf9cad06 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1496,6 +1496,13 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct thread *td, return EINVAL; if (kev->flags & EV_ADD) { + /* Reject an invalid flag pair early */ + if (kev->flags & EV_KEEPUDATA) { + tkn = NULL; + error = EINVAL; + goto done; + } + /* * Prevent waiting with locks. Non-sleepable * allocation failures are handled in the loop, only @@ -1684,7 +1691,8 @@ findkn: kn_enter_flux(kn); KQ_UNLOCK(kq); knl = kn_list_lock(kn); - kn->kn_kevent.udata = kev->udata; + if ((kev->flags & EV_KEEPUDATA) == 0) + kn->kn_kevent.udata = kev->udata; if (!fops->f_isfd && fops->f_touch != NULL) { fops->f_touch(kn, kev, EVENT_REGISTER); } else { diff --git a/sys/sys/event.h b/sys/sys/event.h index 80ed1268c8a1..f1bdc7e2a80e 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -138,6 +138,7 @@ struct kevent32_freebsd11 { #define EV_ENABLE 0x0004 /* enable event */ #define EV_DISABLE 0x0008 /* disable event (not reported) */ #define EV_FORCEONESHOT 0x0100 /* enable _ONESHOT and force trigger */ +#define EV_KEEPUDATA 0x0200 /* do not update the udata field */ /* flags */ #define EV_ONESHOT 0x0010 /* only report one occurrence */ diff --git a/tests/sys/kqueue/libkqueue/user.c b/tests/sys/kqueue/libkqueue/user.c index 3844251ff4ba..1f66234c4cda 100644 --- a/tests/sys/kqueue/libkqueue/user.c +++ b/tests/sys/kqueue/libkqueue/user.c @@ -60,6 +60,32 @@ event_wait(void) success(); } +static void +event_wait_keepudata(void) +{ + const char *test_id = "kevent(EVFILT_USER, wait w/ EV_KEEPUDATA)"; + struct kevent kev; + + test_begin(test_id); + + test_no_kevents(); + + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_ADD | EV_CLEAR, 0, 0, &kev); + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_KEEPUDATA, NOTE_TRIGGER, 0, + NULL); + + kev.fflags &= ~NOTE_FFCTRLMASK; + kev.fflags &= ~NOTE_TRIGGER; + kev.flags = EV_CLEAR; + kev.udata = &kev; + kevent_cmp(&kev, kevent_get(kqfd)); + + test_no_kevents(); + + success(); +} + + static void disable_and_enable(void) { @@ -88,6 +114,38 @@ disable_and_enable(void) success(); } +static void +disable_and_enable_keepudata(void) +{ + const char *test_id = + "kevent(EVFILT_USER, EV_DISABLE and EV_ENABLE w/ EV_KEEPUDATA)"; + struct kevent kev; + + test_begin(test_id); + + test_no_kevents(); + + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_ADD, 0, 0, &kev); + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_DISABLE | EV_KEEPUDATA, 0, 0, + NULL); + + /* Trigger the event, but since it is disabled, nothing will happen. */ + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_KEEPUDATA, NOTE_TRIGGER, 0, NULL); + test_no_kevents(); + + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_ENABLE | EV_KEEPUDATA, 0, 0, + NULL); + kevent_add(kqfd, &kev, 1, EVFILT_USER, EV_KEEPUDATA, NOTE_TRIGGER, 0, NULL); + + kev.flags = EV_CLEAR; + kev.fflags &= ~NOTE_FFCTRLMASK; + kev.fflags &= ~NOTE_TRIGGER; + kev.udata = &kev; + kevent_cmp(&kev, kevent_get(kqfd)); + + success(); +} + static void oneshot(void) { @@ -120,7 +178,9 @@ test_evfilt_user(void) add_and_delete(); event_wait(); + event_wait_keepudata(); disable_and_enable(); + disable_and_enable_keepudata(); oneshot(); /* TODO: try different fflags operations */ From owner-dev-commits-src-main@freebsd.org Fri Sep 24 00:46: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 4A27B6B066A; Fri, 24 Sep 2021 00:46:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4HFtdT4rbfz3FnY; Fri, 24 Sep 2021 00:46:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 18O0kUpI054491 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 24 Sep 2021 03:46:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 18O0kUpI054491 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 18O0kUpE054490; Fri, 24 Sep 2021 03:46:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Sep 2021 03:46:30 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. Message-ID: References: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4HFtdT4rbfz3FnY X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-1.42 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_SHORT(0.57)[0.569]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.985]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 00:46:39 -0000 On Wed, Sep 22, 2021 at 06:03:42PM +0000, Hans Petter Selasky wrote: > The branch main has been updated by hselasky: > > URL: https://cgit.FreeBSD.org/src/commit/?id=903873ce15600fc02a0ea42cbf888cff232b411d > > commit 903873ce15600fc02a0ea42cbf888cff232b411d > Author: Hans Petter Selasky > AuthorDate: 2021-09-22 13:42:51 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-09-22 17:43:56 +0000 > > Implement and use new mixer(3) library for FreeBSD. > > Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements > This project was part of Google Summer of Code 2021. > > Submitted by: christos@ > Differential Revision: https://reviews.freebsd.org/D31636 > Sponsored by: NVIDIA Networking This library is supposed to be used by user' applications, right? If yes, it is highly desirable to provide symbol versioning from the start. From owner-dev-commits-src-main@freebsd.org Fri Sep 24 02:18: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 4A5B66B3C3B; Fri, 24 Sep 2021 02:18: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 4HFwgD1WSNz3N2M; Fri, 24 Sep 2021 02:18: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 004BE64C9; Fri, 24 Sep 2021 02:18:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O2IFPk083882; Fri, 24 Sep 2021 02:18:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O2IFWx083881; Fri, 24 Sep 2021 02:18:15 GMT (envelope-from git) Date: Fri, 24 Sep 2021 02:18:15 GMT Message-Id: <202109240218.18O2IFWx083881@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: f9e28f900353 - main - unionfs: lock newly-created vnodes before calling insmntque() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9e28f900353ca8681fa1815afaebaca16ef254b 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, 24 Sep 2021 02:18:16 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=f9e28f900353ca8681fa1815afaebaca16ef254b commit f9e28f900353ca8681fa1815afaebaca16ef254b Author: Jason A. Harmening AuthorDate: 2021-09-12 05:43:57 +0000 Commit: Jason A. Harmening CommitDate: 2021-09-24 02:20:30 +0000 unionfs: lock newly-created vnodes before calling insmntque() This fixes an insta-panic when attempting to use unionfs with DEBUG_VFS_LOCKS. Note that unionfs still has a long way to go before it's generally stable or usable. Reviewed by: kib (prior version), markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D31917 --- sys/fs/unionfs/union_subr.c | 86 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 18 deletions(-) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 5cb27dc94d55..dcdb41e55258 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -243,6 +243,49 @@ unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp) VI_UNLOCK(dvp); } +/* + * Common cleanup handling for unionfs_nodeget + * Upper, lower, and parent directory vnodes are expected to be referenced by + * the caller. Upper and lower vnodes, if non-NULL, are also expected to be + * exclusively locked by the caller. + * This function will return with the caller's locks and references undone. + */ +static void +unionfs_nodeget_cleanup(struct vnode *vp, void *arg) +{ + struct unionfs_node *unp; + + /* + * Lock and reset the default vnode lock; vgone() expects a locked + * vnode, and we're going to reset the vnode ops. + */ + lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL); + + /* + * Clear out private data and reset the vnode ops to avoid use of + * unionfs vnode ops on a partially constructed vnode. + */ + VI_LOCK(vp); + vp->v_data = NULL; + vp->v_vnlock = &vp->v_lock; + vp->v_op = &dead_vnodeops; + VI_UNLOCK(vp); + vgone(vp); + vput(vp); + + unp = arg; + if (unp->un_dvp != NULLVP) + vrele(unp->un_dvp); + if (unp->un_uppervp != NULLVP) + vput(unp->un_uppervp); + if (unp->un_lowervp != NULLVP) + vput(unp->un_lowervp); + if (unp->un_hashtbl != NULL) + hashdestroy(unp->un_hashtbl, M_UNIONFSHASH, unp->un_hashmask); + free(unp->un_path, M_UNIONFSPATH); + free(unp, M_UNIONFSNODE); +} + /* * Make a new or get existing unionfs node. * @@ -263,6 +306,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, int lkflags; enum vtype vt; + error = 0; ump = MOUNTTOUNIONFSMOUNT(mp); lkflags = (cnp ? cnp->cn_lkflags : 0); path = (cnp ? cnp->cn_nameptr : NULL); @@ -301,11 +345,6 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, free(unp, M_UNIONFSNODE); return (error); } - error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */ - if (error != 0) { - free(unp, M_UNIONFSNODE); - return (error); - } if (dvp != NULLVP) vref(dvp); if (uppervp != NULLVP) @@ -340,24 +379,35 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, (lowervp != NULLVP && ump->um_lowervp == lowervp)) vp->v_vflag |= VV_ROOT; + vn_lock_pair(lowervp, false, uppervp, false); + error = insmntque1(vp, mp, unionfs_nodeget_cleanup, unp); + if (error != 0) + return (error); + if (lowervp != NULL && VN_IS_DOOMED(lowervp)) { + vput(lowervp); + unp->un_lowervp = NULL; + } + if (uppervp != NULL && VN_IS_DOOMED(uppervp)) { + vput(uppervp); + unp->un_uppervp = NULL; + } + if (unp->un_lowervp == NULL && unp->un_uppervp == NULL) { + unionfs_nodeget_cleanup(vp, unp); + return (ENOENT); + } if (path != NULL && dvp != NULLVP && vt == VDIR) *vpp = unionfs_ins_cached_vnode(unp, dvp, path); - if ((*vpp) != NULLVP) { - if (dvp != NULLVP) - vrele(dvp); - if (uppervp != NULLVP) - vrele(uppervp); - if (lowervp != NULLVP) - vrele(lowervp); - - unp->un_uppervp = NULLVP; - unp->un_lowervp = NULLVP; - unp->un_dvp = NULLVP; - vrele(vp); + if (*vpp != NULLVP) { + unionfs_nodeget_cleanup(vp, unp); vp = *vpp; vref(vp); - } else + } else { + if (uppervp != NULL) + VOP_UNLOCK(uppervp); + if (lowervp != NULL) + VOP_UNLOCK(lowervp); *vpp = vp; + } unionfs_nodeget_out: if (lkflags & LK_TYPE_MASK) From owner-dev-commits-src-main@freebsd.org Fri Sep 24 07:35: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 5AFEE6B7A35; Fri, 24 Sep 2021 07:35:10 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_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 4HG3ht1GRNz4RKX; Fri, 24 Sep 2021 07:35:10 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 24CE3260196; Fri, 24 Sep 2021 09:35:09 +0200 (CEST) Subject: Re: git: 903873ce1560 - main - Implement and use new mixer(3) library for FreeBSD. To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202109221803.18MI3gdA013391@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Fri, 24 Sep 2021 09:34:55 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HG3ht1GRNz4RKX 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, 24 Sep 2021 07:35:10 -0000 On 9/24/21 2:46 AM, Konstantin Belousov wrote: > On Wed, Sep 22, 2021 at 06:03:42PM +0000, Hans Petter Selasky wrote: >> The branch main has been updated by hselasky: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=903873ce15600fc02a0ea42cbf888cff232b411d >> >> commit 903873ce15600fc02a0ea42cbf888cff232b411d >> Author: Hans Petter Selasky >> AuthorDate: 2021-09-22 13:42:51 +0000 >> Commit: Hans Petter Selasky >> CommitDate: 2021-09-22 17:43:56 +0000 >> >> Implement and use new mixer(3) library for FreeBSD. >> >> Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements >> This project was part of Google Summer of Code 2021. >> >> Submitted by: christos@ >> Differential Revision: https://reviews.freebsd.org/D31636 >> Sponsored by: NVIDIA Networking > > This library is supposed to be used by user' applications, right? > If yes, it is highly desirable to provide symbol versioning from the > start. Yes. --HPS From owner-dev-commits-src-main@freebsd.org Fri Sep 24 08:28: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 1F0E6668674; Fri, 24 Sep 2021 08:28: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 4HG4tQ71x3z4XLL; Fri, 24 Sep 2021 08:28: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 CD19F130EA; Fri, 24 Sep 2021 08:28: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 18O8SURU075242; Fri, 24 Sep 2021 08:28:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O8SU4l075240; Fri, 24 Sep 2021 08:28:30 GMT (envelope-from git) Date: Fri, 24 Sep 2021 08:28:30 GMT Message-Id: <202109240828.18O8SU4l075240@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: 4f3376951d70 - main - ipsec: Add PMTUD support for IPsec IPv4 over IPv6 tunnel 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: 4f3376951d7024d1c3446af2260cef9e4d3404a6 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, 24 Sep 2021 08:28:31 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=4f3376951d7024d1c3446af2260cef9e4d3404a6 commit 4f3376951d7024d1c3446af2260cef9e4d3404a6 Author: Bartlomiej Grzesik AuthorDate: 2021-09-24 08:17:11 +0000 Commit: Wojciech Macek CommitDate: 2021-09-24 08:17:11 +0000 ipsec: Add PMTUD support for IPsec IPv4 over IPv6 tunnel Add support for checking PMTU for IPv4 packets encapsulated in IPv6 tunnels. Differential revision: https://reviews.freebsd.org/D31769 Sponsored by: Stormshield Obtained from: Semihalf --- sys/netipsec/ipsec_output.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 2f8cc12c526b..50bbd72f0589 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -305,7 +305,6 @@ ipsec4_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) uint32_t idx; int error; - /* Don't check PMTU if the frame won't have DF bit set. */ if (!V_ip4_ipsec_dfbit) return (0); @@ -335,15 +334,22 @@ setdf: } dst = &sav->sah->saidx.dst; - - /* Final header is not ipv4. */ - if (dst->sa.sa_family != AF_INET) { + memset(&inc, 0, sizeof(inc)); + switch (dst->sa.sa_family) { + case AF_INET: + inc.inc_faddr = satosin(&dst->sa)->sin_addr; + break; +#ifdef INET6 + case AF_INET6: + inc.inc6_faddr = satosin6(&dst->sa)->sin6_addr; + inc.inc_flags |= INC_ISIPV6; + break; +#endif + default: key_freesav(&sav); return (0); } - memset(&inc, 0, sizeof(inc)); - inc.inc_faddr = satosin(&dst->sa)->sin_addr; key_freesav(&sav); pmtu = tcp_hc_getmtu(&inc); /* No entry in hostcache. */ From owner-dev-commits-src-main@freebsd.org Fri Sep 24 08:28: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 2ECAE66899C; Fri, 24 Sep 2021 08:28: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 4HG4tS0hwYz4XJT; Fri, 24 Sep 2021 08:28: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 E8D2D135BE; Fri, 24 Sep 2021 08:28: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 18O8SVQJ075268; Fri, 24 Sep 2021 08:28:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O8SVQY075267; Fri, 24 Sep 2021 08:28:31 GMT (envelope-from git) Date: Fri, 24 Sep 2021 08:28:31 GMT Message-Id: <202109240828.18O8SVQY075267@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: b4220bf387e6 - main - ipsec: If no PMTU in hostcache assume it's equal to link's MTU 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: b4220bf387e62f59d73308f122f5eea887a59d58 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, 24 Sep 2021 08:28:32 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=b4220bf387e62f59d73308f122f5eea887a59d58 commit b4220bf387e62f59d73308f122f5eea887a59d58 Author: Bartlomiej Grzesik AuthorDate: 2021-09-24 08:25:53 +0000 Commit: Wojciech Macek CommitDate: 2021-09-24 08:25:53 +0000 ipsec: If no PMTU in hostcache assume it's equal to link's MTU If we fail to find to PMTU in hostcache, we assume it's equal to link's MTU. This patch prevents packets larger then link's MTU to be dropped silently if there is no PMTU in hostcache. Differential revision: https://reviews.freebsd.org/D31770 Obtained from: Semihalf Sponsored by: Stormshield --- sys/netipsec/ipsec_output.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 50bbd72f0589..c4e34665b8f5 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -352,15 +352,29 @@ setdf: key_freesav(&sav); pmtu = tcp_hc_getmtu(&inc); - /* No entry in hostcache. */ - if (pmtu == 0) - return (0); + /* No entry in hostcache. Use link MTU instead. */ + if (pmtu == 0) { + switch (dst->sa.sa_family) { + case AF_INET: + pmtu = tcp_maxmtu(&inc, NULL); + break; +#ifdef INET6 + case AF_INET6: + pmtu = tcp_maxmtu6(&inc, NULL); + break; +#endif + } + if (pmtu == 0) + return (0); + + tcp_hc_updatemtu(&inc, pmtu); + } hlen = ipsec_hdrsiz_internal(sp); if (m_length(m, NULL) + hlen > pmtu) { /* * If we're forwarding generate ICMP message here, - * so that it contains pmtu and not link mtu. + * so that it contains pmtu substraced by header size. * Set error to EINPROGRESS, in order for the frame * to be dropped silently. */ From owner-dev-commits-src-main@freebsd.org Fri Sep 24 08:28: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 85BAE66899F; Fri, 24 Sep 2021 08:28: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 4HG4tT2FrQz4XX3; Fri, 24 Sep 2021 08:28: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 1121E134B3; Fri, 24 Sep 2021 08:28: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 18O8SWlB075292; Fri, 24 Sep 2021 08:28:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O8SWBZ075291; Fri, 24 Sep 2021 08:28:32 GMT (envelope-from git) Date: Fri, 24 Sep 2021 08:28:32 GMT Message-Id: <202109240828.18O8SWBZ075291@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: 9dfc8606eb80 - main - ipsec: Add support for PMTUD for IPv6 tunnels 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: 9dfc8606eb80a49a0b071ff17dbbfa307d7248be 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, 24 Sep 2021 08:28:33 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=9dfc8606eb80a49a0b071ff17dbbfa307d7248be commit 9dfc8606eb80a49a0b071ff17dbbfa307d7248be Author: Bartlomiej Grzesik AuthorDate: 2021-09-24 08:27:21 +0000 Commit: Wojciech Macek CommitDate: 2021-09-24 08:27:21 +0000 ipsec: Add support for PMTUD for IPv6 tunnels Discard and send ICMPv6 Packet Too Big to sender when we try to encapsulate and forward a packet which total length exceeds the PMTU. Logic is based on the IPv4 implementation. Common code was moved to a separate function. Differential revision: https://reviews.freebsd.org/D31771 Obtained from: Semihalf Sponsored by: Stormshield --- sys/netipsec/ipsec6.h | 1 + sys/netipsec/ipsec_output.c | 166 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 133 insertions(+), 34 deletions(-) diff --git a/sys/netipsec/ipsec6.h b/sys/netipsec/ipsec6.h index aaba405ce0db..f690102fae2b 100644 --- a/sys/netipsec/ipsec6.h +++ b/sys/netipsec/ipsec6.h @@ -74,6 +74,7 @@ int ipsec6_output(struct mbuf *, struct inpcb *); int ipsec6_capability(struct mbuf *, u_int); int ipsec6_common_input_cb(struct mbuf *, struct secasvar *, int, int); int ipsec6_ctlinput(int, struct sockaddr *, void *); +int ipsec6_check_pmtu(struct mbuf *, struct secpolicy *, int); int ipsec6_process_packet(struct mbuf *, struct secpolicy *, struct inpcb *); int ip6_ipsec_filtertunnel(struct mbuf *); diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index c4e34665b8f5..9beb5c47444f 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -106,6 +106,7 @@ } while (0) static int ipsec_encap(struct mbuf **mp, struct secasindex *saidx); +static size_t ipsec_get_pmtu(struct secasvar *sav); #ifdef INET static struct secasvar * @@ -297,8 +298,6 @@ ipsec4_process_packet(struct mbuf *m, struct secpolicy *sp, int ipsec4_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) { - union sockaddr_union *dst; - struct in_conninfo inc; struct secasvar *sav; struct ip *ip; size_t hlen, pmtu; @@ -333,44 +332,15 @@ setdf: return (error); } - dst = &sav->sah->saidx.dst; - memset(&inc, 0, sizeof(inc)); - switch (dst->sa.sa_family) { - case AF_INET: - inc.inc_faddr = satosin(&dst->sa)->sin_addr; - break; -#ifdef INET6 - case AF_INET6: - inc.inc6_faddr = satosin6(&dst->sa)->sin6_addr; - inc.inc_flags |= INC_ISIPV6; - break; -#endif - default: + pmtu = ipsec_get_pmtu(sav); + if (pmtu == 0) { key_freesav(&sav); return (0); } + hlen = ipsec_hdrsiz_internal(sp); key_freesav(&sav); - pmtu = tcp_hc_getmtu(&inc); - /* No entry in hostcache. Use link MTU instead. */ - if (pmtu == 0) { - switch (dst->sa.sa_family) { - case AF_INET: - pmtu = tcp_maxmtu(&inc, NULL); - break; -#ifdef INET6 - case AF_INET6: - pmtu = tcp_maxmtu6(&inc, NULL); - break; -#endif - } - if (pmtu == 0) - return (0); - - tcp_hc_updatemtu(&inc, pmtu); - } - hlen = ipsec_hdrsiz_internal(sp); if (m_length(m, NULL) + hlen > pmtu) { /* * If we're forwarding generate ICMP message here, @@ -720,6 +690,72 @@ ipsec6_process_packet(struct mbuf *m, struct secpolicy *sp, return (ipsec6_perform_request(m, sp, inp, 0)); } +/* + * IPv6 implementation is based on IPv4 implementation. + */ +int +ipsec6_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) +{ + struct secasvar *sav; + size_t hlen, pmtu; + uint32_t idx; + int error; + + /* + * According to RFC8200 L3 fragmentation is supposed to be done only on + * locally generated packets. During L3 forwarding packets that are too + * big are always supposed to be dropped, with an ICMPv6 packet being + * sent back. + */ + if (!forwarding) + return (0); + + idx = sp->tcount - 1; + sav = ipsec6_allocsa(m, sp, &idx, &error); + if (sav == NULL) { + key_freesp(&sp); + /* + * No matching SA was found and SADB_ACQUIRE message was generated. + * Since we have matched a SP to this packet drop it silently. + */ + if (error == 0) + error = EINPROGRESS; + if (error != EJUSTRETURN) + m_freem(m); + + return (error); + } + + pmtu = ipsec_get_pmtu(sav); + if (pmtu == 0) { + key_freesav(&sav); + return (0); + } + + hlen = ipsec_hdrsiz_internal(sp); + key_freesav(&sav); + + if (m_length(m, NULL) + hlen > pmtu) { + /* + * If we're forwarding generate ICMPv6 message here, + * so that it contains pmtu substracted by header size. + * Set error to EINPROGRESS, in order for the frame + * to be dropped silently. + */ + if (forwarding) { + if (pmtu > hlen) + icmp6_error(m, ICMP6_PACKET_TOO_BIG, 0, pmtu - hlen); + else + m_freem(m); + + key_freesp(&sp); + return (EINPROGRESS); /* Pretend that we consumed it. */ + } + } + + return (0); +} + static int ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) { @@ -766,6 +802,15 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) } #endif } + + error = ipsec6_check_pmtu(m, sp, forwarding); + if (error != 0) { + if (error == EJUSTRETURN) + return (0); + + return (error); + } + /* NB: callee frees mbuf and releases reference to SP */ error = ipsec6_process_packet(m, sp, inp); if (error == EJUSTRETURN) { @@ -1001,6 +1046,59 @@ ipsec_prepend(struct mbuf *m, int len, int how) return (n); } +static size_t +ipsec_get_pmtu(struct secasvar *sav) +{ + union sockaddr_union *dst; + struct in_conninfo inc; + size_t pmtu; + + dst = &sav->sah->saidx.dst; + memset(&inc, 0, sizeof(inc)); + + switch (dst->sa.sa_family) { +#ifdef INET + case AF_INET: + inc.inc_faddr = satosin(&dst->sa)->sin_addr; + break; +#endif +#ifdef INET6 + case AF_INET6: + inc.inc6_faddr = satosin6(&dst->sa)->sin6_addr; + inc.inc_flags |= INC_ISIPV6; + break; +#endif + default: + return (0); + } + + pmtu = tcp_hc_getmtu(&inc); + if (pmtu != 0) + return (pmtu); + + /* No entry in hostcache. Assume that PMTU is equal to link's MTU */ + switch (dst->sa.sa_family) { +#ifdef INET + case AF_INET: + pmtu = tcp_maxmtu(&inc, NULL); + break; +#endif +#ifdef INET6 + case AF_INET6: + pmtu = tcp_maxmtu6(&inc, NULL); + break; +#endif + default: + return (0); + } + if (pmtu == 0) + return (0); + + tcp_hc_updatemtu(&inc, pmtu); + + return (pmtu); +} + static int ipsec_encap(struct mbuf **mp, struct secasindex *saidx) { From owner-dev-commits-src-main@freebsd.org Fri Sep 24 09:43: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 3788C6697FB; Fri, 24 Sep 2021 09:43: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 4HG6YP18Xyz4crG; Fri, 24 Sep 2021 09:43: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 074F81482B; Fri, 24 Sep 2021 09:43: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 18O9hqiD081115; Fri, 24 Sep 2021 09:43:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9hqfx081114; Fri, 24 Sep 2021 09:43:52 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:52 GMT Message-Id: <202109240943.18O9hqfx081114@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: cc1ce085b81f - main - man dummynet: point to dnctl instead of ipfw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc1ce085b81fbaec4ec0ddcafccc8793da032106 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, 24 Sep 2021 09:43:53 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cc1ce085b81fbaec4ec0ddcafccc8793da032106 commit cc1ce085b81fbaec4ec0ddcafccc8793da032106 Author: Kristof Provost AuthorDate: 2021-09-10 09:50:55 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:25 +0000 man dummynet: point to dnctl instead of ipfw Dummynet configuration is ideally done through dnctl now. While ipfw still works dnctl is preferred now that dummynet can also be used with pf. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31902 --- share/man/man4/dummynet.4 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/share/man/man4/dummynet.4 b/share/man/man4/dummynet.4 index 65571b3dde1f..34655f3a31d2 100644 --- a/share/man/man4/dummynet.4 +++ b/share/man/man4/dummynet.4 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2002 +.Dd September 10, 2021 .Dt DUMMYNET 4 .Os .Sh NAME @@ -18,9 +18,9 @@ management policies, and emulating delays and losses. The user interface for .Nm is implemented by the -.Xr ipfw 8 +.Xr dnctl 8 utility, so please refer to the -.Xr ipfw 8 +.Xr dnctl 8 manpage for a complete description of the .Nm capabilities and how to use it. @@ -61,6 +61,7 @@ pipes. .Xr if_bridge 4 , .Xr ip 4 , .Xr ipfw 8 , +.Xr dnctl 8 , .Xr sysctl 8 .Sh HISTORY The From owner-dev-commits-src-main@freebsd.org Fri Sep 24 09:43: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 CEEF3669BB6; Fri, 24 Sep 2021 09:43: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 4HG6YR2yFYz4clc; Fri, 24 Sep 2021 09:43:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D29614445; Fri, 24 Sep 2021 09:43:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O9htOA081163; Fri, 24 Sep 2021 09:43:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9htUL081162; Fri, 24 Sep 2021 09:43:55 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:55 GMT Message-Id: <202109240943.18O9htUL081162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 63b3c1c77036 - main - pf: support dummynet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63b3c1c77036814c85d36fe7a48c704db7c6fc9c 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, 24 Sep 2021 09:43:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=63b3c1c77036814c85d36fe7a48c704db7c6fc9c commit 63b3c1c77036814c85d36fe7a48c704db7c6fc9c Author: Kristof Provost AuthorDate: 2021-05-15 11:49:22 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:25 +0000 pf: support dummynet Allow pf to use dummynet pipes and queues. We re-use the currently unused IPFW_IS_DUMMYNET flag to allow dummynet to tell us that a packet is being re-injected after being delayed. This is needed to avoid endlessly looping the packet between pf and dummynet. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31904 --- lib/libpfctl/libpfctl.c | 6 ++ lib/libpfctl/libpfctl.h | 3 + sbin/pfctl/parse.y | 41 ++++++++++ sbin/pfctl/pfctl_parser.c | 9 +++ sys/net/pfvar.h | 10 +++ sys/netpfil/ipfw/ip_dn_io.c | 3 +- sys/netpfil/pf/pf.c | 182 +++++++++++++++++++++++++++++++++++++++++++- sys/netpfil/pf/pf_nv.c | 6 ++ 8 files changed, 256 insertions(+), 4 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 3d52502f9ba8..576b256155fb 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -480,6 +480,9 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) nvlist_get_number(nvl, "max_src_conn_rate.seconds"); rule->qid = nvlist_get_number(nvl, "qid"); rule->pqid = nvlist_get_number(nvl, "pqid"); + rule->dnpipe = nvlist_get_number(nvl, "dnpipe"); + rule->dnrpipe = nvlist_get_number(nvl, "dnrpipe"); + rule->free_flags = nvlist_get_number(nvl, "dnflags"); rule->prob = nvlist_get_number(nvl, "prob"); rule->cuid = nvlist_get_number(nvl, "cuid"); rule->cpid = nvlist_get_number(nvl, "cpid"); @@ -584,6 +587,9 @@ pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, r->max_src_conn_rate.limit); nvlist_add_number(nvlr, "max_src_conn_rate.seconds", r->max_src_conn_rate.seconds); + nvlist_add_number(nvlr, "dnpipe", r->dnpipe); + nvlist_add_number(nvlr, "dnrpipe", r->dnrpipe); + nvlist_add_number(nvlr, "dnflags", r->free_flags); nvlist_add_number(nvlr, "prob", r->prob); nvlist_add_number(nvlr, "cuid", r->cuid); nvlist_add_number(nvlr, "cpid", r->cpid); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 70de7627f0a6..f57497b4a88a 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -114,6 +114,9 @@ struct pfctl_rule { } max_src_conn_rate; u_int32_t qid; u_int32_t pqid; + u_int16_t dnpipe; + u_int16_t dnrpipe; + u_int32_t free_flags; u_int32_t nr; u_int32_t prob; uid_t cuid; diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index dbfe299cf34f..6bcf5a0bc397 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -248,6 +248,9 @@ static struct filter_opts { char *tag; char *match_tag; u_int8_t match_tag_not; + u_int16_t dnpipe; + u_int16_t dnrpipe; + u_int32_t free_flags; u_int rtableid; u_int8_t prio; u_int8_t set_prio[2]; @@ -468,6 +471,7 @@ int parseport(char *, struct range *r, int); %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY MAPEPORTSET %token ALTQ CBQ CODEL PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME %token UPPERLIMIT QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE TARGET INTERVAL +%token DNPIPE DNQUEUE %token LOAD RULESET_OPTIMIZATION PRIO %token STICKYADDRESS MAXSRCSTATES MAXSRCNODES SOURCETRACK GLOBAL RULE %token MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH SLOPPY @@ -2464,6 +2468,15 @@ pfrule : action dir logquick interface route af proto fromto } #endif + if ($9.dnpipe || $9.dnrpipe) { + r.dnpipe = $9.dnpipe; + r.dnrpipe = $9.dnrpipe; + if ($9.free_flags & PFRULE_DN_IS_PIPE) + r.free_flags |= PFRULE_DN_IS_PIPE; + else + r.free_flags |= PFRULE_DN_IS_QUEUE; + } + expand_rule(&r, $4, $5.host, $7, $8.src_os, $8.src.host, $8.src.port, $8.dst.host, $8.dst.port, $9.uid, $9.gid, $9.icmpspec, ""); @@ -2565,6 +2578,32 @@ filter_opt : USER uids { } filter_opts.queues = $1; } + | DNPIPE number { + filter_opts.dnpipe = $2; + filter_opts.free_flags |= PFRULE_DN_IS_PIPE; + } + | DNPIPE '(' number ')' { + filter_opts.dnpipe = $3; + filter_opts.free_flags |= PFRULE_DN_IS_PIPE; + } + | DNPIPE '(' number comma number ')' { + filter_opts.dnrpipe = $5; + filter_opts.dnpipe = $3; + filter_opts.free_flags |= PFRULE_DN_IS_PIPE; + } + | DNQUEUE number { + filter_opts.dnpipe = $2; + filter_opts.free_flags |= PFRULE_DN_IS_QUEUE; + } + | DNQUEUE '(' number comma number ')' { + filter_opts.dnrpipe = $5; + filter_opts.dnpipe = $3; + filter_opts.free_flags |= PFRULE_DN_IS_QUEUE; + } + | DNQUEUE '(' number ')' { + filter_opts.dnpipe = $3; + filter_opts.free_flags |= PFRULE_DN_IS_QUEUE; + } | TAG string { filter_opts.tag = $2; } @@ -5592,6 +5631,8 @@ lookup(char *s) { "debug", DEBUG}, { "divert-reply", DIVERTREPLY}, { "divert-to", DIVERTTO}, + { "dnpipe", DNPIPE}, + { "dnqueue", DNQUEUE}, { "drop", DROP}, { "drop-ovl", FRAGDROP}, { "dup-to", DUPTO}, diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 89c9bc349ca3..131ad22123e2 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1018,6 +1018,15 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer i = 0; while (r->label[i][0]) printf(" label \"%s\"", r->label[i++]); + /* Only dnrpipe as we might do (0, 42) to only queue return traffic. */ + if (r->dnrpipe) + printf(" %s(%d, %d)", + r->free_flags & PFRULE_DN_IS_PIPE ? "dnpipe" : "dnqueue", + r->dnpipe, r->dnrpipe); + else if (r->dnpipe) + printf(" %s %d", + r->free_flags & PFRULE_DN_IS_PIPE ? "dnpipe" : "dnqueue", + r->dnpipe); if (r->qname[0] && r->pqname[0]) printf(" queue(%s, %s)", r->qname, r->pqname); else if (r->qname[0]) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 2c5c0037cb92..b2c177fba68c 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -563,6 +563,9 @@ struct pf_kpool { struct pf_rule_actions { uint16_t qid; uint16_t pqid; + uint16_t dnpipe; + uint16_t dnrpipe; /* Reverse direction pipe */ + uint32_t flags; }; union pf_krule_ptr { @@ -608,6 +611,9 @@ struct pf_krule { } max_src_conn_rate; u_int16_t qid; u_int16_t pqid; + u_int16_t dnpipe; + u_int16_t dnrpipe; + u_int32_t free_flags; u_int32_t nr; u_int32_t prob; uid_t cuid; @@ -755,6 +761,8 @@ struct pf_state_cmp { /* was PFSTATE_PFLOW 0x04 */ #define PFSTATE_NOSYNC 0x08 #define PFSTATE_ACK 0x10 +#define PFRULE_DN_IS_PIPE 0x40 +#define PFRULE_DN_IS_QUEUE 0x80 #define PFSTATE_SETPRIO 0x0200 #define PFSTATE_SETMASK (PFSTATE_SETPRIO) @@ -858,6 +866,8 @@ struct pf_kstate { u_int32_t pfsync_time; u_int16_t qid; u_int16_t pqid; + u_int16_t dnpipe; + u_int16_t dnrpipe; u_int16_t tag; u_int8_t log; }; diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index dad5cb087b39..11ad498505f4 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -841,7 +841,8 @@ tag_mbuf(struct mbuf *m, int dir, struct ip_fw_args *fwa) m_tag_prepend(m, mtag); /* Attach to mbuf chain. */ dt = (struct dn_pkt_tag *)(mtag + 1); dt->rule = fwa->rule; - dt->rule.info &= IPFW_ONEPASS; /* only keep this info */ + /* only keep this info */ + dt->rule.info &= (IPFW_ONEPASS | IPFW_IS_DUMMYNET); dt->dn_dir = dir; dt->ifp = fwa->flags & IPFW_ARGS_OUT ? fwa->ifp : NULL; /* dt->output tame is updated as we move through */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 1d492370953a..ac329a37f7bd 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -94,6 +94,13 @@ __FBSDID("$FreeBSD$"); #include #include +/* dummynet */ +#include +#include +#include +#include +#include + #ifdef INET6 #include #include @@ -3310,6 +3317,12 @@ pf_rule_to_actions(struct pf_krule *r, struct pf_rule_actions *a) a->qid = r->qid; if (r->pqid) a->pqid = r->pqid; + if (r->dnpipe) + a->dnpipe = r->dnpipe; + if (r->dnrpipe) + a->dnpipe = r->dnrpipe; + if (r->free_flags & PFRULE_DN_IS_PIPE) + a->flags |= PFRULE_DN_IS_PIPE; } int @@ -3982,6 +3995,9 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->sync_state = PFSYNC_S_NONE; s->qid = pd->act.qid; s->pqid = pd->act.pqid; + s->dnpipe = pd->act.dnpipe; + s->dnrpipe = pd->act.dnrpipe; + s->state_flags |= pd->act.flags; if (nr != NULL) s->log |= nr->log & PF_LOG_ALL; switch (pd->proto) { @@ -6226,6 +6242,64 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, u_int8_t p, sa_family_t a return (0); } +static bool +pf_pdesc_to_dnflow(int dir, const struct pf_pdesc *pd, + const struct pf_krule *r, const struct pf_kstate *s, + struct ip_fw_args *dnflow) +{ + int dndir = r->direction; + + if (s && dndir == PF_INOUT) + dndir = s->direction; + + memset(dnflow, 0, sizeof(*dnflow)); + + if (pd->dport != NULL) + dnflow->f_id.dst_port = ntohs(*pd->dport); + if (pd->sport != NULL) + dnflow->f_id.src_port = ntohs(*pd->sport); + + if (dir == PF_IN) + dnflow->flags |= IPFW_ARGS_IN; + else + dnflow->flags |= IPFW_ARGS_OUT; + + if (dir != dndir && pd->act.dnrpipe) { + dnflow->rule.info = pd->act.dnrpipe; + } + else if (dir == dndir) { + dnflow->rule.info = pd->act.dnpipe; + } + else { + return (false); + } + + dnflow->rule.info |= IPFW_IS_DUMMYNET; + if (r->free_flags & PFRULE_DN_IS_PIPE) + dnflow->rule.info |= IPFW_IS_PIPE; + + dnflow->f_id.proto = pd->proto; + dnflow->f_id.extra = dnflow->rule.info; + switch (pd->af) { + case AF_INET: + dnflow->f_id.addr_type = 4; + dnflow->f_id.src_ip = ntohl(pd->src->v4.s_addr); + dnflow->f_id.dst_ip = ntohl(pd->dst->v4.s_addr); + break; + case AF_INET6: + dnflow->flags |= IPFW_ARGS_IP6; + dnflow->f_id.addr_type = 6; + dnflow->f_id.src_ip6 = pd->src->v6; + dnflow->f_id.dst_ip6 = pd->dst->v6; + break; + default: + panic("Invalid AF"); + break; + } + + return (true); +} + #ifdef INET int pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) @@ -6267,10 +6341,11 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * PF_RULES_RLOCK(); - if (__predict_false(ip_divert_ptr != NULL) && + if ((__predict_false(ip_divert_ptr != NULL) || ip_dn_io_ptr != NULL) && ((ipfwtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL)) != NULL)) { struct ipfw_rule_ref *rr = (struct ipfw_rule_ref *)(ipfwtag+1); - if (rr->info & IPFW_IS_DIVERT && rr->rulenum == 0) { + if ((rr->info & IPFW_IS_DIVERT && rr->rulenum == 0) || + (rr->info & IPFW_IS_DUMMYNET)) { if (pd.pf_mtag == NULL && ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; @@ -6405,6 +6480,8 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * log = action != PF_PASS; goto done; } + pd.sport = &pd.hdr.udp.uh_sport; + pd.dport = &pd.hdr.udp.uh_dport; if (pd.hdr.udp.uh_dport == 0 || ntohs(pd.hdr.udp.uh_ulen) > m->m_pkthdr.len - off || ntohs(pd.hdr.udp.uh_ulen) < sizeof(struct udphdr)) { @@ -6524,6 +6601,47 @@ done: } #endif /* ALTQ */ + if (s && (s->dnpipe || s->dnrpipe)) { + pd.act.dnpipe = s->dnpipe; + pd.act.dnrpipe = s->dnrpipe; + pd.act.flags = s->state_flags; + } else if (r->dnpipe || r->dnrpipe) { + pd.act.dnpipe = r->dnpipe; + pd.act.dnrpipe = r->dnrpipe; + pd.act.flags = r->free_flags; + } + if ((pd.act.dnpipe || pd.act.dnrpipe) && !PACKET_LOOPED(&pd)) { + if (ip_dn_io_ptr == NULL) { + action = PF_DROP; + REASON_SET(&reason, PFRES_MEMORY); + } else { + struct ip_fw_args dnflow; + + if (pd.pf_mtag == NULL && + ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { + action = PF_DROP; + REASON_SET(&reason, PFRES_MEMORY); + if (s) + PF_STATE_UNLOCK(s); + return (action); + } + + if (pf_pdesc_to_dnflow(dir, &pd, r, s, &dnflow)) { + ip_dn_io_ptr(m0, &dnflow); + + if (*m0 == NULL) { + if (s) + PF_STATE_UNLOCK(s); + return (action); + } else { + /* This is dummynet fast io processing */ + m_tag_delete(*m0, m_tag_first(*m0)); + pd.pf_mtag->flags &= ~PF_PACKET_LOOPED; + } + } + } + } + /* * connections redirected to loopback should not match sockets * bound specifically to loopback due to security implications, @@ -6684,6 +6802,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb u_short action, reason = 0, log = 0; struct mbuf *m = *m0, *n = NULL; struct m_tag *mtag; + struct m_tag *ipfwtag; struct ip6_hdr *h = NULL; struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; struct pf_kstate *s = NULL; @@ -6719,7 +6838,19 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb PF_RULES_RLOCK(); /* We do IP header normalization and packet reassembly here */ - if (pf_normalize_ip6(m0, dir, kif, &reason, &pd) != PF_PASS) { + if (ip_dn_io_ptr != NULL && + ((ipfwtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL)) != NULL)) { + struct ipfw_rule_ref *rr = (struct ipfw_rule_ref *)(ipfwtag+1); + if (rr->info & IPFW_IS_DUMMYNET) { + if (pd.pf_mtag == NULL && + ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { + action = PF_DROP; + goto done; + } + pd.pf_mtag->flags |= PF_PACKET_LOOPED; + m_tag_delete(m, ipfwtag); + } + } else if (pf_normalize_ip6(m0, dir, kif, &reason, &pd) != PF_PASS) { action = PF_DROP; goto done; } @@ -6828,6 +6959,8 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb goto done; } pd.p_len = pd.tot_len - off - (pd.hdr.tcp.th_off << 2); + pd.sport = &pd.hdr.tcp.th_sport; + pd.dport = &pd.hdr.tcp.th_dport; action = pf_normalize_tcp(dir, kif, m, 0, off, h, &pd); if (action == PF_DROP) goto done; @@ -6851,6 +6984,8 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb log = action != PF_PASS; goto done; } + pd.sport = &pd.hdr.udp.uh_sport; + pd.dport = &pd.hdr.udp.uh_dport; if (pd.hdr.udp.uh_dport == 0 || ntohs(pd.hdr.udp.uh_ulen) > m->m_pkthdr.len - off || ntohs(pd.hdr.udp.uh_ulen) < sizeof(struct udphdr)) { @@ -6974,6 +7109,47 @@ done: } #endif /* ALTQ */ + if (s && (s->dnpipe || s->dnrpipe)) { + pd.act.dnpipe = s->dnpipe; + pd.act.dnrpipe = s->dnrpipe; + pd.act.flags = s->state_flags; + } else { + pd.act.dnpipe = r->dnpipe; + pd.act.dnrpipe = r->dnrpipe; + pd.act.flags = r->free_flags; + } + if ((pd.act.dnpipe || pd.act.dnrpipe) && !PACKET_LOOPED(&pd)) { + if (ip_dn_io_ptr == NULL) { + action = PF_DROP; + REASON_SET(&reason, PFRES_MEMORY); + } else { + struct ip_fw_args dnflow; + + if (pd.pf_mtag == NULL && + ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { + action = PF_DROP; + REASON_SET(&reason, PFRES_MEMORY); + if (s) + PF_STATE_UNLOCK(s); + return (action); + } + + if (pf_pdesc_to_dnflow(dir, &pd, r, s, &dnflow)) { + ip_dn_io_ptr(m0, &dnflow); + + if (*m0 == NULL) { + if (s) + PF_STATE_UNLOCK(s); + return (action); + } else { + /* This is dummynet fast io processing */ + m_tag_delete(*m0, m_tag_first(*m0)); + pd.pf_mtag->flags &= ~PF_PACKET_LOOPED; + } + } + } + } + if (dir == PF_IN && action == PF_PASS && (pd.proto == IPPROTO_TCP || pd.proto == IPPROTO_UDP) && s != NULL && s->nat_rule.ptr != NULL && (s->nat_rule.ptr->action == PF_RDR || diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index d1eca90e0ee5..fb2bab77ad8f 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -527,6 +527,9 @@ pf_nvrule_to_krule(const nvlist_t *nvl, struct pf_krule *rule) sizeof(rule->pqname))); PFNV_CHK(pf_nvstring(nvl, "tagname", rule->tagname, sizeof(rule->tagname))); + PFNV_CHK(pf_nvuint16_opt(nvl, "dnpipe", &rule->dnpipe, 0)); + PFNV_CHK(pf_nvuint16_opt(nvl, "dnrpipe", &rule->dnrpipe, 0)); + PFNV_CHK(pf_nvuint32_opt(nvl, "dnflags", &rule->free_flags, 0)); PFNV_CHK(pf_nvstring(nvl, "match_tagname", rule->match_tagname, sizeof(rule->match_tagname))); PFNV_CHK(pf_nvstring(nvl, "overload_tblname", rule->overload_tblname, @@ -687,6 +690,9 @@ pf_krule_to_nvrule(struct pf_krule *rule) nvlist_add_string(nvl, "ifname", rule->ifname); nvlist_add_string(nvl, "qname", rule->qname); nvlist_add_string(nvl, "pqname", rule->pqname); + nvlist_add_number(nvl, "dnpipe", rule->dnpipe); + nvlist_add_number(nvl, "dnrpipe", rule->dnrpipe); + nvlist_add_number(nvl, "dnflags", rule->free_flags); nvlist_add_string(nvl, "tagname", rule->tagname); nvlist_add_string(nvl, "match_tagname", rule->match_tagname); nvlist_add_string(nvl, "overload_tblname", rule->overload_tblname); From owner-dev-commits-src-main@freebsd.org Fri Sep 24 09:43:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5B09669BB9; Fri, 24 Sep 2021 09:43:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HG6YS41hQz4d32; Fri, 24 Sep 2021 09:43:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DF7014899; Fri, 24 Sep 2021 09:43:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18O9huhJ081194; Fri, 24 Sep 2021 09:43:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9huvv081193; Fri, 24 Sep 2021 09:43:56 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:56 GMT Message-Id: <202109240943.18O9huvv081193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ab55fa11b38f - main - netpfil tests: extend dummynet tests to pf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab55fa11b38f1794f39c2a94595b088e4c191cfb 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, 24 Sep 2021 09:43:56 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ab55fa11b38f1794f39c2a94595b088e4c191cfb commit ab55fa11b38f1794f39c2a94595b088e4c191cfb Author: Kristof Provost AuthorDate: 2021-09-06 15:13:19 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:25 +0000 netpfil tests: extend dummynet tests to pf Now that pf can also use dummynet we should extend the existing dummynet tests to also test it when used with pf. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31905 --- tests/sys/netpfil/common/dummynet.sh | 32 +++++++++++++++++++++++--------- tests/sys/netpfil/common/utils.subr | 9 ++++++--- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh index 7ff9a1e18fdc..644b36516b5a 100644 --- a/tests/sys/netpfil/common/dummynet.sh +++ b/tests/sys/netpfil/common/dummynet.sh @@ -53,7 +53,9 @@ pipe_body() firewall_config alcatraz ${fw} \ "ipfw" \ - "ipfw add 1000 pipe 1 ip from any to any" + "ipfw add 1000 pipe 1 ip from any to any" \ + "pf" \ + "pass dnpipe 1" # single ping succeeds just fine atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 @@ -95,7 +97,9 @@ pipe_v6_body() firewall_config alcatraz ${fw} \ "ipfw" \ - "ipfw add 1000 pipe 1 ip6 from any to any" + "ipfw add 1000 pipe 1 ip6 from any to any" \ + "pf" \ + "pass dnpipe 1" # Single ping succeeds atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 @@ -149,7 +153,10 @@ queue_body() "ipfw" \ "ipfw add 1000 queue 100 tcp from 192.0.2.2 to any out" \ "ipfw add 1001 queue 200 icmp from 192.0.2.2 to any out" \ - "ipfw add 1002 allow ip from any to any" + "ipfw add 1002 allow ip from any to any" \ + "pf" \ + "pass in proto tcp dnqueue (0, 100)" \ + "pass in proto icmp dnqueue (0, 200)" # Single ping succeeds atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 @@ -188,7 +195,10 @@ queue_body() "ipfw" \ "ipfw add 1000 queue 200 tcp from 192.0.2.2 to any out" \ "ipfw add 1001 queue 100 icmp from 192.0.2.2 to any out" \ - "ipfw add 1002 allow ip from any to any" + "ipfw add 1002 allow ip from any to any" \ + "pf" \ + "pass in proto tcp dnqueue (0, 200)" \ + "pass in proto icmp dnqueue (0, 100)" jexec alcatraz ping -f -s 1300 192.0.2.1 & sleep 1 @@ -253,8 +263,8 @@ queue_v6_body() "ipfw add 1000 queue 200 ipv6-icmp from 2001:db8:42::2 to any out" \ "ipfw add 1002 allow ip6 from any to any" \ "pf" \ - "pass out proto tcp dnqueue 100" \ - "pass out proto icmp6 dnqueue 200" + "pass in proto tcp dnqueue (0, 100)" \ + "pass in proto icmp6 dnqueue (0, 200)" # Single ping succeeds atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 @@ -295,8 +305,8 @@ queue_v6_body() "ipfw add 1000 queue 100 ipv6-icmp from 2001:db8:42::2 to any out" \ "ipfw add 1002 allow ip6 from any to any" \ "pf" \ - "pass out proto tcp dnqueue 200" \ - "pass out proto icmp6 dnqueue 100" + "pass in proto tcp dnqueue (0, 200)" \ + "pass in proto icmp6 dnqueue (0, 100)" fails=0 for i in `seq 1 3` @@ -322,9 +332,13 @@ queue_v6_cleanup() setup_tests \ pipe \ ipfw \ + pf \ pipe_v6 \ ipfw \ + pf \ queue \ ipfw \ + pf \ queue_v6 \ - ipfw + ipfw \ + pf diff --git a/tests/sys/netpfil/common/utils.subr b/tests/sys/netpfil/common/utils.subr index 722271981af4..43cd856b2e87 100644 --- a/tests/sys/netpfil/common/utils.subr +++ b/tests/sys/netpfil/common/utils.subr @@ -111,11 +111,14 @@ dummynet_init() atf_skip "This test requires dummynet" fi - if [ ${firewall} == "ipfw" ]; then + case $firewall in + ipfw|pf) # Nothing. This is okay. - else + ;; + *) atf_skip "${firewall} does not support dummynet" - fi + ;; + esac } nat_init() From owner-dev-commits-src-main@freebsd.org Fri Sep 24 09:43: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 7A0B8669EAD; Fri, 24 Sep 2021 09:43: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 4HG6YQ2W8fz4d27; Fri, 24 Sep 2021 09:43: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 29BEB1471F; Fri, 24 Sep 2021 09:43: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 18O9hsSv081139; Fri, 24 Sep 2021 09:43:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9hsMS081138; Fri, 24 Sep 2021 09:43:54 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:54 GMT Message-Id: <202109240943.18O9hsMS081138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 8160a0f62be6 - main - dummynet: Does not depend on ipfw MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8160a0f62be6dd778172520f253ba057971a8122 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, 24 Sep 2021 09:43:54 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8160a0f62be6dd778172520f253ba057971a8122 commit 8160a0f62be6dd778172520f253ba057971a8122 Author: Kristof Provost AuthorDate: 2021-05-13 13:56:50 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:25 +0000 dummynet: Does not depend on ipfw Allow the dummynet module to be loaded without ipfw, as a first step towards making pf use it for packet scheduling. Reviewed by: donner Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31903 --- sys/netpfil/ipfw/ip_dummynet.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index d3242fd85817..a890507f7b31 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -2735,7 +2735,6 @@ static moduledata_t dummynet_mod = { #define DN_SI_SUB SI_SUB_PROTO_FIREWALL #define DN_MODEV_ORD (SI_ORDER_ANY - 128) /* after ipfw */ DECLARE_MODULE(dummynet, dummynet_mod, DN_SI_SUB, DN_MODEV_ORD); -MODULE_DEPEND(dummynet, ipfw, 3, 3, 3); MODULE_VERSION(dummynet, 3); /* From owner-dev-commits-src-main@freebsd.org Fri Sep 24 09:43: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 071FE669A65; Fri, 24 Sep 2021 09:43: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 4HG6YV5zmLz4cXb; Fri, 24 Sep 2021 09:43: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 9EAAE143F7; Fri, 24 Sep 2021 09:43: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 18O9hwwS081242; Fri, 24 Sep 2021 09:43:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9hw8U081241; Fri, 24 Sep 2021 09:43:58 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:58 GMT Message-Id: <202109240943.18O9hw8U081241@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 00a7a05bde84 - main - pf.conf.5: document dummynet support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00a7a05bde8481a58860253daf86661372ae3b72 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, 24 Sep 2021 09:43:59 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=00a7a05bde8481a58860253daf86661372ae3b72 commit 00a7a05bde8481a58860253daf86661372ae3b72 Author: Kristof Provost AuthorDate: 2021-09-10 12:42:44 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:26 +0000 pf.conf.5: document dummynet support MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31907 --- share/man/man5/pf.conf.5 | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 7b97657d7d1c..1bc7f147e830 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -28,7 +28,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 19, 2021 +.Dd September 10, 2021 .Dt PF.CONF 5 .Os .Sh NAME @@ -772,7 +772,7 @@ much in the same way as works in the packet filter (see below). This mechanism should be used when it is necessary to exclude specific packets from broader scrub rules. -.Sh QUEUEING +.Sh QUEUEING with ALTQ The ALTQ system is currently not available in the GENERIC kernel nor as loadable modules. In order to use the herein after called queueing options one has to use a @@ -1104,6 +1104,33 @@ pass out on dc0 inet proto tcp from any to any port 22 \e pass out on dc0 inet proto tcp from any to any port 25 \e queue mail .Ed +.Sh QUEUEING with dummynet +Queueing can also be done with +.Xr dummynet 4 . +Queues and pipes can be created with +.Xr dnctl 8 . +.Pp +Packets can be assigned to queues and pipes using +.Ar dnqueue +and +.Ar dnpipe +respectively. +.Pp +Both +.Ar dnqueue +and +.Ar dnpipe +take either a single pipe or queue number or two numbers as arguments. +The first pipe or queue number will be used to shape the traffic in the rule +direction, the second will be used to shape the traffic in the reverse +direction. +If the rule does not specify a direction the first packet to create state will +be shaped according to the first number, and the response traffic according to +the second. +.Pp +If the +.Xr dummynet 4 +module is not loaded any traffic sent into a queue or pipe will be dropped. .Sh TRANSLATION Translation rules modify either the source or destination address of the packets associated with a stateful connection. @@ -1324,7 +1351,9 @@ rules in that parameters are set every time a packet matches the rule, not only on the last matching rule. For the following parameters, this means that the parameter effectively becomes "sticky" until explicitly overridden: -.Ar queue +.Ar queue , +.Ar dnpipe , +.Ar dnqueue . .It Ar pass The packet is passed; @@ -2941,7 +2970,9 @@ filteropt = user | group | flags | icmp-type | icmp6-type | "tos" tos | "label" string | "tag" string | [ ! ] "tagged" string | "set prio" ( number | "(" number [ [ "," ] number ] ")" ) | "queue" ( string | "(" string [ [ "," ] string ] ")" ) | - "rtable" number | "probability" number"%" | "prio" number + "rtable" number | "probability" number"%" | "prio" number | + "dnpipe" ( number | "(" number "," number ")" ) | + "dnqueue" ( number | "(" number "," number ")" ) nat-rule = [ "no" ] "nat" [ "pass" [ "log" [ "(" logopts ")" ] ] ] [ "on" ifspec ] [ af ] From owner-dev-commits-src-main@freebsd.org Fri Sep 24 09:43: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 2AB93669AF3; Fri, 24 Sep 2021 09:43: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 4HG6YT4Jvvz4cv4; Fri, 24 Sep 2021 09:43: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 728361482C; Fri, 24 Sep 2021 09:43: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 18O9hvWO081218; Fri, 24 Sep 2021 09:43:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18O9hvYk081217; Fri, 24 Sep 2021 09:43:57 GMT (envelope-from git) Date: Fri, 24 Sep 2021 09:43:57 GMT Message-Id: <202109240943.18O9hvYk081217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c8607bf4e7c1 - main - man dummynet: dummynet can also be used with pf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8607bf4e7c1c94e42377792570c6324cc580c1c 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, 24 Sep 2021 09:43:58 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c8607bf4e7c1c94e42377792570c6324cc580c1c commit c8607bf4e7c1c94e42377792570c6324cc580c1c Author: Kristof Provost AuthorDate: 2021-09-10 11:03:24 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 09:41:26 +0000 man dummynet: dummynet can also be used with pf MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31906 --- share/man/man4/dummynet.4 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/share/man/man4/dummynet.4 b/share/man/man4/dummynet.4 index 34655f3a31d2..ca5d33c51b73 100644 --- a/share/man/man4/dummynet.4 +++ b/share/man/man4/dummynet.4 @@ -31,8 +31,9 @@ operation: .Pp .Bl -tag -width ".Dv IPFIREWALL_VERBOSE_LIMIT" -offset indent -compact .It Dv IPFIREWALL -enable ipfirewall (required for -.Nm ) +enable ipfirewall (if +.Nm +is to be used with ipfw) .It Dv IPFIREWALL_VERBOSE enable firewall output .It Dv IPFIREWALL_VERBOSE_LIMIT @@ -62,6 +63,7 @@ pipes. .Xr ip 4 , .Xr ipfw 8 , .Xr dnctl 8 , +.Xr pf.conf 5 , .Xr sysctl 8 .Sh HISTORY The From owner-dev-commits-src-main@freebsd.org Fri Sep 24 12:28:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3ABAE66CCA9; Fri, 24 Sep 2021 12:28:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGBCf192nz4mnG; Fri, 24 Sep 2021 12:28:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0816B1691D; Fri, 24 Sep 2021 12:28:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18OCSj0V093804; Fri, 24 Sep 2021 12:28:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OCSjXK093803; Fri, 24 Sep 2021 12:28:45 GMT (envelope-from git) Date: Fri, 24 Sep 2021 12:28:45 GMT Message-Id: <202109241228.18OCSjXK093803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: de2a0fafe6f9 - main - cxgbe: fix LINT-NOIP builds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de2a0fafe6f96b57619988824b9525c8a9905cfb 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, 24 Sep 2021 12:28:46 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=de2a0fafe6f96b57619988824b9525c8a9905cfb commit de2a0fafe6f96b57619988824b9525c8a9905cfb Author: Kristof Provost AuthorDate: 2021-09-24 08:31:27 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 12:21:18 +0000 cxgbe: fix LINT-NOIP builds The -NOIP builds fail because cxgbe_tls_tag_free() has no prototype (if neither INET nor INET6 are defined). The function isn't actually used in that case, so we can just remove the stub implementation. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/cxgbe/crypto/t4_kern_tls.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/dev/cxgbe/crypto/t4_kern_tls.c b/sys/dev/cxgbe/crypto/t4_kern_tls.c index f8d5e54cc3b5..725d15e9cb35 100644 --- a/sys/dev/cxgbe/crypto/t4_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t4_kern_tls.c @@ -2138,12 +2138,6 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struct mbuf *m, u_int nsegs, panic("can't happen"); } -void -cxgbe_tls_tag_free(struct m_snd_tag *mst) -{ - panic("can't happen"); -} - void t6_ktls_modload(void) { From owner-dev-commits-src-main@freebsd.org Fri Sep 24 12:28: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 71F7766CCB7; Fri, 24 Sep 2021 12:28: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 4HGBCg2MNyz4mnJ; Fri, 24 Sep 2021 12:28: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 2B4C11654B; Fri, 24 Sep 2021 12:28: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 18OCSlt1093830; Fri, 24 Sep 2021 12:28:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OCSltT093829; Fri, 24 Sep 2021 12:28:47 GMT (envelope-from git) Date: Fri, 24 Sep 2021 12:28:47 GMT Message-Id: <202109241228.18OCSltT093829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 9cce0ef95a07 - main - UPDATING: new entry about dummynet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9cce0ef95a07bab80e768d4dc6cf1aab8baaff70 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, 24 Sep 2021 12:28:47 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9cce0ef95a07bab80e768d4dc6cf1aab8baaff70 commit 9cce0ef95a07bab80e768d4dc6cf1aab8baaff70 Author: Kristof Provost AuthorDate: 2021-09-24 12:19:39 +0000 Commit: Kristof Provost CommitDate: 2021-09-24 12:21:25 +0000 UPDATING: new entry about dummynet Dummynet now no longer requires ipfw, so any users relying on this dependency to load ipfw will need to explicitly load ipfw. While here fix a typo in the date of the previous entry. Sponsored by: Rubicon Communications, LLC ("Netgate") --- UPDATING | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 4b41612dfbc3..34f2a1ee145b 100644 --- a/UPDATING +++ b/UPDATING @@ -27,7 +27,13 @@ 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".) -202010922: +20210923: + As of commit 8160a0f62be6, the dummynet module no longer depends on the + ipfw module. Dummynet can now be used by pf as well as ipfw. As such + users who relied on this dependency may need to include ipfw in the + list of modules to load on their systems. + +20210922: As of commit 903873ce1560, the mixer(8) utility has got a slightly new syntax. Please refer to the mixer(8) manual page for more information. From owner-dev-commits-src-main@freebsd.org Fri Sep 24 15:32: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 2348566EBE7; Fri, 24 Sep 2021 15:32: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 4HGGH506LVz3FtK; Fri, 24 Sep 2021 15:32: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 D830F19488; Fri, 24 Sep 2021 15:32:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18OFW0Is047714; Fri, 24 Sep 2021 15:32:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OFW0rb047713; Fri, 24 Sep 2021 15:32:00 GMT (envelope-from git) Date: Fri, 24 Sep 2021 15:32:00 GMT Message-Id: <202109241532.18OFW0rb047713@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: d7cf1b262f9f - main - tests/sys/sys: Raise WARNS 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: d7cf1b262f9ff5e799446f0cbbd007905ab4ae24 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, 24 Sep 2021 15:32:01 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d7cf1b262f9ff5e799446f0cbbd007905ab4ae24 commit d7cf1b262f9ff5e799446f0cbbd007905ab4ae24 Author: Mark Johnston AuthorDate: 2021-09-24 15:31:53 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 15:31:53 +0000 tests/sys/sys: Raise WARNS MFC after: 1 week Sponsored by: The FreeBSD Foundation --- tests/sys/sys/Makefile | 2 -- tests/sys/sys/arb_test.c | 2 +- tests/sys/sys/rb_test.c | 2 +- tests/sys/sys/splay_test.c | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/sys/sys/Makefile b/tests/sys/sys/Makefile index eed87935e6e7..95739c127632 100644 --- a/tests/sys/sys/Makefile +++ b/tests/sys/sys/Makefile @@ -6,8 +6,6 @@ TESTSDIR= ${TESTSBASE}/sys/sys ATF_TESTS_C= arb_test bitstring_test qmath_test rb_test splay_test -WARNS?= 5 - .if ${COMPILER_TYPE} == "gcc" CFLAGS.bitstring_test= -fno-strict-overflow .endif diff --git a/tests/sys/sys/arb_test.c b/tests/sys/sys/arb_test.c index 9cf3f2052688..adbd7794e6f8 100644 --- a/tests/sys/sys/arb_test.c +++ b/tests/sys/sys/arb_test.c @@ -41,7 +41,7 @@ struct node { int key; }; -ARB32_HEAD(tree, node) *root; +static ARB32_HEAD(tree, node) *root; static int compare(const struct node *a, const struct node *b) diff --git a/tests/sys/sys/rb_test.c b/tests/sys/sys/rb_test.c index 287422ccf902..c558ad6098cf 100644 --- a/tests/sys/sys/rb_test.c +++ b/tests/sys/sys/rb_test.c @@ -39,7 +39,7 @@ struct node { int key; }; -RB_HEAD(tree, node) root; +static RB_HEAD(tree, node) root; static int compare(struct node *a, struct node *b) diff --git a/tests/sys/sys/splay_test.c b/tests/sys/sys/splay_test.c index 9b14c7c855cf..f0cf4ecd5eb6 100644 --- a/tests/sys/sys/splay_test.c +++ b/tests/sys/sys/splay_test.c @@ -39,7 +39,7 @@ struct node { int key; }; -SPLAY_HEAD(tree, node) root; +static SPLAY_HEAD(tree, node) root; static int compare(struct node *a, struct node *b) From owner-dev-commits-src-main@freebsd.org Fri Sep 24 16:53:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E43A670A1F; Fri, 24 Sep 2021 16:53:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGJ4b6h5Jz3Ly0; Fri, 24 Sep 2021 16:53:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5F2D1A166; Fri, 24 Sep 2021 16:53:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18OGr3Uv055545; Fri, 24 Sep 2021 16:53:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OGr3Ps055544; Fri, 24 Sep 2021 16:53:03 GMT (envelope-from git) Date: Fri, 24 Sep 2021 16:53:03 GMT Message-Id: <202109241653.18OGr3Ps055544@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: 364790beafec - main - pidfile test: guarantee nul termination of the read pid string 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: 364790beafec707ca3e334683e4030684d829be2 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, 24 Sep 2021 16:53:04 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=364790beafec707ca3e334683e4030684d829be2 commit 364790beafec707ca3e334683e4030684d829be2 Author: Konstantin Belousov AuthorDate: 2021-09-24 03:12:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-24 16:52:41 +0000 pidfile test: guarantee nul termination of the read pid string PR: 258701 Based on the submission by: sigsys@gmail.com MFC after: 1 week --- lib/libutil/tests/pidfile_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libutil/tests/pidfile_test.c b/lib/libutil/tests/pidfile_test.c index 9e516c35273c..9bfa6754ce54 100644 --- a/lib/libutil/tests/pidfile_test.c +++ b/lib/libutil/tests/pidfile_test.c @@ -286,7 +286,8 @@ test_pidfile_relative(void) fd = open(path, O_RDONLY); if (fd < 0) return (strerror(errno)); - if (read(fd, pid, sizeof(pid)) < 0) + memset(pid, 0, sizeof(pid)); + if (read(fd, pid, sizeof(pid) - 1) < 0) return (strerror(errno)); if (atoi(pid) != getpid()) return ("pid mismatch"); From owner-dev-commits-src-main@freebsd.org Fri Sep 24 17:37:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD00967151F; Fri, 24 Sep 2021 17:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4HGK4B52BLz3Q26; Fri, 24 Sep 2021 17:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 1E358F46; Fri, 24 Sep 2021 17:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: de2a0fafe6f9 - main - cxgbe: fix LINT-NOIP builds To: Kristof Provost , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109241228.18OCSjXK093803@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Fri, 24 Sep 2021 10:37:44 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109241228.18OCSjXK093803@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 17:37:46 -0000 On 9/24/21 5:28 AM, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=de2a0fafe6f96b57619988824b9525c8a9905cfb > > commit de2a0fafe6f96b57619988824b9525c8a9905cfb > Author: Kristof Provost > AuthorDate: 2021-09-24 08:31:27 +0000 > Commit: Kristof Provost > CommitDate: 2021-09-24 12:21:18 +0000 > > cxgbe: fix LINT-NOIP builds > > The -NOIP builds fail because cxgbe_tls_tag_free() has no prototype (if > neither INET nor INET6 are defined). The function isn't actually used > in that case, so we can just remove the stub implementation. > > Sponsored by: Rubicon Communications, LLC ("Netgate") My fault, thanks for fixing. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Fri Sep 24 18:15: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 B635B671D9E; Fri, 24 Sep 2021 18:15: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 4HGKvv4mH1z3hJ1; Fri, 24 Sep 2021 18:15: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 83FC01B637; Fri, 24 Sep 2021 18:15: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 18OIFd7H064295; Fri, 24 Sep 2021 18:15:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIFdA9064294; Fri, 24 Sep 2021 18:15:39 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:15:39 GMT Message-Id: <202109241815.18OIFdA9064294@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: 0389e9be63c5 - main - bus: retire DF_REBID 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: 0389e9be63c5e24ecedbb366c5682ddc2ff4de60 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, 24 Sep 2021 18:15:39 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0389e9be63c5e24ecedbb366c5682ddc2ff4de60 commit 0389e9be63c5e24ecedbb366c5682ddc2ff4de60 Author: Warner Losh AuthorDate: 2021-09-24 18:10:18 +0000 Commit: Warner Losh CommitDate: 2021-09-24 18:15:34 +0000 bus: retire DF_REBID I did DF_REBID to allow for 'hoover' drivers that would attach to otherwise unattached devices in the tree. This notion didn't catch on as it was tricky to make work well and it was easier to just publish a /dev node of some flavor by the parent device. It's been nothing but dead weight for a long time. Reviewed by: mav Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32056 --- sys/kern/subr_bus.c | 41 ++++++----------------------------------- sys/sys/bus.h | 1 - 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 5e1b561155bb..3f84b6e0c56d 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2083,10 +2083,9 @@ device_probe_child(device_t dev, device_t child) panic("device_probe_child: parent device has no devclass"); /* - * If the state is already probed, then return. However, don't - * return if we can rebid this object. + * If the state is already probed, then return. */ - if (child->state == DS_ALIVE && (child->flags & DF_REBID) == 0) + if (child->state == DS_ALIVE) return (0); for (; dc; dc = dc->parent) { @@ -2188,29 +2187,7 @@ device_probe_child(device_t dev, device_t child) /* * If we found a driver, change state and initialise the devclass. */ - /* XXX What happens if we rebid and got no best? */ if (best) { - /* - * If this device was attached, and we were asked to - * rescan, and it is a different driver, then we have - * to detach the old driver and reattach this new one. - * Note, we don't have to check for DF_REBID here - * because if the state is > DS_ALIVE, we know it must - * be. - * - * This assumes that all DF_REBID drivers can have - * their probe routine called at any time and that - * they are idempotent as well as completely benign in - * normal operations. - * - * We also have to make sure that the detach - * succeeded, otherwise we fail the operation (or - * maybe it should just fail silently? I'm torn). - */ - if (child->state > DS_ALIVE && best->driver != child->driver) - if ((result = device_detach(dev)) != 0) - return (result); - /* Set the winning driver, devclass, and flags. */ if (!child->devclass) { result = device_set_devclass(child, best->driver->name); @@ -2229,11 +2206,7 @@ device_probe_child(device_t dev, device_t child) * sure that we have the right description. */ DEVICE_PROBE(child); -#if 0 - child->flags |= DF_REBID; -#endif - } else - child->flags &= ~DF_REBID; + } child->state = DS_ALIVE; bus_data_generation_update(); @@ -2921,7 +2894,7 @@ device_probe(device_t dev) GIANT_REQUIRED; - if (dev->state >= DS_ALIVE && (dev->flags & DF_REBID) == 0) + if (dev->state >= DS_ALIVE) return (-1); if (!(dev->flags & DF_ENABLED)) { @@ -4145,8 +4118,7 @@ bus_generic_driver_added(device_t dev, driver_t *driver) DEVICE_IDENTIFY(driver, dev); TAILQ_FOREACH(child, &dev->children, link) { - if (child->state == DS_NOTPRESENT || - (child->flags & DF_REBID)) + if (child->state == DS_NOTPRESENT) device_probe_and_attach(child); } } @@ -5334,7 +5306,6 @@ print_device_short(device_t dev, int indent) (dev->flags&DF_FIXEDCLASS? "fixed,":""), (dev->flags&DF_WILDCARD? "wildcard,":""), (dev->flags&DF_DESCMALLOCED? "descmalloced,":""), - (dev->flags&DF_REBID? "rebiddable,":""), (dev->flags&DF_SUSPENDED? "suspended,":""), (dev->ivars? "":"no "), (dev->softc? "":"no "), @@ -5736,7 +5707,7 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, /* Perform the requested operation. */ switch (cmd) { case DEV_ATTACH: - if (device_is_attached(dev) && (dev->flags & DF_REBID) == 0) + if (device_is_attached(dev)) error = EBUSY; else if (!device_is_enabled(dev)) error = ENXIO; diff --git a/sys/sys/bus.h b/sys/sys/bus.h index ff86cbcf457f..bf51bdbef387 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -90,7 +90,6 @@ struct u_device { #define DF_QUIET 0x10 /* don't print verbose attach message */ #define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ #define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ -#define DF_REBID 0x80 /* Can rebid after attach */ #define DF_SUSPENDED 0x100 /* Device is suspended. */ #define DF_QUIET_CHILDREN 0x200 /* Default to quiet for all my children */ #define DF_ATTACHED_ONCE 0x400 /* Has been attached at least once */ From owner-dev-commits-src-main@freebsd.org Fri Sep 24 18:35: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 1DAE7671FD8; Fri, 24 Sep 2021 18:35: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 4HGLLx04J5z3j2W; Fri, 24 Sep 2021 18:35: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 D3B781BB1A; Fri, 24 Sep 2021 18:35: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 18OIZa0s090752; Fri, 24 Sep 2021 18:35:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIZaEk090751; Fri, 24 Sep 2021 18:35:36 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:35:36 GMT Message-Id: <202109241835.18OIZaEk090751@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: e31fb97148f7 - main - read builtin: Empty variables on timeout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e31fb97148f7a392aaf6cc84579a232f2969b9d1 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, 24 Sep 2021 18:35:37 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=e31fb97148f7a392aaf6cc84579a232f2969b9d1 commit e31fb97148f7a392aaf6cc84579a232f2969b9d1 Author: Bryan Drewery AuthorDate: 2020-05-23 17:01:45 +0000 Commit: Bryan Drewery CommitDate: 2021-09-24 18:34:54 +0000 read builtin: Empty variables on timeout This matches how a non-timeout error is handled. Reviewed by: jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31876 --- bin/sh/miscbltin.c | 2 ++ bin/sh/tests/builtins/Makefile | 2 ++ bin/sh/tests/builtins/read10.0 | 8 ++++++++ bin/sh/tests/builtins/read11.0 | 17 +++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c index faccfa92d221..79d7dc097b5c 100644 --- a/bin/sh/miscbltin.c +++ b/bin/sh/miscbltin.c @@ -231,6 +231,8 @@ readcmd(int argc __unused, char **argv __unused) * If there's nothing ready, return an error. */ if (status <= 0) { + while (*ap != NULL) + setvar(*ap++, "", 0); sig = pendingsig; return (128 + (sig != 0 ? sig : SIGALRM)); } diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile index 197d735920e6..f9b464a6da4b 100644 --- a/bin/sh/tests/builtins/Makefile +++ b/bin/sh/tests/builtins/Makefile @@ -141,6 +141,8 @@ ${PACKAGE}FILES+= read6.0 ${PACKAGE}FILES+= read7.0 ${PACKAGE}FILES+= read8.0 ${PACKAGE}FILES+= read9.0 +${PACKAGE}FILES+= read10.0 +${PACKAGE}FILES+= read11.0 ${PACKAGE}FILES+= return1.0 ${PACKAGE}FILES+= return2.1 ${PACKAGE}FILES+= return3.1 diff --git a/bin/sh/tests/builtins/read10.0 b/bin/sh/tests/builtins/read10.0 new file mode 100644 index 000000000000..5fc19896390a --- /dev/null +++ b/bin/sh/tests/builtins/read10.0 @@ -0,0 +1,8 @@ + +set -e + +v=original_value +r=0 +read v < /dev/null || r=$? +[ "$r" -eq 1 ] +[ -z "$v" ] diff --git a/bin/sh/tests/builtins/read11.0 b/bin/sh/tests/builtins/read11.0 new file mode 100644 index 000000000000..c75ed9c92a83 --- /dev/null +++ b/bin/sh/tests/builtins/read11.0 @@ -0,0 +1,17 @@ + +set -e + +T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) +trap 'rm -rf "$T"' 0 +cd $T +mkfifo fifo1 +# Open fifo1 for writing and then read block on a dummy fifo +{ mkfifo fifo2; read dummy fifo1 & +# Wait for the child to open fifo1 for writing +exec 3 Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5178A671DFA; Fri, 24 Sep 2021 18:37: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 4HGLNy1rfVz3jb6; Fri, 24 Sep 2021 18:37: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 1F2DC1B7CA; Fri, 24 Sep 2021 18:37: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 18OIbM90090979; Fri, 24 Sep 2021 18:37:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIbMdX090978; Fri, 24 Sep 2021 18:37:22 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:37:22 GMT Message-Id: <202109241837.18OIbMdX090978@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: 14a634df53d2 - main - cxgbe: Mark received packets as initialized for KMSAN 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: 14a634df53d2de65233e490d0bfa806a05baff7c 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, 24 Sep 2021 18:37:22 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=14a634df53d2de65233e490d0bfa806a05baff7c commit 14a634df53d2de65233e490d0bfa806a05baff7c Author: Mark Johnston AuthorDate: 2021-09-24 18:35:38 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 18:37:05 +0000 cxgbe: Mark received packets as initialized for KMSAN The KMSAN runtime needs to have its shadow maps updated when devices update host memory, otherwise it assumes that device-populated memory is uninitialized. For most drivers this is handled transparently by busdma, but cxgbe doesn't make use of dma maps for receive buffers and so requires special treatment. Reported by: mjg Tested by: mjg Reviewed by: np Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32102 --- sys/dev/cxgbe/t4_sge.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 8a502907d172..c2f2f0a13f5b 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1754,6 +1755,7 @@ get_scatter_segment(struct adapter *sc, struct sge_fl *fl, int fr_offset, return (NULL); } m->m_len = len; + kmsan_mark(payload, len, KMSAN_STATE_INITED); if (sc->sc_do_rxcopy && len < RX_COPY_THRESHOLD) { /* copy data to mbuf */ From owner-dev-commits-src-main@freebsd.org Fri Sep 24 18:41: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 C64AE672494; Fri, 24 Sep 2021 18:41: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 4HGLTg5Cyfz3jlh; Fri, 24 Sep 2021 18:41: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 942EC1BA57; Fri, 24 Sep 2021 18:41: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 18OIfRaT002053; Fri, 24 Sep 2021 18:41:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIfRL0002052; Fri, 24 Sep 2021 18:41:27 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:41:27 GMT Message-Id: <202109241841.18OIfRL0002052@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 73db3b64f167 - main - ipfilter: Avoid a null if-then-else blocks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73db3b64f167972db3ee3f780cecb439b09492b1 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, 24 Sep 2021 18:41:27 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=73db3b64f167972db3ee3f780cecb439b09492b1 commit 73db3b64f167972db3ee3f780cecb439b09492b1 Author: Cy Schubert AuthorDate: 2021-09-22 04:58:08 +0000 Commit: Cy Schubert CommitDate: 2021-09-24 18:41:02 +0000 ipfilter: Avoid a null if-then-else blocks When WITHOUT_INET6 is selected we generate a null if-then-else blocks due to incorrect placment of #if statments. Move the #if statements reducing unnecessary runtime comparisons WITHOUT_INET6. MFC after: 1 week --- sys/contrib/ipfilter/netinet/ip_ftp_pxy.c | 18 +++++++----------- sys/contrib/ipfilter/netinet/ip_proxy.c | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c b/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c index 5d8f9f1f51f7..c4ee0ef593df 100644 --- a/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c +++ b/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c @@ -510,11 +510,10 @@ ipf_p_ftp_addport(softf, fin, ip, nat, ftp, dlen, nport, inc) fi.fin_src6 = nat->nat_ndst6; fi.fin_dst6 = nat->nat_nsrc6; - if (nat->nat_v[0] == 6) { #ifndef USE_INET6 + if (nat->nat_v[0] == 6) return APR_INC(inc); #endif - } /* * Add skeleton NAT entry for connection which will come back the @@ -582,15 +581,14 @@ ipf_p_ftp_addport(softf, fin, ip, nat, ftp, dlen, nport, inc) flags = SI_W_SPORT|NAT_SLAVE|IPN_TCP; MUTEX_ENTER(&softn->ipf_nat_new); - if (nat->nat_v[0] == 6) { #ifdef USE_INET6 + if (nat->nat_v[0] == 6) nat2 = ipf_nat6_add(&fi, ipn, &ftp->ftp_pendnat, flags, direction); + else #endif - } else { nat2 = ipf_nat_add(&fi, ipn, &ftp->ftp_pendnat, flags, direction); - } MUTEX_EXIT(&softn->ipf_nat_new); if (nat2 == NULL) { @@ -950,13 +948,12 @@ ipf_p_ftp_pasvreply(softf, fin, ip, nat, ftp, port, newmsg, s) MUTEX_EXIT(&nat2->nat_lock); fi.fin_ifp = NULL; if (nat->nat_dir == NAT_INBOUND) { - if (nat->nat_v[0] == 6) { #ifdef USE_INET6 + if (nat->nat_v[0] == 6) fi.fin_dst6 = nat->nat_ndst6; + else #endif - } else { fi.fin_daddr = nat->nat_ndstaddr; - } } if (ipf_state_add(softc, &fi, (ipstate_t **)&ftp->ftp_pendstate, SI_W_SPORT) != 0) @@ -979,15 +976,14 @@ ipf_p_ftp_pasvreply(softf, fin, ip, nat, ftp, port, newmsg, s) if (inc != 0) { fin->fin_plen += inc; fin->fin_dlen += inc; - if (nat->nat_v[0] == 6) { #ifdef USE_INET6 + if (nat->nat_v[0] == 6) { ip6 = (ip6_t *)fin->fin_ip; u_short len = ntohs(ip6->ip6_plen) + inc; ip6->ip6_plen = htons(len); + } else #endif - } else { ip->ip_len = htons(fin->fin_plen); - } } return APR_INC(inc); diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index 87051b6e6839..4399a9cde8e4 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1354,8 +1354,8 @@ ipf_proxy_rule_rev(nat) if (ipn->in_v[0] == 4) { ipn->in_snip = ntohl(nat->nat_odstaddr); ipn->in_dnip = ntohl(nat->nat_nsrcaddr); - } else { #ifdef USE_INET6 + } else { ipn->in_snip6 = nat->nat_odst6; ipn->in_dnip6 = nat->nat_nsrc6; #endif From owner-dev-commits-src-main@freebsd.org Fri Sep 24 18:41: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 0F0E86725A7; Fri, 24 Sep 2021 18:41: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 4HGLTh6K8Vz3k2H; Fri, 24 Sep 2021 18:41: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 B6E561BC8F; Fri, 24 Sep 2021 18:41: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 18OIfSPn002077; Fri, 24 Sep 2021 18:41:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIfSfb002076; Fri, 24 Sep 2021 18:41:28 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:41:28 GMT Message-Id: <202109241841.18OIfSfb002076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 1605eaa6d23e - main - ipfilter: Locking sysctls here is not required MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1605eaa6d23ea5161b5ab8461e83ab32a591a4fc 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, 24 Sep 2021 18:41:29 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=1605eaa6d23ea5161b5ab8461e83ab32a591a4fc commit 1605eaa6d23ea5161b5ab8461e83ab32a591a4fc Author: Cy Schubert AuthorDate: 2021-09-24 18:18:42 +0000 Commit: Cy Schubert CommitDate: 2021-09-24 18:41:02 +0000 ipfilter: Locking sysctls here is not required Locking of data structures touched by sysctls is more finely locked in ipflter therefore higher level locks are redundant. MFC after: 3 days --- sys/contrib/ipfilter/netinet/mlfk_ipl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c index 64beb1448858..8d9cb780b9e8 100644 --- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c +++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c @@ -349,7 +349,6 @@ sysctl_ipf_int ( SYSCTL_HANDLER_ARGS ) { int error = 0; - WRITE_ENTER(&V_ipfmain.ipf_mutex); if (arg1) error = SYSCTL_OUT(req, arg1, sizeof(int)); else @@ -368,7 +367,6 @@ sysctl_ipf_int ( SYSCTL_HANDLER_ARGS ) } sysctl_error: - RWLOCK_EXIT(&V_ipfmain.ipf_mutex); return (error); } From owner-dev-commits-src-main@freebsd.org Fri Sep 24 18:51: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 34F64672896; Fri, 24 Sep 2021 18:51: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 4HGLhw0q4Xz3kWZ; Fri, 24 Sep 2021 18:51: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 F07CD1B7ED; Fri, 24 Sep 2021 18:51: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 18OIpBE0012847; Fri, 24 Sep 2021 18:51:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OIpBY3012846; Fri, 24 Sep 2021 18:51:11 GMT (envelope-from git) Date: Fri, 24 Sep 2021 18:51:11 GMT Message-Id: <202109241851.18OIpBY3012846@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 1a25c51e38a7 - main - loader: dev_net.c should use __func__ with printf MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a25c51e38a7c9f46ec195836233636616741f06 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, 24 Sep 2021 18:51:12 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=1a25c51e38a7c9f46ec195836233636616741f06 commit 1a25c51e38a7c9f46ec195836233636616741f06 Author: Toomas Soome AuthorDate: 2021-09-24 14:07:20 +0000 Commit: Toomas Soome CommitDate: 2021-09-24 14:12:19 +0000 loader: dev_net.c should use __func__ with printf We have printf calls with function name hardwired to string, sometimes wrong name. Use __func__ instead. MFC after: 1 week --- stand/common/dev_net.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/stand/common/dev_net.c b/stand/common/dev_net.c index 1fa955ac1cf1..db13e618e822 100644 --- a/stand/common/dev_net.c +++ b/stand/common/dev_net.c @@ -141,13 +141,14 @@ net_open(struct open_file *f, ...) if (netdev_sock < 0) { netdev_sock = netif_open(dev); if (netdev_sock < 0) { - printf("net_open: netif_open() failed\n"); + printf("%s: netif_open() failed\n", __func__); return (ENXIO); } netdev_name = strdup(devname); #ifdef NETIF_DEBUG if (debug) - printf("net_open: netif_open() succeeded\n"); + printf("%s: netif_open() succeeded\n", + __func__); #endif } /* @@ -202,7 +203,7 @@ net_close(struct open_file *f) #ifdef NETIF_DEBUG if (debug) - printf("net_close: opens=%d\n", netdev_opens); + printf("%s: opens=%d\n", __func__, netdev_opens); #endif f->f_devdata = NULL; @@ -217,7 +218,7 @@ net_cleanup(void) if (netdev_sock >= 0) { #ifdef NETIF_DEBUG if (debug) - printf("net_cleanup: calling netif_close()\n"); + printf("%s: calling netif_close()\n", __func__); #endif rootip.s_addr = 0; free(netdev_name); @@ -272,7 +273,7 @@ net_getparams(int sock) goto exit; #ifdef NETIF_DEBUG if (debug) - printf("net_open: BOOTP failed, trying RARP/RPC...\n"); + printf("%s: BOOTP failed, trying RARP/RPC...\n", __func__); #endif #endif @@ -281,19 +282,19 @@ net_getparams(int sock) * netmask to the "natural" default for our address. */ if (rarp_getipaddress(sock)) { - printf("net_open: RARP failed\n"); + printf("%s: RARP failed\n", __func__); return (EIO); } - printf("net_open: client addr: %s\n", inet_ntoa(myip)); + printf("%s: client addr: %s\n", __func__, inet_ntoa(myip)); /* Get our hostname, server IP address, gateway. */ if (bp_whoami(sock)) { - printf("net_open: bootparam/whoami RPC failed\n"); + printf("%s: bootparam/whoami RPC failed\n", __func__); return (EIO); } #ifdef NETIF_DEBUG if (debug) - printf("net_open: client name: %s\n", hostname); + printf("%s: client name: %s\n", __func__, hostname); #endif /* @@ -310,17 +311,18 @@ net_getparams(int sock) netmask = smask; #ifdef NETIF_DEBUG if (debug) - printf("net_open: subnet mask: %s\n", intoa(netmask)); + printf("%s: subnet mask: %s\n", __func__, + intoa(netmask)); #endif } #ifdef NETIF_DEBUG if (gateip.s_addr && debug) - printf("net_open: net gateway: %s\n", inet_ntoa(gateip)); + printf("%s: net gateway: %s\n", __func__, inet_ntoa(gateip)); #endif /* Get the root server and pathname. */ if (bp_getfile(sock, "root", &rootip, rootpath)) { - printf("net_open: bootparam/getfile RPC failed\n"); + printf("%s: bootparam/getfile RPC failed\n", __func__); return (EIO); } exit: @@ -329,8 +331,8 @@ exit: #ifdef NETIF_DEBUG if (debug) { - printf("net_open: server addr: %s\n", inet_ntoa(rootip)); - printf("net_open: server path: %s\n", rootpath); + printf("%s: server addr: %s\n", __func__, inet_ntoa(rootip)); + printf("%s: server path: %s\n", __func__, rootpath); } #endif From owner-dev-commits-src-main@freebsd.org Fri Sep 24 19:06: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 ED91C6729EB; Fri, 24 Sep 2021 19:06: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 4HGM2X5Cglz3kx7; Fri, 24 Sep 2021 19:06: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 933361BE3F; Fri, 24 Sep 2021 19:06: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 18OJ6Sl2031695; Fri, 24 Sep 2021 19:06:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OJ6SX3031694; Fri, 24 Sep 2021 19:06:28 GMT (envelope-from git) Date: Fri, 24 Sep 2021 19:06:28 GMT Message-Id: <202109241906.18OJ6SX3031694@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: 7c2f227a17de - main - opencrypto: Disallow requests which pass VERIFY_DIGEST without a MAC 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: 7c2f227a17ded0934c5941c7911797edb7d770a2 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, 24 Sep 2021 19:06:29 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7c2f227a17ded0934c5941c7911797edb7d770a2 commit 7c2f227a17ded0934c5941c7911797edb7d770a2 Author: Mark Johnston AuthorDate: 2021-09-24 19:04:45 +0000 Commit: Mark Johnston CommitDate: 2021-09-24 19:04:45 +0000 opencrypto: Disallow requests which pass VERIFY_DIGEST without a MAC Otherwise we can end up comparing the computed digest with an uninitialized kernel buffer. In cryptoaead_op() we already unconditionally fail the request if a pointer to a digest buffer is not specified. Based on a patch by Simran Kathpalia. Reported by: syzkaller Reviewed by: jhb MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/529 Differential Revision: https://reviews.freebsd.org/D32124 --- sys/opencrypto/cryptodev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 6bbcf977ac72..5d281f3157fa 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -889,7 +889,7 @@ cryptodev_op(struct csession *cse, const struct crypt_op *cop) dst += cse->ivsize; } - if (cop->mac != NULL && crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { + if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { error = copyin(cop->mac, cod->buf + crp->crp_digest_start, cse->hashsize); if (error) { From owner-dev-commits-src-main@freebsd.org Fri Sep 24 19:21: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 1F016673386; Fri, 24 Sep 2021 19:21: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 4HGMMs0S4gz3mR0; Fri, 24 Sep 2021 19:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E59081C62A; Fri, 24 Sep 2021 19:21: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 18OJLSDL054260; Fri, 24 Sep 2021 19:21:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OJLSkA054259; Fri, 24 Sep 2021 19:21:28 GMT (envelope-from git) Date: Fri, 24 Sep 2021 19:21:28 GMT Message-Id: <202109241921.18OJLSkA054259@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: bf27a2253f6b - main - ps: fix `ps -aa` MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf27a2253f6ba6ee3086046b837b2fe40e22c72c 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, 24 Sep 2021 19:21:29 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=bf27a2253f6ba6ee3086046b837b2fe40e22c72c commit bf27a2253f6ba6ee3086046b837b2fe40e22c72c Author: Math Ieu AuthorDate: 2021-09-24 06:58:40 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-24 19:19:52 +0000 ps: fix `ps -aa` Passing the -a flag multiple times made ps show no processes. Differential Revision: https://reviews.freebsd.org/D27215 --- bin/ps/ps.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bin/ps/ps.c b/bin/ps/ps.c index d3cfc669d581..0c656d8a1544 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -253,11 +253,9 @@ main(int argc, char *argv[]) * added for compatibility with SUSv3, but for * now it will not be described in the man page. */ - nselectors++; all = xkeep = 1; break; case 'a': - nselectors++; all = 1; break; case 'C': @@ -473,7 +471,7 @@ main(int argc, char *argv[]) if (!_fmt) parsefmt(dfmt, 0); - if (nselectors == 0) { + if (!all && nselectors == 0) { uidlist.l.ptr = malloc(sizeof(uid_t)); if (uidlist.l.ptr == NULL) xo_errx(1, "malloc failed"); @@ -526,9 +524,6 @@ main(int argc, char *argv[]) what = KERN_PROC_UID | showthreads; flag = *uidlist.l.uids; nselectors = 0; - } else if (all) { - /* No need for this routine to select processes. */ - nselectors = 0; } } From owner-dev-commits-src-main@freebsd.org Fri Sep 24 20:05: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 1B2306735E4; Fri, 24 Sep 2021 20:05: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 4HGNL900qJz3q49; Fri, 24 Sep 2021 20:05: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 D402D1D00D; Fri, 24 Sep 2021 20:05:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18OK54R6011016; Fri, 24 Sep 2021 20:05:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OK54AW011015; Fri, 24 Sep 2021 20:05:04 GMT (envelope-from git) Date: Fri, 24 Sep 2021 20:05:04 GMT Message-Id: <202109242005.18OK54AW011015@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: 67a9e76da6e6 - main - bus: Fix LINT / BUS_DEBUG build 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: 67a9e76da6e69ceee94a3b9c0fd490ed2f781938 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, 24 Sep 2021 20:05:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=67a9e76da6e69ceee94a3b9c0fd490ed2f781938 commit 67a9e76da6e69ceee94a3b9c0fd490ed2f781938 Author: Warner Losh AuthorDate: 2021-09-24 20:03:10 +0000 Commit: Warner Losh CommitDate: 2021-09-24 20:04:39 +0000 bus: Fix LINT / BUS_DEBUG build Fix 0389e9be63c5e for LINT built. Removed an arg only from code under BUS_DEBUG w/o rebuilding LINT... Sponsored by: Netflix Fixes: 0389e9be63c5e24ecedbb366c5682ddc2ff4de60 --- sys/kern/subr_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 3f84b6e0c56d..958e0aa413d4 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -5298,7 +5298,7 @@ print_device_short(device_t dev, int indent) if (!dev) return; - indentprintf(("device %d: <%s> %sparent,%schildren,%s%s%s%s%s%s,%sivars,%ssoftc,busy=%d\n", + indentprintf(("device %d: <%s> %sparent,%schildren,%s%s%s%s%s,%sivars,%ssoftc,busy=%d\n", dev->unit, dev->desc, (dev->parent? "":"no "), (TAILQ_EMPTY(&dev->children)? "no ":""), From owner-dev-commits-src-main@freebsd.org Fri Sep 24 21:09: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 609B7674C89; Fri, 24 Sep 2021 21:09: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 4HGPm9239Zz3tKZ; Fri, 24 Sep 2021 21:09: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 25C261DA7E; Fri, 24 Sep 2021 21:09: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 18OL9D2h091458; Fri, 24 Sep 2021 21:09:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18OL9DJO091457; Fri, 24 Sep 2021 21:09:13 GMT (envelope-from git) Date: Fri, 24 Sep 2021 21:09:13 GMT Message-Id: <202109242109.18OL9DJO091457@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: e725ee7eb672 - main - mount: add libxo(3) support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e725ee7eb672a8501600552283d3d08a2f7b6847 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, 24 Sep 2021 21:09:13 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=e725ee7eb672a8501600552283d3d08a2f7b6847 commit e725ee7eb672a8501600552283d3d08a2f7b6847 Author: Cameron Katri AuthorDate: 2021-09-23 20:51:30 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-24 21:07:00 +0000 mount: add libxo(3) support Adds --libxo to mount(8). Differential Revision: https://reviews.freebsd.org/D30341 --- sbin/mount/Makefile | 2 +- sbin/mount/mount.8 | 14 ++++- sbin/mount/mount.c | 153 ++++++++++++++++++++++++++++++++++------------------ 3 files changed, 114 insertions(+), 55 deletions(-) diff --git a/sbin/mount/Makefile b/sbin/mount/Makefile index 68c7ee9819d8..34ba498a2a3f 100644 --- a/sbin/mount/Makefile +++ b/sbin/mount/Makefile @@ -7,6 +7,6 @@ SRCS= mount.c mount_fs.c getmntopts.c vfslist.c MAN= mount.8 # We do NOT install the getmntopts.3 man page. -LIBADD= util +LIBADD= util xo .include diff --git a/sbin/mount/mount.8 b/sbin/mount/mount.8 index 3aee1bb86151..59a0f6bb0329 100644 --- a/sbin/mount/mount.8 +++ b/sbin/mount/mount.8 @@ -28,7 +28,7 @@ .\" @(#)mount.8 8.8 (Berkeley) 6/16/94 .\" $FreeBSD$ .\" -.Dd August 28, 2019 +.Dd May 18, 2021 .Dt MOUNT 8 .Os .Sh NAME @@ -36,14 +36,17 @@ .Nd mount file systems .Sh SYNOPSIS .Nm +.Op Fl -libxo .Op Fl adflpruvw .Op Fl F Ar fstab .Op Fl o Ar options .Op Fl t Oo Cm no Oc Ns Cm Ar type Ns Op Cm , Ns Ar type ... .Nm +.Op Fl -libxo .Op Fl dfpruvw .Ar special | node .Nm +.Op Fl -libxo .Op Fl dfpruvw .Op Fl o Ar options .Op Fl t Oo Cm no Oc Ns Cm Ar type Ns Op Cm , Ns Ar type ... @@ -72,6 +75,13 @@ this list is printed. .Pp The options are as follows: .Bl -tag -width indent +.It Fl -libxo +Generate output via +.Xr libxo 3 +in a selection of different human and machine readable formats. +See +.Xr xo_parse_args 3 +for details on command line arguments. .It Fl a All the file systems described in .Xr fstab 5 @@ -552,6 +562,8 @@ support for a particular file system might be provided either on a static .Xr setfacl 1 , .Xr nmount 2 , .Xr acl 3 , +.Xr libxo 3 , +.Xr xo_parse_args 3 , .Xr mac 4 , .Xr cd9660 5 , .Xr devfs 5 , diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index fad999c97dc9..02242791a7a2 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -60,11 +60,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "extern.h" #include "mntopts.h" #include "pathnames.h" +#define EXIT(a) { \ + xo_close_container("mount"); \ + xo_finish(); \ + exit(a); \ + } + /* `meta' options */ #define MOUNT_META_OPTION_FSTAB "fstab" #define MOUNT_META_OPTION_CURRENT "current" @@ -146,21 +153,21 @@ exec_mountprog(const char *name, const char *execname, char *const argv[]) switch (pid = fork()) { case -1: /* Error. */ - warn("fork"); - exit (1); + xo_warn("fork"); + EXIT(1); case 0: /* Child. */ /* Go find an executable. */ execvP(execname, _PATH_SYSPATH, argv); if (errno == ENOENT) { - warn("exec %s not found", execname); + xo_warn("exec %s not found", execname); if (execname[0] != '/') { - warnx("in path: %s", _PATH_SYSPATH); + xo_warnx("in path: %s", _PATH_SYSPATH); } } - exit(1); + EXIT(1); default: /* Parent. */ if (waitpid(pid, &status, 0) < 0) { - warn("waitpid"); + xo_warn("waitpid"); return (1); } @@ -168,7 +175,7 @@ exec_mountprog(const char *name, const char *execname, char *const argv[]) if (WEXITSTATUS(status) != 0) return (WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { - warnx("%s: %s", name, sys_siglist[WTERMSIG(status)]); + xo_warnx("%s: %s", name, sys_siglist[WTERMSIG(status)]); return (1); } break; @@ -185,7 +192,7 @@ specified_ro(const char *arg) optbuf = strdup(arg); if (optbuf == NULL) - err(1, NULL); + xo_err(1, NULL); for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) { if (strcmp(opt, "ro") == 0) { @@ -220,13 +227,13 @@ restart_mountd(void) * happened due to the bugs in pidfile(3). */ if (mountdpid <= 0) { - warnx("mountd pid %d, refusing to send SIGHUP", mountdpid); + xo_warnx("mountd pid %d, refusing to send SIGHUP", mountdpid); return; } /* We have mountd(8) PID in mountdpid varible, let's signal it. */ if (kill(mountdpid, SIGHUP) == -1) - err(1, "signal mountd"); + xo_err(1, "signal mountd"); } int @@ -244,6 +251,12 @@ main(int argc, char *argv[]) options = NULL; vfslist = NULL; vfstype = "ufs"; + + argc = xo_parse_args(argc, argv); + if (argc < 0) + exit(1); + xo_open_container("mount"); + while ((ch = getopt(argc, argv, "adF:fLlno:prt:uvw")) != -1) switch (ch) { case 'a': @@ -285,7 +298,7 @@ main(int argc, char *argv[]) break; case 't': if (vfslist != NULL) - errx(1, "only one -t option may be specified"); + xo_errx(1, "only one -t option may be specified"); vfslist = makevfslist(optarg); vfstype = optarg; break; @@ -318,7 +331,7 @@ main(int argc, char *argv[]) case 0: if ((mntsize = getmntinfo(&mntbuf, verbose ? MNT_WAIT : MNT_NOWAIT)) == 0) - err(1, "getmntinfo"); + xo_err(1, "getmntinfo"); if (all) { while ((fs = getfsent()) != NULL) { if (BADTYPE(fs->fs_type)) @@ -347,12 +360,17 @@ main(int argc, char *argv[]) rval = 1; } } else if (fstab_style) { + xo_open_list("fstab"); for (i = 0; i < mntsize; i++) { if (checkvfsname(mntbuf[i].f_fstypename, vfslist)) continue; + xo_open_instance("fstab"); putfsent(&mntbuf[i]); + xo_close_instance("fstab"); } + xo_close_list("fstab"); } else { + xo_open_list("mounted"); for (i = 0; i < mntsize; i++) { if (checkvfsname(mntbuf[i].f_fstypename, vfslist)) @@ -360,10 +378,13 @@ main(int argc, char *argv[]) if (!verbose && (mntbuf[i].f_flags & MNT_IGNORE) != 0) continue; + xo_open_instance("mounted"); prmount(&mntbuf[i]); + xo_close_instance("mounted"); } + xo_close_list("mounted"); } - exit(rval); + EXIT(rval); case 1: if (vfslist != NULL) usage(); @@ -373,7 +394,7 @@ main(int argc, char *argv[]) mntfromname = NULL; have_fstab = 0; if ((mntbuf = getmntpt(*argv)) == NULL) - errx(1, "not currently mounted %s", *argv); + xo_errx(1, "not currently mounted %s", *argv); /* * Only get the mntflags from fstab if both mntpoint * and mntspec are identical. Also handle the special @@ -411,10 +432,10 @@ main(int argc, char *argv[]) } if ((fs = getfsfile(*argv)) == NULL && (fs = getfsspec(*argv)) == NULL) - errx(1, "%s: unknown special file or file system", + xo_errx(1, "%s: unknown special file or file system", *argv); if (BADTYPE(fs->fs_type)) - errx(1, "%s has unknown file system type", + xo_errx(1, "%s has unknown file system type", *argv); rval = mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file, init_flags, options, fs->fs_mntops); @@ -460,7 +481,7 @@ main(int argc, char *argv[]) if (rval == 0 && getuid() == 0) restart_mountd(); - exit(rval); + EXIT(rval); } int @@ -537,7 +558,7 @@ append_arg(struct cpa *sa, char *arg) sa->sz = sa->sz == 0 ? 8 : sa->sz * 2; sa->a = realloc(sa->a, sizeof(*sa->a) * sa->sz); if (sa->a == NULL) - errx(1, "realloc failed"); + xo_errx(1, "realloc failed"); } sa->a[++sa->c] = arg; } @@ -553,7 +574,7 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags, /* resolve the mountpoint with realpath(3) */ if (checkpath(name, mntpath) != 0) { - warn("%s", mntpath); + xo_warn("%s", mntpath); return (1); } name = mntpath; @@ -596,12 +617,12 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags, if (debug) { if (use_mountprog(vfstype)) - printf("exec: %s", execname); + xo_emit("{Lwc:exec}{:execname/%s}", execname); else - printf("mount -t %s", vfstype); + xo_emit("{:execname/mount}{P: }{l:opts/-t}{P: }{l:opts/%s}", vfstype); for (i = 1; i < mnt_argv.c; i++) - (void)printf(" %s", mnt_argv.a[i]); - (void)printf("\n"); + xo_emit("{P: }{l:opts}", mnt_argv.a[i]); + xo_emit("\n"); free(optbuf); free(mountprog); mountprog = NULL; @@ -620,13 +641,22 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags, if (verbose) { if (statfs(name, &sf) < 0) { - warn("statfs %s", name); + xo_warn("statfs %s", name); return (1); } - if (fstab_style) + if (fstab_style) { + xo_open_list("fstab"); + xo_open_instance("fstab"); putfsent(&sf); - else + xo_close_instance("fstab"); + xo_close_list("fstab"); + } else { + xo_open_list("mounted"); + xo_open_instance("mounted"); prmount(&sf); + xo_close_instance("mounted"); + xo_close_list("mounted"); + } } return (ret); @@ -639,14 +669,15 @@ prmount(struct statfs *sfp) unsigned int i; struct mntoptnames *o; struct passwd *pw; + char *fsidbuf; - (void)printf("%s on %s (%s", sfp->f_mntfromname, sfp->f_mntonname, - sfp->f_fstypename); + xo_emit("{:special}{L: on }{:node}{L: (}{:fstype}", sfp->f_mntfromname, + sfp->f_mntonname, sfp->f_fstypename); flags = sfp->f_flags & MNT_VISFLAGMASK; for (o = optnames; flags != 0 && o->o_opt != 0; o++) if (flags & o->o_opt) { - (void)printf(", %s", o->o_name); + xo_emit("{D:, }{l:opts}", o->o_name); flags &= ~o->o_opt; } /* @@ -654,28 +685,40 @@ prmount(struct statfs *sfp) * or privileged non-root user. */ if ((flags & MNT_USER) != 0 || sfp->f_owner != 0) { - (void)printf(", mounted by "); + xo_emit("{D:, }{L:mounted by }"); if ((pw = getpwuid(sfp->f_owner)) != NULL) - (void)printf("%s", pw->pw_name); + xo_emit("{:mounter}", pw->pw_name); else - (void)printf("%d", sfp->f_owner); + xo_emit("{:mounter}", sfp->f_owner); } if (verbose) { - if (sfp->f_syncwrites != 0 || sfp->f_asyncwrites != 0) - (void)printf(", writes: sync %ju async %ju", + if (sfp->f_syncwrites != 0 || sfp->f_asyncwrites != 0) { + xo_open_container("writes"); + xo_emit("{D:, }{Lwc:writes}{Lw:sync}{w:sync/%ju}{Lw:async}{:async/%ju}", (uintmax_t)sfp->f_syncwrites, (uintmax_t)sfp->f_asyncwrites); - if (sfp->f_syncreads != 0 || sfp->f_asyncreads != 0) - (void)printf(", reads: sync %ju async %ju", + xo_close_container("writes"); + } + if (sfp->f_syncreads != 0 || sfp->f_asyncreads != 0) { + xo_open_container("reads"); + xo_emit("{D:, }{Lwc:reads}{Lw:sync}{w:sync/%ju}{Lw:async}{:async/%ju}", (uintmax_t)sfp->f_syncreads, (uintmax_t)sfp->f_asyncreads); + xo_close_container("reads"); + } if (sfp->f_fsid.val[0] != 0 || sfp->f_fsid.val[1] != 0) { - (void)printf(", fsid "); + fsidbuf = malloc(sizeof(sfp->f_fsid) * 2 + 1); + if (fsidbuf == NULL) + xo_errx(1, "malloc failed"); for (i = 0; i < sizeof(sfp->f_fsid); i++) - (void)printf("%02x", ((u_char *)&sfp->f_fsid)[i]); + sprintf(&fsidbuf[i * 2], "%02x", + ((u_char *)&sfp->f_fsid)[i]); + fsidbuf[i * 2] = '\0'; + xo_emit("{D:, }{Lw:fsid}{:fsid}", fsidbuf); + free(fsidbuf); } } - (void)printf(")\n"); + xo_emit("{D:)}\n"); } struct statfs * @@ -703,7 +746,7 @@ catopt(char *s0, const char *s1) if (s0 && *s0) { if (asprintf(&cp, "%s,%s", s0, s1) == -1) - errx(1, "asprintf failed"); + xo_errx(1, "asprintf failed"); } else cp = strdup(s1); @@ -758,7 +801,7 @@ mangle(char *options, struct cpa *a) } if (mountprog == NULL) { - errx(1, "Need value for -o mountprog"); + xo_errx(1, "Need value for -o mountprog"); } continue; } else if (strcmp(p, "userquota") == 0) { @@ -824,7 +867,7 @@ update_options(char *opts, char *fstab, int curflags) newopt = NULL; for (p = expopt; (o = strsep(&p, ",")) != NULL;) { if ((tmpopt = malloc( strlen(o) + 2 + 1 )) == NULL) - errx(1, "malloc failed"); + xo_errx(1, "malloc failed"); strcpy(tmpopt, "no"); strcat(tmpopt, o); @@ -867,11 +910,11 @@ void usage(void) { - (void)fprintf(stderr, "%s\n%s\n%s\n", + xo_error("%s\n%s\n%s\n", "usage: mount [-adflpruvw] [-F fstab] [-o options] [-t ufs | external_type]", " mount [-dfpruvw] special | node", " mount [-dfpruvw] [-o options] [-t ufs | external_type] special node"); - exit(1); + EXIT(1); } void @@ -899,32 +942,36 @@ putfsent(struct statfs *ent) } l = strlen(ent->f_mntfromname); - printf("%s%s%s%s", ent->f_mntfromname, + xo_emit("{:device}{P:/%s}{P:/%s}{P:/%s}", + ent->f_mntfromname, l < 8 ? "\t" : "", l < 16 ? "\t" : "", l < 24 ? "\t" : " "); l = strlen(ent->f_mntonname); - printf("%s%s%s%s", ent->f_mntonname, + xo_emit("{:mntpoint}{P:/%s}{P:/%s}{P:/%s}", + ent->f_mntonname, l < 8 ? "\t" : "", l < 16 ? "\t" : "", l < 24 ? "\t" : " "); - printf("%s\t", ent->f_fstypename); + xo_emit("{:fstype}{P:\t}", ent->f_fstypename); l = strlen(opts); - printf("%s%s", opts, + xo_emit("{:opts}{P:/%s}", opts, l < 8 ? "\t" : " "); free(opts); if ((fst = getfsspec(ent->f_mntfromname))) - printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); + xo_emit("{P:\t}{n:dump/%u}{P: }{n:pass/%u}\n", + fst->fs_freq, fst->fs_passno); else if ((fst = getfsfile(ent->f_mntonname))) - printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); + xo_emit("{P:\t}{n:dump/%u}{P: }{n:pass/%u}\n", + fst->fs_freq, fst->fs_passno); else if (strcmp(ent->f_fstypename, "ufs") == 0) { if (strcmp(ent->f_mntonname, "/") == 0) - printf("\t1 1\n"); + xo_emit("{P:\t}{n:dump/1}{P: }{n:pass/1}\n"); else - printf("\t2 2\n"); + xo_emit("{P:\t}{n:dump/2}{P: }{n:pass/2}\n"); } else - printf("\t0 0\n"); + xo_emit("{P:\t}{n:dump/0}{P: }{n:pass/0}\n"); } From owner-dev-commits-src-main@freebsd.org Sat Sep 25 00:35: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 67A6067762E; Sat, 25 Sep 2021 00:35:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGVKg1Fclz4fJt; Sat, 25 Sep 2021 00:35:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C64F2091B; Sat, 25 Sep 2021 00:35:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18P0Z2Tv069474; Sat, 25 Sep 2021 00:35:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P0Z2Go069473; Sat, 25 Sep 2021 00:35:02 GMT (envelope-from git) Date: Sat, 25 Sep 2021 00:35:02 GMT Message-Id: <202109250035.18P0Z2Go069473@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: f73c2bbf811b - main - bus: Cleanup device_probe_child() 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: f73c2bbf811ba77b2fe91b5bc0cbe19e9f7eb6c4 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, 25 Sep 2021 00:35:03 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=f73c2bbf811ba77b2fe91b5bc0cbe19e9f7eb6c4 commit f73c2bbf811ba77b2fe91b5bc0cbe19e9f7eb6c4 Author: Alexander Motin AuthorDate: 2021-09-25 00:27:10 +0000 Commit: Alexander Motin CommitDate: 2021-09-25 00:34:56 +0000 bus: Cleanup device_probe_child() When device driver probe method returns 0, i.e. absolute priority, do not remove its class from the device just to set it back few lines later, that may change the device unit number, etc. and after which we'd better call the probe again. If during search we found some driver with absolute priority, we do not need to set device driver and class since we haven't removed them before. It should not happen, but if second probe method call failed, remove the driver and possibly the class from the device as it was when we started. Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D32125 --- sys/kern/subr_bus.c | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 958e0aa413d4..cdbaee9c203e 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2074,6 +2074,7 @@ device_probe_child(device_t dev, device_t child) driverlink_t best = NULL; driverlink_t dl; int result, pri = 0; + /* We should preserve the devclass (or lack of) set by the bus. */ int hasclass = (child->devclass != NULL); GIANT_REQUIRED; @@ -2125,11 +2126,6 @@ device_probe_child(device_t dev, device_t child) result = DEVICE_PROBE(child); - /* Reset flags and devclass before the next probe. */ - child->devflags = 0; - if (!hasclass) - (void)device_set_devclass(child, NULL); - /* * If the driver returns SUCCESS, there can be * no higher match for this device. @@ -2140,6 +2136,11 @@ device_probe_child(device_t dev, device_t child) break; } + /* Reset flags and devclass before the next probe. */ + child->devflags = 0; + if (!hasclass) + (void)device_set_devclass(child, NULL); + /* * Reset DF_QUIET in case this driver doesn't * end up as the best driver. @@ -2184,36 +2185,43 @@ device_probe_child(device_t dev, device_t child) break; } + if (best == NULL) + return (ENXIO); + /* * If we found a driver, change state and initialise the devclass. */ - if (best) { + if (pri < 0) { /* Set the winning driver, devclass, and flags. */ + result = device_set_driver(child, best->driver); + if (result != 0) + return (result); if (!child->devclass) { result = device_set_devclass(child, best->driver->name); - if (result != 0) + if (result != 0) { + (void)device_set_driver(child, NULL); return (result); + } } - result = device_set_driver(child, best->driver); - if (result != 0) - return (result); resource_int_value(best->driver->name, child->unit, "flags", &child->devflags); - if (pri < 0) { - /* - * A bit bogus. Call the probe method again to make - * sure that we have the right description. - */ - DEVICE_PROBE(child); + /* + * A bit bogus. Call the probe method again to make sure + * that we have the right description. + */ + result = DEVICE_PROBE(child); + if (result > 0) { + if (!hasclass) + (void)device_set_devclass(child, NULL); + (void)device_set_driver(child, NULL); + return (result); } - child->state = DS_ALIVE; - - bus_data_generation_update(); - return (0); } - return (ENXIO); + child->state = DS_ALIVE; + bus_data_generation_update(); + return (0); } /** From owner-dev-commits-src-main@freebsd.org Sat Sep 25 00:41: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 987B9676F6E; Sat, 25 Sep 2021 00:41: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 4HGVTW3kFJz4fXh; Sat, 25 Sep 2021 00:41: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 6037420A9D; Sat, 25 Sep 2021 00:41: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 18P0fp2s079112; Sat, 25 Sep 2021 00:41:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P0fpHY079111; Sat, 25 Sep 2021 00:41:51 GMT (envelope-from git) Date: Sat, 25 Sep 2021 00:41:51 GMT Message-Id: <202109250041.18P0fpHY079111@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: dc9260515449 - main - e1000: Rename 'struct adapter' to 'struct e1000_sc' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc9260515449cde9a4b26b5448f7386388c55bbd 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, 25 Sep 2021 00:41:51 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=dc9260515449cde9a4b26b5448f7386388c55bbd commit dc9260515449cde9a4b26b5448f7386388c55bbd Author: Kevin Bowling AuthorDate: 2021-09-25 00:09:43 +0000 Commit: Kevin Bowling CommitDate: 2021-09-25 00:41:05 +0000 e1000: Rename 'struct adapter' to 'struct e1000_sc' Rename the 'struct adapter' to 'struct e1000_sc' to avoid type ambiguity in things like kgdb. Reviewed by: jhb, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D32129 --- sys/dev/e1000/em_txrx.c | 80 +-- sys/dev/e1000/if_em.c | 1556 +++++++++++++++++++++++----------------------- sys/dev/e1000/if_em.h | 308 +++++---- sys/dev/e1000/igb_txrx.c | 40 +- 4 files changed, 987 insertions(+), 997 deletions(-) diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c index cc5313a749bd..6ac66a9011f4 100644 --- a/sys/dev/e1000/em_txrx.c +++ b/sys/dev/e1000/em_txrx.c @@ -42,9 +42,9 @@ /********************************************************************* * Local Function prototypes *********************************************************************/ -static int em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, +static int em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower); -static int em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, +static int em_transmit_checksum_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower); static int em_isc_txd_encap(void *arg, if_pkt_info_t pi); static void em_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); @@ -91,9 +91,9 @@ struct if_txrx lem_txrx = { extern if_shared_ctx_t em_sctx; void -em_dump_rs(struct adapter *adapter) +em_dump_rs(struct e1000_softc *sc) { - if_softc_ctx_t scctx = adapter->shared; + if_softc_ctx_t scctx = sc->shared; struct em_tx_queue *que; struct tx_ring *txr; qidx_t i, ntxd, qid, cur; @@ -102,8 +102,8 @@ em_dump_rs(struct adapter *adapter) printf("\n"); ntxd = scctx->isc_ntxd[0]; - for (qid = 0; qid < adapter->tx_num_queues; qid++) { - que = &adapter->tx_queues[qid]; + for (qid = 0; qid < sc->tx_num_queues; qid++) { + que = &sc->tx_queues[qid]; txr = &que->txr; rs_cidx = txr->tx_rs_cidx; if (rs_cidx != txr->tx_rs_pidx) { @@ -132,10 +132,10 @@ em_dump_rs(struct adapter *adapter) * **********************************************************************/ static int -em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) +em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) { - if_softc_ctx_t scctx = adapter->shared; - struct em_tx_queue *que = &adapter->tx_queues[pi->ipi_qsidx]; + if_softc_ctx_t scctx = sc->shared; + struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; struct e1000_context_desc *TXD; int cur, hdr_len; @@ -178,7 +178,7 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd TXD->tcp_seg_setup.fields.mss = htole16(pi->ipi_tso_segsz); TXD->tcp_seg_setup.fields.hdr_len = hdr_len; - TXD->cmd_and_length = htole32(adapter->txd_cmd | + TXD->cmd_and_length = htole32(sc->txd_cmd | E1000_TXD_CMD_DEXT | /* Extended descr */ E1000_TXD_CMD_TSE | /* TSE context */ E1000_TXD_CMD_IP | /* Do IP csum */ @@ -189,7 +189,7 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd if (++cur == scctx->isc_ntxd[0]) { cur = 0; } - DPRINTF(iflib_get_dev(adapter->ctx), "%s: pidx: %d cur: %d\n", __FUNCTION__, pi->ipi_pidx, cur); + DPRINTF(iflib_get_dev(sc->ctx), "%s: pidx: %d cur: %d\n", __FUNCTION__, pi->ipi_pidx, cur); return (cur); } @@ -215,11 +215,11 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd **********************************************************************/ static int -em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) +em_transmit_checksum_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) { struct e1000_context_desc *TXD = NULL; - if_softc_ctx_t scctx = adapter->shared; - struct em_tx_queue *que = &adapter->tx_queues[pi->ipi_qsidx]; + if_softc_ctx_t scctx = sc->shared; + struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; int csum_flags = pi->ipi_csum_flags; int cur, hdr_len; @@ -227,7 +227,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u cur = pi->ipi_pidx; hdr_len = pi->ipi_ehdrlen + pi->ipi_ip_hlen; - cmd = adapter->txd_cmd; + cmd = sc->txd_cmd; /* * The 82574L can only remember the *last* context used @@ -237,7 +237,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u * second note. */ if (DONT_FORCE_CTX && - adapter->tx_num_queues == 1 && + sc->tx_num_queues == 1 && txr->csum_lhlen == pi->ipi_ehdrlen && txr->csum_iphlen == pi->ipi_ip_hlen && txr->csum_flags == csum_flags) { @@ -293,7 +293,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u if (++cur == scctx->isc_ntxd[0]) { cur = 0; } - DPRINTF(iflib_get_dev(adapter->ctx), "checksum_setup csum_flags=%x txd_upper=%x txd_lower=%x hdr_len=%d cmd=%x\n", + DPRINTF(iflib_get_dev(sc->ctx), "checksum_setup csum_flags=%x txd_upper=%x txd_lower=%x hdr_len=%d cmd=%x\n", csum_flags, *txd_upper, *txd_lower, hdr_len, cmd); return (cur); } @@ -301,7 +301,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u static int em_isc_txd_encap(void *arg, if_pkt_info_t pi) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; struct tx_ring *txr = &que->txr; @@ -348,7 +348,7 @@ em_isc_txd_encap(void *arg, if_pkt_info_t pi) } DPRINTF(iflib_get_dev(sc->ctx), "encap: set up tx: nsegs=%d first=%d i=%d\n", nsegs, first, i); - /* XXX adapter->pcix_82544 -- lem_fill_descriptors */ + /* XXX sc->pcix_82544 -- lem_fill_descriptors */ /* Set up our transmit descriptors */ for (j = 0; j < nsegs; j++) { @@ -416,19 +416,19 @@ em_isc_txd_encap(void *arg, if_pkt_info_t pi) static void em_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx) { - struct adapter *adapter = arg; - struct em_tx_queue *que = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = arg; + struct em_tx_queue *que = &sc->tx_queues[txqid]; struct tx_ring *txr = &que->txr; - E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), pidx); + E1000_WRITE_REG(&sc->hw, E1000_TDT(txr->me), pidx); } static int em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) { - struct adapter *adapter = arg; - if_softc_ctx_t scctx = adapter->shared; - struct em_tx_queue *que = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = arg; + if_softc_ctx_t scctx = sc->shared; + struct em_tx_queue *que = &sc->tx_queues[txqid]; struct tx_ring *txr = &que->txr; qidx_t processed = 0; @@ -461,7 +461,7 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) if (delta < 0) delta += ntxd; MPASS(delta > 0); - DPRINTF(iflib_get_dev(adapter->ctx), + DPRINTF(iflib_get_dev(sc->ctx), "%s: cidx_processed=%u cur=%u clear=%d delta=%d\n", __FUNCTION__, prev, cur, clear, delta); @@ -483,7 +483,7 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) static void lem_isc_rxd_refill(void *arg, if_rxd_update_t iru) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_rx_queue *que = &sc->rx_queues[iru->iru_qsidx]; struct rx_ring *rxr = &que->rxr; @@ -511,7 +511,7 @@ lem_isc_rxd_refill(void *arg, if_rxd_update_t iru) static void em_isc_rxd_refill(void *arg, if_rxd_update_t iru) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; uint16_t rxqid = iru->iru_qsidx; struct em_rx_queue *que = &sc->rx_queues[rxqid]; @@ -540,7 +540,7 @@ em_isc_rxd_refill(void *arg, if_rxd_update_t iru) static void em_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; @@ -550,7 +550,7 @@ em_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx) static int lem_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; @@ -575,7 +575,7 @@ lem_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) static int em_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) { - struct adapter *sc = arg; + struct e1000_softc *sc = arg; if_softc_ctx_t scctx = sc->shared; struct em_rx_queue *que = &sc->rx_queues[rxqid]; struct rx_ring *rxr = &que->rxr; @@ -600,9 +600,9 @@ em_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) static int lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) { - struct adapter *adapter = arg; - if_softc_ctx_t scctx = adapter->shared; - struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; + struct e1000_softc *sc = arg; + if_softc_ctx_t scctx = sc->shared; + struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; struct e1000_rx_desc *rxd; u16 len; @@ -628,7 +628,7 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (errors & E1000_RXD_ERR_FRAME_ERR_MASK) { - adapter->dropped_pkts++; + sc->dropped_pkts++; /* XXX fixup if common */ return (EBADMSG); } @@ -645,7 +645,7 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) } while (!eop); /* XXX add a faster way to look this up */ - if (adapter->hw.mac.type >= e1000_82543) + if (sc->hw.mac.type >= e1000_82543) em_receive_checksum(status, errors, ri); if (status & E1000_RXD_STAT_VP) { @@ -661,9 +661,9 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) static int em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) { - struct adapter *adapter = arg; - if_softc_ctx_t scctx = adapter->shared; - struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; + struct e1000_softc *sc = arg; + if_softc_ctx_t scctx = sc->shared; + struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; struct rx_ring *rxr = &que->rxr; union e1000_rx_desc_extended *rxd; @@ -691,7 +691,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) /* Make sure bad packets are discarded */ if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) { - adapter->dropped_pkts++; + sc->dropped_pkts++; return EBADMSG; } diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 89ccb30ce922..47513c5d9e1e 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -294,33 +294,33 @@ static int igb_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid); static void em_if_multi_set(if_ctx_t ctx); static void em_if_update_admin_status(if_ctx_t ctx); static void em_if_debug(if_ctx_t ctx); -static void em_update_stats_counters(struct adapter *); -static void em_add_hw_stats(struct adapter *adapter); +static void em_update_stats_counters(struct e1000_softc *); +static void em_add_hw_stats(struct e1000_softc *); static int em_if_set_promisc(if_ctx_t ctx, int flags); -static bool em_if_vlan_filter_capable(struct adapter *); -static bool em_if_vlan_filter_used(struct adapter *); -static void em_if_vlan_filter_enable(struct adapter *); -static void em_if_vlan_filter_disable(struct adapter *); -static void em_if_vlan_filter_write(struct adapter *); -static void em_setup_vlan_hw_support(struct adapter *); +static bool em_if_vlan_filter_capable(struct e1000_softc *); +static bool em_if_vlan_filter_used(struct e1000_softc *); +static void em_if_vlan_filter_enable(struct e1000_softc *); +static void em_if_vlan_filter_disable(struct e1000_softc *); +static void em_if_vlan_filter_write(struct e1000_softc *); +static void em_setup_vlan_hw_support(struct e1000_softc *); static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); -static void em_print_nvm_info(struct adapter *); +static void em_print_nvm_info(struct e1000_softc *); static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); static int em_get_rs(SYSCTL_HANDLER_ARGS); -static void em_print_debug_info(struct adapter *); +static void em_print_debug_info(struct e1000_softc *); static int em_is_valid_ether_addr(u8 *); static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); -static void em_add_int_delay_sysctl(struct adapter *, const char *, +static void em_add_int_delay_sysctl(struct e1000_softc *, const char *, const char *, struct em_int_delay_info *, int, int); /* Management and WOL Support */ -static void em_init_manageability(struct adapter *); -static void em_release_manageability(struct adapter *); -static void em_get_hw_control(struct adapter *); -static void em_release_hw_control(struct adapter *); +static void em_init_manageability(struct e1000_softc *); +static void em_release_manageability(struct e1000_softc *); +static void em_get_hw_control(struct e1000_softc *); +static void em_release_hw_control(struct e1000_softc *); static void em_get_wakeup(if_ctx_t ctx); static void em_enable_wakeup(if_ctx_t ctx); -static int em_enable_phy_wakeup(struct adapter *); -static void em_disable_aspm(struct adapter *); +static int em_enable_phy_wakeup(struct e1000_softc *); +static void em_disable_aspm(struct e1000_softc *); int em_intr(void *arg); @@ -337,8 +337,8 @@ static void em_if_led_func(if_ctx_t ctx, int onoff); static int em_get_regs(SYSCTL_HANDLER_ARGS); -static void lem_smartspeed(struct adapter *adapter); -static void igb_configure_queues(struct adapter *adapter); +static void lem_smartspeed(struct e1000_softc *); +static void igb_configure_queues(struct e1000_softc *); /********************************************************************* @@ -370,7 +370,7 @@ static device_method_t igb_methods[] = { static driver_t em_driver = { - "em", em_methods, sizeof(struct adapter), + "em", em_methods, sizeof(struct e1000_softc), }; static devclass_t em_devclass; @@ -383,7 +383,7 @@ MODULE_DEPEND(em, iflib, 1, 1, 1); IFLIB_PNP_INFO(pci, em, em_vendor_info_array); static driver_t igb_driver = { - "igb", igb_methods, sizeof(struct adapter), + "igb", igb_methods, sizeof(struct e1000_softc), }; static devclass_t igb_devclass; @@ -430,7 +430,7 @@ static device_method_t em_if_methods[] = { }; static driver_t em_if_driver = { - "em_if", em_if_methods, sizeof(struct adapter) + "em_if", em_if_methods, sizeof(struct e1000_softc) }; static device_method_t igb_if_methods[] = { @@ -468,7 +468,7 @@ static device_method_t igb_if_methods[] = { }; static driver_t igb_if_driver = { - "igb_if", igb_if_methods, sizeof(struct adapter) + "igb_if", igb_if_methods, sizeof(struct e1000_softc) }; /********************************************************************* @@ -609,8 +609,8 @@ static struct if_shared_ctx igb_sctx_init = { static int em_get_regs(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *)arg1; - struct e1000_hw *hw = &adapter->hw; + struct e1000_softc *sc = (struct e1000_softc *)arg1; + struct e1000_hw *hw = &sc->hw; struct sbuf *sb; u32 *regs_buff; int rc; @@ -690,7 +690,7 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) #ifdef DUMP_DESCS { - if_softc_ctx_t scctx = adapter->shared; + if_softc_ctx_t scctx = sc->shared; struct rx_ring *rxr = &rx_que->rxr; struct tx_ring *txr = &tx_que->txr; int ntxd = scctx->isc_ntxd[0]; @@ -734,11 +734,11 @@ igb_register(device_t dev) static int em_set_num_queues(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); int maxqueues; /* Sanity check based on HW */ - switch (adapter->hw.mac.type) { + switch (sc->hw.mac.type) { case e1000_82576: case e1000_82580: case e1000_i350: @@ -788,7 +788,7 @@ em_set_num_queues(if_ctx_t ctx) static int em_if_attach_pre(if_ctx_t ctx) { - struct adapter *adapter; + struct e1000_softc *sc; if_softc_ctx_t scctx; device_t dev; struct e1000_hw *hw; @@ -796,42 +796,42 @@ em_if_attach_pre(if_ctx_t ctx) INIT_DEBUGOUT("em_if_attach_pre: begin"); dev = iflib_get_dev(ctx); - adapter = iflib_get_softc(ctx); + sc = iflib_get_softc(ctx); - adapter->ctx = adapter->osdep.ctx = ctx; - adapter->dev = adapter->osdep.dev = dev; - scctx = adapter->shared = iflib_get_softc_ctx(ctx); - adapter->media = iflib_get_media(ctx); - hw = &adapter->hw; + sc->ctx = sc->osdep.ctx = ctx; + sc->dev = sc->osdep.dev = dev; + scctx = sc->shared = iflib_get_softc_ctx(ctx); + sc->media = iflib_get_media(ctx); + hw = &sc->hw; - adapter->tx_process_limit = scctx->isc_ntxd[0]; + sc->tx_process_limit = scctx->isc_ntxd[0]; /* SYSCTL stuff */ SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "nvm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, em_sysctl_nvm_info, "I", "NVM Information"); + sc, 0, em_sysctl_nvm_info, "I", "NVM Information"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "debug", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, em_sysctl_debug_info, "I", "Debug Information"); + sc, 0, em_sysctl_debug_info, "I", "Debug Information"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, em_set_flowcntl, "I", "Flow Control"); + sc, 0, em_set_flowcntl, "I", "Flow Control"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "reg_dump", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, em_get_regs, "A", "Dump Registers"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "rs_dump", - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, adapter, 0, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, em_get_rs, "I", "Dump RS indexes"); /* Determine hardware and mac info */ @@ -938,19 +938,19 @@ em_if_attach_pre(if_ctx_t ctx) (hw->mac.type == e1000_pch2lan) || (hw->mac.type == e1000_pch_lpt)) { int rid = EM_BAR_TYPE_FLASH; - adapter->flash = bus_alloc_resource_any(dev, + sc->flash = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (adapter->flash == NULL) { + if (sc->flash == NULL) { device_printf(dev, "Mapping of Flash failed\n"); error = ENXIO; goto err_pci; } /* This is used in the shared code */ - hw->flash_address = (u8 *)adapter->flash; - adapter->osdep.flash_bus_space_tag = - rman_get_bustag(adapter->flash); - adapter->osdep.flash_bus_space_handle = - rman_get_bushandle(adapter->flash); + hw->flash_address = (u8 *)sc->flash; + sc->osdep.flash_bus_space_tag = + rman_get_bustag(sc->flash); + sc->osdep.flash_bus_space_handle = + rman_get_bushandle(sc->flash); } /* ** In the new SPT device flash is not a @@ -959,10 +959,10 @@ em_if_attach_pre(if_ctx_t ctx) ** FLASH read/write macros in the shared code. */ else if (hw->mac.type >= e1000_pch_spt) { - adapter->osdep.flash_bus_space_tag = - adapter->osdep.mem_bus_space_tag; - adapter->osdep.flash_bus_space_handle = - adapter->osdep.mem_bus_space_handle + sc->osdep.flash_bus_space_tag = + sc->osdep.mem_bus_space_tag; + sc->osdep.flash_bus_space_handle = + sc->osdep.mem_bus_space_handle + E1000_FLASH_BASE_ADDR; } @@ -979,25 +979,25 @@ em_if_attach_pre(if_ctx_t ctx) e1000_get_bus_info(hw); /* Set up some sysctls for the tunable interrupt delays */ - em_add_int_delay_sysctl(adapter, "rx_int_delay", - "receive interrupt delay in usecs", &adapter->rx_int_delay, + em_add_int_delay_sysctl(sc, "rx_int_delay", + "receive interrupt delay in usecs", &sc->rx_int_delay, E1000_REGISTER(hw, E1000_RDTR), em_rx_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "tx_int_delay", - "transmit interrupt delay in usecs", &adapter->tx_int_delay, + em_add_int_delay_sysctl(sc, "tx_int_delay", + "transmit interrupt delay in usecs", &sc->tx_int_delay, E1000_REGISTER(hw, E1000_TIDV), em_tx_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "rx_abs_int_delay", + em_add_int_delay_sysctl(sc, "rx_abs_int_delay", "receive interrupt delay limit in usecs", - &adapter->rx_abs_int_delay, + &sc->rx_abs_int_delay, E1000_REGISTER(hw, E1000_RADV), em_rx_abs_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "tx_abs_int_delay", + em_add_int_delay_sysctl(sc, "tx_abs_int_delay", "transmit interrupt delay limit in usecs", - &adapter->tx_abs_int_delay, + &sc->tx_abs_int_delay, E1000_REGISTER(hw, E1000_TADV), em_tx_abs_int_delay_dflt); - em_add_int_delay_sysctl(adapter, "itr", + em_add_int_delay_sysctl(sc, "itr", "interrupt delay limit in usecs/4", - &adapter->tx_itr, + &sc->tx_itr, E1000_REGISTER(hw, E1000_ITR), DEFAULT_ITR); @@ -1030,9 +1030,9 @@ em_if_attach_pre(if_ctx_t ctx) hw->mac.report_tx_early = 1; /* Allocate multicast array memory. */ - adapter->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN * + sc->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); - if (adapter->mta == NULL) { + if (sc->mta == NULL) { device_printf(dev, "Can not allocate multicast setup array\n"); error = ENOMEM; goto err_late; @@ -1049,7 +1049,7 @@ em_if_attach_pre(if_ctx_t ctx) SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "eee_control", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, em_sysctl_eee, "I", + sc, 0, em_sysctl_eee, "I", "Disable Energy Efficient Ethernet"); /* @@ -1083,7 +1083,7 @@ em_if_attach_pre(if_ctx_t ctx) } if (!em_is_valid_ether_addr(hw->mac.addr)) { - if (adapter->vf_ifp) { + if (sc->vf_ifp) { ether_gen_addr(iflib_get_ifp(ctx), (struct ether_addr *)hw->mac.addr); } else { @@ -1103,7 +1103,7 @@ em_if_attach_pre(if_ctx_t ctx) /* Enable only WOL MAGIC by default */ scctx->isc_capenable &= ~IFCAP_WOL; - if (adapter->wol != 0) + if (sc->wol != 0) scctx->isc_capenable |= IFCAP_WOL_MAGIC; iflib_set_mac(ctx, hw->mac.addr); @@ -1111,10 +1111,10 @@ em_if_attach_pre(if_ctx_t ctx) return (0); err_late: - em_release_hw_control(adapter); + em_release_hw_control(sc); err_pci: em_free_pci_resources(ctx); - free(adapter->mta, M_DEVBUF); + free(sc->mta, M_DEVBUF); return (error); } @@ -1122,28 +1122,28 @@ err_pci: static int em_if_attach_post(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); - struct e1000_hw *hw = &adapter->hw; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct e1000_hw *hw = &sc->hw; int error = 0; /* Setup OS specific network interface */ error = em_setup_interface(ctx); if (error != 0) { - device_printf(adapter->dev, "Interface setup failed: %d\n", error); + device_printf(sc->dev, "Interface setup failed: %d\n", error); goto err_late; } em_reset(ctx); /* Initialize statistics */ - em_update_stats_counters(adapter); + em_update_stats_counters(sc); hw->mac.get_link_status = 1; em_if_update_admin_status(ctx); - em_add_hw_stats(adapter); + em_add_hw_stats(sc); /* Non-AMT based hardware can now take control from firmware */ - if (adapter->has_manage && !adapter->has_amt) - em_get_hw_control(adapter); + if (sc->has_manage && !sc->has_amt) + em_get_hw_control(sc); INIT_DEBUGOUT("em_if_attach_post: end"); @@ -1166,17 +1166,17 @@ err_late: static int em_if_detach(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); INIT_DEBUGOUT("em_if_detach: begin"); - e1000_phy_hw_reset(&adapter->hw); + e1000_phy_hw_reset(&sc->hw); - em_release_manageability(adapter); - em_release_hw_control(adapter); + em_release_manageability(sc); + em_release_hw_control(sc); em_free_pci_resources(ctx); - free(adapter->mta, M_DEVBUF); - adapter->mta = NULL; + free(sc->mta, M_DEVBUF); + sc->mta = NULL; return (0); } @@ -1199,10 +1199,10 @@ em_if_shutdown(if_ctx_t ctx) static int em_if_suspend(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); - em_release_manageability(adapter); - em_release_hw_control(adapter); + em_release_manageability(sc); + em_release_hw_control(sc); em_enable_wakeup(ctx); return (0); } @@ -1210,12 +1210,12 @@ em_if_suspend(if_ctx_t ctx) static int em_if_resume(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); - if (adapter->hw.mac.type == e1000_pch2lan) - e1000_resume_workarounds_pchlan(&adapter->hw); + if (sc->hw.mac.type == e1000_pch2lan) + e1000_resume_workarounds_pchlan(&sc->hw); em_if_init(ctx); - em_init_manageability(adapter); + em_init_manageability(sc); return(0); } @@ -1224,12 +1224,12 @@ static int em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) { int max_frame_size; - struct adapter *adapter = iflib_get_softc(ctx); + struct e1000_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = iflib_get_softc_ctx(ctx); IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); - switch (adapter->hw.mac.type) { + switch (sc->hw.mac.type) { case e1000_82571: case e1000_82572: case e1000_ich9lan: @@ -1256,7 +1256,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) max_frame_size = ETHER_MAX_LEN; break; default: - if (adapter->hw.mac.type >= igb_mac_min) + if (sc->hw.mac.type >= igb_mac_min) max_frame_size = 9234; else /* lem */ max_frame_size = MAX_JUMBO_FRAME_SIZE; @@ -1265,7 +1265,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) return (EINVAL); } - scctx->isc_max_frame_size = adapter->hw.mac.max_frame_size = + scctx->isc_max_frame_size = sc->hw.mac.max_frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; return (0); } @@ -1282,8 +1282,8 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) static void em_if_init(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); - if_softc_ctx_t scctx = adapter->shared; + struct e1000_softc *sc = iflib_get_softc(ctx); + if_softc_ctx_t scctx = sc->shared; struct ifnet *ifp = iflib_get_ifp(ctx); struct em_tx_queue *tx_que; int i; @@ -1291,11 +1291,11 @@ em_if_init(if_ctx_t ctx) INIT_DEBUGOUT("em_if_init: begin"); /* Get the latest mac address, User can use a LAA */ - bcopy(if_getlladdr(ifp), adapter->hw.mac.addr, + bcopy(if_getlladdr(ifp), sc->hw.mac.addr, ETHER_ADDR_LEN); /* Put the address into the Receive Address Array */ - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); + e1000_rar_set(&sc->hw, sc->hw.mac.addr, 0); /* * With the 82571 adapter, RAR[0] may be overwritten @@ -1303,9 +1303,9 @@ em_if_init(if_ctx_t ctx) * in RAR[14] for that eventuality, this assures * the interface continues to function. */ - if (adapter->hw.mac.type == e1000_82571) { - e1000_set_laa_state_82571(&adapter->hw, true); - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, + if (sc->hw.mac.type == e1000_82571) { + e1000_set_laa_state_82571(&sc->hw, true); + e1000_rar_set(&sc->hw, sc->hw.mac.addr, E1000_RAR_ENTRIES - 1); } @@ -1314,7 +1314,7 @@ em_if_init(if_ctx_t ctx) em_reset(ctx); em_if_update_admin_status(ctx); - for (i = 0, tx_que = adapter->tx_queues; i < adapter->tx_num_queues; i++, tx_que++) { + for (i = 0, tx_que = sc->tx_queues; i < sc->tx_num_queues; i++, tx_que++) { struct tx_ring *txr = &tx_que->txr; txr->tx_rs_cidx = txr->tx_rs_pidx; @@ -1328,14 +1328,14 @@ em_if_init(if_ctx_t ctx) } /* Setup VLAN support, basic and offload if available */ - E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); + E1000_WRITE_REG(&sc->hw, E1000_VET, ETHERTYPE_VLAN); /* Clear bad data from Rx FIFOs */ - if (adapter->hw.mac.type >= igb_mac_min) - e1000_rx_fifo_flush_base(&adapter->hw); + if (sc->hw.mac.type >= igb_mac_min) + e1000_rx_fifo_flush_base(&sc->hw); /* Configure for OS presence */ - em_init_manageability(adapter); + em_init_manageability(sc); /* Prepare transmit descriptors and buffers */ em_initialize_transmit_unit(ctx); @@ -1343,42 +1343,42 @@ em_if_init(if_ctx_t ctx) /* Setup Multicast table */ em_if_multi_set(ctx); - adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); + sc->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); em_initialize_receive_unit(ctx); /* Set up VLAN support and filter */ - em_setup_vlan_hw_support(adapter); + em_setup_vlan_hw_support(sc); /* Don't lose promiscuous settings */ em_if_set_promisc(ctx, if_getflags(ifp)); - e1000_clear_hw_cntrs_base_generic(&adapter->hw); + e1000_clear_hw_cntrs_base_generic(&sc->hw); /* MSI-X configuration for 82574 */ - if (adapter->hw.mac.type == e1000_82574) { - int tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); + if (sc->hw.mac.type == e1000_82574) { + int tmp = E1000_READ_REG(&sc->hw, E1000_CTRL_EXT); tmp |= E1000_CTRL_EXT_PBA_CLR; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); + E1000_WRITE_REG(&sc->hw, E1000_CTRL_EXT, tmp); /* Set the IVAR - interrupt vector routing. */ - E1000_WRITE_REG(&adapter->hw, E1000_IVAR, adapter->ivars); - } else if (adapter->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ - igb_configure_queues(adapter); + E1000_WRITE_REG(&sc->hw, E1000_IVAR, sc->ivars); + } else if (sc->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ + igb_configure_queues(sc); /* this clears any pending interrupts */ - E1000_READ_REG(&adapter->hw, E1000_ICR); - E1000_WRITE_REG(&adapter->hw, E1000_ICS, E1000_ICS_LSC); + E1000_READ_REG(&sc->hw, E1000_ICR); + E1000_WRITE_REG(&sc->hw, E1000_ICS, E1000_ICS_LSC); /* AMT based hardware can now take control from firmware */ - if (adapter->has_manage && adapter->has_amt) - em_get_hw_control(adapter); + if (sc->has_manage && sc->has_amt) + em_get_hw_control(sc); /* Set Energy Efficient Ethernet */ - if (adapter->hw.mac.type >= igb_mac_min && - adapter->hw.phy.media_type == e1000_media_type_copper) { - if (adapter->hw.mac.type == e1000_i354) - e1000_set_eee_i354(&adapter->hw, true, true); + if (sc->hw.mac.type >= igb_mac_min && + sc->hw.phy.media_type == e1000_media_type_copper) { + if (sc->hw.mac.type == e1000_i354) + e1000_set_eee_i354(&sc->hw, true, true); else - e1000_set_eee_i350(&adapter->hw, true, true); + e1000_set_eee_i350(&sc->hw, true, true); } } @@ -1390,11 +1390,11 @@ em_if_init(if_ctx_t ctx) int em_intr(void *arg) { - struct adapter *adapter = arg; - if_ctx_t ctx = adapter->ctx; + struct e1000_softc *sc = arg; + if_ctx_t ctx = sc->ctx; u32 reg_icr; - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + reg_icr = E1000_READ_REG(&sc->hw, E1000_ICR); /* Hot eject? */ if (reg_icr == 0xffffffff) @@ -1408,7 +1408,7 @@ em_intr(void *arg) * Starting with the 82571 chip, bit 31 should be used to * determine whether the interrupt belongs to us. */ - if (adapter->hw.mac.type >= e1000_82571 && + if (sc->hw.mac.type >= e1000_82571 && (reg_icr & E1000_ICR_INT_ASSERTED) == 0) return FILTER_STRAY; @@ -1425,7 +1425,7 @@ em_intr(void *arg) em_handle_link(ctx); if (reg_icr & E1000_ICR_RXO) - adapter->rx_overruns++; + sc->rx_overruns++; return (FILTER_SCHEDULE_THREAD); } @@ -1433,40 +1433,40 @@ em_intr(void *arg) static int em_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_rx_queue *rxq = &adapter->rx_queues[rxqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_rx_queue *rxq = &sc->rx_queues[rxqid]; - E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxq->eims); + E1000_WRITE_REG(&sc->hw, E1000_IMS, rxq->eims); return (0); } static int em_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_tx_queue *txq = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_tx_queue *txq = &sc->tx_queues[txqid]; - E1000_WRITE_REG(&adapter->hw, E1000_IMS, txq->eims); + E1000_WRITE_REG(&sc->hw, E1000_IMS, txq->eims); return (0); } static int igb_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_rx_queue *rxq = &adapter->rx_queues[rxqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_rx_queue *rxq = &sc->rx_queues[rxqid]; - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, rxq->eims); + E1000_WRITE_REG(&sc->hw, E1000_EIMS, rxq->eims); return (0); } static int igb_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid) { - struct adapter *adapter = iflib_get_softc(ctx); - struct em_tx_queue *txq = &adapter->tx_queues[txqid]; + struct e1000_softc *sc = iflib_get_softc(ctx); + struct em_tx_queue *txq = &sc->tx_queues[txqid]; - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, txq->eims); + E1000_WRITE_REG(&sc->hw, E1000_EIMS, txq->eims); return (0); } @@ -1493,29 +1493,29 @@ em_msix_que(void *arg) static int em_msix_link(void *arg) { - struct adapter *adapter = arg; + struct e1000_softc *sc = arg; u32 reg_icr; bool notlink = false; - ++adapter->link_irq; - MPASS(adapter->hw.back != NULL); - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + ++sc->link_irq; + MPASS(sc->hw.back != NULL); + reg_icr = E1000_READ_REG(&sc->hw, E1000_ICR); if (reg_icr & E1000_ICR_RXO) - adapter->rx_overruns++; + sc->rx_overruns++; if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) - em_handle_link(adapter->ctx); + em_handle_link(sc->ctx); else notlink = true; /* Re-arm for other/spurious interrupts */ - if (notlink && adapter->hw.mac.type >= igb_mac_min) { - E1000_WRITE_REG(&adapter->hw, E1000_IMS, E1000_IMS_LSC); - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); - } else if (adapter->hw.mac.type == e1000_82574) { *** 3445 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sat Sep 25 00:43:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83E676774DB for ; Sat, 25 Sep 2021 00:43:46 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) (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 4HGVWk2Qn8z4fhZ for ; Sat, 25 Sep 2021 00:43:46 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb33.google.com with SMTP id f133so9451085yba.11 for ; Fri, 24 Sep 2021 17:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jJ3HDNC9Md5KjFZaE7ZwD3CEK0HwyxTIe7M9qExVOws=; b=GAxtLbPb1QT6hQ3slFapOJNyCU/PQTh6Y8eEkSlHUPol6/JDEStTMX7rWA5otQEWPQ TwICZOIeLHvcPu64+PRQk4Ta2TzysgE7K7gzGZP/BBJoT93jP3LK5UJR8rAsMccuADUL YL/zFIygQ0sQxwzbm/RnWufwsje6I3yYF+v5o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jJ3HDNC9Md5KjFZaE7ZwD3CEK0HwyxTIe7M9qExVOws=; b=UoT1IFtGvtwaMwq8zRcpcyoS0bNufpWvHOge3XqdVI0xiyd62HwDKxtpprDIAe6ycB Rs3f31llLZpEeRYY+LBTTgeWZzjSq/6MlIWzm08c8zJ5UXuAY9aRJc6l+0s9Ac4O0J+R n0ekhmgFJUBf/Ako+dUh0nGQN83/uDs55RvmcZFAU6vhaRIisEuTG///tbPvUXhNHqQT brO5fj9gt+9HDouJMTjeqwRtheIB8lWZMFXjo0aHylkU+ihSOVikCCYHk+vG5CP4GRfq icjdt6u9qyuhAiHQVfgKbUIcrQzdb7T6VdLaj8g353RAyrUV89VOxCnLOx0AizsEbTlm 3Kow== X-Gm-Message-State: AOAM531mjNRl/89aNxJA0TPhQfLD7g8CkTi3P817L0nJoFC2yP8Zh+2i A0RGNOhB5HvvEp4GjZ9/KPZZmD/UHmN77HZUopSN7w== X-Google-Smtp-Source: ABdhPJwBzTUwmNVLh7ob0w6g9aA6BUXriI+9KRJvUiHxN8Nz0hnI4KNfteKqFc7lfTJiSJqDV3Icsk476Us7xER8Ys4= X-Received: by 2002:a25:bb08:: with SMTP id z8mr16632387ybg.306.1632530625295; Fri, 24 Sep 2021 17:43:45 -0700 (PDT) MIME-Version: 1.0 References: <202109250041.18P0fpHY079111@gitrepo.freebsd.org> In-Reply-To: <202109250041.18P0fpHY079111@gitrepo.freebsd.org> From: Kevin Bowling Date: Fri, 24 Sep 2021 17:43:33 -0700 Message-ID: Subject: Re: git: dc9260515449 - main - e1000: Rename 'struct adapter' to 'struct e1000_sc' To: Kevin Bowling Cc: src-committers , "" , "dev-commits-src-main@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HGVWk2Qn8z4fhZ 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: Sat, 25 Sep 2021 00:43:46 -0000 I didn't update the commit message, it was renamed to 'struct e1000_softc' per feedback from markj. On Fri, Sep 24, 2021 at 5:41 PM Kevin Bowling wrote: > > The branch main has been updated by kbowling (ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=dc9260515449cde9a4b26b5448f7386388c55bbd > > commit dc9260515449cde9a4b26b5448f7386388c55bbd > Author: Kevin Bowling > AuthorDate: 2021-09-25 00:09:43 +0000 > Commit: Kevin Bowling > CommitDate: 2021-09-25 00:41:05 +0000 > > e1000: Rename 'struct adapter' to 'struct e1000_sc' > > Rename the 'struct adapter' to 'struct e1000_sc' to avoid type ambiguity > in things like kgdb. > > Reviewed by: jhb, markj > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D32129 > --- > sys/dev/e1000/em_txrx.c | 80 +-- > sys/dev/e1000/if_em.c | 1556 +++++++++++++++++++++++----------------------- > sys/dev/e1000/if_em.h | 308 +++++---- > sys/dev/e1000/igb_txrx.c | 40 +- > 4 files changed, 987 insertions(+), 997 deletions(-) > > diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c > index cc5313a749bd..6ac66a9011f4 100644 > --- a/sys/dev/e1000/em_txrx.c > +++ b/sys/dev/e1000/em_txrx.c > @@ -42,9 +42,9 @@ > /********************************************************************* > * Local Function prototypes > *********************************************************************/ > -static int em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, > +static int em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, > u32 *txd_lower); > -static int em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, > +static int em_transmit_checksum_setup(struct e1000_softc *sc, if_pkt_info_t pi, > u32 *txd_upper, u32 *txd_lower); > static int em_isc_txd_encap(void *arg, if_pkt_info_t pi); > static void em_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); > @@ -91,9 +91,9 @@ struct if_txrx lem_txrx = { > extern if_shared_ctx_t em_sctx; > > void > -em_dump_rs(struct adapter *adapter) > +em_dump_rs(struct e1000_softc *sc) > { > - if_softc_ctx_t scctx = adapter->shared; > + if_softc_ctx_t scctx = sc->shared; > struct em_tx_queue *que; > struct tx_ring *txr; > qidx_t i, ntxd, qid, cur; > @@ -102,8 +102,8 @@ em_dump_rs(struct adapter *adapter) > > printf("\n"); > ntxd = scctx->isc_ntxd[0]; > - for (qid = 0; qid < adapter->tx_num_queues; qid++) { > - que = &adapter->tx_queues[qid]; > + for (qid = 0; qid < sc->tx_num_queues; qid++) { > + que = &sc->tx_queues[qid]; > txr = &que->txr; > rs_cidx = txr->tx_rs_cidx; > if (rs_cidx != txr->tx_rs_pidx) { > @@ -132,10 +132,10 @@ em_dump_rs(struct adapter *adapter) > * > **********************************************************************/ > static int > -em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) > +em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) > { > - if_softc_ctx_t scctx = adapter->shared; > - struct em_tx_queue *que = &adapter->tx_queues[pi->ipi_qsidx]; > + if_softc_ctx_t scctx = sc->shared; > + struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; > struct tx_ring *txr = &que->txr; > struct e1000_context_desc *TXD; > int cur, hdr_len; > @@ -178,7 +178,7 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd > TXD->tcp_seg_setup.fields.mss = htole16(pi->ipi_tso_segsz); > TXD->tcp_seg_setup.fields.hdr_len = hdr_len; > > - TXD->cmd_and_length = htole32(adapter->txd_cmd | > + TXD->cmd_and_length = htole32(sc->txd_cmd | > E1000_TXD_CMD_DEXT | /* Extended descr */ > E1000_TXD_CMD_TSE | /* TSE context */ > E1000_TXD_CMD_IP | /* Do IP csum */ > @@ -189,7 +189,7 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd > if (++cur == scctx->isc_ntxd[0]) { > cur = 0; > } > - DPRINTF(iflib_get_dev(adapter->ctx), "%s: pidx: %d cur: %d\n", __FUNCTION__, pi->ipi_pidx, cur); > + DPRINTF(iflib_get_dev(sc->ctx), "%s: pidx: %d cur: %d\n", __FUNCTION__, pi->ipi_pidx, cur); > return (cur); > } > > @@ -215,11 +215,11 @@ em_tso_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd > **********************************************************************/ > > static int > -em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) > +em_transmit_checksum_setup(struct e1000_softc *sc, if_pkt_info_t pi, u32 *txd_upper, u32 *txd_lower) > { > struct e1000_context_desc *TXD = NULL; > - if_softc_ctx_t scctx = adapter->shared; > - struct em_tx_queue *que = &adapter->tx_queues[pi->ipi_qsidx]; > + if_softc_ctx_t scctx = sc->shared; > + struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; > struct tx_ring *txr = &que->txr; > int csum_flags = pi->ipi_csum_flags; > int cur, hdr_len; > @@ -227,7 +227,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u > > cur = pi->ipi_pidx; > hdr_len = pi->ipi_ehdrlen + pi->ipi_ip_hlen; > - cmd = adapter->txd_cmd; > + cmd = sc->txd_cmd; > > /* > * The 82574L can only remember the *last* context used > @@ -237,7 +237,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u > * second note. > */ > if (DONT_FORCE_CTX && > - adapter->tx_num_queues == 1 && > + sc->tx_num_queues == 1 && > txr->csum_lhlen == pi->ipi_ehdrlen && > txr->csum_iphlen == pi->ipi_ip_hlen && > txr->csum_flags == csum_flags) { > @@ -293,7 +293,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u > if (++cur == scctx->isc_ntxd[0]) { > cur = 0; > } > - DPRINTF(iflib_get_dev(adapter->ctx), "checksum_setup csum_flags=%x txd_upper=%x txd_lower=%x hdr_len=%d cmd=%x\n", > + DPRINTF(iflib_get_dev(sc->ctx), "checksum_setup csum_flags=%x txd_upper=%x txd_lower=%x hdr_len=%d cmd=%x\n", > csum_flags, *txd_upper, *txd_lower, hdr_len, cmd); > return (cur); > } > @@ -301,7 +301,7 @@ em_transmit_checksum_setup(struct adapter *adapter, if_pkt_info_t pi, u32 *txd_u > static int > em_isc_txd_encap(void *arg, if_pkt_info_t pi) > { > - struct adapter *sc = arg; > + struct e1000_softc *sc = arg; > if_softc_ctx_t scctx = sc->shared; > struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx]; > struct tx_ring *txr = &que->txr; > @@ -348,7 +348,7 @@ em_isc_txd_encap(void *arg, if_pkt_info_t pi) > } > > DPRINTF(iflib_get_dev(sc->ctx), "encap: set up tx: nsegs=%d first=%d i=%d\n", nsegs, first, i); > - /* XXX adapter->pcix_82544 -- lem_fill_descriptors */ > + /* XXX sc->pcix_82544 -- lem_fill_descriptors */ > > /* Set up our transmit descriptors */ > for (j = 0; j < nsegs; j++) { > @@ -416,19 +416,19 @@ em_isc_txd_encap(void *arg, if_pkt_info_t pi) > static void > em_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx) > { > - struct adapter *adapter = arg; > - struct em_tx_queue *que = &adapter->tx_queues[txqid]; > + struct e1000_softc *sc = arg; > + struct em_tx_queue *que = &sc->tx_queues[txqid]; > struct tx_ring *txr = &que->txr; > > - E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), pidx); > + E1000_WRITE_REG(&sc->hw, E1000_TDT(txr->me), pidx); > } > > static int > em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) > { > - struct adapter *adapter = arg; > - if_softc_ctx_t scctx = adapter->shared; > - struct em_tx_queue *que = &adapter->tx_queues[txqid]; > + struct e1000_softc *sc = arg; > + if_softc_ctx_t scctx = sc->shared; > + struct em_tx_queue *que = &sc->tx_queues[txqid]; > struct tx_ring *txr = &que->txr; > > qidx_t processed = 0; > @@ -461,7 +461,7 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) > if (delta < 0) > delta += ntxd; > MPASS(delta > 0); > - DPRINTF(iflib_get_dev(adapter->ctx), > + DPRINTF(iflib_get_dev(sc->ctx), > "%s: cidx_processed=%u cur=%u clear=%d delta=%d\n", > __FUNCTION__, prev, cur, clear, delta); > > @@ -483,7 +483,7 @@ em_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear) > static void > lem_isc_rxd_refill(void *arg, if_rxd_update_t iru) > { > - struct adapter *sc = arg; > + struct e1000_softc *sc = arg; > if_softc_ctx_t scctx = sc->shared; > struct em_rx_queue *que = &sc->rx_queues[iru->iru_qsidx]; > struct rx_ring *rxr = &que->rxr; > @@ -511,7 +511,7 @@ lem_isc_rxd_refill(void *arg, if_rxd_update_t iru) > static void > em_isc_rxd_refill(void *arg, if_rxd_update_t iru) > { > - struct adapter *sc = arg; > + struct e1000_softc *sc = arg; > if_softc_ctx_t scctx = sc->shared; > uint16_t rxqid = iru->iru_qsidx; > struct em_rx_queue *que = &sc->rx_queues[rxqid]; > @@ -540,7 +540,7 @@ em_isc_rxd_refill(void *arg, if_rxd_update_t iru) > static void > em_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx) > { > - struct adapter *sc = arg; > + struct e1000_softc *sc = arg; > struct em_rx_queue *que = &sc->rx_queues[rxqid]; > struct rx_ring *rxr = &que->rxr; > > @@ -550,7 +550,7 @@ em_isc_rxd_flush(void *arg, uint16_t rxqid, uint8_t flid __unused, qidx_t pidx) > static int > lem_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) > { > - struct adapter *sc = arg; > + struct e1000_softc *sc = arg; > if_softc_ctx_t scctx = sc->shared; > struct em_rx_queue *que = &sc->rx_queues[rxqid]; > struct rx_ring *rxr = &que->rxr; > @@ -575,7 +575,7 @@ lem_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) > static int > em_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) > { > - struct adapter *sc = arg; > + struct e1000_softc *sc = arg; > if_softc_ctx_t scctx = sc->shared; > struct em_rx_queue *que = &sc->rx_queues[rxqid]; > struct rx_ring *rxr = &que->rxr; > @@ -600,9 +600,9 @@ em_isc_rxd_available(void *arg, uint16_t rxqid, qidx_t idx, qidx_t budget) > static int > lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > { > - struct adapter *adapter = arg; > - if_softc_ctx_t scctx = adapter->shared; > - struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; > + struct e1000_softc *sc = arg; > + if_softc_ctx_t scctx = sc->shared; > + struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; > struct rx_ring *rxr = &que->rxr; > struct e1000_rx_desc *rxd; > u16 len; > @@ -628,7 +628,7 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > > /* Make sure bad packets are discarded */ > if (errors & E1000_RXD_ERR_FRAME_ERR_MASK) { > - adapter->dropped_pkts++; > + sc->dropped_pkts++; > /* XXX fixup if common */ > return (EBADMSG); > } > @@ -645,7 +645,7 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > } while (!eop); > > /* XXX add a faster way to look this up */ > - if (adapter->hw.mac.type >= e1000_82543) > + if (sc->hw.mac.type >= e1000_82543) > em_receive_checksum(status, errors, ri); > > if (status & E1000_RXD_STAT_VP) { > @@ -661,9 +661,9 @@ lem_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > static int > em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > { > - struct adapter *adapter = arg; > - if_softc_ctx_t scctx = adapter->shared; > - struct em_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx]; > + struct e1000_softc *sc = arg; > + if_softc_ctx_t scctx = sc->shared; > + struct em_rx_queue *que = &sc->rx_queues[ri->iri_qsidx]; > struct rx_ring *rxr = &que->rxr; > union e1000_rx_desc_extended *rxd; > > @@ -691,7 +691,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) > > /* Make sure bad packets are discarded */ > if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) { > - adapter->dropped_pkts++; > + sc->dropped_pkts++; > return EBADMSG; > } > > diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c > index 89ccb30ce922..47513c5d9e1e 100644 > --- a/sys/dev/e1000/if_em.c > +++ b/sys/dev/e1000/if_em.c > @@ -294,33 +294,33 @@ static int igb_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid); > static void em_if_multi_set(if_ctx_t ctx); > static void em_if_update_admin_status(if_ctx_t ctx); > static void em_if_debug(if_ctx_t ctx); > -static void em_update_stats_counters(struct adapter *); > -static void em_add_hw_stats(struct adapter *adapter); > +static void em_update_stats_counters(struct e1000_softc *); > +static void em_add_hw_stats(struct e1000_softc *); > static int em_if_set_promisc(if_ctx_t ctx, int flags); > -static bool em_if_vlan_filter_capable(struct adapter *); > -static bool em_if_vlan_filter_used(struct adapter *); > -static void em_if_vlan_filter_enable(struct adapter *); > -static void em_if_vlan_filter_disable(struct adapter *); > -static void em_if_vlan_filter_write(struct adapter *); > -static void em_setup_vlan_hw_support(struct adapter *); > +static bool em_if_vlan_filter_capable(struct e1000_softc *); > +static bool em_if_vlan_filter_used(struct e1000_softc *); > +static void em_if_vlan_filter_enable(struct e1000_softc *); > +static void em_if_vlan_filter_disable(struct e1000_softc *); > +static void em_if_vlan_filter_write(struct e1000_softc *); > +static void em_setup_vlan_hw_support(struct e1000_softc *); > static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); > -static void em_print_nvm_info(struct adapter *); > +static void em_print_nvm_info(struct e1000_softc *); > static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); > static int em_get_rs(SYSCTL_HANDLER_ARGS); > -static void em_print_debug_info(struct adapter *); > +static void em_print_debug_info(struct e1000_softc *); > static int em_is_valid_ether_addr(u8 *); > static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); > -static void em_add_int_delay_sysctl(struct adapter *, const char *, > +static void em_add_int_delay_sysctl(struct e1000_softc *, const char *, > const char *, struct em_int_delay_info *, int, int); > /* Management and WOL Support */ > -static void em_init_manageability(struct adapter *); > -static void em_release_manageability(struct adapter *); > -static void em_get_hw_control(struct adapter *); > -static void em_release_hw_control(struct adapter *); > +static void em_init_manageability(struct e1000_softc *); > +static void em_release_manageability(struct e1000_softc *); > +static void em_get_hw_control(struct e1000_softc *); > +static void em_release_hw_control(struct e1000_softc *); > static void em_get_wakeup(if_ctx_t ctx); > static void em_enable_wakeup(if_ctx_t ctx); > -static int em_enable_phy_wakeup(struct adapter *); > -static void em_disable_aspm(struct adapter *); > +static int em_enable_phy_wakeup(struct e1000_softc *); > +static void em_disable_aspm(struct e1000_softc *); > > int em_intr(void *arg); > > @@ -337,8 +337,8 @@ static void em_if_led_func(if_ctx_t ctx, int onoff); > > static int em_get_regs(SYSCTL_HANDLER_ARGS); > > -static void lem_smartspeed(struct adapter *adapter); > -static void igb_configure_queues(struct adapter *adapter); > +static void lem_smartspeed(struct e1000_softc *); > +static void igb_configure_queues(struct e1000_softc *); > > > /********************************************************************* > @@ -370,7 +370,7 @@ static device_method_t igb_methods[] = { > > > static driver_t em_driver = { > - "em", em_methods, sizeof(struct adapter), > + "em", em_methods, sizeof(struct e1000_softc), > }; > > static devclass_t em_devclass; > @@ -383,7 +383,7 @@ MODULE_DEPEND(em, iflib, 1, 1, 1); > IFLIB_PNP_INFO(pci, em, em_vendor_info_array); > > static driver_t igb_driver = { > - "igb", igb_methods, sizeof(struct adapter), > + "igb", igb_methods, sizeof(struct e1000_softc), > }; > > static devclass_t igb_devclass; > @@ -430,7 +430,7 @@ static device_method_t em_if_methods[] = { > }; > > static driver_t em_if_driver = { > - "em_if", em_if_methods, sizeof(struct adapter) > + "em_if", em_if_methods, sizeof(struct e1000_softc) > }; > > static device_method_t igb_if_methods[] = { > @@ -468,7 +468,7 @@ static device_method_t igb_if_methods[] = { > }; > > static driver_t igb_if_driver = { > - "igb_if", igb_if_methods, sizeof(struct adapter) > + "igb_if", igb_if_methods, sizeof(struct e1000_softc) > }; > > /********************************************************************* > @@ -609,8 +609,8 @@ static struct if_shared_ctx igb_sctx_init = { > > static int em_get_regs(SYSCTL_HANDLER_ARGS) > { > - struct adapter *adapter = (struct adapter *)arg1; > - struct e1000_hw *hw = &adapter->hw; > + struct e1000_softc *sc = (struct e1000_softc *)arg1; > + struct e1000_hw *hw = &sc->hw; > struct sbuf *sb; > u32 *regs_buff; > int rc; > @@ -690,7 +690,7 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) > > #ifdef DUMP_DESCS > { > - if_softc_ctx_t scctx = adapter->shared; > + if_softc_ctx_t scctx = sc->shared; > struct rx_ring *rxr = &rx_que->rxr; > struct tx_ring *txr = &tx_que->txr; > int ntxd = scctx->isc_ntxd[0]; > @@ -734,11 +734,11 @@ igb_register(device_t dev) > static int > em_set_num_queues(if_ctx_t ctx) > { > - struct adapter *adapter = iflib_get_softc(ctx); > + struct e1000_softc *sc = iflib_get_softc(ctx); > int maxqueues; > > /* Sanity check based on HW */ > - switch (adapter->hw.mac.type) { > + switch (sc->hw.mac.type) { > case e1000_82576: > case e1000_82580: > case e1000_i350: > @@ -788,7 +788,7 @@ em_set_num_queues(if_ctx_t ctx) > static int > em_if_attach_pre(if_ctx_t ctx) > { > - struct adapter *adapter; > + struct e1000_softc *sc; > if_softc_ctx_t scctx; > device_t dev; > struct e1000_hw *hw; > @@ -796,42 +796,42 @@ em_if_attach_pre(if_ctx_t ctx) > > INIT_DEBUGOUT("em_if_attach_pre: begin"); > dev = iflib_get_dev(ctx); > - adapter = iflib_get_softc(ctx); > + sc = iflib_get_softc(ctx); > > - adapter->ctx = adapter->osdep.ctx = ctx; > - adapter->dev = adapter->osdep.dev = dev; > - scctx = adapter->shared = iflib_get_softc_ctx(ctx); > - adapter->media = iflib_get_media(ctx); > - hw = &adapter->hw; > + sc->ctx = sc->osdep.ctx = ctx; > + sc->dev = sc->osdep.dev = dev; > + scctx = sc->shared = iflib_get_softc_ctx(ctx); > + sc->media = iflib_get_media(ctx); > + hw = &sc->hw; > > - adapter->tx_process_limit = scctx->isc_ntxd[0]; > + sc->tx_process_limit = scctx->isc_ntxd[0]; > > /* SYSCTL stuff */ > SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), > SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > OID_AUTO, "nvm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, > - adapter, 0, em_sysctl_nvm_info, "I", "NVM Information"); > + sc, 0, em_sysctl_nvm_info, "I", "NVM Information"); > > SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), > SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > OID_AUTO, "debug", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, > - adapter, 0, em_sysctl_debug_info, "I", "Debug Information"); > + sc, 0, em_sysctl_debug_info, "I", "Debug Information"); > > SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), > SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, > - adapter, 0, em_set_flowcntl, "I", "Flow Control"); > + sc, 0, em_set_flowcntl, "I", "Flow Control"); > > SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), > SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > OID_AUTO, "reg_dump", > - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0, > + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0, > em_get_regs, "A", "Dump Registers"); > > SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), > SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > OID_AUTO, "rs_dump", > - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, adapter, 0, > + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, > em_get_rs, "I", "Dump RS indexes"); > > /* Determine hardware and mac info */ > @@ -938,19 +938,19 @@ em_if_attach_pre(if_ctx_t ctx) > (hw->mac.type == e1000_pch2lan) || > (hw->mac.type == e1000_pch_lpt)) { > int rid = EM_BAR_TYPE_FLASH; > - adapter->flash = bus_alloc_resource_any(dev, > + sc->flash = bus_alloc_resource_any(dev, > SYS_RES_MEMORY, &rid, RF_ACTIVE); > - if (adapter->flash == NULL) { > + if (sc->flash == NULL) { > device_printf(dev, "Mapping of Flash failed\n"); > error = ENXIO; > goto err_pci; > } > /* This is used in the shared code */ > - hw->flash_address = (u8 *)adapter->flash; > - adapter->osdep.flash_bus_space_tag = > - rman_get_bustag(adapter->flash); > - adapter->osdep.flash_bus_space_handle = > - rman_get_bushandle(adapter->flash); > + hw->flash_address = (u8 *)sc->flash; > + sc->osdep.flash_bus_space_tag = > + rman_get_bustag(sc->flash); > + sc->osdep.flash_bus_space_handle = > + rman_get_bushandle(sc->flash); > } > /* > ** In the new SPT device flash is not a > @@ -959,10 +959,10 @@ em_if_attach_pre(if_ctx_t ctx) > ** FLASH read/write macros in the shared code. > */ > else if (hw->mac.type >= e1000_pch_spt) { > - adapter->osdep.flash_bus_space_tag = > - adapter->osdep.mem_bus_space_tag; > - adapter->osdep.flash_bus_space_handle = > - adapter->osdep.mem_bus_space_handle > + sc->osdep.flash_bus_space_tag = > + sc->osdep.mem_bus_space_tag; > + sc->osdep.flash_bus_space_handle = > + sc->osdep.mem_bus_space_handle > + E1000_FLASH_BASE_ADDR; > } > > @@ -979,25 +979,25 @@ em_if_attach_pre(if_ctx_t ctx) > e1000_get_bus_info(hw); > > /* Set up some sysctls for the tunable interrupt delays */ > - em_add_int_delay_sysctl(adapter, "rx_int_delay", > - "receive interrupt delay in usecs", &adapter->rx_int_delay, > + em_add_int_delay_sysctl(sc, "rx_int_delay", > + "receive interrupt delay in usecs", &sc->rx_int_delay, > E1000_REGISTER(hw, E1000_RDTR), em_rx_int_delay_dflt); > - em_add_int_delay_sysctl(adapter, "tx_int_delay", > - "transmit interrupt delay in usecs", &adapter->tx_int_delay, > + em_add_int_delay_sysctl(sc, "tx_int_delay", > + "transmit interrupt delay in usecs", &sc->tx_int_delay, > E1000_REGISTER(hw, E1000_TIDV), em_tx_int_delay_dflt); > - em_add_int_delay_sysctl(adapter, "rx_abs_int_delay", > + em_add_int_delay_sysctl(sc, "rx_abs_int_delay", > "receive interrupt delay limit in usecs", > - &adapter->rx_abs_int_delay, > + &sc->rx_abs_int_delay, > E1000_REGISTER(hw, E1000_RADV), > em_rx_abs_int_delay_dflt); > - em_add_int_delay_sysctl(adapter, "tx_abs_int_delay", > + em_add_int_delay_sysctl(sc, "tx_abs_int_delay", > "transmit interrupt delay limit in usecs", > - &adapter->tx_abs_int_delay, > + &sc->tx_abs_int_delay, > E1000_REGISTER(hw, E1000_TADV), > em_tx_abs_int_delay_dflt); > - em_add_int_delay_sysctl(adapter, "itr", > + em_add_int_delay_sysctl(sc, "itr", > "interrupt delay limit in usecs/4", > - &adapter->tx_itr, > + &sc->tx_itr, > E1000_REGISTER(hw, E1000_ITR), > DEFAULT_ITR); > > @@ -1030,9 +1030,9 @@ em_if_attach_pre(if_ctx_t ctx) > hw->mac.report_tx_early = 1; > > /* Allocate multicast array memory. */ > - adapter->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN * > + sc->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN * > MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); > - if (adapter->mta == NULL) { > + if (sc->mta == NULL) { > device_printf(dev, "Can not allocate multicast setup array\n"); > error = ENOMEM; > goto err_late; > @@ -1049,7 +1049,7 @@ em_if_attach_pre(if_ctx_t ctx) > SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > OID_AUTO, "eee_control", > CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, > - adapter, 0, em_sysctl_eee, "I", > + sc, 0, em_sysctl_eee, "I", > "Disable Energy Efficient Ethernet"); > > /* > @@ -1083,7 +1083,7 @@ em_if_attach_pre(if_ctx_t ctx) > } > > if (!em_is_valid_ether_addr(hw->mac.addr)) { > - if (adapter->vf_ifp) { > + if (sc->vf_ifp) { > ether_gen_addr(iflib_get_ifp(ctx), > (struct ether_addr *)hw->mac.addr); > } else { > @@ -1103,7 +1103,7 @@ em_if_attach_pre(if_ctx_t ctx) > > /* Enable only WOL MAGIC by default */ > scctx->isc_capenable &= ~IFCAP_WOL; > - if (adapter->wol != 0) > + if (sc->wol != 0) > scctx->isc_capenable |= IFCAP_WOL_MAGIC; > > iflib_set_mac(ctx, hw->mac.addr); > @@ -1111,10 +1111,10 @@ em_if_attach_pre(if_ctx_t ctx) > return (0); > > err_late: > - em_release_hw_control(adapter); > + em_release_hw_control(sc); > err_pci: > em_free_pci_resources(ctx); > - free(adapter->mta, M_DEVBUF); > + free(sc->mta, M_DEVBUF); > > return (error); > } > @@ -1122,28 +1122,28 @@ err_pci: > static int > em_if_attach_post(if_ctx_t ctx) > { > - struct adapter *adapter = iflib_get_softc(ctx); > - struct e1000_hw *hw = &adapter->hw; > + struct e1000_softc *sc = iflib_get_softc(ctx); > + struct e1000_hw *hw = &sc->hw; > int error = 0; > > /* Setup OS specific network interface */ > error = em_setup_interface(ctx); > if (error != 0) { > - device_printf(adapter->dev, "Interface setup failed: %d\n", error); > + device_printf(sc->dev, "Interface setup failed: %d\n", error); > goto err_late; > } > > em_reset(ctx); > > /* Initialize statistics */ > - em_update_stats_counters(adapter); > + em_update_stats_counters(sc); > hw->mac.get_link_status = 1; > em_if_update_admin_status(ctx); > - em_add_hw_stats(adapter); > + em_add_hw_stats(sc); > > /* Non-AMT based hardware can now take control from firmware */ > - if (adapter->has_manage && !adapter->has_amt) > - em_get_hw_control(adapter); > + if (sc->has_manage && !sc->has_amt) > + em_get_hw_control(sc); > > INIT_DEBUGOUT("em_if_attach_post: end"); > > @@ -1166,17 +1166,17 @@ err_late: > static int > em_if_detach(if_ctx_t ctx) > { > - struct adapter *adapter = iflib_get_softc(ctx); > + struct e1000_softc *sc = iflib_get_softc(ctx); > > INIT_DEBUGOUT("em_if_detach: begin"); > > - e1000_phy_hw_reset(&adapter->hw); > + e1000_phy_hw_reset(&sc->hw); > > - em_release_manageability(adapter); > - em_release_hw_control(adapter); > + em_release_manageability(sc); > + em_release_hw_control(sc); > em_free_pci_resources(ctx); > - free(adapter->mta, M_DEVBUF); > - adapter->mta = NULL; > + free(sc->mta, M_DEVBUF); > + sc->mta = NULL; > > return (0); > } > @@ -1199,10 +1199,10 @@ em_if_shutdown(if_ctx_t ctx) > static int > em_if_suspend(if_ctx_t ctx) > { > - struct adapter *adapter = iflib_get_softc(ctx); > + struct e1000_softc *sc = iflib_get_softc(ctx); > > - em_release_manageability(adapter); > - em_release_hw_control(adapter); > + em_release_manageability(sc); > + em_release_hw_control(sc); > em_enable_wakeup(ctx); > return (0); > } > @@ -1210,12 +1210,12 @@ em_if_suspend(if_ctx_t ctx) > static int > em_if_resume(if_ctx_t ctx) > { > - struct adapter *adapter = iflib_get_softc(ctx); > + struct e1000_softc *sc = iflib_get_softc(ctx); > > - if (adapter->hw.mac.type == e1000_pch2lan) > - e1000_resume_workarounds_pchlan(&adapter->hw); > + if (sc->hw.mac.type == e1000_pch2lan) > + e1000_resume_workarounds_pchlan(&sc->hw); > em_if_init(ctx); > - em_init_manageability(adapter); > + em_init_manageability(sc); > > return(0); > } > @@ -1224,12 +1224,12 @@ static int > em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) > { > int max_frame_size; > - struct adapter *adapter = iflib_get_softc(ctx); > + struct e1000_softc *sc = iflib_get_softc(ctx); > if_softc_ctx_t scctx = iflib_get_softc_ctx(ctx); > > IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); > > - switch (adapter->hw.mac.type) { > + switch (sc->hw.mac.type) { > case e1000_82571: > case e1000_82572: > case e1000_ich9lan: > @@ -1256,7 +1256,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) > max_frame_size = ETHER_MAX_LEN; > break; > default: > - if (adapter->hw.mac.type >= igb_mac_min) > + if (sc->hw.mac.type >= igb_mac_min) > max_frame_size = 9234; > else /* lem */ > max_frame_size = MAX_JUMBO_FRAME_SIZE; > @@ -1265,7 +1265,7 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) > return (EINVAL); > } > > - scctx->isc_max_frame_size = adapter->hw.mac.max_frame_size = > + scctx->isc_max_frame_size = sc->hw.mac.max_frame_size = > mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; > return (0); > } > @@ -1282,8 +1282,8 @@ em_if_mtu_set(if_ctx_t ctx, uint32_t mtu) > static void > em_if_init(if_ctx_t ctx) > { > - struct adapter *adapter = iflib_get_softc(ctx); > - if_softc_ctx_t scctx = adapter->shared; > + struct e1000_softc *sc = iflib_get_softc(ctx); > + if_softc_ctx_t scctx = sc->shared; > struct ifnet *ifp = iflib_get_ifp(ctx); > struct em_tx_queue *tx_que; > int i; > @@ -1291,11 +1291,11 @@ em_if_init(if_ctx_t ctx) > INIT_DEBUGOUT("em_if_init: begin"); > > /* Get the latest mac address, User can use a LAA */ > - bcopy(if_getlladdr(ifp), adapter->hw.mac.addr, > + bcopy(if_getlladdr(ifp), sc->hw.mac.addr, > ETHER_ADDR_LEN); > > /* Put the address into the Receive Address Array */ > - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); > + e1000_rar_set(&sc->hw, sc->hw.mac.addr, 0); > > /* > * With the 82571 adapter, RAR[0] may be overwritten > @@ -1303,9 +1303,9 @@ em_if_init(if_ctx_t ctx) > * in RAR[14] for that eventuality, this assures > * the interface continues to function. > */ > - if (adapter->hw.mac.type == e1000_82571) { > - e1000_set_laa_state_82571(&adapter->hw, true); > - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, > + if (sc->hw.mac.type == e1000_82571) { > + e1000_set_laa_state_82571(&sc->hw, true); > + e1000_rar_set(&sc->hw, sc->hw.mac.addr, > E1000_RAR_ENTRIES - 1); > } > > @@ -1314,7 +1314,7 @@ em_if_init(if_ctx_t ctx) > em_reset(ctx); > em_if_update_admin_status(ctx); > > - for (i = 0, tx_que = adapter->tx_queues; i < adapter->tx_num_queues; i++, tx_que++) { > + for (i = 0, tx_que = sc->tx_queues; i < sc->tx_num_queues; i++, tx_que++) { > struct tx_ring *txr = &tx_que->txr; > > txr->tx_rs_cidx = txr->tx_rs_pidx; > @@ -1328,14 +1328,14 @@ em_if_init(if_ctx_t ctx) > } > > /* Setup VLAN support, basic and offload if available */ > - E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); > + E1000_WRITE_REG(&sc->hw, E1000_VET, ETHERTYPE_VLAN); > > /* Clear bad data from Rx FIFOs */ > - if (adapter->hw.mac.type >= igb_mac_min) > - e1000_rx_fifo_flush_base(&adapter->hw); > + if (sc->hw.mac.type >= igb_mac_min) > + e1000_rx_fifo_flush_base(&sc->hw); > > /* Configure for OS presence */ > - em_init_manageability(adapter); > + em_init_manageability(sc); > > /* Prepare transmit descriptors and buffers */ > em_initialize_transmit_unit(ctx); > @@ -1343,42 +1343,42 @@ em_if_init(if_ctx_t ctx) > /* Setup Multicast table */ > em_if_multi_set(ctx); > > - adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); > + sc->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); > em_initialize_receive_unit(ctx); > > /* Set up VLAN support and filter */ > - em_setup_vlan_hw_support(adapter); > + em_setup_vlan_hw_support(sc); > > /* Don't lose promiscuous settings */ > em_if_set_promisc(ctx, if_getflags(ifp)); > - e1000_clear_hw_cntrs_base_generic(&adapter->hw); > + e1000_clear_hw_cntrs_base_generic(&sc->hw); > > /* MSI-X configuration for 82574 */ > - if (adapter->hw.mac.type == e1000_82574) { > - int tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); > + if (sc->hw.mac.type == e1000_82574) { > + int tmp = E1000_READ_REG(&sc->hw, E1000_CTRL_EXT); > > tmp |= E1000_CTRL_EXT_PBA_CLR; > - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); > + E1000_WRITE_REG(&sc->hw, E1000_CTRL_EXT, tmp); > /* Set the IVAR - interrupt vector routing. */ > - E1000_WRITE_REG(&adapter->hw, E1000_IVAR, adapter->ivars); > - } else if (adapter->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ > - igb_configure_queues(adapter); > + E1000_WRITE_REG(&sc->hw, E1000_IVAR, sc->ivars); > + } else if (sc->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ > + igb_configure_queues(sc); > > /* this clears any pending interrupts */ > - E1000_READ_REG(&adapter->hw, E1000_ICR); > - E1000_WRITE_REG(&adapter->hw, E1000_ICS, E1000_ICS_LSC); > + E1000_READ_REG(&sc->hw, E1000_ICR); > + E1000_WRITE_REG(&sc->hw, E1000_ICS, E1000_ICS_LSC); > > /* AMT based hardware can now take control from firmware */ > - if (adapter->has_manage && adapter->has_amt) > - em_get_hw_control(adapter); > + if (sc->has_manage && sc->has_amt) > + em_get_hw_control(sc); > > /* Set Energy Efficient Ethernet */ > - if (adapter->hw.mac.type >= igb_mac_min && > - adapter->hw.phy.media_type == e1000_media_type_copper) { > - if (adapter->hw.mac.type == e1000_i354) > - e1000_set_eee_i354(&adapter->hw, true, true); > + if (sc->hw.mac.type >= igb_mac_min && > + sc->hw.phy.media_type == e1000_media_type_copper) { > + if (sc->hw.mac.type == e1000_i354) > + e1000_set_eee_i354(&sc->hw, true, true); > else > - e1000_set_eee_i350(&adapter->hw, true, true); > + e1000_set_eee_i350(&sc->hw, true, true); > } > } > > @@ -1390,11 +1390,11 @@ em_if_init(if_ctx_t ctx) > int > em_intr(void *arg) > { > - struct adapter *adapter = arg; > - if_ctx_t ctx = adapter->ctx; > + struct e1000_softc *sc = arg; > + if_ctx_t ctx = sc->ctx; > u32 reg_icr; > > - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); > + reg_icr = E1000_READ_REG(&sc->hw, E1000_ICR); > > /* Hot eject? */ > if (reg_icr == 0xffffffff) > @@ -1408,7 +1408,7 @@ em_intr(void *arg) > * Starting with the 82571 chip, bit 31 should be used to > * determine whether the interrupt belongs to us. > */ > - if (adapter->hw.mac.type >= e1000_82571 && > + if (sc->hw.mac.type >= e1000_82571 && > (reg_icr & E1000_ICR_INT_ASSERTED) == 0) > return FILTER_STRAY; > > @@ -1425,7 +1425,7 @@ em_intr(void *arg) > em_handle_link(ctx); > > if (reg_icr & E1000_ICR_RXO) > - adapter->rx_overruns++; > + sc->rx_overruns++; > > return (FILTER_SCHEDULE_THREAD); > } > @@ -1433,40 +1433,40 @@ em_intr(void *arg) > static int > em_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid) > { > - struct adapter *adapter = iflib_get_softc(ctx); > - struct em_rx_queue *rxq = &adapter->rx_queues[rxqid]; > + struct e1000_softc *sc = iflib_get_softc(ctx); > + struct em_rx_queue *rxq = &sc->rx_queues[rxqid]; > > - E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxq->eims); > + E1000_WRITE_REG(&sc->hw, E1000_IMS, rxq->eims); > return (0); > } > > static int > em_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid) > { > - struct adapter *adapter = iflib_get_softc(ctx); > - struct em_tx_queue *txq = &adapter->tx_queues[txqid]; > + struct e1000_softc *sc = iflib_get_softc(ctx); > + struct em_tx_queue *txq = &sc->tx_queues[txqid]; > > - E1000_WRITE_REG(&adapter->hw, E1000_IMS, txq->eims); > + E1000_WRITE_REG(&sc->hw, E1000_IMS, txq->eims); > return (0); > } > > static int > igb_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid) > { > - struct adapter *adapter = iflib_get_softc(ctx); > - struct em_rx_queue *rxq = &adapter->rx_queues[rxqid]; > + struct e1000_softc *sc = iflib_get_softc(ctx); > + struct em_rx_queue *rxq = &sc->rx_queues[rxqid]; > > - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, rxq->eims); > + E1000_WRITE_REG(&sc->hw, E1000_EIMS, rxq->eims); > return (0); > } > > static int > igb_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid) > { > - struct adapter *adapter = iflib_get_softc(ctx); > - struct em_tx_queue *txq = &adapter->tx_queues[txqid]; > + struct e1000_softc *sc = iflib_get_softc(ctx); > + struct em_tx_queue *txq = &sc->tx_queues[txqid]; > > - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, txq->eims); > + E1000_WRITE_REG(&sc->hw, E1000_EIMS, txq->eims); > return (0); > } > > @@ -1493,29 +1493,29 @@ em_msix_que(void *arg) > static int > em_msix_link(void *arg) > { > - struct adapter *adapter = arg; > + struct e1000_softc *sc = arg; > u32 reg_icr; > bool notlink = false; > > - ++adapter->link_irq; > - MPASS(adapter->hw.back != NULL); > - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); > + ++sc->link_irq; > + MPASS(sc->hw.back != NULL); > + reg_icr = E1000_READ_REG(&sc->hw, E1000_ICR); > > if (reg_icr & E1000_ICR_RXO) > - adapter->rx_overruns++; > + sc->rx_overruns++; > > if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) > - em_handle_link(adapter->ctx); > + em_handle_link(sc->ctx); > else > notlink = true; > > /* Re-arm for other/spurious interrupts */ > - if (notlink && adapter->hw.mac.type >= igb_mac_min) { > - E1000_WRITE_REG(&adapter->hw, E1000_IMS, E1000_IMS_LSC); > - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); > - } else if (adapter->hw.mac.type == e1000_82574) { > *** 3445 LINES SKIPPED *** > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" From owner-dev-commits-src-main@freebsd.org Sat Sep 25 01:24: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 70C09677F69; Sat, 25 Sep 2021 01:24: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 4HGWQc2TPKz4kQK; Sat, 25 Sep 2021 01:24: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 34E9F21590; Sat, 25 Sep 2021 01:24: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 18P1OOLD035830; Sat, 25 Sep 2021 01:24:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P1OOP5035829; Sat, 25 Sep 2021 01:24:24 GMT (envelope-from git) Date: Sat, 25 Sep 2021 01:24:24 GMT Message-Id: <202109250124.18P1OOP5035829@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: c8077ccd70cf - main - acpi_cpu: Make device unit numbers match OS CPU IDs. 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: c8077ccd70cfcbcccb752e89b848f098abcb9309 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, 25 Sep 2021 01:24:24 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c8077ccd70cfcbcccb752e89b848f098abcb9309 commit c8077ccd70cfcbcccb752e89b848f098abcb9309 Author: Alexander Motin AuthorDate: 2021-09-25 01:03:02 +0000 Commit: Alexander Motin CommitDate: 2021-09-25 01:24:19 +0000 acpi_cpu: Make device unit numbers match OS CPU IDs. There are already APIC ID, ACPI ID and OS ID for each CPU. In perfect world all of those may match, but at least for SuperMicro server boards none of them do. Plus none of them match the CPU devices listing order by ACPI. Previous code used the ACPI device listing order to number cpuX devices. It looked nice from NewBus perspective, but introduced 4th different set of IDs. Extremely confusing one, since in some places the device unit numbers were treated as OS CPU IDs (coretemp), but not in others (sysctl dev.cpu.X.%location). --- share/man/man4/acpi.4 | 7 +--- sys/dev/acpica/acpi_cpu.c | 83 ++++++++++++----------------------------------- 2 files changed, 22 insertions(+), 68 deletions(-) diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4 index bf3f5f4d4128..60d77843b340 100644 --- a/share/man/man4/acpi.4 +++ b/share/man/man4/acpi.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2015 +.Dd September 24, 2021 .Dt ACPI 4 .Os .Sh NAME @@ -210,11 +210,6 @@ entry for access after boot. Enables loading of a custom ACPI DSDT. .It Va acpi_dsdt_name Name of the DSDT table to load, if loading is enabled. -.It Va debug.acpi.cpu_unordered -Do not use the MADT to match ACPI Processor objects to CPUs. -This is needed on a few systems with a buggy BIOS that does not use -consistent processor IDs. -Default is 0 (disabled). .It Va debug.acpi.disabled Selectively disables portions of ACPI for debugging purposes. .It Va debug.acpi.interpreter_slack diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 3c81d55436ca..ab4ffda7a02e 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -140,12 +140,6 @@ struct acpi_cpu_device { #define CPUDEV_DEVICE_ID "ACPI0007" -/* Allow users to ignore processor orders in MADT. */ -static int cpu_unordered; -SYSCTL_INT(_debug_acpi, OID_AUTO, cpu_unordered, CTLFLAG_RDTUN, - &cpu_unordered, 0, - "Do not use the MADT to match ACPI Processor objects to CPUs."); - /* Knob to disable acpi_cpu devices */ bool acpi_cpu_disabled = false; @@ -169,8 +163,8 @@ static int acpi_cpu_probe(device_t dev); static int acpi_cpu_attach(device_t dev); static int acpi_cpu_suspend(device_t dev); static int acpi_cpu_resume(device_t dev); -static int acpi_pcpu_get_id(device_t dev, uint32_t *acpi_id, - uint32_t *cpu_id); +static int acpi_pcpu_get_id(device_t dev, uint32_t acpi_id, + u_int *cpu_id); static struct resource_list *acpi_cpu_get_rlist(device_t dev, device_t child); static device_t acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit); @@ -291,19 +285,16 @@ acpi_cpu_probe(device_t dev) return (ENXIO); } } - if (acpi_pcpu_get_id(dev, &acpi_id, &cpu_id) != 0) + if (acpi_pcpu_get_id(dev, acpi_id, &cpu_id) != 0) { + if (bootverbose && (type != ACPI_TYPE_PROCESSOR || acpi_id != 255)) + printf("ACPI: Processor %s (ACPI ID %u) ignored\n", + acpi_name(acpi_get_handle(dev)), acpi_id); return (ENXIO); + } - /* - * Check if we already probed this processor. We scan the bus twice - * so it's possible we've already seen this one. - */ - if (cpu_softc[cpu_id] != NULL) + if (device_set_unit(dev, cpu_id) != 0) return (ENXIO); - /* Mark this processor as in-use and save our derived id for attach. */ - cpu_softc[cpu_id] = (void *)1; - acpi_set_private(dev, (void*)(intptr_t)cpu_id); device_set_desc(dev, "ACPI CPU"); if (!bootverbose && device_get_unit(dev) != 0) { @@ -339,7 +330,7 @@ acpi_cpu_attach(device_t dev) sc = device_get_softc(dev); sc->cpu_dev = dev; sc->cpu_handle = acpi_get_handle(dev); - cpu_id = (int)(intptr_t)acpi_get_private(dev); + cpu_id = device_get_unit(dev); cpu_softc[cpu_id] = sc; pcpu_data = pcpu_find(cpu_id); pcpu_data->pc_device = dev; @@ -546,66 +537,34 @@ acpi_cpu_resume(device_t dev) } /* - * Find the processor associated with a given ACPI ID. By default, - * use the MADT to map ACPI IDs to APIC IDs and use that to locate a - * processor. Some systems have inconsistent ASL and MADT however. - * For these systems the cpu_unordered tunable can be set in which - * case we assume that Processor objects are listed in the same order - * in both the MADT and ASL. + * Find the processor associated with a given ACPI ID. */ static int -acpi_pcpu_get_id(device_t dev, uint32_t *acpi_id, uint32_t *cpu_id) +acpi_pcpu_get_id(device_t dev, uint32_t acpi_id, u_int *cpu_id) { struct pcpu *pc; - uint32_t i, idx; + u_int i; - KASSERT(acpi_id != NULL, ("Null acpi_id")); - KASSERT(cpu_id != NULL, ("Null cpu_id")); - idx = device_get_unit(dev); + CPU_FOREACH(i) { + pc = pcpu_find(i); + if (pc->pc_acpi_id == acpi_id) { + *cpu_id = pc->pc_cpuid; + return (0); + } + } /* * If pc_acpi_id for CPU 0 is not initialized (e.g. a non-APIC * UP box) use the ACPI ID from the first processor we find. */ - if (idx == 0 && mp_ncpus == 1) { + if (mp_ncpus == 1) { pc = pcpu_find(0); if (pc->pc_acpi_id == 0xffffffff) - pc->pc_acpi_id = *acpi_id; + pc->pc_acpi_id = acpi_id; *cpu_id = 0; return (0); } - CPU_FOREACH(i) { - pc = pcpu_find(i); - KASSERT(pc != NULL, ("no pcpu data for %d", i)); - if (cpu_unordered) { - if (idx-- == 0) { - /* - * If pc_acpi_id doesn't match the ACPI ID from the - * ASL, prefer the MADT-derived value. - */ - if (pc->pc_acpi_id != *acpi_id) - *acpi_id = pc->pc_acpi_id; - *cpu_id = pc->pc_cpuid; - return (0); - } - } else { - if (pc->pc_acpi_id == *acpi_id) { - if (bootverbose) - device_printf(dev, - "Processor %s (ACPI ID %u) -> APIC ID %d\n", - acpi_name(acpi_get_handle(dev)), *acpi_id, - pc->pc_cpuid); - *cpu_id = pc->pc_cpuid; - return (0); - } - } - } - - if (bootverbose) - printf("ACPI: Processor %s (ACPI ID %u) ignored\n", - acpi_name(acpi_get_handle(dev)), *acpi_id); - return (ESRCH); } From owner-dev-commits-src-main@freebsd.org Sat Sep 25 01:59: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 34F0967863B; Sat, 25 Sep 2021 01:59: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 4HGXBY0zmbz4mdR; Sat, 25 Sep 2021 01:59: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 F1DDF21C71; Sat, 25 Sep 2021 01:59:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18P1x0CI075799; Sat, 25 Sep 2021 01:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P1x0fW075798; Sat, 25 Sep 2021 01:59:00 GMT (envelope-from git) Date: Sat, 25 Sep 2021 01:59:00 GMT Message-Id: <202109250159.18P1x0fW075798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 340e009ecc00 - main - makesyscalls: stop trying to remove . and .. in cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 340e009ecc00e5e74d58920ca909968dc7e88af1 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, 25 Sep 2021 01:59:01 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=340e009ecc00e5e74d58920ca909968dc7e88af1 commit 340e009ecc00e5e74d58920ca909968dc7e88af1 Author: Kyle Evans AuthorDate: 2021-01-27 17:46:15 +0000 Commit: Kyle Evans CommitDate: 2021-09-25 01:50:39 +0000 makesyscalls: stop trying to remove . and .. in cleanup lfs.dir() will include these entries, but os.remove() cannot remove them for obvious reasons. --- sys/tools/makesyscalls.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index bedece17c162..811101305ec4 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -100,7 +100,9 @@ local function cleanup() if cleantmp then if lfs.dir(tmpspace) then for fname in lfs.dir(tmpspace) do - os.remove(tmpspace .. "/" .. fname) + if fname ~= "." and fname ~= ".." then + os.remove(tmpspace .. "/" .. fname)) + end end end From owner-dev-commits-src-main@freebsd.org Sat Sep 25 01:59: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 88B10678B2D; Sat, 25 Sep 2021 01:59:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGXBb3CSdz4mk7; Sat, 25 Sep 2021 01:59:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FACD21C72; Sat, 25 Sep 2021 01:59:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18P1x3Cf075854; Sat, 25 Sep 2021 01:59:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P1x3vq075853; Sat, 25 Sep 2021 01:59:03 GMT (envelope-from git) Date: Sat, 25 Sep 2021 01:59:03 GMT Message-Id: <202109250159.18P1x3vq075853@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6687410af7db - main - makesyscalls: sprinkle some assert() on standard function calls MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6687410af7dba54e19b773684a969e9c590999e4 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, 25 Sep 2021 01:59:03 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6687410af7dba54e19b773684a969e9c590999e4 commit 6687410af7dba54e19b773684a969e9c590999e4 Author: Kyle Evans AuthorDate: 2021-01-27 18:12:33 +0000 Commit: Kyle Evans CommitDate: 2021-09-25 01:55:56 +0000 makesyscalls: sprinkle some assert() on standard function calls Improves our error reporting, ensuring that we aren't just ignoring errors in the common case. Note specifically the boundary where we have to change up our error handling approach. It's fine to error() out up until we create the tempdir, then the rest should try to handle it gracefully and abort(). A future change will clean this up further by pcall'ing all of the bits that cannot currently error() without cleaning up. --- sys/tools/makesyscalls.lua | 64 ++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index 64b260eb65bf..7824a533e4d5 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -95,28 +95,30 @@ local files = {} local function cleanup() for _, v in pairs(files) do - v:close() + assert(v:close()) end if cleantmp then if lfs.dir(tmpspace) then for fname in lfs.dir(tmpspace) do if fname ~= "." and fname ~= ".." then - os.remove(tmpspace .. "/" .. fname)) + assert(os.remove(tmpspace .. "/" .. + fname)) end end end if lfs.attributes(tmpspace) and not lfs.rmdir(tmpspace) then - io.stderr:write("Failed to clean up tmpdir: " .. - tmpspace .. "\n") + assert(io.stderr:write("Failed to clean up tmpdir: " .. + tmpspace .. "\n")) end else - io.stderr:write("Temp files left in " .. tmpspace .. "\n") + assert(io.stderr:write("Temp files left in " .. tmpspace .. + "\n")) end end local function abort(status, msg) - io.stderr:write(msg .. "\n") + assert(io.stderr:write(msg .. "\n")) cleanup() os.exit(status) end @@ -208,14 +210,11 @@ local function process_config(file) -- would need to sanitize the line for potentially special characters. local line_expr = "^([%w%p]+%s*)=(%s*[`\"]?[^\"`]+[`\"]?)" - if file == nil then + if not file then return nil, "No file given" end - local fh = io.open(file) - if fh == nil then - return nil, "Could not open file" - end + local fh = assert(io.open(file)) for nextline in fh:lines() do -- Strip any whole-line comments @@ -262,7 +261,7 @@ local function process_config(file) end end - io.close(fh) + assert(io.close(fh)) return cfg end @@ -291,7 +290,7 @@ local function grab_capenabled(file, open_fail_ok) end end - io.close(fh) + assert(io.close(fh)) return capentries end @@ -369,8 +368,8 @@ local function read_file(tmpfile) end local fh = files[tmpfile] - fh:seek("set") - return fh:read("a") + assert(fh:seek("set")) + return assert(fh:read("a")) end local function write_line(tmpfile, line) @@ -378,13 +377,13 @@ local function write_line(tmpfile, line) print("Not found: " .. tmpfile) return end - files[tmpfile]:write(line) + assert(files[tmpfile]:write(line)) end local function write_line_pfile(tmppat, line) for k in pairs(files) do if k:match(tmppat) ~= nil then - files[k]:write(line) + assert(files[k]:write(line)) end end end @@ -505,7 +504,7 @@ local function process_sysfile(file) process_syscall_def(prevline) end - io.close(fh) + assert(io.close(fh)) return capentries end @@ -1108,7 +1107,7 @@ end -- Entry point if #arg < 1 or #arg > 2 then - abort(1, "usage: " .. arg[0] .. " input-file ") + error("usage: " .. arg[0] .. " input-file ") end local sysfile, configfile = arg[1], arg[2] @@ -1116,13 +1115,7 @@ local sysfile, configfile = arg[1], arg[2] -- process_config either returns nil and a message, or a -- table that we should merge into the global config if configfile ~= nil then - local res, msg = process_config(configfile) - - if res == nil then - -- Error... handle? - print(msg) - os.exit(1) - end + local res = assert(process_config(configfile)) for k, v in pairs(res) do if v ~= config[k] then @@ -1150,17 +1143,28 @@ process_compat() process_abi_flags() if not lfs.mkdir(tmpspace) then - abort(1, "Failed to create tempdir " .. tmpspace) + error("Failed to create tempdir " .. tmpspace) end +-- XXX Revisit the error handling here, we should probably move the rest of this +-- into a function that we pcall() so we can catch the errors and clean up +-- gracefully. for _, v in ipairs(temp_files) do local tmpname = tmpspace .. v files[v] = io.open(tmpname, "w+") + -- XXX Revisit these with a pcall() + error handler + if not files[v] then + abort(1, "Failed to open temp file: " .. tmpname) + end end for _, v in ipairs(output_files) do local tmpname = tmpspace .. v files[v] = io.open(tmpname, "w+") + -- XXX Revisit these with a pcall() + error handler + if not files[v] then + abort(1, "Failed to open temp output file: " .. tmpname) + end end -- Write out all of the preamble bits @@ -1358,12 +1362,12 @@ write_line("systrace", read_file("systraceret")) for _, v in ipairs(output_files) do local target = config[v] if target ~= "/dev/null" then - local fh = io.open(target, "w+") + local fh = assert(io.open(target, "w+")) if fh == nil then abort(1, "Failed to open '" .. target .. "'") end - fh:write(read_file(v)) - fh:close() + assert(fh:write(read_file(v))) + assert(fh:close()) end end From owner-dev-commits-src-main@freebsd.org Sat Sep 25 01:59: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 4A672678B25; Sat, 25 Sep 2021 01:59: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 4HGXBZ1YYRz4mm7; Sat, 25 Sep 2021 01:59: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 1695E21B19; Sat, 25 Sep 2021 01:59: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 18P1x1tM075823; Sat, 25 Sep 2021 01:59:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P1x1IQ075822; Sat, 25 Sep 2021 01:59:01 GMT (envelope-from git) Date: Sat, 25 Sep 2021 01:59:01 GMT Message-Id: <202109250159.18P1x1IQ075822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: e12a0ffe2b01 - main - makesyscalls: rip out arbitrary command execution MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e12a0ffe2b01a653a213423435bfe0a696ca737e 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, 25 Sep 2021 01:59:02 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e12a0ffe2b01a653a213423435bfe0a696ca737e commit e12a0ffe2b01a653a213423435bfe0a696ca737e Author: Kyle Evans AuthorDate: 2021-09-24 01:04:36 +0000 Commit: Kyle Evans CommitDate: 2021-09-25 01:53:44 +0000 makesyscalls: rip out arbitrary command execution This was previously needed only for CloudABI, which used it to generate its capenabled from syscalls.master. CloudABI was removed in cf0ee8738e31, so we don't need to support this anymore. Others looking to do similar things should come up with a more integrated technique, such as a .conf flag or pattern/glob support. brooks suggests that it could be done in modern makesyscalls.lua by adding a config flag to specify always-on/initial flags (CAPENABLED). Reviewed by: brooks, imp MFC after: never Differential Revision: https://reviews.freebsd.org/D32095 --- sys/tools/makesyscalls.lua | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index 811101305ec4..64b260eb65bf 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -195,19 +195,6 @@ local function trim(s, char) return s:gsub("^" .. char .. "+", ""):gsub(char .. "+$", "") end --- We have to io.popen it, making sure it's properly escaped, and grab the --- output from the handle returned. -local function exec(cmd) - cmd = cmd:gsub('"', '\\"') - - local shcmd = "/bin/sh -c \"" .. cmd .. "\"" - local fh = io.popen(shcmd) - local output = fh:read("a") - - fh:close() - return output -end - -- config looks like a shell script; in fact, the previous makesyscalls.sh -- script actually sourced it in. It had a pretty common format, so we should -- be fine to make various assumptions @@ -240,8 +227,9 @@ local function process_config(file) key = trim(key) value = trim(value) local delim = value:sub(1,1) - if delim == '`' or delim == '"' then + if delim == '"' then local trailing_context + -- Strip off the key/value part trailing_context = nextline:sub(kvp:len() + 1) -- Strip off any trailing comment @@ -253,26 +241,7 @@ local function process_config(file) print(trailing_context) abort(1, "Malformed line: " .. nextline) end - end - if delim == '`' then - -- Command substition may use $1 and $2 to mean - -- the syscall definition file and itself - -- respectively. We'll go ahead and replace - -- $[0-9] with respective arg in case we want to - -- expand this in the future easily... - value = trim(value, delim) - for capture in value:gmatch("$([0-9]+)") do - capture = tonumber(capture) - if capture > #arg then - abort(1, "Not enough args: " .. - value) - end - value = value:gsub("$" .. capture, - arg[capture]) - end - value = exec(value) - elseif delim == '"' then value = trim(value, delim) else -- Strip off potential comments From owner-dev-commits-src-main@freebsd.org Sat Sep 25 03:23: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 F02E66794EB; Sat, 25 Sep 2021 03:23: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 4HGZ4W6DSzz4tqL; Sat, 25 Sep 2021 03:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5A612302C; Sat, 25 Sep 2021 03:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18P3Nt1Q096408; Sat, 25 Sep 2021 03:23:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P3Ntsc096407; Sat, 25 Sep 2021 03:23:55 GMT (envelope-from git) Date: Sat, 25 Sep 2021 03:23:55 GMT Message-Id: <202109250323.18P3Ntsc096407@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: 242923eb848a - main - loader tslog: Don't use sprintf 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: 242923eb848a94d657344c2ff45c4f15433cdf3c 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, 25 Sep 2021 03:23:56 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=242923eb848a94d657344c2ff45c4f15433cdf3c commit 242923eb848a94d657344c2ff45c4f15433cdf3c Author: Colin Percival AuthorDate: 2021-09-25 03:19:38 +0000 Commit: Colin Percival CommitDate: 2021-09-25 03:23:37 +0000 loader tslog: Don't use sprintf Instead, append the log entry "manually". MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva --- stand/libsa/tslog.c | 50 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/stand/libsa/tslog.c b/stand/libsa/tslog.c index c6164aab02a9..a2791f9dc9c4 100644 --- a/stand/libsa/tslog.c +++ b/stand/libsa/tslog.c @@ -42,6 +42,24 @@ static char * tslog_buf = NULL; static size_t tslog_buflen = 0; static size_t tslog_bufpos = 0; +static size_t +tsccat(char * buf, uint64_t tsc) +{ + size_t len; + + /* Handle upper digits. */ + if (tsc >= 10) + len = tsccat(buf, tsc / 10); + else + len = 0; + + /* Write the last digit. */ + buf[len] = "0123456789"[tsc % 10]; + + /* Return the length written. */ + return (len + 1); +} + void tslog_setbuf(void * buf, size_t len) { @@ -69,16 +87,34 @@ tslog(const char * type, const char * f, const char * s) #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; + /* Check that we have enough space. */ + if (tslog_buflen - tslog_bufpos < 32 + strlen(type) + strlen(f) + + (s ? strlen(s) : 0)) + return; + + /* Append to existing buffer. */ + strcpy(&tslog_buf[tslog_bufpos], "0x0 "); + tslog_bufpos += 4; + tslog_bufpos += tsccat(&tslog_buf[tslog_bufpos], tsc); + strcpy(&tslog_buf[tslog_bufpos], " "); + tslog_bufpos += 1; + strcpy(&tslog_buf[tslog_bufpos], type); + tslog_bufpos += strlen(type); + strcpy(&tslog_buf[tslog_bufpos], " "); + tslog_bufpos += 1; + strcpy(&tslog_buf[tslog_bufpos], f); + tslog_bufpos += strlen(f); + if (s != NULL) { + strcpy(&tslog_buf[tslog_bufpos], " "); + tslog_bufpos += 1; + strcpy(&tslog_buf[tslog_bufpos], s); + tslog_bufpos += strlen(s); + } + strcpy(&tslog_buf[tslog_bufpos], "\n"); + tslog_bufpos += 1; } From owner-dev-commits-src-main@freebsd.org Sat Sep 25 03:23: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 2674567990E; Sat, 25 Sep 2021 03:23: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 4HGZ4X742Rz4tqN; Sat, 25 Sep 2021 03:23:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D097322F6A; Sat, 25 Sep 2021 03:23:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18P3NugO096432; Sat, 25 Sep 2021 03:23:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P3NuNA096431; Sat, 25 Sep 2021 03:23:56 GMT (envelope-from git) Date: Sat, 25 Sep 2021 03:23:56 GMT Message-Id: <202109250323.18P3NuNA096431@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: 0a35c4b3cab5 - main - loader printf: Profile 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: 0a35c4b3cab563e3ab1bf5b7b49bf26e0bb7cb04 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, 25 Sep 2021 03:23:57 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=0a35c4b3cab563e3ab1bf5b7b49bf26e0bb7cb04 commit 0a35c4b3cab563e3ab1bf5b7b49bf26e0bb7cb04 Author: Colin Percival AuthorDate: 2021-09-25 03:20:33 +0000 Commit: Colin Percival CommitDate: 2021-09-25 03:23:49 +0000 loader printf: Profile with TSLOG Now that the loader tslog code doesn't call printf, we can profile printf using TSLOG. On an EC2 c5.xlarge instance, we spend roughly 45 ms here (out of roughly 500 ms), presumably due to the time spent writing output to the console. MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva --- stand/libsa/printf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stand/libsa/printf.c b/stand/libsa/printf.c index 1602a2dc519d..4de547b644dd 100644 --- a/stand/libsa/printf.c +++ b/stand/libsa/printf.c @@ -271,6 +271,7 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) char padc; int stop = 0, retval = 0; + TSENTER(); num = 0; if (!func) d = (char *) arg; @@ -287,8 +288,10 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) padc = ' '; width = 0; while ((ch = (u_char)*fmt++) != '%' || stop) { - if (ch == '\0') + if (ch == '\0') { + TSEXIT(); return (retval); + } PCHAR(ch); } percent = fmt - 1; From owner-dev-commits-src-main@freebsd.org Sat Sep 25 03:32: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 B4394679264; Sat, 25 Sep 2021 03:32: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 4HGZG14bbyz4vSx; Sat, 25 Sep 2021 03:32: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 7DC19230B1; Sat, 25 Sep 2021 03:32: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 18P3W9jI008784; Sat, 25 Sep 2021 03:32:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P3W9UM008783; Sat, 25 Sep 2021 03:32:09 GMT (envelope-from git) Date: Sat, 25 Sep 2021 03:32:09 GMT Message-Id: <202109250332.18P3W9UM008783@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: d3a8f98acbf5 - main - Make CPU children explicitly share parent unit numbers. 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: d3a8f98acbf51e728411f10c5f179a30b9ca683c 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, 25 Sep 2021 03:32:09 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d3a8f98acbf51e728411f10c5f179a30b9ca683c commit d3a8f98acbf51e728411f10c5f179a30b9ca683c Author: Alexander Motin AuthorDate: 2021-09-25 03:25:46 +0000 Commit: Alexander Motin CommitDate: 2021-09-25 03:31:51 +0000 Make CPU children explicitly share parent unit numbers. Before this device unit number match was coincidental and broke if I disabled some CPU device(s). Aside of cosmetics, for some drivers (may be considered broken) it caused talking to wrong CPUs. --- sys/dev/acpica/acpi_perf.c | 3 ++- sys/dev/acpica/acpi_throttle.c | 3 ++- sys/dev/amdtemp/amdtemp.c | 3 ++- sys/dev/coretemp/coretemp.c | 2 +- sys/dev/cpufreq/cpufreq_dt.c | 3 ++- sys/kern/kern_cpu.c | 2 +- sys/x86/cpufreq/est.c | 2 +- sys/x86/cpufreq/hwpstate_amd.c | 3 ++- sys/x86/cpufreq/hwpstate_intel.c | 8 +++----- sys/x86/cpufreq/p4tcc.c | 3 ++- sys/x86/cpufreq/powernow.c | 3 ++- sys/x86/cpufreq/smist.c | 3 ++- 12 files changed, 22 insertions(+), 16 deletions(-) diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c index df0fa9a29b6e..5134bbaaa4dc 100644 --- a/sys/dev/acpica/acpi_perf.c +++ b/sys/dev/acpica/acpi_perf.c @@ -161,7 +161,8 @@ acpi_perf_identify(driver_t *driver, device_t parent) * We probe this child now so that other devices that depend * on it (i.e., for info about supported states) will see it. */ - if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_perf", -1)) != NULL) + if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_perf", + device_get_unit(parent))) != NULL) device_probe_and_attach(dev); else device_printf(parent, "add acpi_perf child failed\n"); diff --git a/sys/dev/acpica/acpi_throttle.c b/sys/dev/acpica/acpi_throttle.c index 883b5d34de09..a9cc2d77ecf9 100644 --- a/sys/dev/acpica/acpi_throttle.c +++ b/sys/dev/acpica/acpi_throttle.c @@ -157,7 +157,8 @@ acpi_throttle_identify(driver_t *driver, device_t parent) obj = (ACPI_OBJECT *)buf.Pointer; if ((obj->Processor.PblkAddress && obj->Processor.PblkLength >= 4) || ACPI_SUCCESS(AcpiEvaluateObject(handle, "_PTC", NULL, NULL))) { - if (BUS_ADD_CHILD(parent, 0, "acpi_throttle", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "acpi_throttle", + device_get_unit(parent)) == NULL) device_printf(parent, "add throttle child failed\n"); } AcpiOsFree(obj); diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c index 21227a47c513..c1d696d070a5 100644 --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -263,7 +263,8 @@ amdtemp_identify(driver_t *driver, device_t parent) return; if (amdtemp_match(parent, NULL)) { - child = device_add_child(parent, "amdtemp", -1); + child = device_add_child(parent, "amdtemp", + device_get_unit(parent)); if (child == NULL) device_printf(parent, "add amdtemp child failed\n"); } diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c index bdc71b284ac7..251fb08b4c11 100644 --- a/sys/dev/coretemp/coretemp.c +++ b/sys/dev/coretemp/coretemp.c @@ -133,7 +133,7 @@ coretemp_identify(driver_t *driver, device_t parent) * We add a child for each CPU since settings must be performed * on each CPU in the SMP case. */ - child = device_add_child(parent, "coretemp", -1); + child = device_add_child(parent, "coretemp", device_get_unit(parent)); if (child == NULL) device_printf(parent, "add coretemp child failed\n"); } diff --git a/sys/dev/cpufreq/cpufreq_dt.c b/sys/dev/cpufreq/cpufreq_dt.c index 3beffeb7063a..4ab021a97d31 100644 --- a/sys/dev/cpufreq/cpufreq_dt.c +++ b/sys/dev/cpufreq/cpufreq_dt.c @@ -309,7 +309,8 @@ cpufreq_dt_identify(driver_t *driver, device_t parent) if (device_find_child(parent, "cpufreq_dt", -1) != NULL) return; - if (BUS_ADD_CHILD(parent, 0, "cpufreq_dt", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "cpufreq_dt", device_get_unit(parent)) + == NULL) device_printf(parent, "add cpufreq_dt child failed\n"); } diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c index 2f44405aef37..380849974a35 100644 --- a/sys/kern/kern_cpu.c +++ b/sys/kern/kern_cpu.c @@ -1103,7 +1103,7 @@ cpufreq_register(device_t dev) } /* Add the child device and possibly sysctls. */ - cf_dev = BUS_ADD_CHILD(cpu_dev, 0, "cpufreq", -1); + cf_dev = BUS_ADD_CHILD(cpu_dev, 0, "cpufreq", device_get_unit(cpu_dev)); if (cf_dev == NULL) return (ENOMEM); device_quiet(cf_dev); diff --git a/sys/x86/cpufreq/est.c b/sys/x86/cpufreq/est.c index 258a9c493d0f..cdca2fdfec5f 100644 --- a/sys/x86/cpufreq/est.c +++ b/sys/x86/cpufreq/est.c @@ -946,7 +946,7 @@ est_identify(driver_t *driver, device_t parent) * We add a child for each CPU since settings must be performed * on each CPU in the SMP case. */ - child = BUS_ADD_CHILD(parent, 10, "est", -1); + child = BUS_ADD_CHILD(parent, 10, "est", device_get_unit(parent)); if (child == NULL) device_printf(parent, "add est child failed\n"); } diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c index ee67da43de53..3193cbd908cc 100644 --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -341,7 +341,8 @@ hwpstate_identify(driver_t *driver, device_t parent) if (resource_disabled("hwpstate", 0)) return; - if (BUS_ADD_CHILD(parent, 10, "hwpstate", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "hwpstate", device_get_unit(parent)) + == NULL) device_printf(parent, "hwpstate: add child failed\n"); } diff --git a/sys/x86/cpufreq/hwpstate_intel.c b/sys/x86/cpufreq/hwpstate_intel.c index f6e63fdeb854..d4d94cadab28 100644 --- a/sys/x86/cpufreq/hwpstate_intel.c +++ b/sys/x86/cpufreq/hwpstate_intel.c @@ -351,11 +351,9 @@ intel_hwpstate_identify(driver_t *driver, device_t parent) if ((cpu_power_eax & CPUTPM1_HWP) == 0) return; - if (BUS_ADD_CHILD(parent, 10, "hwpstate_intel", -1) == NULL) - return; - - if (bootverbose) - device_printf(parent, "hwpstate registered\n"); + if (BUS_ADD_CHILD(parent, 10, "hwpstate_intel", device_get_unit(parent)) + == NULL) + device_printf(parent, "hwpstate_intel: add child failed\n"); } static int diff --git a/sys/x86/cpufreq/p4tcc.c b/sys/x86/cpufreq/p4tcc.c index 89bfef3f6930..4370da81cf06 100644 --- a/sys/x86/cpufreq/p4tcc.c +++ b/sys/x86/cpufreq/p4tcc.c @@ -135,7 +135,8 @@ p4tcc_identify(driver_t *driver, device_t parent) * of the IA32 Intel Architecture Software Developer's Manual, * Volume 3, for more info. */ - if (BUS_ADD_CHILD(parent, 10, "p4tcc", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "p4tcc", device_get_unit(parent)) + == NULL) device_printf(parent, "add p4tcc child failed\n"); } diff --git a/sys/x86/cpufreq/powernow.c b/sys/x86/cpufreq/powernow.c index da5598557387..977798ab2f77 100644 --- a/sys/x86/cpufreq/powernow.c +++ b/sys/x86/cpufreq/powernow.c @@ -876,7 +876,8 @@ pn_identify(driver_t *driver, device_t parent) } if (device_find_child(parent, "powernow", -1) != NULL) return; - if (BUS_ADD_CHILD(parent, 10, "powernow", -1) == NULL) + if (BUS_ADD_CHILD(parent, 10, "powernow", device_get_unit(parent)) + == NULL) device_printf(parent, "powernow: add child failed\n"); } diff --git a/sys/x86/cpufreq/smist.c b/sys/x86/cpufreq/smist.c index f95939001ecb..fda7cb2f52bc 100644 --- a/sys/x86/cpufreq/smist.c +++ b/sys/x86/cpufreq/smist.c @@ -311,7 +311,8 @@ smist_identify(driver_t *driver, device_t parent) if (device_find_child(parent, "smist", -1) != NULL) return; - if (BUS_ADD_CHILD(parent, 30, "smist", -1) == NULL) + if (BUS_ADD_CHILD(parent, 30, "smist", device_get_unit(parent)) + == NULL) device_printf(parent, "smist: add child failed\n"); } From owner-dev-commits-src-main@freebsd.org Sat Sep 25 04:53: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 6B76067B241; Sat, 25 Sep 2021 04:53: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 4HGc3q18Y3z3JNh; Sat, 25 Sep 2021 04:53: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 08712242B2; Sat, 25 Sep 2021 04:53: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 18P4rQ0L016060; Sat, 25 Sep 2021 04:53:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P4rQ3G016059; Sat, 25 Sep 2021 04:53:26 GMT (envelope-from git) Date: Sat, 25 Sep 2021 04:53:26 GMT Message-Id: <202109250453.18P4rQ3G016059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: 43880c511cef - main - [fib_algo][dxr] Split unused range chunk list in multiple buckets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 43880c511cef68098a9ca5a797f28e2c4d29cfad 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, 25 Sep 2021 04:53:27 -0000 The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=43880c511cef68098a9ca5a797f28e2c4d29cfad commit 43880c511cef68098a9ca5a797f28e2c4d29cfad Author: Marko Zec AuthorDate: 2021-09-25 04:29:48 +0000 Commit: Marko Zec CommitDate: 2021-09-25 04:29:48 +0000 [fib_algo][dxr] Split unused range chunk list in multiple buckets Traversing a single list of unused range chunks in search for a block of optimal size was suboptimal. The experience with real-world BGP workloads has shown that on average unused range chunks are tiny, mostly in length from 1 to 4 or 5, when DXR is configured with K = 20 which is the current default (D16X4R). Therefore, introduce a limited amount of buckets to accomodate descriptors of empty blocks of fixed (small) size, so that those can be found in O(1) time. If no empty chunks of the requested size can be found in fixed-size buckets, the search continues in an unsorted list of empty chunks of variable lengths, which should only happen infrequently. This change should permit us to manage significantly more empty range chunks without sacrifying the speed of incremental range table updating. MFC after: 3 days --- sys/netinet/in_fib_dxr.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index c4f42abdda27..6a9f414c3ab0 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -115,6 +115,8 @@ CTASSERT(DXR_TRIE_BITS >= 16 && DXR_TRIE_BITS <= 24); #define XTBL_SIZE_INCR (DIRECT_TBL_SIZE / 16) +#define UNUSED_BUCKETS 8 + /* Lookup structure elements */ struct direct_entry { @@ -181,7 +183,7 @@ struct dxr_aux { struct trie_desc *trietbl[D_TBL_SIZE]; LIST_HEAD(, chunk_desc) chunk_hashtbl[CHUNK_HASH_SIZE]; LIST_HEAD(, chunk_desc) all_chunks; - LIST_HEAD(, chunk_desc) unused_chunks; /* abuses hash link entry */ + LIST_HEAD(, chunk_desc) unused_chunks[UNUSED_BUCKETS]; LIST_HEAD(, trie_desc) trie_hashtbl[TRIE_HASH_SIZE]; LIST_HEAD(, trie_desc) all_trie; LIST_HEAD(, trie_desc) unused_trie; /* abuses hash link entry */ @@ -387,6 +389,7 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) uint32_t base = fdesc->base; uint32_t size = chunk_size(da, fdesc); uint32_t hash = chunk_hash(da, fdesc); + int i; /* Find an existing descriptor */ LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], @@ -401,15 +404,18 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) return (0); } - /* No matching chunks found. Recycle an empty or allocate a new one */ - cdp = NULL; - LIST_FOREACH(empty_cdp, &da->unused_chunks, cd_hash_le) - if (empty_cdp->cd_max_size >= size && (cdp == NULL || - empty_cdp->cd_max_size < cdp->cd_max_size)) { - cdp = empty_cdp; - if (empty_cdp->cd_max_size == size) - break; - } + /* No matching chunks found. Find an empty one to recycle. */ + for (cdp = NULL, i = size; cdp == NULL && i < UNUSED_BUCKETS; i++) + cdp = LIST_FIRST(&da->unused_chunks[i]); + + if (cdp == NULL) + LIST_FOREACH(empty_cdp, &da->unused_chunks[0], cd_hash_le) + if (empty_cdp->cd_max_size >= size && (cdp == NULL || + empty_cdp->cd_max_size < cdp->cd_max_size)) { + cdp = empty_cdp; + if (empty_cdp->cd_max_size == size) + break; + } if (cdp != NULL) { /* Copy from heap into the recycled chunk */ @@ -423,11 +429,17 @@ chunk_ref(struct dxr_aux *da, uint32_t chunk) empty_cdp = uma_zalloc(chunk_zone, M_NOWAIT); if (empty_cdp == NULL) return (1); + LIST_INSERT_BEFORE(cdp, empty_cdp, cd_all_le); + empty_cdp->cd_base = cdp->cd_base + size; empty_cdp->cd_cur_size = 0; empty_cdp->cd_max_size = cdp->cd_max_size - size; - empty_cdp->cd_base = cdp->cd_base + size; - LIST_INSERT_BEFORE(cdp, empty_cdp, cd_all_le); - LIST_INSERT_AFTER(cdp, empty_cdp, cd_hash_le); + + i = empty_cdp->cd_max_size; + if (i >= UNUSED_BUCKETS) + i = 0; + LIST_INSERT_HEAD(&da->unused_chunks[i], empty_cdp, + cd_hash_le); + da->all_chunks_cnt++; da->unused_chunks_cnt++; cdp->cd_max_size = size; @@ -480,6 +492,7 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk) uint32_t base = fdesc->base; uint32_t size = chunk_size(da, fdesc); uint32_t hash = chunk_hash(da, fdesc); + int i; /* Find the corresponding descriptor */ LIST_FOREACH(cdp, &da->chunk_hashtbl[hash & CHUNK_HASH_MASK], @@ -538,7 +551,10 @@ chunk_unref(struct dxr_aux *da, uint32_t chunk) return; } - LIST_INSERT_HEAD(&da->unused_chunks, cdp, cd_hash_le); + i = cdp->cd_max_size; + if (i >= UNUSED_BUCKETS) + i = 0; + LIST_INSERT_HEAD(&da->unused_chunks[i], cdp, cd_hash_le); } #ifdef DXR2 @@ -891,7 +907,8 @@ dxr_build(struct dxr *dxr) LIST_REMOVE(cdp, cd_all_le); uma_zfree(chunk_zone, cdp); } - LIST_INIT(&da->unused_chunks); + for (i = 0; i < UNUSED_BUCKETS; i++) + LIST_INIT(&da->unused_chunks[i]); da->all_chunks_cnt = da->unused_chunks_cnt = 0; da->rtbl_top = 0; da->updates_low = 0; From owner-dev-commits-src-main@freebsd.org Sat Sep 25 05:04: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 2783E67B604; Sat, 25 Sep 2021 05:04: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 4HGcK706Jdz3Jx9; Sat, 25 Sep 2021 05:04: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 CD62E2468E; Sat, 25 Sep 2021 05:04: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 18P54wdE030561; Sat, 25 Sep 2021 05:04:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P54waG030560; Sat, 25 Sep 2021 05:04:58 GMT (envelope-from git) Date: Sat, 25 Sep 2021 05:04:58 GMT Message-Id: <202109250504.18P54waG030560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 33c1e7271ac2 - main - hostname: avoid strcpy() overlap in -d flag handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33c1e7271ac21a626829289780b88071ae46ec65 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, 25 Sep 2021 05:04:59 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=33c1e7271ac21a626829289780b88071ae46ec65 commit 33c1e7271ac21a626829289780b88071ae46ec65 Author: Kyle Evans AuthorDate: 2021-09-25 05:00:31 +0000 Commit: Kyle Evans CommitDate: 2021-09-25 05:03:50 +0000 hostname: avoid strcpy() overlap in -d flag handling We don't need the strcpy() anyways, just use a pointer to the hostname buffer and move it forward for `hostname -d`. Sponsored by: Klara, Inc. --- bin/hostname/hostname.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/hostname/hostname.c b/bin/hostname/hostname.c index d5cc6b1cfff2..3dbafa9d3566 100644 --- a/bin/hostname/hostname.c +++ b/bin/hostname/hostname.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { int ch, sflag, dflag; - char *p, hostname[MAXHOSTNAMELEN]; + char hostname[MAXHOSTNAMELEN], *hostp, *p; sflag = 0; dflag = 0; @@ -90,6 +90,7 @@ main(int argc, char *argv[]) if (sethostname(*argv, (int)strlen(*argv))) err(1, "sethostname"); } else { + hostp = hostname; if (gethostname(hostname, (int)sizeof(hostname))) err(1, "gethostname"); if (sflag) { @@ -99,9 +100,9 @@ main(int argc, char *argv[]) } else if (dflag) { p = strchr(hostname, '.'); if (p != NULL) - strcpy(hostname, ++p); + hostp = p + 1; } - (void)printf("%s\n", hostname); + (void)printf("%s\n", hostp); } exit(0); } From owner-dev-commits-src-main@freebsd.org Sat Sep 25 09:48: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 D3E6D67EC3F; Sat, 25 Sep 2021 09:48: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 4HGkcY5RW9z3pyv; Sat, 25 Sep 2021 09:48: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 9A8831AD; Sat, 25 Sep 2021 09:48: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 18P9mj0g001654; Sat, 25 Sep 2021 09:48:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18P9mj99001653; Sat, 25 Sep 2021 09:48:45 GMT (envelope-from git) Date: Sat, 25 Sep 2021 09:48:45 GMT Message-Id: <202109250948.18P9mj99001653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 2aad906266d6 - main - ubsan: Fix a typo in an error message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2aad906266d67eea6ad11d8e0c6fe9263077ee99 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, 25 Sep 2021 09:48:45 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2aad906266d67eea6ad11d8e0c6fe9263077ee99 commit 2aad906266d67eea6ad11d8e0c6fe9263077ee99 Author: Gordon Bergling AuthorDate: 2021-09-25 09:47:24 +0000 Commit: Gordon Bergling CommitDate: 2021-09-25 09:47:24 +0000 ubsan: Fix a typo in an error message - s/asumption/assumption/ Obtained from: NetBSD MFC after: 1 week --- sys/kern/kern_ubsan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_ubsan.c b/sys/kern/kern_ubsan.c index 93d39103929c..e1482f004d47 100644 --- a/sys/kern/kern_ubsan.c +++ b/sys/kern/kern_ubsan.c @@ -717,7 +717,7 @@ HandleAlignmentAssumption(bool isFatal, struct CAlignmentAssumptionData *pData, if (pData->mAssumptionLocation.mFilename != NULL) { DeserializeLocation(szAssumptionLocation, LOCATION_MAXLEN, &pData->mAssumptionLocation); - Report(isFatal, "UBSan: Undefined Behavior in %s, alignment assumption of %#lx for pointer %#lx (offset %#lx), asumption made in %s\n", + Report(isFatal, "UBSan: Undefined Behavior in %s, alignment assumption of %#lx for pointer %#lx (offset %#lx), assumption made in %s\n", szLocation, ulAlignment, ulRealPointer, ulOffset, szAssumptionLocation); } else { From owner-dev-commits-src-main@freebsd.org Sat Sep 25 11:58: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 AF0036A80B4; Sat, 25 Sep 2021 11:58: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 4HGnV74JVjz4RLV; Sat, 25 Sep 2021 11:58: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 745D51C0E; Sat, 25 Sep 2021 11:58: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 18PBwNhf073622; Sat, 25 Sep 2021 11:58:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PBwNav073621; Sat, 25 Sep 2021 11:58:23 GMT (envelope-from git) Date: Sat, 25 Sep 2021 11:58:23 GMT Message-Id: <202109251158.18PBwNav073621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 2ec4c3c7f3ef - main - net80211(4): Fix a few common typos in source code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ec4c3c7f3ef7bae1d3efd314b64f493acd51642 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, 25 Sep 2021 11:58:23 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2ec4c3c7f3ef7bae1d3efd314b64f493acd51642 commit 2ec4c3c7f3ef7bae1d3efd314b64f493acd51642 Author: Gordon Bergling AuthorDate: 2021-09-25 11:57:41 +0000 Commit: Gordon Bergling CommitDate: 2021-09-25 11:57:41 +0000 net80211(4): Fix a few common typos in source code comments - s/annoucement/announcement/ - s/setings/settings/ MFC after: 1 week --- sys/net80211/ieee80211_hwmp.c | 2 +- sys/net80211/ieee80211_mesh.c | 2 +- sys/net80211/ieee80211_node.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index 37541b1c51f2..2e596513c791 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -1839,7 +1839,7 @@ hwmp_send_rann(struct ieee80211vap *vap, * [6] addr3 = sa * [1] action * [1] category - * [tlv] root annoucement + * [tlv] root announcement */ rann->rann_ie = IEEE80211_ELEMID_MESHRANN; rann->rann_len = IEEE80211_MESHRANN_BASE_SZ; diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index 7da344707a9b..b4326905a7a3 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -2959,7 +2959,7 @@ mesh_send_action_meshgate(struct ieee80211_node *ni, * mesh link metric * [1] category * [1] action - * [tlv] mesh gate annoucement + * [tlv] mesh gate announcement */ *frm++ = category; *frm++ = action; diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 5a9677836dbd..d71503d28179 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -149,7 +149,7 @@ ieee80211_node_vattach(struct ieee80211vap *vap) /* NB: driver can override */ vap->iv_max_aid = IEEE80211_AID_DEF; - /* default station inactivity timer setings */ + /* default station inactivity timer settings */ vap->iv_inact_init = IEEE80211_INACT_INIT; vap->iv_inact_auth = IEEE80211_INACT_AUTH; vap->iv_inact_run = IEEE80211_INACT_RUN; From owner-dev-commits-src-main@freebsd.org Sat Sep 25 13:11: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 F11B36A9146; Sat, 25 Sep 2021 13:11: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 4HGq6W5Vsvz4Wrv; Sat, 25 Sep 2021 13:11: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 9CAF12CA5; Sat, 25 Sep 2021 13:11: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 18PDBVTG077217; Sat, 25 Sep 2021 13:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PDBVqf077216; Sat, 25 Sep 2021 13:11:31 GMT (envelope-from git) Date: Sat, 25 Sep 2021 13:11:31 GMT Message-Id: <202109251311.18PDBVqf077216@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: 24a3897c2c32 - main - x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible 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: 24a3897c2c3205c2ec0cf323c555c403d3171e2c 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, 25 Sep 2021 13:11:32 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=24a3897c2c3205c2ec0cf323c555c403d3171e2c commit 24a3897c2c3205c2ec0cf323c555c403d3171e2c Author: Konstantin Belousov AuthorDate: 2021-09-24 17:46:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-25 12:58:12 +0000 x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible malloc_domainset_aligned() requires that alignment is less than page size. Fall back to other allocation methods, most likely kmem_alloc_contig(), when malloc_aligned() cannot fullfill the driver request. Reported by: Loic F Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32127 --- sys/x86/x86/busdma_bounce.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c index 53ec6a3cab96..5519888542d3 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -453,6 +453,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags, /* * Allocate the buffer from the malloc(9) allocator if... * - It's small enough to fit into a single page. + * - Its alignment requirement is also smaller than the page size. * - The low address requirement is fulfilled. * - Default cache attributes are requested (WB). * else allocate non-contiguous pages if... @@ -467,6 +468,7 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags, * Warn the user if malloc gets it wrong. */ if (dmat->common.maxsize <= PAGE_SIZE && + dmat->common.alignment <= PAGE_SIZE && dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) && attr == VM_MEMATTR_DEFAULT) { *vaddr = malloc_domainset_aligned(dmat->common.maxsize, From owner-dev-commits-src-main@freebsd.org Sat Sep 25 13:11: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 A6A086A8F2D; Sat, 25 Sep 2021 13:11: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 4HGq6V47w4z4X21; Sat, 25 Sep 2021 13:11: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 6E7AF2CA4; Sat, 25 Sep 2021 13:11: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 18PDBUOD077193; Sat, 25 Sep 2021 13:11:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PDBUtg077192; Sat, 25 Sep 2021 13:11:30 GMT (envelope-from git) Date: Sat, 25 Sep 2021 13:11:30 GMT Message-Id: <202109251311.18PDBUtg077192@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: 71d31f1cf601 - main - malloc_aligned(9): allow zero size and alignment 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: 71d31f1cf6012b143fd676f099430818ae949c3f 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, 25 Sep 2021 13:11:30 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=71d31f1cf6012b143fd676f099430818ae949c3f commit 71d31f1cf6012b143fd676f099430818ae949c3f Author: Konstantin Belousov AuthorDate: 2021-09-24 19:38:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-25 12:58:12 +0000 malloc_aligned(9): allow zero size and alignment For alignment we do not need to do anything to make it operational. For size, upgrade zero sized request to one byte so that we do not request insane amount of memory for placeholder. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32127 --- sys/kern/kern_malloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 0bdce47b37b4..b1c5909db2a4 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -797,7 +797,7 @@ malloc_domainset_aligned(size_t size, size_t align, void *res; size_t asize; - KASSERT(align != 0 && powerof2(align), + KASSERT(powerof2(align), ("malloc_domainset_aligned: wrong align %#zx size %#zx", align, size)); KASSERT(align <= PAGE_SIZE, @@ -812,6 +812,8 @@ malloc_domainset_aligned(size_t size, size_t align, * align, since malloc zones provide alignment equal to their * size. */ + if (size == 0) + size = 1; asize = size <= align ? align : 1UL << flsl(size - 1); res = malloc_domainset(asize, mtp, ds, flags); From owner-dev-commits-src-main@freebsd.org Sat Sep 25 13:18: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 4C7B86A9682 for ; Sat, 25 Sep 2021 13:18:08 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) (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 4HGqG81N1Wz4XC3 for ; Sat, 25 Sep 2021 13:18:08 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qv1-xf2c.google.com with SMTP id gs10so8078198qvb.13 for ; Sat, 25 Sep 2021 06:18:08 -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=mvU2yd8hPOHjGf0x2AvHQO1ph/Y3/NlfM7paYR7GMws=; b=b8Y8S8xdZTCzt+s/D2iRW4z2qTDvF8k7DwXc08Af0a/C0bhO5OnOOEv20t5qgrFF8D kQDtxLdyEzwneijq0FYuWScLPebwiJtJ1IhoMlOKyHYdvUF+7lqHO7REm3Qsr2O3zgWT vsZIUEQU2APTc+U3PbmN7UCODb6VtPaL59hn5JzWonmEKG144I2wqNjDN89M5/vmYJbf iJBNLcPQ8AMZVPJqX3cuydcgYXYfUer1m6htIHLUFkNPtaimMfWPEGJVz576h64+bsrU 0l0BhNT1lmutCcU2r4Fr8UJOwIwc/YZuqG9l+szUvGm0+8Dch8TfAuuyIBdrRz9lxNxE MzIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mvU2yd8hPOHjGf0x2AvHQO1ph/Y3/NlfM7paYR7GMws=; b=swJhNMzSm042cph+KbrNIpeTQTT6fEbdRShy45zRl/K9aSYgVB0bDFBzOqybKvjEgk b5E5DXneH3UHLdUykVpx0hQc91d2OkgFkCUhv32Lkih1ml4JTqb6ZC1b8i/w8Z9FtDae 2CbZxNL0oD1CHa5FMcSGuBiMxOZgKqDexvOttLEA90BPmNxdY1ZnOyvOeQbVv5cpHFeI HFawT7XrP7VFKJ3S9cfF1Kgq5reOErbxMfDjYAeqsWFNGLkaqsO2ARBH+Nta2mp/duoh wVf7Lpwzvbs6ifz70kEhFC/yzh0nm2oihAy3e1aTHdQb3gw8zLACjknGm/sWngDV4DL1 VmXA== X-Gm-Message-State: AOAM532WBAUWrG8XY+f9nIoC3wGjf9MsGQiLj7Xav8Rv7HnZnrl9RZuD UTzbumjuieFzXfnWCse1cVqlnA== X-Google-Smtp-Source: ABdhPJyjMPB9FqEZXSRcFOlb/9il6eeOSu1WAgrtD0pVvCKTlBtnqWBSTqaW5yn4gJzC+0/S9joNjQ== X-Received: by 2002:a0c:816b:: with SMTP id 98mr15602829qvc.37.1632575882060; Sat, 25 Sep 2021 06:18:02 -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 p201sm6155438qke.27.2021.09.25.06.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 06:18:01 -0700 (PDT) Date: Sat, 25 Sep 2021 09:18:01 -0400 From: Shawn Webb To: Konstantin Belousov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 24a3897c2c32 - main - x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible Message-ID: <20210925131801.b4lyozg7b56646x4@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: <202109251311.18PDBVqf077216@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="z6scvdiowkqgtp6u" Content-Disposition: inline In-Reply-To: <202109251311.18PDBVqf077216@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4HGqG81N1Wz4XC3 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: Sat, 25 Sep 2021 13:18:08 -0000 --z6scvdiowkqgtp6u Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 25, 2021 at 01:11:31PM +0000, Konstantin Belousov wrote: > The branch main has been updated by kib: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D24a3897c2c3205c2ec0cf323c5= 55c403d3171e2c >=20 > commit 24a3897c2c3205c2ec0cf323c555c403d3171e2c > Author: Konstantin Belousov > AuthorDate: 2021-09-24 17:46:47 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-09-25 12:58:12 +0000 >=20 > x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible > =20 > malloc_domainset_aligned() requires that alignment is less than > page size. Fall back to other allocation methods, most likely > kmem_alloc_contig(), when malloc_aligned() cannot fullfill the driver > request. > =20 > Reported by: Loic F > Reviewed by: markj > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D32127 Wrong Differential revision URL? The patch in the URL doesn't match what was committed here. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --z6scvdiowkqgtp6u Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmFPIYEACgkQ/y5nonf4 4fp/5A/+MGW9Urd36WzmK6VZ1JA2GaV1PHDj2d32ooI7xSKtdwYt3nbo1ssWthRf LZQreBJmDAZp0YKkJgKbXOqT0KGe9pNpgmv9blZXJkWJxK18pDu2zrUCgpE8QXUf Ki3fwMEvhpuTfOkvPWikegoAFNbPF/DmrR6jHDeURIubHJ8LrSAkJPLcXGbY1g5c q5SIpH5JM4R0Yea377yqs3lPNCL5wdeskkbzwK7Aqp09kIGcK5KFTmnxtHHUKF+L hPHjvayR0poBms/LQihetS3k54VbF/6f16ZkLVfylGSBJVXfaVs6Ng84LnfATB8g y4qYPo1FTif5PPmcDwVlgRsUahr/cy4QTbeE1N+sjPFE4rYhf+si1VYGzhffODVm t/Wr7E+9hVnIHq8CgKqmNJqI8lt4MqgevKvKZzhYpu2ERIcseV5MV/uYLYXmXQJP TM8Mlm4/E2+DwWn4UMMFd6Kd/fjVJYE8jISJJbUazfImBWF0pRKSbc2bjLYa6bZ3 3USVht/sBkYrW4NFweJIBaSiGN60AooL/sqYibnxiSbU64v/jxZwTpgvGLs5S+CI vfTPdHF5AY/+PsFGYCd0ZEg5UIA3iKIaplj+kw9MMEhDZpI3W5XaVUwmOjGjR2Qi Ga3PSAP8vPNCFkXOUy+K/r5/I9nG4VWMaowEW73n23wpQzfCKQE= =LRdr -----END PGP SIGNATURE----- --z6scvdiowkqgtp6u-- From owner-dev-commits-src-main@freebsd.org Sat Sep 25 14:28: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 74D0F6AA2F9; Sat, 25 Sep 2021 14:28: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 4HGrpz2hHRz4cSb; Sat, 25 Sep 2021 14:28: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 38DFD3FA2; Sat, 25 Sep 2021 14:28: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 18PESBBL073041; Sat, 25 Sep 2021 14:28:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PESBnB073040; Sat, 25 Sep 2021 14:28:11 GMT (envelope-from git) Date: Sat, 25 Sep 2021 14:28:11 GMT Message-Id: <202109251428.18PESBnB073040@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: ed8ef7ae8b05 - main - cam: Avoiding waking up doneq threads if we're dumping 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: ed8ef7ae8b05d9f73db2182b5e24b0b76b0783a2 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, 25 Sep 2021 14:28:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ed8ef7ae8b05d9f73db2182b5e24b0b76b0783a2 commit ed8ef7ae8b05d9f73db2182b5e24b0b76b0783a2 Author: Mark Johnston AuthorDate: 2021-09-25 14:13:56 +0000 Commit: Mark Johnston CommitDate: 2021-09-25 14:15:03 +0000 cam: Avoiding waking up doneq threads if we're dumping Depending on the state of the target doneq thread at the time of the panic, the wakeup can hang indefinitely in thread_lock_block_wait(). That function should likely be modified to return immediately if the scheduler is stopped, but it is also preferable to avoid wakeups in general after a panic. Reported by: pho Reviewed by: mav, imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32126 --- sys/cam/cam_xpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 6b5a04b174e1..e228f0967f0e 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4627,7 +4627,7 @@ xpt_done(union ccb *done_ccb) STAILQ_INSERT_TAIL(&queue->cam_doneq, &done_ccb->ccb_h, sim_links.stqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; mtx_unlock(&queue->cam_doneq_mtx); - if (run) + if (run && !dumping) wakeup(&queue->cam_doneq); } From owner-dev-commits-src-main@freebsd.org Sat Sep 25 14:28: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 A1DE46AA2FB; Sat, 25 Sep 2021 14:28: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 4HGrq03CgFz4cgL; Sat, 25 Sep 2021 14:28: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 4F9E33DA9; Sat, 25 Sep 2021 14:28: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 18PESCpZ073065; Sat, 25 Sep 2021 14:28:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PESCKx073064; Sat, 25 Sep 2021 14:28:12 GMT (envelope-from git) Date: Sat, 25 Sep 2021 14:28:12 GMT Message-Id: <202109251428.18PESCKx073064@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: ca1e447b1048 - main - amd64: Avoid copying td_frame from kernel procs 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: ca1e447b1048b26b855d7f7fbcdad78309e4d741 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, 25 Sep 2021 14:28:12 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ca1e447b1048b26b855d7f7fbcdad78309e4d741 commit ca1e447b1048b26b855d7f7fbcdad78309e4d741 Author: Mark Johnston AuthorDate: 2021-09-25 14:15:31 +0000 Commit: Mark Johnston CommitDate: 2021-09-25 14:18:30 +0000 amd64: Avoid copying td_frame from kernel procs When creating a new thread, we unconditionally copy td_frame from the creating thread. For threads which never return to user mode, this is unnecessary since td_frame just points to the base of the stack or a random interrupt frame. If KASAN is configured this copying may also trigger false positives since the td_frame region may contain poisoned stack regions. It was not noticed before since thread0 used a dummy proc0_tf trapframe, and kernel procs are generally created by thread0. Since commit df8dd6025af88a99d34f549fa9591a9b8f9b75b1, though, we call cpu_thread_alloc(&thread0) when initializing FPU state, which reinitializes thread0.td_frame. Work around the problem by not copying the frame unless the copying thread came from user mode. While here, de-duplicate the copying and remove redundant re(initialization) of td_frame. Reported by: syzbot+2ec89312bffbf38d9aec@syzkaller.appspotmail.com Reviewed by: kib Fixes: df8dd6025af8 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32057 --- sys/amd64/amd64/vm_machdep.c | 48 +++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 0bfcd03d6655..c0456c1d958c 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -193,6 +193,24 @@ copy_thread(struct thread *td1, struct thread *td2) td2->td_md.md_spinlock_count = 1; td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; pmap_thread_init_invl_gen(td2); + + /* + * Copy the trap frame for the return to user mode as if from a syscall. + * This copies most of the user mode register values. Some of these + * registers are rewritten by cpu_set_upcall() and linux_set_upcall(). + */ + if ((td1->td_proc->p_flag & P_KPROC) == 0) { + bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); + + /* + * If the current thread has the trap bit set (i.e. a debugger + * had single stepped the process to the system call), we need + * to clear the trap flag from the new frame. Otherwise, the new + * thread will receive a (likely unexpected) SIGTRAP when it + * executes the first instruction after returning to userland. + */ + td2->td_frame->tf_rflags &= ~PSL_T; + } } /* @@ -236,23 +254,9 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); - /* - * Copy the trap frame for the return to user mode as if from a - * syscall. This copies most of the user mode register values. - */ - td2->td_frame = (struct trapframe *)td2->td_md.md_stack_base - 1; - bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); - /* Set child return values. */ p2->p_sysent->sv_set_fork_retval(td2); - /* - * If the parent process has the trap bit set (i.e. a debugger - * had single stepped the process to the system call), we need - * to clear the trap flag from the new frame. - */ - td2->td_frame->tf_rflags &= ~PSL_T; - /* As on i386, do not copy io permission bitmap. */ pcb2->pcb_tssp = NULL; @@ -602,22 +606,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) { copy_thread(td0, td); - /* - * Copy user general-purpose registers. - * - * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall(). - */ - bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); - - /* If the current thread has the trap bit set (i.e. a debugger had - * single stepped the process to the system call), we need to clear - * the trap flag from the new frame. Otherwise, the new thread will - * receive a (likely unexpected) SIGTRAP when it executes the first - * instruction after returning to userland. - */ - td->td_frame->tf_rflags &= ~PSL_T; - set_pcb_flags_raw(td->td_pcb, PCB_FULL_IRET); } From owner-dev-commits-src-main@freebsd.org Sat Sep 25 14:28: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 D238E6A9AFC; Sat, 25 Sep 2021 14:28: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 4HGrq14m2Lz4cYk; Sat, 25 Sep 2021 14:28: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 6A21D3BEC; Sat, 25 Sep 2021 14:28: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 18PESD0i073093; Sat, 25 Sep 2021 14:28:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PESDG4073092; Sat, 25 Sep 2021 14:28:13 GMT (envelope-from git) Date: Sat, 25 Sep 2021 14:28:13 GMT Message-Id: <202109251428.18PESDG4073092@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: f766826fe3b8 - main - amd64: Remove proc0_tf, the bootstrap trapframe 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: f766826fe3b82462c6397ec849dc2243f4bdfeee 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, 25 Sep 2021 14:28:14 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f766826fe3b82462c6397ec849dc2243f4bdfeee commit f766826fe3b82462c6397ec849dc2243f4bdfeee Author: Mark Johnston AuthorDate: 2021-09-25 14:18:52 +0000 Commit: Mark Johnston CommitDate: 2021-09-25 14:18:52 +0000 amd64: Remove proc0_tf, the bootstrap trapframe It no longer serves any purpose as thread0's td_frame field is now initialized during fpuinitstate(). No functional change intended. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32057 --- sys/amd64/amd64/machdep.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 5c9b64526609..c629db566528 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -202,7 +202,6 @@ long realmem = 0; struct kva_md_info kmi; -static struct trapframe proc0_tf; struct region_descriptor r_idt; struct pcpu *__pcpu; @@ -1584,7 +1583,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) /* setup proc 0's pcb */ thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; env = kern_getenv("kernelname"); if (env != NULL) From owner-dev-commits-src-main@freebsd.org Sat Sep 25 15:36: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 5E0FE6AB76E; Sat, 25 Sep 2021 15:36: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 4HGtLL22h7z4hn7; Sat, 25 Sep 2021 15:36: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 2245A4E54; Sat, 25 Sep 2021 15:36: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 18PFawMj066063; Sat, 25 Sep 2021 15:36:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PFawjc066062; Sat, 25 Sep 2021 15:36:58 GMT (envelope-from git) Date: Sat, 25 Sep 2021 15:36:58 GMT Message-Id: <202109251536.18PFawjc066062@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: d71e1a883c92 - main - fifo: support flock 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: d71e1a883c92b8b166eea59734850acd54048d72 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, 25 Sep 2021 15:36:58 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d71e1a883c92b8b166eea59734850acd54048d72 commit d71e1a883c92b8b166eea59734850acd54048d72 Author: Mateusz Guzik AuthorDate: 2021-09-25 12:24:39 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-25 14:58:31 +0000 fifo: support flock This evens it up with Linux. Original patch by: Greg V Differential Revision: https://reviews.freebsd.org/D24255#565302 --- sys/fs/fifofs/fifo_vnops.c | 4 +++- sys/kern/kern_descrip.c | 16 ++++++++++------ sys/kern/vfs_vnops.c | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 861f1b40a744..1b941620b080 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -376,5 +376,7 @@ fifo_advlock(ap) } */ *ap; { - return (ap->a_flags & F_FLOCK ? EOPNOTSUPP : EINVAL); + if ((ap->a_flags & F_FLOCK) == 0) + return (EINVAL); + return (vop_stdadvlock(ap)); } diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index ed7fe83cf02f..58c2d1939dba 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3560,11 +3560,15 @@ sys_flock(struct thread *td, struct flock_args *uap) error = fget(td, uap->fd, &cap_flock_rights, &fp); if (error != 0) return (error); - if (fp->f_type != DTYPE_VNODE || fp->f_ops == &path_fileops) { - fdrop(fp, td); - return (EOPNOTSUPP); + error = EOPNOTSUPP; + if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_FIFO) { + goto done; + } + if (fp->f_ops == &path_fileops) { + goto done; } + error = 0; vp = fp->f_vnode; lf.l_whence = SEEK_SET; lf.l_start = 0; @@ -3573,7 +3577,7 @@ sys_flock(struct thread *td, struct flock_args *uap) lf.l_type = F_UNLCK; atomic_clear_int(&fp->f_flag, FHASLOCK); error = VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK); - goto done2; + goto done; } if (uap->how & LOCK_EX) lf.l_type = F_WRLCK; @@ -3581,12 +3585,12 @@ sys_flock(struct thread *td, struct flock_args *uap) lf.l_type = F_RDLCK; else { error = EBADF; - goto done2; + goto done; } atomic_set_int(&fp->f_flag, FHASLOCK); error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, (uap->how & LOCK_NB) ? F_FLOCK : F_FLOCK | F_WAIT); -done2: +done: fdrop(fp, td); return (error); } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index d4229160f11e..aeeeee3e3a1d 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1829,7 +1829,7 @@ vn_closefile(struct file *fp, struct thread *td) vp = fp->f_vnode; fp->f_ops = &badfileops; - ref = (fp->f_flag & FHASLOCK) != 0 && fp->f_type == DTYPE_VNODE; + ref = (fp->f_flag & FHASLOCK) != 0; error = vn_close1(vp, fp->f_flag, fp->f_cred, td, ref); From owner-dev-commits-src-main@freebsd.org Sat Sep 25 15:36: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 7EBC86AB3FA; Sat, 25 Sep 2021 15:36: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 4HGtLM2tjpz4hZ7; Sat, 25 Sep 2021 15:36: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 3FF204E55; Sat, 25 Sep 2021 15:36: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 18PFaxH5066087; Sat, 25 Sep 2021 15:36:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PFaxpu066086; Sat, 25 Sep 2021 15:36:59 GMT (envelope-from git) Date: Sat, 25 Sep 2021 15:36:59 GMT Message-Id: <202109251536.18PFaxpu066086@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: 13c63ae08df4 - main - mmc: fix 1-byte reallocs (when it should have been sizeof device_t) 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: 13c63ae08df43d4e662b73ea3e05137fff88e639 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, 25 Sep 2021 15:36:59 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=13c63ae08df43d4e662b73ea3e05137fff88e639 commit 13c63ae08df43d4e662b73ea3e05137fff88e639 Author: Mateusz Guzik AuthorDate: 2021-09-25 12:49:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-25 14:58:31 +0000 mmc: fix 1-byte reallocs (when it should have been sizeof device_t) Reported by KASAN: panic: ASan: Invalid access, 8-byte write at 0xfffffe00f0992610, RedZonePartial(1) panic() at panic+0xb5/frame 0xffffffff86a595b0 __asan_store8_noabort() at __asan_store8_noabort+0x376/frame 0xffffffff86a59670 mmc_go_discovery() at mmc_go_discovery+0x6c61/frame 0xffffffff86a5a790 mmc_delayed_attach() at mmc_delayed_attach+0x35/frame 0xffffffff86a5a7b0 [snip] Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/mmc/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index 74d0549ca491..071c238374df 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -1920,7 +1920,7 @@ child_common: if (child != NULL) { device_set_ivars(child, ivar); sc->child_list = realloc(sc->child_list, - sizeof(device_t) * sc->child_count + 1, + sizeof(device_t) * (sc->child_count + 1), M_DEVBUF, M_WAITOK); sc->child_list[sc->child_count++] = child; } else From owner-dev-commits-src-main@freebsd.org Sat Sep 25 15:55: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 17E726ABE5A; Sat, 25 Sep 2021 15:55:40 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4HGtlv6sf4z4jb8; Sat, 25 Sep 2021 15:55:39 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id C4844C4B2; Sat, 25 Sep 2021 15:55:39 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f171.google.com with SMTP id x9so12559630qtv.0; Sat, 25 Sep 2021 08:55:39 -0700 (PDT) X-Gm-Message-State: AOAM530G18uBMwte2ftWlULJsBiLkJKKNJH1uQVO23n+QJQpt8IvkiXs t/dK16TZU50beHy88pCNN3xbdlsK2jMHs2Y4gN8= X-Google-Smtp-Source: ABdhPJx3SA10mseFFhwtF8kQh4FFsDl5AwDi8c0OXocWBh7ZksbWbuowRtyVzlF6L0+NXBdUD9lfTXMZf7rbvGbH2os= X-Received: by 2002:ac8:7384:: with SMTP id t4mr10148360qtp.83.1632585339166; Sat, 25 Sep 2021 08:55:39 -0700 (PDT) MIME-Version: 1.0 References: <202109251311.18PDBVqf077216@gitrepo.freebsd.org> <20210925131801.b4lyozg7b56646x4@mutt-hbsd> In-Reply-To: <20210925131801.b4lyozg7b56646x4@mutt-hbsd> From: Kyle Evans Date: Sat, 25 Sep 2021 10:55:28 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 24a3897c2c32 - main - x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible To: Shawn Webb Cc: Konstantin Belousov , src-committers , "" , 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: Sat, 25 Sep 2021 15:55:40 -0000 On Sat, Sep 25, 2021 at 8:18 AM Shawn Webb wrote: > > On Sat, Sep 25, 2021 at 01:11:31PM +0000, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=24a3897c2c3205c2ec0cf323c555c403d3171e2c > > > > commit 24a3897c2c3205c2ec0cf323c555c403d3171e2c > > Author: Konstantin Belousov > > AuthorDate: 2021-09-24 17:46:47 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-09-25 12:58:12 +0000 > > > > x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible > > > > malloc_domainset_aligned() requires that alignment is less than > > page size. Fall back to other allocation methods, most likely > > kmem_alloc_contig(), when malloc_aligned() cannot fullfill the driver > > request. > > > > Reported by: Loic F > > Reviewed by: markj > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > Differential revision: https://reviews.freebsd.org/D32127 > > Wrong Differential revision URL? The patch in the URL doesn't match > what was committed here. > No; there were two patches included, and Phabricator always updates the diff to the first one that closed it. You can check the history on the diff to find the last one pre-commit. From owner-dev-commits-src-main@freebsd.org Sat Sep 25 16:24: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 BE17B6AC49D for ; Sat, 25 Sep 2021 16:24:48 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (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 4HGvPX4gzLz4m0g for ; Sat, 25 Sep 2021 16:24:48 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x72a.google.com with SMTP id m7so14969606qke.8 for ; Sat, 25 Sep 2021 09:24:48 -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=EplBykSmk+oej7mvVRy39XDlmh+Y3OAIsvYp3dSs8dA=; b=ASOGNgpIJedZhJ78p6KN0O9opZFaKBQ52QLbbHn5cfUgA1URx/zdsqIggOv7bSkIOO PmOHPb2oUKyHhJY0KTiugaAzq+B7FaUcRv2bMMVYlVDBStwA79R4lmycYAy6SmcR83Lr 7go6PGuwCOmiQgnu0mZ+GAuJV4Oxk33Gv184bY9Ev/+rxS0G7eezctxXk/Q5wUk3zFwH zKyMzZpILCigeQ7B98HJQo840VqSQj4k0mMFfKkoHe0nNRbExpTwuabECMCzpFmr1A4c WnN5Gx1oomro8BHS+2s6NqrDEdgt9QTqlruvY2MZUl2ANX+8Yl5AhQDQ3Gr21mU9/WhP PjIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EplBykSmk+oej7mvVRy39XDlmh+Y3OAIsvYp3dSs8dA=; b=DgHGw0i6KfH1yKTKTwpvd0gTiAkMEO9U/tM98p/50G96JYrReQg0KvKe1An77rM/38 K0PTxPLUL4Df+rDxwABVisUB4qK9ya72dLz5AcV9bzsWibmtecStAr+zGt1UfTs3I9+x RksBN9i+ycZBwhG7heLLnIULYiS1a87x0QmTnmIJvNvKz61kjD0drgXTj/nT/B4uSJLk TczbFsrAfX7+ln6I4K0EB3+00ew+9+GBMeC7naYTT+3wtPQsmat6Wx/EiSzAc8sc6BS3 /rRBhRkg/WNNNif93CohS7DmVtOBfe7k0++ExoIYS5UZDZ1yEvtkKUZeQD9SoQJpYH1V 9nwg== X-Gm-Message-State: AOAM530JeTj4vyQ+68WK4FgTmI9k+NwJCA/c4KLrun+B7CZktCYEPhW6 MnCkfkxzfphMr4e0xVB6uEFM+Q== X-Google-Smtp-Source: ABdhPJxvUsU/pstCc1IId1o5QkTSxlVQ1UApV5GoVYSKmB3+4kq1JZ7jVQ/LIapf7okVYKS1lKKnag== X-Received: by 2002:a37:aa8d:: with SMTP id t135mr16192246qke.370.1632587082626; Sat, 25 Sep 2021 09:24:42 -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 f5sm6350374qtp.44.2021.09.25.09.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 09:24:42 -0700 (PDT) Date: Sat, 25 Sep 2021 12:24:41 -0400 From: Shawn Webb To: Kyle Evans Cc: Konstantin Belousov , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 24a3897c2c32 - main - x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when possible Message-ID: <20210925162441.jidijkgso3x6udxm@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: <202109251311.18PDBVqf077216@gitrepo.freebsd.org> <20210925131801.b4lyozg7b56646x4@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6qgzcylfpocqbcmk" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HGvPX4gzLz4m0g 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: Sat, 25 Sep 2021 16:24:48 -0000 --6qgzcylfpocqbcmk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 25, 2021 at 10:55:28AM -0500, Kyle Evans wrote: > On Sat, Sep 25, 2021 at 8:18 AM Shawn Webb w= rote: > > > > On Sat, Sep 25, 2021 at 01:11:31PM +0000, Konstantin Belousov wrote: > > > The branch main has been updated by kib: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D24a3897c2c3205c2ec0cf3= 23c555c403d3171e2c > > > > > > commit 24a3897c2c3205c2ec0cf323c555c403d3171e2c > > > Author: Konstantin Belousov > > > AuthorDate: 2021-09-24 17:46:47 +0000 > > > Commit: Konstantin Belousov > > > CommitDate: 2021-09-25 12:58:12 +0000 > > > > > > x86 bounce_bus_dmamem_alloc(): use malloc_aligned() only when pos= sible > > > > > > malloc_domainset_aligned() requires that alignment is less than > > > page size. Fall back to other allocation methods, most likely > > > kmem_alloc_contig(), when malloc_aligned() cannot fullfill the dr= iver > > > request. > > > > > > Reported by: Loic F > > > Reviewed by: markj > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 1 week > > > Differential revision: https://reviews.freebsd.org/D32127 > > > > Wrong Differential revision URL? The patch in the URL doesn't match > > what was committed here. > > >=20 > No; there were two patches included, and Phabricator always updates > the diff to the first one that closed it. You can check the history on > the diff to find the last one pre-commit. Cool. Thanks for the clarification! --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --6qgzcylfpocqbcmk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmFPTUcACgkQ/y5nonf4 4fo++Q//bu+bYu+KfmnQA1P9EMSaP9rke530/rHUPZSob/K7Z8D0qhvF7hCrS0cP qk/Em5AL0+ATLiZccTsoLL2Hc4YZZgKeZXI+pUzDu654ZH7zcWtYH2Upt2KlxYqH 35nV9t9M87D4eO0x8T7T8TK29/YUAiHXiQ79S2JFTimJLKM6gkEGXszSJKph+Pas Q9gxn06l6+bbYkU3cQ+YCVV2SXe+9Tp6ibNR32PF3d867NAcW7nHubdW/2tMIONe Tfvc7CkY7kNd3ffPjS8mW0sAgGt2vRJTqplPoiYkYfkmXYnYvesjCiQB1HlsUVxQ wpxxqRyZ6hf9AW0EdGappfM93QLhE8xF27y3jZwWSo8VDjBB5nFjx9Mhrnzk4edB tqVNtU+C04b3CdX4rDLSyePBj0jA3Gi7bbtB4vPlTI/qYsJidcmAN+JBbesEtHWc tGYSXm4YawtigsS99EI6aAmUomnI2DaKx8qsbx8hOyFnBu4uacYhX9BzANBW0/lp ZP0Sufy7c3GGxwWLpyiDX/cUl/kMlu29Dr+gzNmPjf/QH8yTAmd86snAmHPJi0tj fnd9Md2HGUhY2DFmmnz+WJOCT37Xzpcx9bwzU6KZzCp7b5USIH/ATcCoj3LD+5Ph /I3goz+6ISiA05QRyBo49r+sCCm5nW1NZT+f7xfBrYfqimrqr8Q= =1Q2t -----END PGP SIGNATURE----- --6qgzcylfpocqbcmk-- From owner-dev-commits-src-main@freebsd.org Sat Sep 25 16:28: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 468066AC4B4; Sat, 25 Sep 2021 16:28: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 4HGvTs1Wncz4mcv; Sat, 25 Sep 2021 16:28: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 107E955E3; Sat, 25 Sep 2021 16:28: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 18PGSWuD032705; Sat, 25 Sep 2021 16:28:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PGSWTT032704; Sat, 25 Sep 2021 16:28:32 GMT (envelope-from git) Date: Sat, 25 Sep 2021 16:28:32 GMT Message-Id: <202109251628.18PGSWTT032704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yoshihiro Takahashi Subject: git: d653b188e89b - main - ng_ether: Create netgraph nodes for bridge interfaces. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d653b188e89b5e44b2708342c7d3b789398f9cde 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, 25 Sep 2021 16:28:33 -0000 The branch main has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=d653b188e89b5e44b2708342c7d3b789398f9cde commit d653b188e89b5e44b2708342c7d3b789398f9cde Author: Yoshihiro Takahashi AuthorDate: 2021-09-25 16:24:33 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-09-25 16:24:33 +0000 ng_ether: Create netgraph nodes for bridge interfaces. Create netgraph nodes for bridge interfaces when the ng_ether module is loaded. If a bridge interface is created after loading the ng_ether module, a netgraph node is created via ether_ifattach(). MFC after: 1 week --- sys/netgraph/ng_ether.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c index 5718de235c4c..40e06604b8bb 100644 --- a/sys/netgraph/ng_ether.c +++ b/sys/netgraph/ng_ether.c @@ -414,7 +414,9 @@ ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) node_p node; /* Only ethernet interfaces are of interest. */ - if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) + if (ifp->if_type != IFT_ETHER && + ifp->if_type != IFT_L2VLAN && + ifp->if_type != IFT_BRIDGE) return; /* @@ -868,8 +870,9 @@ vnet_ng_ether_init(const void *unused) /* Create nodes for any already-existing Ethernet interfaces. */ IFNET_RLOCK(); CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_type == IFT_ETHER - || ifp->if_type == IFT_L2VLAN) + if (ifp->if_type == IFT_ETHER || + ifp->if_type == IFT_L2VLAN || + ifp->if_type == IFT_BRIDGE) ng_ether_attach(ifp); } IFNET_RUNLOCK(); From owner-dev-commits-src-main@freebsd.org Sat Sep 25 16:30: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 9EA986AC59B; Sat, 25 Sep 2021 16:30:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4HGvWb479Nz4mgR; Sat, 25 Sep 2021 16:30:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:e948:53aa:fce5:d12d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 009B9C3B4; Sat, 25 Sep 2021 16:30:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: c8077ccd70cf - main - acpi_cpu: Make device unit numbers match OS CPU IDs. To: Alexander Motin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109250124.18P1OOP5035829@gitrepo.freebsd.org> From: John Baldwin Message-ID: <5d4a3f4f-0249-01b6-37ef-9a3dd9a8d7ad@FreeBSD.org> Date: Sat, 25 Sep 2021 09:30:01 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109250124.18P1OOP5035829@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 16:30:03 -0000 On 9/24/21 6:24 PM, Alexander Motin wrote: > The branch main has been updated by mav: > > URL: https://cgit.FreeBSD.org/src/commit/?id=c8077ccd70cfcbcccb752e89b848f098abcb9309 > > commit c8077ccd70cfcbcccb752e89b848f098abcb9309 > Author: Alexander Motin > AuthorDate: 2021-09-25 01:03:02 +0000 > Commit: Alexander Motin > CommitDate: 2021-09-25 01:24:19 +0000 > > acpi_cpu: Make device unit numbers match OS CPU IDs. > > There are already APIC ID, ACPI ID and OS ID for each CPU. In perfect > world all of those may match, but at least for SuperMicro server boards > none of them do. Plus none of them match the CPU devices listing order > by ACPI. Previous code used the ACPI device listing order to number > cpuX devices. It looked nice from NewBus perspective, but introduced > 4th different set of IDs. Extremely confusing one, since in some places > the device unit numbers were treated as OS CPU IDs (coretemp), but not > in others (sysctl dev.cpu.X.%location). FWIW, the "normal" way to force specific device unit numbers is via bus_hint_device_unit, but perhaps that is specific to when hints exits whereas this is specific to a bus property. Perhaps though this can't have the unit number assigned by the bus at the BUS_ADD_CHILD call? That would be the other way to handle this perhaps vs trying to change the unit in the probe routine. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Sat Sep 25 16:39: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 190EE6AC3D2; Sat, 25 Sep 2021 16:39: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 4HGvjx5dS0z4pYl; Sat, 25 Sep 2021 16:39:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AB5A5D4F; Sat, 25 Sep 2021 16:39:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18PGd1v7046338; Sat, 25 Sep 2021 16:39:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PGd1ka046337; Sat, 25 Sep 2021 16:39:01 GMT (envelope-from git) Date: Sat, 25 Sep 2021 16:39:01 GMT Message-Id: <202109251639.18PGd1ka046337@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yoshihiro Takahashi Subject: git: a4724ff48108 - main - unzip: sync with NetBSD upstream to add passphrase support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nyan X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a4724ff48108840416c83f10e15d666ac8d78937 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, 25 Sep 2021 16:39:02 -0000 The branch main has been updated by nyan: URL: https://cgit.FreeBSD.org/src/commit/?id=a4724ff48108840416c83f10e15d666ac8d78937 commit a4724ff48108840416c83f10e15d666ac8d78937 Author: Yoshihiro Takahashi AuthorDate: 2021-09-25 16:32:42 +0000 Commit: Yoshihiro Takahashi CommitDate: 2021-09-25 16:32:42 +0000 unzip: sync with NetBSD upstream to add passphrase support - Add support for password protected zip archives. We use memset_s() rather than explicit_bzero() for more portable (See PR). - Use success/failure macro in exit() - Mention ZIPX format in unzip(1) Submitted by: Mingye Wang and Alex Kozlov (ak@) PR: 244181 Reviewed by: mizhka Obtained from: NetBSD MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28892 --- usr.bin/unzip/unzip.1 | 10 ++++++-- usr.bin/unzip/unzip.c | 66 ++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 66 insertions(+), 10 deletions(-) diff --git a/usr.bin/unzip/unzip.1 b/usr.bin/unzip/unzip.1 index b7c2d858f012..bb43abf43a85 100644 --- a/usr.bin/unzip/unzip.1 +++ b/usr.bin/unzip/unzip.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2015 +.Dd September 25, 2021 .Dt UNZIP 1 .Os .Sh NAME @@ -35,6 +35,8 @@ .Nm .Op Fl aCcfjLlnopqtuvy .Op Fl d Ar dir +.Op Fl x Ar pattern +.Op Fl P Ar password .Ar zipfile .Sh DESCRIPTION .\" ... @@ -81,6 +83,10 @@ When extracting files from the zipfile, they are written to stdout. The normal output is suppressed as if .Fl q was specified. +.It Fl P Ar password +Extract encrypted files using a password. +Putting a password on the command line using this option can be +insecure. .It Fl q Quiet: print less information while extracting. .It Fl t @@ -172,7 +178,7 @@ utility is only able to process ZIP archives handled by .Xr libarchive 3 . Depending on the installed version of .Xr libarchive 3 , -this may or may not include self-extracting archives. +this may or may not include self-extracting or ZIPX archives. .Sh SEE ALSO .Xr libarchive 3 .Sh HISTORY diff --git a/usr.bin/unzip/unzip.c b/usr.bin/unzip/unzip.c index 937176111a02..e5ca1ff2c939 100644 --- a/usr.bin/unzip/unzip.c +++ b/usr.bin/unzip/unzip.c @@ -51,6 +51,7 @@ #include #include +#include /* command-line options */ static int a_opt; /* convert EOL */ @@ -63,6 +64,7 @@ static int L_opt; /* lowercase names */ static int n_opt; /* never overwrite */ static int o_opt; /* always overwrite */ static int p_opt; /* extract to stdout, quiet */ +static char *P_arg; /* passphrase */ static int q_opt; /* quiet */ static int t_opt; /* test */ static int u_opt; /* update */ @@ -95,6 +97,9 @@ static int tty; */ static int noeol; +/* for an interactive passphrase input */ +static char *passphrase_buf; + /* fatal error message + errno */ static void error(const char *fmt, ...) @@ -109,7 +114,7 @@ error(const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, ": %s\n", strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } /* fatal error message, no errno */ @@ -126,7 +131,7 @@ errorx(const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); - exit(1); + exit(EXIT_FAILURE); } /* non-fatal error message + errno */ @@ -854,6 +859,36 @@ test(struct archive *a, struct archive_entry *e) return error_count; } +/* + * Callback function for reading passphrase. + * Originally from cpio.c and passphrase.c, libarchive. + */ +#define PPBUFF_SIZE 1024 +static const char * +passphrase_callback(struct archive *a, void *_client_data) +{ + char *p; + + (void)a; /* UNUSED */ + (void)_client_data; /* UNUSED */ + + if (passphrase_buf == NULL) { + passphrase_buf = malloc(PPBUFF_SIZE); + if (passphrase_buf == NULL) { + errno = ENOMEM; + error("malloc()"); + } + } + + p = readpassphrase("\nEnter password: ", passphrase_buf, + PPBUFF_SIZE, RPP_ECHO_OFF); + + if (p == NULL && errno != EINTR) + error("Error reading password"); + + return p; +} + /* * Main loop: open the zipfile, iterate over its contents and decide what * to do with each entry. @@ -870,6 +905,13 @@ unzip(const char *fn) error("archive_read_new failed"); ac(archive_read_support_format_zip(a)); + + if (P_arg) + archive_read_add_passphrase(a, P_arg); + else + archive_read_set_passphrase_callback(a, NULL, + &passphrase_callback); + ac(archive_read_open_filename(a, fn, 8192)); if (!zipinfo_mode) { @@ -925,6 +967,11 @@ unzip(const char *fn) ac(archive_read_free(a)); + if (passphrase_buf != NULL) { + memset_s(passphrase_buf, PPBUFF_SIZE, 0, PPBUFF_SIZE); + free(passphrase_buf); + } + if (t_opt) { if (error_count > 0) { errorx("%ju checksum error(s) found.", error_count); @@ -940,9 +987,9 @@ static void usage(void) { - fprintf(stderr, "Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] [-x pattern] " - "zipfile\n"); - exit(1); + fprintf(stderr, "Usage: unzip [-aCcfjLlnopqtuvyZ1] [-d dir] " + "[-x pattern] [-P password] zipfile\n"); + exit(EXIT_FAILURE); } static int @@ -951,7 +998,7 @@ getopts(int argc, char *argv[]) int opt; optreset = optind = 1; - while ((opt = getopt(argc, argv, "aCcd:fjLlnopqtuvx:yZ1")) != -1) + while ((opt = getopt(argc, argv, "aCcd:fjLlnopP:qtuvx:yZ1")) != -1) switch (opt) { case '1': Z1_opt = 1; @@ -991,6 +1038,9 @@ getopts(int argc, char *argv[]) case 'p': p_opt = 1; break; + case 'P': + P_arg = optarg; + break; case 'q': q_opt = 1; break; @@ -1047,7 +1097,7 @@ main(int argc, char *argv[]) */ if (zipinfo_mode && !Z1_opt) { printf("Zipinfo mode needs additional options\n"); - exit(1); + exit(EXIT_FAILURE); } if (argc <= nopts) @@ -1068,5 +1118,5 @@ main(int argc, char *argv[]) unzip(zipfile); - exit(0); + exit(EXIT_SUCCESS); } From owner-dev-commits-src-main@freebsd.org Sat Sep 25 17:07: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 96AE86AC96E; Sat, 25 Sep 2021 17:07: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 4HGwLx3g3Sz4sDP; Sat, 25 Sep 2021 17:07: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 5F2DC638D; Sat, 25 Sep 2021 17:07: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 18PH7btH086715; Sat, 25 Sep 2021 17:07:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PH7bru086714; Sat, 25 Sep 2021 17:07:37 GMT (envelope-from git) Date: Sat, 25 Sep 2021 17:07:37 GMT Message-Id: <202109251707.18PH7bru086714@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: b70b050ab5e9 - main - bhyve: Update the -G description in the SYNPOSIS. 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: b70b050ab5e9368e6748e78cee38c3ecc4662c87 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, 25 Sep 2021 17:07:37 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b70b050ab5e9368e6748e78cee38c3ecc4662c87 commit b70b050ab5e9368e6748e78cee38c3ecc4662c87 Author: John Baldwin AuthorDate: 2021-09-25 17:01:43 +0000 Commit: John Baldwin CommitDate: 2021-09-25 17:01:43 +0000 bhyve: Update the -G description in the SYNPOSIS. It was missing both the 'w' flag and 'bind_address'. --- usr.sbin/bhyve/bhyve.8 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 8ebb8aea6210..09bba05a4f7a 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -45,7 +45,13 @@ .Op Cm ,threads= Ar n .Oc .Sm on -.Op Fl G Ar port +.Oo Fl G +.Sm off +.Oo Ar w Oc +.Oo Ar bind_address: Oc +.Ar port +.Sm on +.Oc .Op Fl k Ar file .Oo Fl l .Sm off From owner-dev-commits-src-main@freebsd.org Sat Sep 25 17:07: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 CD2676ACBF4; Sat, 25 Sep 2021 17:07: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 4HGwLy4v5Jz4s80; Sat, 25 Sep 2021 17:07: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 8917A5FF2; Sat, 25 Sep 2021 17:07: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 18PH7cAB086739; Sat, 25 Sep 2021 17:07:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PH7ck1086738; Sat, 25 Sep 2021 17:07:38 GMT (envelope-from git) Date: Sat, 25 Sep 2021 17:07:38 GMT Message-Id: <202109251707.18PH7ck1086738@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: 48759c4ed7f2 - main - bhyve_config.5: Document gdb.address. 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: 48759c4ed7f258baccd791c603baf22c8ddb1bb4 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, 25 Sep 2021 17:07:39 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=48759c4ed7f258baccd791c603baf22c8ddb1bb4 commit 48759c4ed7f258baccd791c603baf22c8ddb1bb4 Author: John Baldwin AuthorDate: 2021-09-25 17:07:18 +0000 Commit: John Baldwin CommitDate: 2021-09-25 17:07:18 +0000 bhyve_config.5: Document gdb.address. --- usr.sbin/bhyve/bhyve_config.5 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index 25bd818d6148..941fc447535c 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 17, 2021 +.Dd September 25, 2021 .Dt BHYVE_CONFIG 5 .Os .Sh NAME @@ -124,6 +124,8 @@ Wire guest memory. Generate ACPI tables. .It Va destroy_on_poweroff Ta bool Ta false Ta Destroy the VM on guest-initiated power-off. +.It Va gdb.address Ta string Ta localhost Ta +Hostname, IP address, or IPv6 address for the debug server. .It Va gdb.port Ta integer Ta 0 Ta TCP port number for the debug server. If this is set to a non-zero value, a debug server From owner-dev-commits-src-main@freebsd.org Sat Sep 25 17:20:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81A646ACF21; Sat, 25 Sep 2021 17:20:21 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (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 4HGwdd2rqCz4srj; Sat, 25 Sep 2021 17:20:21 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qt1-x836.google.com with SMTP id r1so12583210qta.12; Sat, 25 Sep 2021 10:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=vo4nL/uHZ67pRqjWuFleC8cgwln/rApcTx2ERfpHp+U=; b=Gn13z4e2L/qUKOVqYQVdNoBSlv9kizJx6F0bsPZwq/DLPM4i/MCUjt2Wk7fhJVI81n pWvVAaZHxye3uHP3Nu2IaLA6YCoVQ7vSQr6396XQ1b4YC21piF5tSVYIqY1V2ZB1ahdZ prS/wghw1R0EMwIH5dn3Gc4Vs4tFYtKG2/bdRLSF/Hf2Mg1rXV4pZXGW37LSdlGsvgUQ 9VfFwldbm8Q4A5DaoUG1wXu//srQ4KCwveRBSEheR5AvbKHwl0/gKUO1IimJo9Rdoh6t goFz1XSVm47GVZMAb1/3kDJcuH+fBik2y/joPTL6zuT3vfTfHxay2EEu243hsFq35TzL Vlyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vo4nL/uHZ67pRqjWuFleC8cgwln/rApcTx2ERfpHp+U=; b=S1+pAaBz9Lj10+d5zzJA6dKixfONJ6IjtDAQjyRqFE4x1R7SUyLvJtFYTuFSfWGp/s CSwA/cXnqrn5vAyfZ3ZacYN9qhv9NAdkopC8QelEZijQ+hYQuqQFgCxPX0Qh9oNjv2+v XXuaJIO3dcPZgN/AujR07zJ4aUtpUIDZndnGpWHZazK0sAMCrfAEqyhndBDlLEDJe68L i9nbQ1YgYyedcJhyuU8mprpaalWIOqBqaICa+idRGotLuLgj66RY0Nfx/5Uvhw7Gay1Z WMV1c6u6MnbzyBVmz1GFRQk1H9EO+TlhJHB62ovcebFm7FRL1Xs8Hh0VWoAhMOj7E5h6 t5jw== X-Gm-Message-State: AOAM532yBU4SWLZAhOFbEw3+nQtbQEoptYqc20sw5QkgvEx8amGqUpEd u2wJoLlndQFrp9Fl9SAteFwlCHSMsUU= X-Google-Smtp-Source: ABdhPJz/6CUo7LWqUKIBKIgtftBIm+4P51bDZ92lxHHMztH75cHwDuy+jLKOjMhhXvGO8fEva5FlPQ== X-Received: by 2002:ac8:615a:: with SMTP id d26mr10514807qtm.318.1632590419874; Sat, 25 Sep 2021 10:20:19 -0700 (PDT) Received: from spectre.mavhome.dp.ua (104-55-12-234.lightspeed.knvltn.sbcglobal.net. [104.55.12.234]) by smtp.gmail.com with ESMTPSA id n20sm8947174qkk.135.2021.09.25.10.20.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Sep 2021 10:20:19 -0700 (PDT) Sender: Alexander Motin Subject: Re: git: c8077ccd70cf - main - acpi_cpu: Make device unit numbers match OS CPU IDs. To: John Baldwin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109250124.18P1OOP5035829@gitrepo.freebsd.org> <5d4a3f4f-0249-01b6-37ef-9a3dd9a8d7ad@FreeBSD.org> From: Alexander Motin Message-ID: Date: Sat, 25 Sep 2021 13:20:18 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <5d4a3f4f-0249-01b6-37ef-9a3dd9a8d7ad@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4HGwdd2rqCz4srj 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: Sat, 25 Sep 2021 17:20:21 -0000 On 25.09.2021 12:30, John Baldwin wrote: > On 9/24/21 6:24 PM, Alexander Motin wrote: >> The branch main has been updated by mav: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=c8077ccd70cfcbcccb752e89b848f098abcb9309 >> >> >> commit c8077ccd70cfcbcccb752e89b848f098abcb9309 >> Author:     Alexander Motin >> AuthorDate: 2021-09-25 01:03:02 +0000 >> Commit:     Alexander Motin >> CommitDate: 2021-09-25 01:24:19 +0000 >> >>      acpi_cpu: Make device unit numbers match OS CPU IDs. >>           There are already APIC ID, ACPI ID and OS ID for each CPU.  >> In perfect >>      world all of those may match, but at least for SuperMicro server >> boards >>      none of them do.  Plus none of them match the CPU devices listing >> order >>      by ACPI.  Previous code used the ACPI device listing order to number >>      cpuX devices.  It looked nice from NewBus perspective, but >> introduced >>      4th different set of IDs. Extremely confusing one, since in some >> places >>      the device unit numbers were treated as OS CPU IDs (coretemp), >> but not >>      in others (sysctl dev.cpu.X.%location). > > FWIW, the "normal" way to force specific device unit numbers is via > bus_hint_device_unit, but perhaps that is specific to when hints > exits whereas this is specific to a bus property.  Perhaps though this > can't have the unit number assigned by the bus at the BUS_ADD_CHILD > call?  That would be the other way to handle this perhaps vs trying to > change the unit in the probe routine. Doing it in any of proposed ways would require bus to know about the device specifics much more than it should. I've found it better done this way. Setting device unit number by the driver during the probe is not much worse than setting description, and definitely much better than during attach as done by xen/blkfront, which should probably be changed to probe way too. -- Alexander Motin From owner-dev-commits-src-main@freebsd.org Sat Sep 25 18:30: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 B10D26AE04D; Sat, 25 Sep 2021 18:30: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 4HGyBg4drjz3Fcc; Sat, 25 Sep 2021 18: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 8034B7236; Sat, 25 Sep 2021 18: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 18PIUZOu001755; Sat, 25 Sep 2021 18: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 18PIUZpF001739; Sat, 25 Sep 2021 18:30:35 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:30:35 GMT Message-Id: <202109251830.18PIUZpF001739@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: e72c7e2738ca - main - kernel: Disable errors for -Walloca-larger-than for GCC. 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: e72c7e2738ca9f5893ba5e5e9dc120dfc82fabfd 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, 25 Sep 2021 18:30:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e72c7e2738ca9f5893ba5e5e9dc120dfc82fabfd commit e72c7e2738ca9f5893ba5e5e9dc120dfc82fabfd Author: John Baldwin AuthorDate: 2021-09-25 18:24:35 +0000 Commit: John Baldwin CommitDate: 2021-09-25 18:24:35 +0000 kernel: Disable errors for -Walloca-larger-than for GCC. GCC complains about the use of alloca() with variable sizes (for XSAVE state len) in sendsig() for i386. Modern XSAVE state is probably getting a bit large for the i386 kstack, but downgrade the error to a warning. Reviewed by: kib, emaste Differential Revision: https://reviews.freebsd.org/D31934 --- sys/conf/kern.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index f6767ba76a46..859719db0083 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -69,7 +69,8 @@ CWARNEXTRA+= -Wno-error=memset-elt-size CWARNEXTRA+= -Wno-error=packed-not-aligned .endif .if ${COMPILER_VERSION} >= 90100 -CWARNEXTRA+= -Wno-address-of-packed-member +CWARNEXTRA+= -Wno-address-of-packed-member \ + -Wno-error=alloca-larger-than= .endif .endif # gcc From owner-dev-commits-src-main@freebsd.org Sat Sep 25 18: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 D0A076ADC66; Sat, 25 Sep 2021 18: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 4HGyBh5TDYz3FTm; Sat, 25 Sep 2021 18:30: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 9AA757320; Sat, 25 Sep 2021 18:30: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 18PIUaY8002362; Sat, 25 Sep 2021 18:30:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PIUafd002361; Sat, 25 Sep 2021 18:30:36 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:30:36 GMT Message-Id: <202109251830.18PIUafd002361@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: 7ecdfc823798 - main - bhyve: Add an empty case for event types in mevent_kq_fflags(). 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: 7ecdfc823798a8f7add245651b26d9d900bc9889 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, 25 Sep 2021 18:30:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7ecdfc823798a8f7add245651b26d9d900bc9889 commit 7ecdfc823798a8f7add245651b26d9d900bc9889 Author: John Baldwin AuthorDate: 2021-09-25 18:25:25 +0000 Commit: John Baldwin CommitDate: 2021-09-25 18:25:25 +0000 bhyve: Add an empty case for event types in mevent_kq_fflags(). This fixes a -Wswitch error raised by GCC 9. Differential Revision: https://reviews.freebsd.org/D31938 --- usr.sbin/bhyve/mevent.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.sbin/bhyve/mevent.c b/usr.sbin/bhyve/mevent.c index 0c5351cd31a9..eb84dc15ad47 100644 --- a/usr.sbin/bhyve/mevent.c +++ b/usr.sbin/bhyve/mevent.c @@ -190,6 +190,11 @@ mevent_kq_fflags(struct mevent *mevp) if ((mevp->me_fflags & EVFF_ATTRIB) != 0) retval |= NOTE_ATTRIB; break; + case EVF_READ: + case EVF_WRITE: + case EVF_TIMER: + case EVF_SIGNAL: + break; } return (retval); From owner-dev-commits-src-main@freebsd.org Sat Sep 25 18:30: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 192F36AE2D8; Sat, 25 Sep 2021 18:30: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 4HGyBj7042z3FX1; Sat, 25 Sep 2021 18:30: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 C208D7590; Sat, 25 Sep 2021 18:30: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 18PIUbOb002388; Sat, 25 Sep 2021 18:30:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PIUbSJ002387; Sat, 25 Sep 2021 18:30:37 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:30:37 GMT Message-Id: <202109251830.18PIUbSJ002387@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: 0def501d143a - main - mana: Cast an unused value to void to quiet a warning. 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: 0def501d143a84714eed0a431d35c43d30546802 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, 25 Sep 2021 18:30:38 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0def501d143a84714eed0a431d35c43d30546802 commit 0def501d143a84714eed0a431d35c43d30546802 Author: John Baldwin AuthorDate: 2021-09-25 18:28:14 +0000 Commit: John Baldwin CommitDate: 2021-09-25 18:28:14 +0000 mana: Cast an unused value to void to quiet a warning. This appeases a -Wunused-value warning from GCC 9. Reviewed by: whu Differential Revision: https://reviews.freebsd.org/D31948 --- sys/dev/mana/mana_en.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index ffeee336f694..5b680f146476 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -576,7 +576,7 @@ mana_xmit(struct mana_txq *txq) next_to_use = (next_to_use + 1) % MAX_SEND_BUFFERS_PER_QUEUE; - atomic_inc_return(&txq->pending_sends); + (void)atomic_inc_return(&txq->pending_sends); drbr_advance(ndev, txq->txq_br); From owner-dev-commits-src-main@freebsd.org Sat Sep 25 18:52: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 D39FD6AE4CA; Sat, 25 Sep 2021 18:52: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 4HGygq5d4Kz3HyM; Sat, 25 Sep 2021 18:52: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 9D33B7AA5; Sat, 25 Sep 2021 18:52: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 18PIqN5i032120; Sat, 25 Sep 2021 18:52:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PIqN8T032119; Sat, 25 Sep 2021 18:52:23 GMT (envelope-from git) Date: Sat, 25 Sep 2021 18:52:23 GMT Message-Id: <202109251852.18PIqN8T032119@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: 9d324b5ffc8a - main - mount: Don't pass a NULL format string to xo_err(). 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: 9d324b5ffc8a783ceff2a78dea19602a1d8f045a 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, 25 Sep 2021 18:52:23 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9d324b5ffc8a783ceff2a78dea19602a1d8f045a commit 9d324b5ffc8a783ceff2a78dea19602a1d8f045a Author: John Baldwin AuthorDate: 2021-09-25 18:51:01 +0000 Commit: John Baldwin CommitDate: 2021-09-25 18:52:10 +0000 mount: Don't pass a NULL format string to xo_err(). This fixes a -Wformat error from GCC 9. Fixes: e725ee7eb672 mount: add libxo(3) support --- sbin/mount/mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 02242791a7a2..80eda100c66f 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -192,7 +192,7 @@ specified_ro(const char *arg) optbuf = strdup(arg); if (optbuf == NULL) - xo_err(1, NULL); + xo_err(1, "strdup failed"); for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) { if (strcmp(opt, "ro") == 0) { From owner-dev-commits-src-main@freebsd.org Sat Sep 25 18:57: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 32B146AE8FA; Sat, 25 Sep 2021 18:57:42 +0000 (UTC) (envelope-from pstef@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGyny0lQhz3JDb; Sat, 25 Sep 2021 18:57:42 +0000 (UTC) (envelope-from pstef@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632596262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WDUPXzq6gAzaHJLDWxdRIleDO65+fk3noBX1mSTSX0E=; b=ITHAco1QmV7T7+PQSMVc9uVp8NOwwvHbSpbdYSS1A27RRR57VpNB2IN3ok+IdCxXqyLiZF cNIRm2L8lyf9X0WFlcU3EZRDAMRtmrFSwRfY6hOBw852ZdLBCOM2Hdhopk8yAK1QeFlUqH WAtesnige8AwLqtSKZ8jF/8y61xqc/Kn+b3Ym6zvKS6DwI8lJgM2n+zKMdPrabU05yw1lK ZrXdYUveFNZFZEiT1tOvmviW76q0uFj6kdbw8klI/OALjHbbxLMrDJR5/0RV191YIHp3ZW 8xABCC4nJeno+XW+pES3QA+h3jyAxbOZQK1G9h+9iPtSme32pDRKu4MZMWfWAA== Received: by freefall.freebsd.org (Postfix, from userid 1403) id F3E761F9E3; Sat, 25 Sep 2021 18:57:41 +0000 (UTC) Date: Sat, 25 Sep 2021 18:57:41 +0000 From: "Piotr P. Stefaniak" To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9d324b5ffc8a - main - mount: Don't pass a NULL format string to xo_err(). Message-ID: References: <202109251852.18PIqN8T032119@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <202109251852.18PIqN8T032119@gitrepo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1632596262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WDUPXzq6gAzaHJLDWxdRIleDO65+fk3noBX1mSTSX0E=; b=eQiSzUg87Oh84aEAO11pkn/h+by0y+ozia53zzBdU/U5a/9qVh+l46VKv00YoShk1/GGna S3TRyXgq04WuO6Hz3cgYxnlZ4RKUQBxzMUC6N5eUivI+u5fmWU6VwTxMM7FPVbAzDMtEf1 gxNCbwU8WDPi3hqd3VBekilcD6cwwjoXg2GYePfycKKX8l4ZvZmjY7MA9NVy/eLVjRjEjs Gdl6jwxSWtYWU2YAq+iWCVdeduMmin9Ucq64H+8afREEmV0c3A2kwyIFHhvdSdOj7nOxBW L1sqk/4rUEsgs9V7vCY0WtFdSlrRbbID0js3c/ds2tCTb87gYc1ynRsX/8/uqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1632596262; a=rsa-sha256; cv=none; b=dca/iKsk6L5kkulAx7MF2acc5VeFkWNZhHXB1u+JzV1fJoEFh5mxvplGi/e8SqIONitgHF 0Aup2l7UTKd+6AGrHfYp6e4oySeq/4p3n9carwzlhJVbZJsO/diBX6Wv+BsEguucXrMelN QhcyLN7iQoRF/Kwrq7rkncgNYD/limqk5OSxyZFSy2GsIqtcym+XiOrfhSS/TJmUcYobE1 HtClFJl0EXd9z29vgSZWPV6me8w5MTZP2PxUv5aFqLhXqUBDKplsAB6662VciABwV1aPFx twx+nqJQv0Qq9aUABoaSiX6HS3D+Vd6rXXRokDqJothLj3pjavQ81qkl4MWVew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 18:57:42 -0000 On 2021-09-25 18:52:23, John Baldwin wrote: >The branch main has been updated by jhb: > >URL: https://cgit.FreeBSD.org/src/commit/?id=9d324b5ffc8a783ceff2a78dea19602a1d8f045a > >commit 9d324b5ffc8a783ceff2a78dea19602a1d8f045a >Author: John Baldwin >AuthorDate: 2021-09-25 18:51:01 +0000 >Commit: John Baldwin >CommitDate: 2021-09-25 18:52:10 +0000 > > mount: Don't pass a NULL format string to xo_err(). > > This fixes a -Wformat error from GCC 9. > > Fixes: e725ee7eb672 mount: add libxo(3) support Sorry, I missed that. Thanks for fixing it! Piotr From owner-dev-commits-src-main@freebsd.org Sat Sep 25 19:10: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 062C36AEAA7; Sat, 25 Sep 2021 19:10: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 4HGz4f5GwBz3JXr; Sat, 25 Sep 2021 19:10: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 965B27C33; Sat, 25 Sep 2021 19:10: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 18PJAQG5055364; Sat, 25 Sep 2021 19:10:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PJAQLK055363; Sat, 25 Sep 2021 19:10:26 GMT (envelope-from git) Date: Sat, 25 Sep 2021 19:10:26 GMT Message-Id: <202109251910.18PJAQLK055363@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: 19e4f2f289fb - main - efi loader: Call tslog_init from efi_main 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: 19e4f2f289fb8d2b14576a65ca9e6f931dbb6a02 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, 25 Sep 2021 19:10:27 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=19e4f2f289fb8d2b14576a65ca9e6f931dbb6a02 commit 19e4f2f289fb8d2b14576a65ca9e6f931dbb6a02 Author: Colin Percival AuthorDate: 2021-09-25 19:04:06 +0000 Commit: Colin Percival CommitDate: 2021-09-25 19:06:07 +0000 efi loader: Call tslog_init from efi_main We were calling tslog_init from main; no reason to wait that long. Fixes: f49381ccb6bc efi/loader: Call tslog_init Sponsored by: https://www.patreon.com/cperciva --- stand/efi/loader/efi_main.c | 4 ++++ stand/efi/loader/main.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/stand/efi/loader/efi_main.c b/stand/efi/loader/efi_main.c index fa3c765c36ab..736c1aa56c99 100644 --- a/stand/efi/loader/efi_main.c +++ b/stand/efi/loader/efi_main.c @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -101,6 +102,9 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) setheap((void *)(uintptr_t)heap, (void *)(uintptr_t)(heap + heapsize)); + /* Start tslog now that we have a heap.*/ + tslog_init(); + /* Use efi_exit() from here on... */ status = OpenProtocolByHandle(IH, &image_protocol, (void**)&img); diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index b687255181e3..d8b3b1d19b15 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -924,8 +924,6 @@ 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 Sat Sep 25 21:01: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 DEFB1668A91; Sat, 25 Sep 2021 21:01: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 4HH1Xr5rx9z3j07; Sat, 25 Sep 2021 21:01: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 A92291164B; Sat, 25 Sep 2021 21:01: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 18PL1WW7003366; Sat, 25 Sep 2021 21:01:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PL1W4I003365; Sat, 25 Sep 2021 21:01:32 GMT (envelope-from git) Date: Sat, 25 Sep 2021 21:01:32 GMT Message-Id: <202109252101.18PL1W4I003365@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: 695323ae88c7 - main - acpi_cpu: Fix panic if some CPU devices are disabled. 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: 695323ae88c71776e131940ed7dedd25365e932f 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, 25 Sep 2021 21:01:32 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=695323ae88c71776e131940ed7dedd25365e932f commit 695323ae88c71776e131940ed7dedd25365e932f Author: Alexander Motin AuthorDate: 2021-09-25 20:54:28 +0000 Commit: Alexander Motin CommitDate: 2021-09-25 21:01:28 +0000 acpi_cpu: Fix panic if some CPU devices are disabled. While there, remove couple unneeded global variables. --- sys/dev/acpica/acpi_cpu.c | 66 +++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index ab4ffda7a02e..0577b6eac8b7 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -154,8 +154,6 @@ static struct sysctl_oid *cpu_sysctl_tree; static int cpu_cx_generic; static int cpu_cx_lowest_lim; -static device_t *cpu_devices; -static int cpu_ndevices; static struct acpi_cpu_softc **cpu_softc; ACPI_SERIAL_DECL(cpu, "ACPI CPU"); @@ -443,26 +441,21 @@ acpi_cpu_attach(device_t dev) static void acpi_cpu_postattach(void *unused __unused) { - device_t *devices; - int err; - int i, n; - int attached; - - err = devclass_get_devices(acpi_cpu_devclass, &devices, &n); - if (err != 0) { - printf("devclass_get_devices(acpi_cpu_devclass) failed\n"); - return; + struct acpi_cpu_softc *sc; + int attached = 0, i; + + mtx_lock(&Giant); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) + bus_generic_probe(sc->cpu_dev); + } + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) { + bus_generic_attach(sc->cpu_dev); + attached = 1; + } } - attached = 0; - for (i = 0; i < n; i++) - if (device_is_attached(devices[i]) && - device_get_driver(devices[i]) == &acpi_cpu_driver) - attached = 1; - for (i = 0; i < n; i++) - bus_generic_probe(devices[i]); - for (i = 0; i < n; i++) - bus_generic_attach(devices[i]); - free(devices, M_TEMP); + mtx_unlock(&Giant); if (attached) { #ifdef EARLY_AP_STARTUP @@ -937,9 +930,6 @@ acpi_cpu_startup(void *arg) struct acpi_cpu_softc *sc; int i; - /* Get set of CPU devices */ - devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices); - /* * Setup any quirks that might necessary now that we have probed * all the CPUs @@ -951,9 +941,9 @@ acpi_cpu_startup(void *arg) * We are using generic Cx mode, probe for available Cx states * for all processors. */ - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); - acpi_cpu_generic_cx_probe(sc); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) + acpi_cpu_generic_cx_probe(sc); } } else { /* @@ -961,8 +951,9 @@ acpi_cpu_startup(void *arg) * As we now know for sure that we will be using _CST mode * install our notify handler. */ - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) == NULL) + continue; if (cpu_quirks & CPU_QUIRK_NO_C3) { sc->cpu_cx_count = min(sc->cpu_cx_count, sc->cpu_non_c3 + 1); } @@ -972,9 +963,9 @@ acpi_cpu_startup(void *arg) } /* Perform Cx final initialization. */ - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); - acpi_cpu_startup_cx(sc); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) + acpi_cpu_startup_cx(sc); } /* Add a sysctl handler to handle global Cx lowest setting */ @@ -985,9 +976,9 @@ acpi_cpu_startup(void *arg) /* Take over idling from cpu_idle_default(). */ cpu_cx_lowest_lim = 0; - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); - enable_idle(sc); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) != NULL) + enable_idle(sc); } #if defined(__i386__) || defined(__amd64__) cpu_idle_hook = acpi_cpu_idle; @@ -1517,8 +1508,9 @@ acpi_cpu_global_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS) /* Update the new lowest useable Cx state for all CPUs. */ ACPI_SERIAL_BEGIN(cpu); cpu_cx_lowest_lim = val - 1; - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); + CPU_FOREACH(i) { + if ((sc = cpu_softc[i]) == NULL) + continue; sc->cpu_cx_lowest_lim = cpu_cx_lowest_lim; acpi_cpu_set_cx_lowest(sc); } From owner-dev-commits-src-main@freebsd.org Sat Sep 25 22:24: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 47EB0669F11; Sat, 25 Sep 2021 22:24: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 4HH3P31YGNz3nYd; Sat, 25 Sep 2021 22:24:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 157A5128BC; Sat, 25 Sep 2021 22:24:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18PMOsDM013677; Sat, 25 Sep 2021 22:24:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PMOsWn013676; Sat, 25 Sep 2021 22:24:54 GMT (envelope-from git) Date: Sat, 25 Sep 2021 22:24:54 GMT Message-Id: <202109252224.18PMOsWn013676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: fb640be4e944 - main - uart: Add PCI ID for intel 100 Series/C230 Series AMT MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb640be4e9443f1890680c27b213825300bc65f4 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, 25 Sep 2021 22:24:55 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fb640be4e9443f1890680c27b213825300bc65f4 commit fb640be4e9443f1890680c27b213825300bc65f4 Author: Sean Bruno AuthorDate: 2021-09-25 22:23:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-25 22:24:34 +0000 uart: Add PCI ID for intel 100 Series/C230 Series AMT Reviewed by: kib Tested by: kbowling Differential Revision: https://reviews.freebsd.org/D32146 --- sys/dev/uart/uart_bus_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index f7e9bd6ac401..92046261f544 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -170,6 +170,8 @@ static const struct pci_id pci_ns8250_ids[] = { { 0x8086, 0x8c3d, 0xffff, 0, "Intel Lynx Point KT Controller", 0x10 }, { 0x8086, 0x8cbd, 0xffff, 0, "Intel Wildcat Point KT Controller", 0x10 }, { 0x8086, 0x9c3d, 0xffff, 0, "Intel Lynx Point-LP HECI KT", 0x10 }, +{ 0x8086, 0xa13d, 0xffff, 0, + "100 Series/C230 Series Chipset Family KT Redirection", 0x10 }, { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, From owner-dev-commits-src-main@freebsd.org Sun Sep 26 01:49: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 8943766C47D; Sun, 26 Sep 2021 01:49:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4HH7wz3DRTz4Y9v; Sun, 26 Sep 2021 01:49:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:e948:53aa:fce5:d12d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id C92CC20D2B; Sun, 26 Sep 2021 01:49:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 9d324b5ffc8a - main - mount: Don't pass a NULL format string to xo_err(). To: "Piotr P. Stefaniak" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202109251852.18PIqN8T032119@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Sat, 25 Sep 2021 18:49:21 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Sep 2021 01:49:23 -0000 On 9/25/21 11:57 AM, Piotr P. Stefaniak wrote: > On 2021-09-25 18:52:23, John Baldwin wrote: >> The branch main has been updated by jhb: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=9d324b5ffc8a783ceff2a78dea19602a1d8f045a >> >> commit 9d324b5ffc8a783ceff2a78dea19602a1d8f045a >> Author: John Baldwin >> AuthorDate: 2021-09-25 18:51:01 +0000 >> Commit: John Baldwin >> CommitDate: 2021-09-25 18:52:10 +0000 >> >> mount: Don't pass a NULL format string to xo_err(). >> >> This fixes a -Wformat error from GCC 9. >> >> Fixes: e725ee7eb672 mount: add libxo(3) support > > Sorry, I missed that. Thanks for fixing it! No worries. I'm not sure why clang's -Wformat doesn't catch this. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Sun Sep 26 06:34: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 2A9C2672847; Sun, 26 Sep 2021 06:34: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 4HHGG00RXdz3CFM; Sun, 26 Sep 2021 06:34: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 E396019050; Sun, 26 Sep 2021 06:34: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 18Q6YVj2063932; Sun, 26 Sep 2021 06:34:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18Q6YVUI063931; Sun, 26 Sep 2021 06:34:31 GMT (envelope-from git) Date: Sun, 26 Sep 2021 06:34:31 GMT Message-Id: <202109260634.18Q6YVUI063931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: cb17f4a6bdaf - main - kern_ctf: Use zlib's uncompress function for simpler code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb17f4a6bdaf133bdc658b8ed92ad2c62eff8a18 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, 26 Sep 2021 06:34:32 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=cb17f4a6bdaf133bdc658b8ed92ad2c62eff8a18 commit cb17f4a6bdaf133bdc658b8ed92ad2c62eff8a18 Author: Yoshihiro Ota AuthorDate: 2021-09-26 06:28:43 +0000 Commit: Xin LI CommitDate: 2021-09-26 06:33:00 +0000 kern_ctf: Use zlib's uncompress function for simpler code. Reviewed by: markj, delphij MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21531 --- sys/kern/kern_ctf.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/sys/kern/kern_ctf.c b/sys/kern/kern_ctf.c index 6a6a08033137..ee7576ab6fb9 100644 --- a/sys/kern/kern_ctf.c +++ b/sys/kern/kern_ctf.c @@ -244,7 +244,7 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) /* Check if decompression is required. */ if (raw != NULL) { - z_stream zs; + uLongf destlen; int ret; /* @@ -253,22 +253,12 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) */ bcopy(ctf_hdr, ctftab, sizeof(ctf_hdr)); - /* Initialise the zlib structure. */ - bzero(&zs, sizeof(zs)); - - if (inflateInit(&zs) != Z_OK) { - error = EIO; - goto out; - } - - zs.avail_in = shdr[i].sh_size - sizeof(ctf_hdr); - zs.next_in = ((uint8_t *) raw) + sizeof(ctf_hdr); - zs.avail_out = sz - sizeof(ctf_hdr); - zs.next_out = ((uint8_t *) ctftab) + sizeof(ctf_hdr); - ret = inflate(&zs, Z_FINISH); - inflateEnd(&zs); - if (ret != Z_STREAM_END) { - printf("%s(%d): zlib inflate returned %d\n", __func__, __LINE__, ret); + destlen = sz - sizeof(ctf_hdr); + ret = uncompress(((uint8_t *) ctftab) + sizeof(ctf_hdr), + &destlen, ((uint8_t *) raw) + sizeof(ctf_hdr), + shdr[i].sh_size - sizeof(ctf_hdr)); + if (ret != Z_OK) { + printf("%s(%d): zlib uncompress returned %d\n", __func__, __LINE__, ret); error = EIO; goto out; } From owner-dev-commits-src-main@freebsd.org Sun Sep 26 06:54: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 2A4F2672BE5; Sun, 26 Sep 2021 06:54: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 4HHGhy0N8Wz3DnK; Sun, 26 Sep 2021 06:54: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 E094A19426; Sun, 26 Sep 2021 06:54: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 18Q6sPTX090087; Sun, 26 Sep 2021 06:54:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18Q6sN6p090080; Sun, 26 Sep 2021 06:54:23 GMT (envelope-from git) Date: Sun, 26 Sep 2021 06:54:23 GMT Message-Id: <202109260654.18Q6sN6p090080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: 94c2d487f14b - main - contrib/tzdata: import tzdata 2021b MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94c2d487f14bc7143bbf3a9809f1f8f98db9f0ab 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, 26 Sep 2021 06:54:26 -0000 The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=94c2d487f14bc7143bbf3a9809f1f8f98db9f0ab commit 94c2d487f14bc7143bbf3a9809f1f8f98db9f0ab Merge: cb17f4a6bdaf a5725262945a Author: Philip Paeps AuthorDate: 2021-09-26 06:45:39 +0000 Commit: Philip Paeps CommitDate: 2021-09-26 06:45:39 +0000 contrib/tzdata: import tzdata 2021b Merge commit 'a5725262945a2971af3b808088217fe975e8364e' Changes: https://github.com/eggert/tz/blob/2021b/NEWS MFC after: 3 days contrib/tzdata/CONTRIBUTING | 15 +- contrib/tzdata/Makefile | 43 ++-- contrib/tzdata/NEWS | 229 ++++++++++++++++++++- contrib/tzdata/africa | 135 +------------ contrib/tzdata/antarctica | 29 +-- contrib/tzdata/asia | 34 ++-- contrib/tzdata/australasia | 120 +++++++++-- contrib/tzdata/backward | 102 +++++++++- contrib/tzdata/backzone | 426 +++++++++++++++++++++++++++++++++++++-- contrib/tzdata/checktab.awk | 50 +++-- contrib/tzdata/europe | 44 ++-- contrib/tzdata/leap-seconds.list | 8 +- contrib/tzdata/leapseconds | 8 +- contrib/tzdata/northamerica | 244 ++++++---------------- contrib/tzdata/southamerica | 87 ++++---- contrib/tzdata/theory.html | 39 ++-- contrib/tzdata/version | 2 +- contrib/tzdata/ziguard.awk | 11 +- contrib/tzdata/zone.tab | 9 +- contrib/tzdata/zone1970.tab | 29 +-- 20 files changed, 1092 insertions(+), 572 deletions(-) diff --cc contrib/tzdata/Makefile index 1136af9298f1,000000000000..33f31684114b mode 100644,000000..100644 --- a/contrib/tzdata/Makefile +++ b/contrib/tzdata/Makefile @@@ -1,1130 -1,0 +1,1143 @@@ +# Make and install tzdb code and data. + +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. + +# Package name for the code distribution. +PACKAGE= tzcode + +# Version number for the distribution, overridden in the 'tarballs' rule below. +VERSION= unknown + +# Email address for bug reports. +BUGEMAIL= tz@iana.org + +# DATAFORM selects the data format. +# Available formats represent essentially the same data, albeit +# possibly with minor discrepancies that users are not likely to notice. +# To get new features and the best data right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +# Rearguard users might also want "ZFLAGS = -b fat"; see below. +DATAFORM= main + +# Change the line below for your timezone (after finding the one you want in +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for LOCALTIME. + +LOCALTIME= GMT + +# The POSIXRULES macro controls interpretation of nonstandard and obsolete +# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules. +# Such a setting uses the rules in a template file to determine +# "spring forward" and "fall back" days and times; the environment +# variable itself specifies UT offsets of standard and daylight saving time. +# +# If POSIXRULES is '-', no template is installed; this is the default. +# +# Any other value for POSIXRULES is obsolete and should not be relied on, as: +# * It does not work correctly in popular implementations such as GNU/Linux. - # * It does not work in the tzdb implementation for timestamps after 2037. - # * It is incompatible with 'zic -b slim' if POSIXRULES specifies transitions - # at standard time or UT rather than at local time. ++# * It does not work even in tzcode, except for historical timestamps ++# that precede the last explicit transition in the POSIXRULES file. ++# Hence it typically does not work for current and future timestamps. +# In short, software should avoid ruleless settings like TZ='EET-2EEST' +# and so should not depend on the value of POSIXRULES. +# +# If, despite the above, you want a template for handling these settings, +# you can change the line below (after finding the timezone you want in the +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -p -' to remove it, or 'zic -p rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for POSIXRULES. + +POSIXRULES= - + +# Also see TZDEFRULESTRING below, which takes effect only +# if the time zone files cannot be accessed. + + +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). + +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local timezone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + +# "Compiled" timezone information is placed in the "TZDIR" directory +# (and subdirectories). +# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. +TZDIR_BASENAME= zoneinfo +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) + +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin + +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) + +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin + +# Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man + +# Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib + + +# Types to try, as an alternative to time_t. +TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) - TIME_T_ALTERNATIVES_HEAD = int64_t - TIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t ++TIME_T_ALTERNATIVES_HEAD = int_least64_t ++TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t + +# What kind of TZif data files to generate. (TZif is the binary time +# zone data format that zic generates; see Internet RFC 8536.) +# If you want only POSIX time, with time values interpreted as +# seconds since the epoch (not counting leap seconds), use +# REDO= posix_only +# below. If you want only "right" time, with values interpreted +# as seconds since the epoch (counting leap seconds), use +# REDO= right_only +# below. If you want both sets of data available, with leap seconds not +# counted normally, use +# REDO= posix_right +# below. If you want both sets of data available, with leap seconds counted +# normally, use +# REDO= right_posix +# below. POSIX mandates that leap seconds not be counted; for compatibility +# with it, use "posix_only" or "posix_right". Use POSIX time on systems with +# leap smearing; this can work better than unsmeared "right" time with +# applications that are not leap second aware, and is closer to unsmeared +# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). + +REDO= posix_right + +# Whether to put an "Expires" line in the leapseconds file. +# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. +# The EXPIRES_LINE value matters only if REDO's value contains "right". +# If you change EXPIRES_LINE, remove the leapseconds file before running "make". +# zic's support for the Expires line was introduced in tzdb 2020a, - # and EXPIRES_LINE defaults to 0 for now so that the leapseconds file - # can be given to older zic implementations. ++# and was modified in tzdb 2021b to generate version 4 TZif files. ++# EXPIRES_LINE defaults to 0 for now so that the leapseconds file ++# can be given to pre-2020a zic implementations and so that TZif files ++# built by newer zic implementations can be read by pre-2021b libraries. +EXPIRES_LINE= 0 + +# To install data in text form that has all the information of the TZif data, +# (optionally incorporating leap second information), use +# TZDATA_TEXT= tzdata.zi leapseconds +# To install text data without leap second information (e.g., because +# REDO='posix_only'), use +# TZDATA_TEXT= tzdata.zi +# To avoid installing text data, use +# TZDATA_TEXT= + +TZDATA_TEXT= leapseconds tzdata.zi + +# For backward-compatibility links for old zone names, use +# BACKWARD= backward +# To omit these links, use +# BACKWARD= + +BACKWARD= backward + +# If you want out-of-scope and often-wrong data from the file 'backzone', use +# PACKRATDATA= backzone +# To omit this data, use +# PACKRATDATA= + +PACKRATDATA= + +# The name of a locale using the UTF-8 encoding, used during self-tests. +# The tests are skipped if the name does not appear to work on this system. + +UTF8_LOCALE= en_US.utf8 + +# Non-default libraries needed to link. +LDLIBS= + +# Add the following to the end of the "CFLAGS=" line as needed to override +# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1". +# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime +# formats that generate only the last two digits of year numbers +# -DEPOCH_LOCAL if the 'time' function returns local time not UT +# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater +# than what POSIX specifies, assuming local time is UT. +# For example, N is 252460800 on AmigaOS. +# -DHAVE_DECL_ASCTIME_R=0 if does not declare asctime_r +# -DHAVE_DECL_ENVIRON if declares 'environ' +# -DHAVE_DIRECT_H if mkdir needs (MS-Windows) +# -DHAVE_GENERIC=0 if _Generic does not work +# -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris) +# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares +# ctime_r and asctime_r incompatibly with the POSIX standard +# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). +# -DHAVE_INTTYPES_H if you have a non-C99 compiler with +# -DHAVE_LINK=0 if your system lacks a link function +# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function +# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz +# localtime_rz can make zdump significantly faster, but is nonstandard. ++# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. +# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare +# functions like 'link' or variables like 'tzname' required by POSIX +# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function +# -DHAVE_STDBOOL_H if you have a non-C99 compiler with +# -DHAVE_STDINT_H if you have a non-C99 compiler with +# -DHAVE_STRFTIME_L if declares locale_t and strftime_l +# -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function +# -DHAVE_SYMLINK=0 if your system lacks the symlink function +# -DHAVE_SYS_STAT_H=0 if your compiler lacks a - # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a +# -DHAVE_TZSET=0 if your system lacks a tzset function +# -DHAVE_UNISTD_H=0 if your compiler lacks a +# -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. +# -Dssize_t=long on hosts like MS-Windows that lack ssize_t +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use +# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; +# not needed by the main-program tz code, which is single-threaded. +# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. +# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t +# This is intended for internal use only; it mangles external names. +# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" +# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; +# the default is system-supplied, typically "/usr/lib/locale" +# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified +# DST transitions if the time zone files cannot be accessed +# -DUNINIT_TRAP if reading uninitialized storage can cause problems +# other than simply getting garbage data +# -DUSE_LTZ=0 to build zdump with the system time zone library +# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and +# similarly for "slim". Fat TZif files work around incompatibilities +# and bugs in some TZif readers, notably readers that mishandle 64-bit +# data in TZif files. Slim TZif files are more efficient and do not +# work around these incompatibilities and bugs. If not given, the +# default is "slim". +# -DZIC_MAX_ABBR_LEN_WO_WARN=3 +# (or some other number) to set the maximum time zone abbreviation length +# that zic will accept without a warning (the default is 6) +# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking +# Select instrumentation via "make GCC_INSTRUMENT='whatever'". +GCC_INSTRUMENT = \ + -fsanitize=undefined -fsanitize-address-use-after-scope \ + -fsanitize-undefined-trap-on-error -fstack-protector ++# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. +GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ + $(GCC_INSTRUMENT) \ + -Wall -Wextra \ + -Walloc-size-larger-than=100000 -Warray-bounds=2 \ + -Wbad-function-cast -Wcast-align=strict -Wdate-time \ + -Wdeclaration-after-statement -Wdouble-promotion \ ++ -Wduplicated-branches -Wduplicated-cond \ + -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ - -Winit-self -Wjump-misses-init -Wlogical-op \ ++ -Winit-self -Wlogical-op \ + -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ ++ -Wnull-dereference \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ - -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=4 \ ++ -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ ++ -Wstrict-prototypes -Wstringop-overflow=4 \ + -Wstringop-truncation -Wsuggest-attribute=cold \ + -Wsuggest-attribute=const -Wsuggest-attribute=format \ + -Wsuggest-attribute=malloc \ + -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ - -Wtrampolines -Wundef -Wuninitialized -Wunused \ ++ -Wtrampolines -Wundef -Wuninitialized -Wunused-macros \ + -Wvariadic-macros -Wvla -Wwrite-strings \ + -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ + -Wno-type-limits -Wno-unused-parameter +# +# If your system has a "GMT offset" field in its "struct tm"s +# (or if you decide to add such a field in your system's "time.h" file), +# add the name to a define such as +# -DTM_GMTOFF=tm_gmtoff +# to the end of the "CFLAGS=" line. If not defined, the code attempts to +# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. +# Similarly, if your system has a "zone abbreviation" field, define +# -DTM_ZONE=tm_zone +# and define NO_TM_ZONE to suppress any guessing. These two fields are not +# required by POSIX, but are widely available on GNU/Linux and BSD systems. +# +# The next batch of options control support for external variables +# exported by tzcode. In practice these variables are less useful +# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. +# # +# # To omit or support the external variable "tzname", add one of: +# # -DHAVE_TZNAME=0 # do not support "tzname" +# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library +# # -DHAVE_TZNAME=2 # support and define "tzname" +# # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later. +# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. +# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause +# # crashes when combined with some platforms' standard libraries, +# # presumably due to memory allocation issues. +# # +# # To omit or support the external variables "timezone" and "daylight", add +# # -DUSG_COMPAT=0 # do not support +# # -DUSG_COMPAT=1 # support, and variables are defined by system library +# # -DUSG_COMPAT=2 # support and define variables +# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by +# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later. +# # If not defined, the code attempts to guess USG_COMPAT from other macros. +# # +# # To support the external variable "altzone", add +# # -DALTZONE=0 # do not support +# # -DALTZONE=1 # support "altzone", which is defined by system library +# # -DALTZONE=2 # support and define "altzone" +# # to the end of the "CFLAGS=" line; although "altzone" appeared in +# # System V Release 3.1 it has not been standardized. +# # If not defined, the code attempts to guess ALTZONE from other macros. +# +# If you want functions that were inspired by early versions of X3J11's work, +# add +# -DSTD_INSPIRED +# to the end of the "CFLAGS=" line. This arranges for the functions +# "offtime", "timelocal", "timegm", "timeoff", +# "posix2time", and "time2posix" to be added to the time conversion library. +# "offtime" is like "gmtime" except that it accepts a second (long) argument +# that gives an offset to add to the time_t when converting it. +# "timelocal" is equivalent to "mktime". +# "timegm" is like "timelocal" except that it turns a struct tm into +# a time_t using UT (rather than local time as "timelocal" does). +# "timeoff" is like "timegm" except that it accepts a second (long) argument +# that gives an offset to use when converting to a time_t. +# "posix2time" and "time2posix" are described in an included manual page. +# X3J11's work does not describe any of these functions. +# These functions may well disappear in future releases of the time +# conversion package. +# +# If you don't want functions that were inspired by NetBSD, add +# -DNETBSD_INSPIRED=0 +# to the end of the "CFLAGS=" line. Otherwise, the functions +# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the +# time library, and if STD_INSPIRED is also defined the functions +# "posix2time_z" and "time2posix_z" are added as well. +# The functions ending in "_z" (or "_rz") are like their unsuffixed +# (or suffixed-by-"_r") counterparts, except with an extra first +# argument of opaque type timezone_t that specifies the timezone. +# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. +# +# If you want to allocate state structures in localtime, add +# -DALL_STATE +# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. +# +# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put +# out by the National Institute of Standards and Technology +# which claims to test C and Posix conformance. If you want to pass PCTS, add +# -DPCTS +# to the end of the "CFLAGS=" line. +# +# If you want strict compliance with XPG4 as of 1994-04-09, add +# -DXPG4_1994_04_09 +# to the end of the "CFLAGS=" line. This causes "strftime" to always return +# 53 as a week number (rather than 52 or 53) for January days before +# January's first Monday when a "%V" format is used and January 1 +# falls on a Friday, Saturday, or Sunday. + +CFLAGS= + +# Linker flags. Default to $(LFLAGS) for backwards compatibility +# to release 2012h and earlier. + +LDFLAGS= $(LFLAGS) + +# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in +# submake command lines. The default is no leap seconds. + +LEAPSECONDS= + +# The zic command and its arguments. + +zic= ./zic +ZIC= $(zic) $(ZFLAGS) + +# To shrink the size of installed TZif files, +# append "-r @N" to omit data before N-seconds-after-the-Epoch. +# To grow the files and work around older application bugs, append "-b fat"; +# see ZIC_BLOAT_DEFAULT above. +# See the zic man page for more about -b and -r. +ZFLAGS= + +# How to use zic to install TZif files. + +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) + +# The name of a Posix-compliant 'awk' on your system. +# Older 'mawk' versions, such as the 'mawk' in Ubuntu 16.04, might dump core; +# on Ubuntu you can work around this with +# AWK= gawk +AWK= awk + +# The full path name of a Posix-compliant shell, preferably one that supports +# the Korn shell's 'select' statement as an extension. +# These days, Bash is the most popular. +# It should be OK to set this to /bin/sh, on platforms where /bin/sh +# lacks 'select' or doesn't completely conform to Posix, but /bin/bash +# is typically nicer if it works. +KSHELL= /bin/bash + +# Name of curl , used for HTML validation. +CURL= curl + +# Name of GNU Privacy Guard , used to sign distributions. +GPG= gpg + +# This expensive test requires USE_LTZ. +# To suppress it, define this macro to be empty. +CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives + +# SAFE_CHAR is a regular expression that matches a safe character. +# Some parts of this distribution are limited to safe characters; +# others can use any UTF-8 character. +# For now, the safe characters are a safe subset of ASCII. +# The caller must set the shell variable 'sharp' to the character '#', +# since Makefile macros cannot contain '#'. +# TAB_CHAR is a single tab character, in single quotes. +TAB_CHAR= ' ' +SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' +SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' +SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' +SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) +SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' + +# These characters are Latin-1, and so are likely to be displayable +# even in editors with limited character sets. +UNUSUAL_OK_LATIN_1 = «°±»½¾× +# This IPA symbol is represented in Unicode as the composition of +# U+0075 and U+032F, and U+032F is not considered alphabetic by some +# grep implementations that do not grok composition. +UNUSUAL_OK_IPA = u̯ +# Non-ASCII non-letters that OK_CHAR allows, as these characters are +# useful in commentary. +UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA) + +# OK_CHAR matches any character allowed in the distributed files. +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +# Other non-letters are limited to ASCII renderings for the +# convenience of maintainers using XEmacs 21.5.34, which by default +# mishandles Unicode characters U+0100 and greater. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' + +# SAFE_LINE matches a line of safe characters. +# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; +# this is so that comments can contain non-ASCII characters. +# OK_LINE matches a line of OK characters. +SAFE_LINE= '^'$(SAFE_CHAR)'*$$' +SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' +OK_LINE= '^'$(OK_CHAR)'*$$' + +# Flags to give 'tar' when making a distribution. +# Try to use flags appropriate for GNU tar. +GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name +TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ + then echo $(GNUTARFLAGS); \ + else :; \ + fi` + +# Flags to give 'gzip' when making a distribution. +GZIPFLAGS= -9n + +############################################################################### + +#MAKE= make + +cc= cc +CC= $(cc) -DTZDIR='"$(TZDIR)"' + +AR= ar + +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : + +TZCOBJS= zic.o +TZDOBJS= zdump.o localtime.o asctime.o strftime.o +DATEOBJS= date.o localtime.o strftime.o asctime.o +LIBSRCS= localtime.c asctime.c difftime.c strftime.c +LIBOBJS= localtime.o asctime.o difftime.o strftime.o +HEADERS= tzfile.h private.h +NONLIBSRCS= zic.c zdump.c +NEWUCBSRCS= date.c +SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ + tzselect.ksh workman.sh +MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ + tzfile.5 tzselect.8 zic.8 zdump.8 +MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ + time2posix.3.txt \ + tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ + date.1.txt +COMMON= calendars CONTRIBUTING LICENSE Makefile \ + NEWS README theory.html version +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html +CHECK_WEB_PAGES=check_theory.html check_tz-art.html \ + check_tz-how-to.html check_tz-link.html +DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) +PRIMARY_YDATA= africa antarctica asia australasia \ + europe northamerica southamerica +YDATA= $(PRIMARY_YDATA) etcetera +NDATA= factory +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward +TDATA= $(YDATA) $(NDATA) $(BACKWARD) +ZONETABLES= zone1970.tab zone.tab +TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) +LEAP_DEPS= leapseconds.awk leap-seconds.list +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) $(PACKRATDATA) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ + leapseconds $(ZONETABLES) +AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk +MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl +TZS_YEAR= 2050 +TZS_CUTOFF_FLAG= -c $(TZS_YEAR) +TZS= to$(TZS_YEAR).tzs +TZS_NEW= to$(TZS_YEAR)new.tzs - TZS_DEPS= $(PRIMARY_YDATA) asctime.c localtime.c \ ++TZS_DEPS= $(YDATA) asctime.c localtime.c \ + private.h tzfile.h zdump.c zic.c +# EIGHT_YARDS is just a yard short of the whole ENCHILADA. +EIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi +ENCHILADA = $(EIGHT_YARDS) $(TZS) + +# Consult these files when deciding whether to rebuild the 'version' file. +# This list is not the same as the output of 'git ls-files', since +# .gitignore is not distributed. +VERSION_DEPS= \ + calendars CONTRIBUTING LICENSE Makefile NEWS README \ + africa antarctica asctime.c asia australasia \ + backward backzone \ + checklinks.awk checktab.awk \ + date.1 date.c difftime.c \ + etcetera europe factory iso3166.tab \ + leap-seconds.list leapseconds.awk localtime.c \ + newctime.3 newstrftime.3 newtzset.3 northamerica \ + private.h southamerica strftime.c theory.html \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ + tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ + workman.sh zdump.8 zdump.c zic.8 zic.c \ + ziguard.awk zishrink.awk \ + zone.tab zone1970.tab zoneinfo2tdf.pl + +# And for the benefit of csh users on systems that assume the user +# shell should be used to handle commands in Makefiles. . . + +SHELL= /bin/sh + +all: tzselect zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi + +ALL: all date $(ENCHILADA) + +install: all $(DATA) $(REDO) $(MANS) + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) \ + `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ + ` $(POSIXRULES) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' + +INSTALL: ALL install date.1 + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' + +# Calculate version number from git, if available. +# Otherwise, use $(VERSION) unless it is "unknown" and there is already +# a 'version' file, in which case reuse the existing 'version' contents +# and append "-dirty" if the contents do not already end in "-dirty". +version: $(VERSION_DEPS) + { (type git) >/dev/null 2>&1 && \ + V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ + --abbrev=7 --dirty` || \ + if test '$(VERSION)' = unknown && V=`cat $@`; then \ + case $$V in *-dirty);; *) V=$$V-dirty;; esac; \ + else \ + V='$(VERSION)'; \ + fi; } && \ + printf '%s\n' "$$V" >$@.out + mv $@.out $@ + +# These files can be tailored by setting BACKWARD and PACKRATDATA. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \ + $(TDATA) $(PACKRATDATA) >$@.out + mv $@.out $@ +# This file has a version comment that attempts to capture any tailoring +# via BACKWARD, DATAFORM, PACKRATDATA, and REDO. +tzdata.zi: $(DATAFORM).zi version zishrink.awk + version=`sed 1q version` && \ + LC_ALL=C $(AWK) \ + -v dataform='$(DATAFORM)' \ + -v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \ + -v redo='$(REDO)' \ + -v version="$$version" \ + -f zishrink.awk \ + $(DATAFORM).zi >$@.out + mv $@.out $@ + +version.h: version + VERSION=`cat version` && printf '%s\n' \ + 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ + "static char const TZVERSION[]=\"$$VERSION\";" \ + 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ + >$@.out + mv $@.out $@ + +zdump: $(TZDOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) + +zic: $(TZCOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) + +leapseconds: $(LEAP_DEPS) + $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ + -f leapseconds.awk leap-seconds.list >$@.out + mv $@.out $@ + +# Arguments to pass to submakes of install_data. +# They can be overridden by later submake arguments. +INSTALLARGS = \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ + LEAPSECONDS='$(LEAPSECONDS)' \ + PACKRATDATA='$(PACKRATDATA)' \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + ZIC='$(ZIC)' + +INSTALL_DATA_DEPS = zic leapseconds tzdata.zi + +# 'make install_data' installs one set of TZif files. +install_data: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) tzdata.zi + +posix_only: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data + +right_only: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ + install_data + +# In earlier versions of this makefile, the other two directories were +# subdirectories of $(TZDIR). However, this led to configuration errors. +# For example, with posix_right under the earlier scheme, +# TZ='right/Australia/Adelaide' got you localtime with leap seconds, +# but gmtime without leap seconds, which led to problems with applications +# like sendmail that subtract gmtime from localtime. +# Therefore, the other two directories are now siblings of $(TZDIR). +# You must replace all of $(TZDIR) to switch from not using leap seconds +# to using them, or vice versa. +right_posix: right_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + +posix_right: posix_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + +# This obsolescent rule is present for backwards compatibility with +# tz releases 2014g through 2015g. It should go away eventually. +posix_packrat: $(INSTALL_DATA_DEPS) + $(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only + +zones: $(REDO) + +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \ + >$@ + +TZS_NEW_DEPS = tzdata.zi zdump zic +$(TZS_NEW): $(TZS_NEW_DEPS) + rm -fr tzs$(TZS_YEAR).dir + mkdir tzs$(TZS_YEAR).dir + $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi + $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ + tzdata.zi | LC_ALL=C sort >$@.out + wd=`pwd` && \ + x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ + tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2` && \ + set x $$x && \ + shift && \ + ZDS=$$* && \ + $(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ + ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs$(TZS_YEAR).dir + mv $@.out $@ + +# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the +# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. +$(TZS): + touch $@ + +force_tzs: $(TZS_NEW) + cp $(TZS_NEW) $(TZS) + +libtz.a: $(LIBOBJS) + rm -f $@ + $(AR) -rc $@ $(LIBOBJS) + $(RANLIB) $@ + +date: $(DATEOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) + +tzselect: tzselect.ksh version + VERSION=`cat version` && sed \ + -e 's|#!/bin/bash|#!$(KSHELL)|g' \ + -e 's|AWK=[^}]*|AWK=$(AWK)|g' \ + -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ + -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ + -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ + -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \ + <$@.ksh >$@.out + chmod +x $@.out + mv $@.out $@ + +check: check_character_set check_white_space check_links \ + check_name_lengths check_sorted \ + check_tables check_web check_zishrink check_tzs + +check_character_set: $(ENCHILADA) + test ! '$(UTF8_LOCALE)' || \ + ! printf 'A\304\200B\n' | \ + LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \ + LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \ + sharp='#' && \ + ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ + $(MISC) $(SOURCES) $(WEB_PAGES) \ + CONTRIBUTING LICENSE README \ + version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ + Makefile && \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ + leapseconds zone.tab && \ + ! grep -Env $(OK_LINE) $(ENCHILADA); \ + } + touch $@ + +check_white_space: $(ENCHILADA) + patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ + ! grep -En "$$pat" \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) + ! grep -n '[[:space:]]$$' \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) + touch $@ + +PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ +FILE_NAME_COMPONENT_TOO_LONG = \ + $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} + +check_name_lengths: $(TDATA_TO_CHECK) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone + touch $@ + +CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } + +check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab + $(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu + $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu + touch $@ + +check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi + $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk tzdata.zi + touch $@ + - check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) ++check_tables: checktab.awk $(YDATA) backward $(ZONETABLES) + for tab in $(ZONETABLES); do \ - $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \ ++ test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ ++ $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ + || exit; \ + done + touch $@ + +check_tzs: $(TZS) $(TZS_NEW) + if test -s $(TZS); then \ + diff -u $(TZS) $(TZS_NEW); \ + else \ + cp $(TZS_NEW) $(TZS); \ + fi + touch $@ + +check_web: $(CHECK_WEB_PAGES) +check_theory.html: theory.html +check_tz-art.html: tz-art.html +check_tz-how-to.html: tz-how-to.html +check_tz-link.html: tz-link.html +check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html: + $(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \ + -F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \ + test ! -s $@.out || { cat $@.out; exit 1; } + mv $@.out $@ + +# Check that zishrink.awk does not alter the data, and that ziguard.awk +# preserves main-format data. +check_zishrink: check_zishrink_posix check_zishrink_right +check_zishrink_posix check_zishrink_right: \ + zic leapseconds $(PACKRATDATA) $(TDATA) $(DATAFORM).zi tzdata.zi + rm -fr $@.dir $@-t.dir $@-shrunk.dir + mkdir $@.dir $@-t.dir $@-shrunk.dir + case $@ in \ + *_right) leap='-L leapseconds';; \ + *) leap=;; \ + esac && \ + $(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \ + $(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \ + case $(DATAFORM) in \ + main) \ + $(ZIC) $$leap -d $@-t.dir $(TDATA) && \ + $(AWK) '/^Rule/' $(TDATA) | \ + $(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \ + diff -r $@.dir $@-t.dir;; \ + esac + diff -r $@.dir $@-shrunk.dir + rm -fr $@.dir $@-t.dir $@-shrunk.dir + touch $@ + +clean_misc: + rm -fr check_*.dir + rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ + check_* core typecheck_* \ + date tzselect version.h zdump zic libtz.a +clean: clean_misc + rm -fr *.dir tzdb-*/ + rm -f *.zi $(TZS_NEW) + +maintainer-clean: clean + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* + +names: + @echo $(ENCHILADA) + +public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ + tarballs signatures + +date.1.txt: date.1 +newctime.3.txt: newctime.3 +newstrftime.3.txt: newstrftime.3 +newtzset.3.txt: newtzset.3 +time2posix.3.txt: time2posix.3 +tzfile.5.txt: tzfile.5 +tzselect.8.txt: tzselect.8 +zdump.8.txt: zdump.8 +zic.8.txt: zic.8 + +$(MANTXTS): workman.sh + LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out + mv $@.out $@ + +# Set file timestamps deterministically if possible, +# so that tarballs containing the timestamps are reproducible. +# +# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the +# file DEST to the maximum of the timestamps of the files A B C ..., +# plus N if GNU ls and touch are available. +SET_TIMESTAMP_N = sh -c '\ + n=$$0 dest=$$1; shift; \ + touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \ + if test $$n != 0 && \ + lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \ + set x $$lsout && \ + touch -cmd @`expr $$7 + $$n` "$$dest"; \ + else :; fi' +# If DEST depends on A B C ... in this Makefile, callers should use +# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any +# downstream 'make' that considers equal timestamps to be out of date. +# POSIX allows this 'make' behavior, and HP-UX 'make' does it. +# If all that matters is that the timestamp be reproducible +# and plausible, use $(SET_TIMESTAMP). +SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 +SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1 + +# Set the timestamps to those of the git repository, if available, +# and if the files have not changed since then. +# This uses GNU 'ls --time-style=+%s', which outputs the seconds count, +# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970. +# If git or GNU is absent, don't bother to sync with git timestamps. +# Also, set the timestamp of each prebuilt file like 'leapseconds' +# to be the maximum of the files it depends on. +set-timestamps.out: $(EIGHT_YARDS) + rm -f $@ + if (type git) >/dev/null 2>&1 && \ + files=`git ls-files $(EIGHT_YARDS)` && \ + touch -md @1 test.out; then \ + rm -f test.out && \ + for file in $$files; do \ *** 218 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sun Sep 26 09:22: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 72ACB674B42; Sun, 26 Sep 2021 09:22: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 4HHKzL2XZwz3MqR; Sun, 26 Sep 2021 09:22: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 379471B1CB; Sun, 26 Sep 2021 09:22: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 18Q9M6ch090261; Sun, 26 Sep 2021 09:22:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18Q9M6C3090260; Sun, 26 Sep 2021 09:22:06 GMT (envelope-from git) Date: Sun, 26 Sep 2021 09:22:06 GMT Message-Id: <202109260922.18Q9M6C3090260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 513ee901eec6 - main - pcm(4): Fix a common typo in source code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 513ee901eec639da45796d563168f0af966705e6 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, 26 Sep 2021 09:22:06 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=513ee901eec639da45796d563168f0af966705e6 commit 513ee901eec639da45796d563168f0af966705e6 Author: Gordon Bergling AuthorDate: 2021-09-26 09:21:16 +0000 Commit: Gordon Bergling CommitDate: 2021-09-26 09:21:16 +0000 pcm(4): Fix a common typo in source code comments - s/prefered/preferred/ MFC after: 3 days --- sys/dev/sound/pcm/feeder_chain.c | 4 ++-- sys/dev/sound/pcm/feeder_matrix.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pcm/feeder_chain.c b/sys/dev/sound/pcm/feeder_chain.c index b2d48abd71d1..fe114b727ffd 100644 --- a/sys/dev/sound/pcm/feeder_chain.c +++ b/sys/dev/sound/pcm/feeder_chain.c @@ -52,7 +52,7 @@ struct feeder_chain_desc { struct feeder_chain_state current; /* current state */ struct feeder_chain_state target; /* target state */ struct pcm_feederdesc desc; /* feeder descriptor */ - uint32_t afmt_ne; /* prefered native endian */ + uint32_t afmt_ne; /* preferred native endian */ int mode; /* chain mode */ int use_eq; /* need EQ? */ int use_matrix; /* need channel matrixing? */ @@ -77,7 +77,7 @@ struct feeder_chain_desc { #endif /* - * List of prefered formats that might be required during + * List of preferred formats that might be required during * processing. It will be decided through snd_fmtbest(). */ diff --git a/sys/dev/sound/pcm/feeder_matrix.c b/sys/dev/sound/pcm/feeder_matrix.c index c6a65113574a..d4925fe0d7e6 100644 --- a/sys/dev/sound/pcm/feeder_matrix.c +++ b/sys/dev/sound/pcm/feeder_matrix.c @@ -552,7 +552,7 @@ feeder_matrix_setup(struct pcm_feeder *f, struct pcmchan_matrix *m_in, /* * feeder_matrix_default_id(): For a given number of channels, return - * default prefered id (example: both 5.1 and + * default preferred id (example: both 5.1 and * 6.0 are simply 6 channels, but 5.1 is more * preferable). */ From owner-dev-commits-src-main@freebsd.org Sun Sep 26 11:27: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 3D7E867663E; Sun, 26 Sep 2021 11:27: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 4HHNlc12QDz3lmK; Sun, 26 Sep 2021 11:27: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 F3B6A1CD22; Sun, 26 Sep 2021 11:27: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 18QBR7cq049883; Sun, 26 Sep 2021 11:27:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QBR7jO049882; Sun, 26 Sep 2021 11:27:07 GMT (envelope-from git) Date: Sun, 26 Sep 2021 11:27:07 GMT Message-Id: <202109261127.18QBR7jO049882@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: 8c15a9ce53da - main - Spell cloudabi correctly in ObsoleteFiles.inc 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: 8c15a9ce53da6dc05ba440aeb9b3e5c209ecad24 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, 26 Sep 2021 11:27:08 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=8c15a9ce53da6dc05ba440aeb9b3e5c209ecad24 commit 8c15a9ce53da6dc05ba440aeb9b3e5c209ecad24 Author: Dimitry Andric AuthorDate: 2021-09-26 11:26:42 +0000 Commit: Dimitry Andric CommitDate: 2021-09-26 11:26:42 +0000 Spell cloudabi correctly in ObsoleteFiles.inc Fixes: cf0ee8738e31 Drop cloudabi --- ObsoleteFiles.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 111fced8ce20..87a7f95b67a1 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,7 +40,7 @@ # xargs -n1 | sort | uniq -d; # done -# 20210921: remove couldabi +# 20210921: remove cloudabi OLD_FILES+=usr/share/man/man4/cloudabi.4.gz # 20210906: stop installing {llvm,clang,lldb}-tblgen From owner-dev-commits-src-main@freebsd.org Sun Sep 26 13:18: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 F14C5678785; Sun, 26 Sep 2021 13:18: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 4HHRD86Hmgz3tyH; Sun, 26 Sep 2021 13:18: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 B8ED01E44A; Sun, 26 Sep 2021 13:18: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 18QDIWnv096332; Sun, 26 Sep 2021 13:18:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QDIWe3096331; Sun, 26 Sep 2021 13:18:32 GMT (envelope-from git) Date: Sun, 26 Sep 2021 13:18:32 GMT Message-Id: <202109261318.18QDIWe3096331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: d2e616147db7 - main - sctp: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2e616147db7b688f2b6fa8ec6d545bc4253de92 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, 26 Sep 2021 13:18:33 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d2e616147db7b688f2b6fa8ec6d545bc4253de92 commit d2e616147db7b688f2b6fa8ec6d545bc4253de92 Author: Gordon Bergling AuthorDate: 2021-09-26 13:15:39 +0000 Commit: Gordon Bergling CommitDate: 2021-09-26 13:15:39 +0000 sctp: Fix a typo in a comment - s/assue/assume/ MFC after: 3 days --- sys/netinet/sctp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index c0a976b84184..03305b539ad2 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -510,7 +510,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, /* * Cancel the INIT timer, We do this first before queueing the - * cookie. We always cancel at the primary to assue that we are + * cookie. We always cancel at the primary to assume that we are * canceling the timer started by the INIT which always goes to the * primary. */ From owner-dev-commits-src-main@freebsd.org Sun Sep 26 13:18: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 5634E678373; Sun, 26 Sep 2021 13:18: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 4HHRDC1mmNz3tmS; Sun, 26 Sep 2021 13:18: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 0412D1E4D3; Sun, 26 Sep 2021 13:18: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 18QDIYgV096380; Sun, 26 Sep 2021 13:18:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QDIYa5096379; Sun, 26 Sep 2021 13:18:34 GMT (envelope-from git) Date: Sun, 26 Sep 2021 13:18:34 GMT Message-Id: <202109261318.18QDIYa5096379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 8771ff75384d - main - jail(9): Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8771ff75384dec8c9f95ce25b6ca9a639c4b208c 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, 26 Sep 2021 13:18:35 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8771ff75384dec8c9f95ce25b6ca9a639c4b208c commit 8771ff75384dec8c9f95ce25b6ca9a639c4b208c Author: Gordon Bergling AuthorDate: 2021-09-26 13:17:41 +0000 Commit: Gordon Bergling CommitDate: 2021-09-26 13:17:41 +0000 jail(9): Fix a typo in a comment - s/erorr/error/ MFC after: 3 days --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 9784f3bfc23b..c13aa73538a5 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1304,7 +1304,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #endif /* * Allocate a dedicated cpuset for each jail. - * Unlike other initial settings, this may return an erorr. + * Unlike other initial settings, this may return an error. */ error = cpuset_create_root(ppr, &pr->pr_cpuset); if (error) From owner-dev-commits-src-main@freebsd.org Sun Sep 26 13:18: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 1F682678707; Sun, 26 Sep 2021 13:18: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 4HHRDB0B90z3tyK; Sun, 26 Sep 2021 13:18: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 D93141DD63; Sun, 26 Sep 2021 13:18: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 18QDIXjV096356; Sun, 26 Sep 2021 13:18:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QDIXul096355; Sun, 26 Sep 2021 13:18:33 GMT (envelope-from git) Date: Sun, 26 Sep 2021 13:18:33 GMT Message-Id: <202109261318.18QDIXul096355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 90d60ca8b7f2 - main - nfsclient: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90d60ca8b7f2483cdc162633f7ea4738dad8fa0e 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, 26 Sep 2021 13:18:34 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=90d60ca8b7f2483cdc162633f7ea4738dad8fa0e commit 90d60ca8b7f2483cdc162633f7ea4738dad8fa0e Author: Gordon Bergling AuthorDate: 2021-09-26 13:17:00 +0000 Commit: Gordon Bergling CommitDate: 2021-09-26 13:17:00 +0000 nfsclient: Fix a typo in a comment - s/derefernce/dereference/ MFC after: 3 days --- sys/fs/nfsclient/nfs_clcomsubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c index 554f5e820f54..c6556d287b1e 100644 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -476,7 +476,7 @@ nfscl_lockunlock(struct nfsv4lock *lckp) } /* - * Called to derefernce a lock on a stateid (delegation or open owner). + * Called to dereference a lock on a stateid (delegation or open owner). */ void nfscl_lockderef(struct nfsv4lock *lckp) From owner-dev-commits-src-main@freebsd.org Sun Sep 26 13:48: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 1D1C767954C; Sun, 26 Sep 2021 13:48: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 4HHRtj0Df4z4RGV; Sun, 26 Sep 2021 13:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D917A1E958; Sun, 26 Sep 2021 13:48: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 18QDmSgC035744; Sun, 26 Sep 2021 13:48:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QDmSgX035743; Sun, 26 Sep 2021 13:48:28 GMT (envelope-from git) Date: Sun, 26 Sep 2021 13:48:28 GMT Message-Id: <202109261348.18QDmSgX035743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: f7cef43aa9a3 - main - nemtap: lb app: Validate ihl field when hashing packet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7cef43aa9a357582a703c75dafa4a44c1b2f28c 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, 26 Sep 2021 13:48:29 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=f7cef43aa9a357582a703c75dafa4a44c1b2f28c commit f7cef43aa9a357582a703c75dafa4a44c1b2f28c Author: Vincenzo Maffione AuthorDate: 2021-09-26 13:44:51 +0000 Commit: Vincenzo Maffione CommitDate: 2021-09-26 13:48:21 +0000 nemtap: lb app: Validate ihl field when hashing packet MFC after: 1 week --- tools/tools/netmap/pkt_hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/tools/netmap/pkt_hash.c b/tools/tools/netmap/pkt_hash.c index 3071935e11ef..eb9704fd2058 100644 --- a/tools/tools/netmap/pkt_hash.c +++ b/tools/tools/netmap/pkt_hash.c @@ -150,7 +150,9 @@ decode_ip_n_hash(const struct ip *iph, uint8_t hash_split, uint8_t seed) { uint32_t rc = 0; - if (hash_split == 2) { + if (iph->ip_hl < 5 || iph->ip_hl * 4 > iph->ip_len) { + rc = 0; + } else if (hash_split == 2) { rc = sym_hash_fn(ntohl(iph->ip_src.s_addr), ntohl(iph->ip_dst.s_addr), ntohs(0xFFFD) + seed, From owner-dev-commits-src-main@freebsd.org Sun Sep 26 14:08: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 0D3DE679B55; Sun, 26 Sep 2021 14:08: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 4HHSKs6Wtdz4SKn; Sun, 26 Sep 2021 14:08: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 B1D121EF17; Sun, 26 Sep 2021 14:08: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 18QE8XQu063144; Sun, 26 Sep 2021 14:08:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QE8XeU063143; Sun, 26 Sep 2021 14:08:33 GMT (envelope-from git) Date: Sun, 26 Sep 2021 14:08:33 GMT Message-Id: <202109261408.18QE8XeU063143@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 6127ce9d91c8 - main - netmap: monitor: support offsets in copy mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6127ce9d91c81e3025aeb1d832750d827e28314f 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, 26 Sep 2021 14:08:34 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=6127ce9d91c81e3025aeb1d832750d827e28314f commit 6127ce9d91c81e3025aeb1d832750d827e28314f Author: Vincenzo Maffione AuthorDate: 2021-09-26 13:52:16 +0000 Commit: Vincenzo Maffione CommitDate: 2021-09-26 13:52:16 +0000 netmap: monitor: support offsets in copy mode --- sys/dev/netmap/netmap_monitor.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/netmap/netmap_monitor.c b/sys/dev/netmap/netmap_monitor.c index 4827c2a7585f..e05313c1f792 100644 --- a/sys/dev/netmap/netmap_monitor.c +++ b/sys/dev/netmap/netmap_monitor.c @@ -737,8 +737,7 @@ netmap_monitor_parent_sync(struct netmap_kring *kring, u_int first_new, int new_ int free_slots, busy, sent = 0, m; u_int lim = kring->nkr_num_slots - 1; struct netmap_ring *ring = kring->ring, *mring = mkring->ring; - u_int max_len = NETMAP_BUF_SIZE(mkring->na); - + u_int max_len; mlim = mkring->nkr_num_slots - 1; /* we need to lock the monitor receive ring, since it @@ -770,9 +769,10 @@ netmap_monitor_parent_sync(struct netmap_kring *kring, u_int first_new, int new_ struct netmap_slot *s = &ring->slot[beg]; struct netmap_slot *ms = &mring->slot[i]; u_int copy_len = s->len; - char *src = NMB(kring->na, s), - *dst = NMB(mkring->na, ms); + char *src = NMB_O(kring, s), + *dst = NMB_O(mkring, ms); + max_len = NETMAP_BUF_SIZE(mkring->na) - nm_get_offset(mkring, ms); if (unlikely(copy_len > max_len)) { nm_prlim(5, "%s->%s: truncating %d to %d", kring->name, mkring->name, copy_len, max_len); @@ -966,7 +966,9 @@ netmap_get_monitor_na(struct nmreq_header *hdr, struct netmap_adapter **na, pna->monitor_id++); /* the monitor supports the host rings iff the parent does */ - mna->up.na_flags |= (pna->na_flags & NAF_HOST_RINGS); + mna->up.na_flags |= (pna->na_flags & NAF_HOST_RINGS) & ~NAF_OFFSETS; + if (!zcopy) + mna->up.na_flags |= NAF_OFFSETS; /* a do-nothing txsync: monitors cannot be used to inject packets */ mna->up.nm_txsync = netmap_monitor_txsync; mna->up.nm_rxsync = netmap_monitor_rxsync; From owner-dev-commits-src-main@freebsd.org Sun Sep 26 14:08: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 015CB679643; Sun, 26 Sep 2021 14:08: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 4HHSKt6cF4z4SK0; Sun, 26 Sep 2021 14:08: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 C3C961EF18; Sun, 26 Sep 2021 14:08: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 18QE8Ye3063168; Sun, 26 Sep 2021 14:08:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QE8Ykc063167; Sun, 26 Sep 2021 14:08:34 GMT (envelope-from git) Date: Sun, 26 Sep 2021 14:08:34 GMT Message-Id: <202109261408.18QE8Ykc063167@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 3e3314a8b7e3 - main - netmap: fix uint32_t overflow in pool size calculation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e3314a8b7e3dd8d19a209ee2988f724e138a0ae 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, 26 Sep 2021 14:08:35 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=3e3314a8b7e3dd8d19a209ee2988f724e138a0ae commit 3e3314a8b7e3dd8d19a209ee2988f724e138a0ae Author: Vincenzo Maffione AuthorDate: 2021-09-26 13:56:33 +0000 Commit: Vincenzo Maffione CommitDate: 2021-09-26 13:56:33 +0000 netmap: fix uint32_t overflow in pool size calculation MFC after: 1 week --- sys/dev/netmap/netmap_mem2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c index a6be490e5b09..2b41af761c04 100644 --- a/sys/dev/netmap/netmap_mem2.c +++ b/sys/dev/netmap/netmap_mem2.c @@ -1702,7 +1702,7 @@ _netmap_mem_private_new(size_t size, struct netmap_obj_params *p, int grp_id, nm_blueprint.pools[i].name, d->name); if (checksz) { - uint64_t poolsz = p[i].num * p[i].size; + uint64_t poolsz = (uint64_t)p[i].num * p[i].size; if (memtotal < poolsz) { nm_prerr("%s: request too large", d->pools[i].name); err = ENOMEM; From owner-dev-commits-src-main@freebsd.org Sun Sep 26 16:10:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB71D67BAB6; Sun, 26 Sep 2021 16:10:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HHW2t585Yz4fQ3; Sun, 26 Sep 2021 16:10:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91B29207D5; Sun, 26 Sep 2021 16:10:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18QGAkPW031250; Sun, 26 Sep 2021 16:10:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QGAkpq031249; Sun, 26 Sep 2021 16:10:46 GMT (envelope-from git) Date: Sun, 26 Sep 2021 16:10:46 GMT Message-Id: <202109261610.18QGAkpq031249@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: 08063e9f98a3 - main - sched_ule(4): Fix hang with steal_thresh < 2. 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: 08063e9f98a33980a09e3bd465926719b3437122 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, 26 Sep 2021 16:10:46 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=08063e9f98a33980a09e3bd465926719b3437122 commit 08063e9f98a33980a09e3bd465926719b3437122 Author: Alexander Motin AuthorDate: 2021-09-26 16:03:05 +0000 Commit: Alexander Motin CommitDate: 2021-09-26 16:03:05 +0000 sched_ule(4): Fix hang with steal_thresh < 2. e745d729be60 caused infinite loop with interrupts disabled in load stealing code if steal_thresh set below 2. Such configuration should not generally be used, but appeared some people are using it to workaround some problems. To fix the problem explicitly pass to sched_highest() minimum number of transferrable threads, supported by the caller, instead of guessing. MFC after: 25 days --- sys/kern/sched_ule.c | 70 +++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 49199b6f319f..0f873a6a30b6 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -638,12 +638,13 @@ struct cpu_search { int cs_prefer; /* Prefer this CPU and groups including it. */ int cs_running; /* The thread is now running at cs_prefer. */ int cs_pri; /* Min priority for low. */ - int cs_limit; /* Max load for low, min load for high. */ + int cs_load; /* Max load for low, min load for high. */ + int cs_trans; /* Min transferable load for high. */ }; struct cpu_search_res { - int cs_cpu; /* The best CPU found. */ - int cs_load; /* The load of cs_cpu. */ + int csr_cpu; /* The best CPU found. */ + int csr_load; /* The load of cs_cpu. */ }; /* @@ -663,7 +664,7 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, total = 0; bload = INT_MAX; - r->cs_cpu = -1; + r->csr_cpu = -1; /* Loop through children CPU groups if there are any. */ if (cg->cg_children > 0) { @@ -681,11 +682,11 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, load >= 128 && (load & 128) != 0) load += 128; - if (lr.cs_cpu >= 0 && (load < bload || - (load == bload && lr.cs_load < r->cs_load))) { + if (lr.csr_cpu >= 0 && (load < bload || + (load == bload && lr.csr_load < r->csr_load))) { bload = load; - r->cs_cpu = lr.cs_cpu; - r->cs_load = lr.cs_load; + r->csr_cpu = lr.csr_cpu; + r->csr_load = lr.csr_load; } } return (total); @@ -711,7 +712,7 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, * If the threads is already on the CPU, don't look on the TDQ * priority, since it can be the priority of the thread itself. */ - if (l > s->cs_limit || (tdq->tdq_lowpri <= s->cs_pri && + if (l > s->cs_load || (tdq->tdq_lowpri <= s->cs_pri && (!s->cs_running || c != s->cs_prefer)) || !CPU_ISSET(c, s->cs_mask)) continue; @@ -727,8 +728,8 @@ cpu_search_lowest(const struct cpu_group *cg, const struct cpu_search *s, load -= sched_random() % 128; if (bload > load - p) { bload = load - p; - r->cs_cpu = c; - r->cs_load = load; + r->csr_cpu = c; + r->csr_load = load; } } return (total); @@ -744,18 +745,18 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, total = 0; bload = INT_MIN; - r->cs_cpu = -1; + r->csr_cpu = -1; /* Loop through children CPU groups if there are any. */ if (cg->cg_children > 0) { for (c = cg->cg_children - 1; c >= 0; c--) { load = cpu_search_highest(&cg->cg_child[c], s, &lr); total += load; - if (lr.cs_cpu >= 0 && (load > bload || - (load == bload && lr.cs_load > r->cs_load))) { + if (lr.csr_cpu >= 0 && (load > bload || + (load == bload && lr.csr_load > r->csr_load))) { bload = load; - r->cs_cpu = lr.cs_cpu; - r->cs_load = lr.cs_load; + r->csr_cpu = lr.csr_cpu; + r->csr_load = lr.csr_load; } } return (total); @@ -772,21 +773,18 @@ cpu_search_highest(const struct cpu_group *cg, const struct cpu_search *s, /* * Check this CPU is acceptable. - * If requested minimum load is 1, then caller must know how - * to handle running threads, not counted in tdq_transferable. */ - if (l < s->cs_limit || (tdq->tdq_transferable == 0 && - (s->cs_limit > 1 || l > 1)) || + if (l < s->cs_load || (tdq->tdq_transferable < s->cs_trans) || !CPU_ISSET(c, s->cs_mask)) continue; load -= sched_random() % 256; if (load > bload) { bload = load; - r->cs_cpu = c; + r->csr_cpu = c; } } - r->cs_load = bload; + r->csr_load = bload; return (total); } @@ -806,24 +804,26 @@ sched_lowest(const struct cpu_group *cg, cpuset_t *mask, int pri, int maxload, s.cs_running = running; s.cs_mask = mask; s.cs_pri = pri; - s.cs_limit = maxload; + s.cs_load = maxload; cpu_search_lowest(cg, &s, &r); - return (r.cs_cpu); + return (r.csr_cpu); } /* * Find the cpu with the highest load via the highest loaded path. */ static inline int -sched_highest(const struct cpu_group *cg, cpuset_t *mask, int minload) +sched_highest(const struct cpu_group *cg, cpuset_t *mask, int minload, + int mintrans) { struct cpu_search s; struct cpu_search_res r; s.cs_mask = mask; - s.cs_limit = minload; + s.cs_load = minload; + s.cs_trans = mintrans; cpu_search_highest(cg, &s, &r); - return (r.cs_cpu); + return (r.csr_cpu); } static void @@ -836,7 +836,7 @@ sched_balance_group(struct cpu_group *cg) CPU_FILL(&hmask); for (;;) { - high = sched_highest(cg, &hmask, 1); + high = sched_highest(cg, &hmask, 1, 0); /* Stop if there is no more CPU with transferrable threads. */ if (high == -1) break; @@ -1008,7 +1008,7 @@ tdq_idled(struct tdq *tdq) restart: switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; for (cg = tdq->tdq_cg, goup = 0; ; ) { - cpu = sched_highest(cg, &mask, steal_thresh); + cpu = sched_highest(cg, &mask, steal_thresh, 1); /* * We were assigned a thread but not preempted. Returning * 0 here will cause our caller to switch to it. @@ -1968,7 +1968,8 @@ tdq_trysteal(struct tdq *tdq) cpuset_t mask; int cpu, i, goup; - if (smp_started == 0 || trysteal_limit == 0 || tdq->tdq_cg == NULL) + if (smp_started == 0 || steal_idle == 0 || trysteal_limit == 0 || + tdq->tdq_cg == NULL) return; CPU_FILL(&mask); CPU_CLR(PCPU_GET(cpuid), &mask); @@ -1976,7 +1977,7 @@ tdq_trysteal(struct tdq *tdq) spinlock_enter(); TDQ_UNLOCK(tdq); for (i = 1, cg = tdq->tdq_cg, goup = 0; ; ) { - cpu = sched_highest(cg, &mask, steal_thresh); + cpu = sched_highest(cg, &mask, steal_thresh, 1); /* * If a thread was added while interrupts were disabled don't * steal one here. @@ -2019,7 +2020,9 @@ tdq_trysteal(struct tdq *tdq) steal = TDQ_CPU(cpu); /* * The data returned by sched_highest() is stale and - * the chosen CPU no longer has an eligible thread. + * the chosen CPU no longer has an eligible thread. + * At this point unconditonally exit the loop to bound + * the time spent in the critcal section. */ if (steal->tdq_load < steal_thresh || steal->tdq_transferable == 0) @@ -2028,8 +2031,7 @@ tdq_trysteal(struct tdq *tdq) * Try to lock both queues. If we are assigned a thread while * waited for the lock, switch to it now instead of stealing. * If we can't get the lock, then somebody likely got there - * first. At this point unconditonally exit the loop to - * bound the time spent in the critcal section. + * first. */ TDQ_LOCK(tdq); if (tdq->tdq_load > 0) From owner-dev-commits-src-main@freebsd.org Sun Sep 26 16:25: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 E8F7167C043; Sun, 26 Sep 2021 16:25: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 4HHWNM58vZz4gmM; Sun, 26 Sep 2021 16:25:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D02C209FF; Sun, 26 Sep 2021 16:25:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18QGPtw7049487; Sun, 26 Sep 2021 16:25:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QGPtfX049486; Sun, 26 Sep 2021 16:25:55 GMT (envelope-from git) Date: Sun, 26 Sep 2021 16:25:55 GMT Message-Id: <202109261625.18QGPtfX049486@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 21ab8c75c940 - main - e1000: Fix tabstop width in if_em.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 21ab8c75c940dd15343b4af28b18a66f377e670a 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, 26 Sep 2021 16:25:56 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=21ab8c75c940dd15343b4af28b18a66f377e670a commit 21ab8c75c940dd15343b4af28b18a66f377e670a Author: Kevin Bowling AuthorDate: 2021-09-26 16:24:53 +0000 Commit: Kevin Bowling CommitDate: 2021-09-26 16:24:53 +0000 e1000: Fix tabstop width in if_em.h Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D32145 --- sys/dev/e1000/if_em.h | 236 +++++++++++++++++++++++++------------------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 7f259abfd9a6..41deecb69bf3 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -111,11 +111,11 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define EM_MIN_TXD 128 -#define EM_MAX_TXD 4096 -#define EM_DEFAULT_TXD 1024 +#define EM_MIN_TXD 128 +#define EM_MAX_TXD 4096 +#define EM_DEFAULT_TXD 1024 #define EM_DEFAULT_MULTI_TXD 4096 -#define IGB_MAX_TXD 4096 +#define IGB_MAX_TXD 4096 /* * EM_MAX_RXD - Maximum number of receive Descriptors @@ -130,11 +130,11 @@ * desscriptors should meet the following condition. * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0 */ -#define EM_MIN_RXD 128 -#define EM_MAX_RXD 4096 -#define EM_DEFAULT_RXD 1024 +#define EM_MIN_RXD 128 +#define EM_MAX_RXD 4096 +#define EM_DEFAULT_RXD 1024 #define EM_DEFAULT_MULTI_RXD 4096 -#define IGB_MAX_RXD 4096 +#define IGB_MAX_RXD 4096 /* * EM_TIDV - Transmit Interrupt Delay Value @@ -201,7 +201,7 @@ * 0 - Disable autonegotiation * 1 - Enable autonegotiation */ -#define DO_AUTO_NEG 1 +#define DO_AUTO_NEG 1 /* * This parameter control whether or not the driver will wait for @@ -214,8 +214,8 @@ /* Tunables -- End */ #define AUTONEG_ADV_DEFAULT (ADVERTISE_10_HALF | ADVERTISE_10_FULL | \ - ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ - ADVERTISE_1000_FULL) + ADVERTISE_100_HALF | ADVERTISE_100_FULL | \ + ADVERTISE_1000_FULL) #define AUTO_ALL_MODES 0 @@ -225,35 +225,35 @@ /* * Miscellaneous constants */ -#define EM_VENDOR_ID 0x8086 -#define EM_FLASH 0x0014 +#define EM_VENDOR_ID 0x8086 +#define EM_FLASH 0x0014 -#define EM_JUMBO_PBA 0x00000028 -#define EM_DEFAULT_PBA 0x00000030 +#define EM_JUMBO_PBA 0x00000028 +#define EM_DEFAULT_PBA 0x00000030 #define EM_SMARTSPEED_DOWNSHIFT 3 -#define EM_SMARTSPEED_MAX 15 -#define EM_MAX_LOOP 10 +#define EM_SMARTSPEED_MAX 15 +#define EM_MAX_LOOP 10 #define MAX_NUM_MULTICAST_ADDRESSES 128 -#define PCI_ANY_ID (~0U) -#define ETHER_ALIGN 2 -#define EM_FC_PAUSE_TIME 0x0680 -#define EM_EEPROM_APME 0x400; -#define EM_82544_APME 0x0004; +#define PCI_ANY_ID (~0U) +#define ETHER_ALIGN 2 +#define EM_FC_PAUSE_TIME 0x0680 +#define EM_EEPROM_APME 0x400; +#define EM_82544_APME 0x0004; /* Support AutoMediaDetect for Marvell M88 PHY in i354 */ -#define IGB_MEDIA_RESET (1 << 0) +#define IGB_MEDIA_RESET (1 << 0) /* Define the starting Interrupt rate per Queue */ -#define IGB_INTS_PER_SEC 8000 -#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) +#define IGB_INTS_PER_SEC 8000 +#define IGB_DEFAULT_ITR ((1000000/IGB_INTS_PER_SEC) << 2) -#define IGB_LINK_ITR 2000 -#define I210_LINK_DELAY 1000 +#define IGB_LINK_ITR 2000 +#define I210_LINK_DELAY 1000 -#define IGB_TXPBSIZE 20408 -#define IGB_HDR_BUF 128 -#define IGB_PKTTYPE_MASK 0x0000FFF0 +#define IGB_TXPBSIZE 20408 +#define IGB_HDR_BUF 128 +#define IGB_PKTTYPE_MASK 0x0000FFF0 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coalesce Flush */ /* @@ -265,25 +265,25 @@ * and compare to TX_MAXTRIES. When counter > TX_MAXTRIES, * reset adapter. */ -#define EM_TX_IDLE 0x00000000 -#define EM_TX_BUSY 0x00000001 -#define EM_TX_HUNG 0x80000000 +#define EM_TX_IDLE 0x00000000 +#define EM_TX_BUSY 0x00000001 +#define EM_TX_HUNG 0x80000000 #define EM_TX_MAXTRIES 10 -#define PCICFG_DESC_RING_STATUS 0xe4 -#define FLUSH_DESC_REQUIRED 0x100 +#define PCICFG_DESC_RING_STATUS 0xe4 +#define FLUSH_DESC_REQUIRED 0x100 -#define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ - ((hw->mac.type <= e1000_82576) ? 16 : 8)) -#define IGB_RX_HTHRESH 8 -#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ - (sc->intr_type == IFLIB_INTR_MSIX)) ? 1 : 4) +#define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : \ + ((hw->mac.type <= e1000_82576) ? 16 : 8)) +#define IGB_RX_HTHRESH 8 +#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ + (sc->intr_type == IFLIB_INTR_MSIX)) ? 1 : 4) -#define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8) -#define IGB_TX_HTHRESH 1 -#define IGB_TX_WTHRESH ((hw->mac.type != e1000_82575 && \ - sc->intr_type == IFLIB_INTR_MSIX) ? 1 : 16) +#define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8) +#define IGB_TX_HTHRESH 1 +#define IGB_TX_WTHRESH ((hw->mac.type != e1000_82575 && \ + sc->intr_type == IFLIB_INTR_MSIX) ? 1 : 16) /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be @@ -297,10 +297,10 @@ */ #define TARC_COMPENSATION_MODE (1 << 7) /* Compensation Mode */ #define TARC_SPEED_MODE_BIT (1 << 21) /* On PCI-E MACs only */ -#define TARC_MQ_FIX (1 << 23) | \ - (1 << 24) | \ - (1 << 25) /* Handle errata in MQ mode */ -#define TARC_ERRATA_BIT (1 << 26) /* Note from errata on 82574 */ +#define TARC_MQ_FIX (1 << 23) | \ + (1 << 24) | \ + (1 << 25) /* Handle errata in MQ mode */ +#define TARC_ERRATA_BIT (1 << 26) /* Note from errata on 82574 */ /* PCI Config defines */ #define EM_BAR_TYPE(v) ((v) & EM_BAR_TYPE_MASK) @@ -318,27 +318,27 @@ #define DEBUG_IOCTL 0 #define DEBUG_HW 0 -#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") +#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") #define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) #define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) -#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") +#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") #define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) #define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) -#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") -#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) +#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") +#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) #define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) #define EM_MAX_SCATTER 40 #define EM_VFTA_SIZE 128 -#define EM_TSO_SIZE 65535 +#define EM_TSO_SIZE 65535 #define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */ -#define ETH_ZLEN 60 +#define ETH_ZLEN 60 #define EM_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP) /* Offload bits in mbuf flag */ #define IGB_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | \ - CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ - CSUM_IP6_SCTP) /* Offload bits in mbuf flag */ + CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ + CSUM_IP6_SCTP) /* Offload bits in mbuf flag */ -#define IGB_PKTTYPE_MASK 0x0000FFF0 +#define IGB_PKTTYPE_MASK 0x0000FFF0 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coalesce Flush */ /* @@ -361,15 +361,15 @@ struct e1000_softc; struct em_int_delay_info { struct e1000_softc *sc; /* Back-pointer to the sc struct */ - int offset; /* Register offset to read/write */ - int value; /* Current value in usecs */ + int offset; /* Register offset to read/write */ + int value; /* Current value in usecs */ }; /* * The transmit ring, one per tx queue */ struct tx_ring { - struct e1000_softc *sc; + struct e1000_softc *sc; struct e1000_tx_desc *tx_base; uint64_t tx_paddr; qidx_t *tx_rsq; @@ -380,8 +380,8 @@ struct tx_ring { qidx_t tx_cidx_processed; /* Interrupt resources */ void *tag; - struct resource *res; - unsigned long tx_irq; + struct resource *res; + unsigned long tx_irq; /* Saved csum offloading context information */ int csum_flags; @@ -402,10 +402,10 @@ struct tx_ring { struct rx_ring { struct e1000_softc *sc; struct em_rx_queue *que; - u32 me; - u32 payload; + u32 me; + u32 payload; union e1000_rx_desc_extended *rx_base; - uint64_t rx_paddr; + uint64_t rx_paddr; /* Interrupt resources */ void *tag; @@ -421,36 +421,36 @@ struct rx_ring { struct em_tx_queue { struct e1000_softc *sc; - u32 msix; - u32 eims; /* This queue's EIMS bit */ - u32 me; + u32 msix; + u32 eims; /* This queue's EIMS bit */ + u32 me; struct tx_ring txr; }; struct em_rx_queue { struct e1000_softc *sc; - u32 me; - u32 msix; - u32 eims; + u32 me; + u32 msix; + u32 eims; struct rx_ring rxr; - u64 irqs; + u64 irqs; struct if_irq que_irq; }; /* Our softc structure */ struct e1000_softc { - struct ifnet *ifp; - struct e1000_hw hw; + struct ifnet *ifp; + struct e1000_hw hw; - if_softc_ctx_t shared; - if_ctx_t ctx; -#define tx_num_queues shared->isc_ntxqsets -#define rx_num_queues shared->isc_nrxqsets + if_softc_ctx_t shared; + if_ctx_t ctx; +#define tx_num_queues shared->isc_ntxqsets +#define rx_num_queues shared->isc_nrxqsets #define intr_type shared->isc_intr /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; - device_t dev; - struct cdev *led_dev; + device_t dev; + struct cdev *led_dev; struct em_tx_queue *tx_queues; struct em_rx_queue *rx_queues; @@ -461,35 +461,35 @@ struct e1000_softc { struct resource *ioport; struct resource *res; - void *tag; - u32 linkvec; - u32 ivars; - - struct ifmedia *media; - int msix; - int if_flags; - int em_insert_vlan_header; - u32 ims; + void *tag; + u32 linkvec; + u32 ivars; + + struct ifmedia *media; + int msix; + int if_flags; + int em_insert_vlan_header; + u32 ims; bool in_detach; - u32 flags; + u32 flags; /* Task for FAST handling */ struct grouptask link_task; - u16 num_vlans; - u32 txd_cmd; + u16 num_vlans; + u32 txd_cmd; - u32 tx_process_limit; - u32 rx_process_limit; - u32 rx_mbuf_sz; + u32 tx_process_limit; + u32 rx_process_limit; + u32 rx_mbuf_sz; /* Management and WOL features */ - u32 wol; - bool has_manage; - bool has_amt; + u32 wol; + bool has_manage; + bool has_amt; /* Multicast array memory */ - u8 *mta; + u8 *mta; /* ** Shadow VFTA table, this is needed because @@ -497,18 +497,18 @@ struct e1000_softc { ** a soft reset and the driver needs to be able ** to repopulate it. */ - u32 shadow_vfta[EM_VFTA_SIZE]; + u32 shadow_vfta[EM_VFTA_SIZE]; /* Info about the interface */ - u16 link_active; - u16 fc; - u16 link_speed; - u16 link_duplex; - u32 smartspeed; - u32 dmac; - int link_mask; + u16 link_active; + u16 fc; + u16 link_speed; + u16 link_duplex; + u32 smartspeed; + u32 dmac; + int link_mask; - u64 que_mask; + u64 que_mask; struct em_int_delay_info tx_int_delay; struct em_int_delay_info tx_abs_int_delay; @@ -517,13 +517,13 @@ struct e1000_softc { struct em_int_delay_info tx_itr; /* Misc stats maintained by the driver */ - unsigned long dropped_pkts; - unsigned long link_irq; - unsigned long rx_overruns; - unsigned long watchdog_events; + unsigned long dropped_pkts; + unsigned long link_irq; + unsigned long rx_overruns; + unsigned long watchdog_events; - struct e1000_hw_stats stats; - u16 vf_ifp; + struct e1000_hw_stats stats; + u16 vf_ifp; }; /******************************************************************************** @@ -544,8 +544,8 @@ typedef struct _em_vendor_info_t { void em_dump_rs(struct e1000_softc *); #define EM_RSSRK_SIZE 4 -#define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ - key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ - key[(i) * EM_RSSRK_SIZE + 2] << 16 | \ - key[(i) * EM_RSSRK_SIZE + 3] << 24) +#define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ + key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ + key[(i) * EM_RSSRK_SIZE + 2] << 16 | \ + key[(i) * EM_RSSRK_SIZE + 3] << 24) #endif /* _EM_H_DEFINED_ */ From owner-dev-commits-src-main@freebsd.org Sun Sep 26 18:18: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 5DE8567D0CC; Sun, 26 Sep 2021 18:18: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 4HHYtl23X2z4q8q; Sun, 26 Sep 2021 18:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2245422507; Sun, 26 Sep 2021 18:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18QIItgp096012; Sun, 26 Sep 2021 18:18:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QIIs35096011; Sun, 26 Sep 2021 18:18:54 GMT (envelope-from git) Date: Sun, 26 Sep 2021 18:18:54 GMT Message-Id: <202109261818.18QIIs35096011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: b1d5caf3c750 - main - ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1d5caf3c7504a1ece0498ec3f7360ac760577f7 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, 26 Sep 2021 18:18:55 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b1d5caf3c7504a1ece0498ec3f7360ac760577f7 commit b1d5caf3c7504a1ece0498ec3f7360ac760577f7 Author: Kevin Bowling AuthorDate: 2021-09-25 23:12:23 +0000 Commit: Kevin Bowling CommitDate: 2021-09-26 18:18:07 +0000 ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc' Rename the 'struct adapter' to 'struct ixgbe_softc' to avoid type ambiguity in things like kgdb. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32131 --- sys/dev/ixgbe/if_bypass.c | 186 +++---- sys/dev/ixgbe/if_fdir.c | 26 +- sys/dev/ixgbe/if_ix.c | 1263 +++++++++++++++++++++--------------------- sys/dev/ixgbe/if_ixv.c | 602 ++++++++++---------- sys/dev/ixgbe/if_sriov.c | 296 +++++----- sys/dev/ixgbe/ix_txrx.c | 47 +- sys/dev/ixgbe/ixgbe.h | 22 +- sys/dev/ixgbe/ixgbe_bypass.h | 2 +- sys/dev/ixgbe/ixgbe_fdir.h | 2 +- sys/dev/ixgbe/ixgbe_osdep.c | 20 +- sys/dev/ixgbe/ixgbe_sriov.h | 8 +- 11 files changed, 1232 insertions(+), 1242 deletions(-) diff --git a/sys/dev/ixgbe/if_bypass.c b/sys/dev/ixgbe/if_bypass.c index 41669e29d475..7e8848512e05 100644 --- a/sys/dev/ixgbe/if_bypass.c +++ b/sys/dev/ixgbe/if_bypass.c @@ -43,11 +43,11 @@ * over other threads. ************************************************************************/ static void -ixgbe_bypass_mutex_enter(struct adapter *adapter) +ixgbe_bypass_mutex_enter(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.low, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.low, 0, 1) == 0) usec_delay(3000); - while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0) usec_delay(3000); return; } /* ixgbe_bypass_mutex_enter */ @@ -56,11 +56,11 @@ ixgbe_bypass_mutex_enter(struct adapter *adapter) * ixgbe_bypass_mutex_clear ************************************************************************/ static void -ixgbe_bypass_mutex_clear(struct adapter *adapter) +ixgbe_bypass_mutex_clear(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0) usec_delay(6000); - while (atomic_cmpset_int(&adapter->bypass.low, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.low, 1, 0) == 0) usec_delay(6000); return; } /* ixgbe_bypass_mutex_clear */ @@ -71,9 +71,9 @@ ixgbe_bypass_mutex_clear(struct adapter *adapter) * Watchdog entry is allowed to simply grab the high priority ************************************************************************/ static void -ixgbe_bypass_wd_mutex_enter(struct adapter *adapter) +ixgbe_bypass_wd_mutex_enter(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0) usec_delay(3000); return; } /* ixgbe_bypass_wd_mutex_enter */ @@ -82,9 +82,9 @@ ixgbe_bypass_wd_mutex_enter(struct adapter *adapter) * ixgbe_bypass_wd_mutex_clear ************************************************************************/ static void -ixgbe_bypass_wd_mutex_clear(struct adapter *adapter) +ixgbe_bypass_wd_mutex_clear(struct ixgbe_softc *sc) { - while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0) usec_delay(6000); return; } /* ixgbe_bypass_wd_mutex_clear */ @@ -115,13 +115,13 @@ ixgbe_get_bypass_time(u32 *year, u32 *sec) static int ixgbe_bp_version(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int version = 0; u32 cmd; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); cmd = BYPASS_PAGE_CTL2 | BYPASS_WE; cmd |= (BYPASS_EEPROM_VER_ADD << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M; @@ -131,12 +131,12 @@ ixgbe_bp_version(SYSCTL_HANDLER_ARGS) cmd &= ~BYPASS_WE; if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0)) goto err; - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); version &= BYPASS_CTL2_DATA_M; error = sysctl_handle_int(oidp, &version, 0, req); return (error); err: - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); return (error); } /* ixgbe_bp_version */ @@ -155,16 +155,16 @@ err: static int ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int state = 0; /* Get the current state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &state); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error != 0) return (error); state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3; @@ -182,7 +182,7 @@ ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) default: return (EINVAL); } - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); if ((error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MODE_OFF_M, state) != 0)) goto out; @@ -190,7 +190,7 @@ ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS) error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MODE_OFF_M, BYPASS_AUTO); out: - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_set_state */ @@ -217,15 +217,15 @@ out: static int ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int timeout = 0; /* Get the current value */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &timeout); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3; @@ -246,10 +246,10 @@ ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_WDTIMEOUT_M, timeout << BYPASS_WDTIMEOUT_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_timeout */ @@ -260,15 +260,15 @@ ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int main_on = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on); main_on = (main_on >> BYPASS_MAIN_ON_SHIFT) & 0x3; - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); @@ -288,10 +288,10 @@ ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MAIN_ON_M, main_on << BYPASS_MAIN_ON_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_main_on */ @@ -302,14 +302,14 @@ ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int main_off = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_off); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); main_off = (main_off >> BYPASS_MAIN_OFF_SHIFT) & 0x3; @@ -330,10 +330,10 @@ ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_MAIN_OFF_M, main_off << BYPASS_MAIN_OFF_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_main_off */ @@ -344,14 +344,14 @@ ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int aux_on = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_on); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); aux_on = (aux_on >> BYPASS_AUX_ON_SHIFT) & 0x3; @@ -372,10 +372,10 @@ ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_AUX_ON_M, aux_on << BYPASS_AUX_ON_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_aux_on */ @@ -386,14 +386,14 @@ ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error = 0; static int aux_off = 0; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_off); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); aux_off = (aux_off >> BYPASS_AUX_OFF_SHIFT) & 0x3; @@ -414,10 +414,10 @@ ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) } /* Set the new state */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, BYPASS_AUX_OFF_M, aux_off << BYPASS_AUX_OFF_SHIFT); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); usec_delay(6000); return (error); } /* ixgbe_bp_aux_off */ @@ -433,16 +433,16 @@ ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; int error, tmp; static int timeout = 0; u32 mask, arg; /* Get the current hardware value */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &tmp); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (error); /* @@ -489,9 +489,9 @@ ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) } /* Set the new watchdog */ - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, mask, arg); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); return (error); } /* ixgbe_bp_wd_set */ @@ -504,8 +504,8 @@ ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; u32 sec, year; int cmd, count = 0, error = 0; int reset_wd = 0; @@ -522,7 +522,7 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) cmd |= (sec & BYPASS_CTL1_TIME_M) | BYPASS_CTL1_VALID; cmd |= BYPASS_CTL1_OFFTRST; - ixgbe_bypass_wd_mutex_enter(adapter); + ixgbe_bypass_wd_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, cmd, &reset_wd); /* Read until it matches what we wrote, or we time out */ @@ -539,7 +539,7 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) } while (!hw->mac.ops.bypass_valid_rd(cmd, reset_wd)); reset_wd = 0; - ixgbe_bypass_wd_mutex_clear(adapter); + ixgbe_bypass_wd_mutex_clear(sc); return (error); } /* ixgbe_bp_wd_reset */ @@ -551,8 +551,8 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS) static int ixgbe_bp_log(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter = (struct adapter *) arg1; - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1; + struct ixgbe_hw *hw = &sc->hw; u32 cmd, base, head; u32 log_off, count = 0; static int status = 0; @@ -565,10 +565,10 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) return (error); /* Keep the log display single-threaded */ - while (atomic_cmpset_int(&adapter->bypass.log, 0, 1) == 0) + while (atomic_cmpset_int(&sc->bypass.log, 0, 1) == 0) usec_delay(3000); - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); /* Find Current head of the log eeprom offset */ cmd = BYPASS_PAGE_CTL2 | BYPASS_WE; @@ -586,7 +586,7 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) if (error) goto unlock_err; - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); base = status & BYPASS_CTL2_DATA_M; head = (status & BYPASS_CTL2_HEAD_M) >> BYPASS_CTL2_HEAD_SHIFT; @@ -601,19 +601,19 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) /* Log 5 bytes store in on u32 and a u8 */ for (i = 0; i < 4; i++) { - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rd_eep(hw, log_off + i, &data); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (EINVAL); eeprom[count].logs += data << (8 * i); } - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rd_eep(hw, log_off + i, &eeprom[count].actions); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (EINVAL); @@ -668,7 +668,7 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) time %= (60 * 60); min = time / 60; sec = time % 60; - device_printf(adapter->dev, + device_printf(sc->dev, "UT %02d/%02d %02d:%02d:%02d %8.8s -> %7.7s\n", mon, days, hours, min, sec, event_str[event], action_str[action]); @@ -677,14 +677,14 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M; cmd |= ((eeprom[count].logs & ~BYPASS_LOG_CLEAR_M) >> 24); - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); error = hw->mac.ops.bypass_rw(hw, cmd, &status); /* wait for the write to stick */ msec_delay(100); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); if (error) return (EINVAL); @@ -692,14 +692,14 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS) status = 0; /* reset */ /* Another log command can now run */ - while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0) usec_delay(3000); return (error); unlock_err: - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); status = 0; /* reset */ - while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0) + while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0) usec_delay(3000); return (EINVAL); } /* ixgbe_bp_log */ @@ -711,15 +711,15 @@ unlock_err: * only enabled for the first port of a bypass adapter. ************************************************************************/ void -ixgbe_bypass_init(struct adapter *adapter) +ixgbe_bypass_init(struct ixgbe_softc *sc) { - struct ixgbe_hw *hw = &adapter->hw; - device_t dev = adapter->dev; + struct ixgbe_hw *hw = &sc->hw; + device_t dev = sc->dev; struct sysctl_oid *bp_node; struct sysctl_oid_list *bp_list; u32 mask, value, sec, year; - if (!(adapter->feat_cap & IXGBE_FEATURE_BYPASS)) + if (!(sc->feat_cap & IXGBE_FEATURE_BYPASS)) return; /* First set up time for the hardware */ @@ -733,9 +733,9 @@ ixgbe_bypass_init(struct adapter *adapter) | BYPASS_CTL1_VALID | BYPASS_CTL1_OFFTRST; - ixgbe_bypass_mutex_enter(adapter); + ixgbe_bypass_mutex_enter(sc); hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL1, mask, value); - ixgbe_bypass_mutex_clear(adapter); + ixgbe_bypass_mutex_clear(sc); /* Now set up the SYSCTL infrastructure */ @@ -748,7 +748,7 @@ ixgbe_bypass_init(struct adapter *adapter) SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "bypass_log", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_log, "I", "Bypass Log"); + sc, 0, ixgbe_bp_log, "I", "Bypass Log"); /* All other setting are hung from the 'bypass' node */ bp_node = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), @@ -759,40 +759,40 @@ ixgbe_bypass_init(struct adapter *adapter) SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "version", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_version, "I", "Bypass Version"); + sc, 0, ixgbe_bp_version, "I", "Bypass Version"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_set_state, "I", "Bypass State"); + sc, 0, ixgbe_bp_set_state, "I", "Bypass State"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "timeout", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_timeout, "I", "Bypass Timeout"); + sc, 0, ixgbe_bp_timeout, "I", "Bypass Timeout"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "main_on", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_main_on, "I", "Bypass Main On"); + sc, 0, ixgbe_bp_main_on, "I", "Bypass Main On"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "main_off", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_main_off, "I", "Bypass Main Off"); + sc, 0, ixgbe_bp_main_off, "I", "Bypass Main Off"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "aux_on", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On"); + sc, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "aux_off", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off"); + sc, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "wd_set", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog"); + sc, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list, OID_AUTO, "wd_reset", CTLTYPE_INT | CTLFLAG_WR | CTLFLAG_NEEDGIANT, - adapter, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset"); + sc, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset"); - adapter->feat_en |= IXGBE_FEATURE_BYPASS; + sc->feat_en |= IXGBE_FEATURE_BYPASS; } /* ixgbe_bypass_init */ diff --git a/sys/dev/ixgbe/if_fdir.c b/sys/dev/ixgbe/if_fdir.c index 09a5b70464ae..22b71f2bdf09 100644 --- a/sys/dev/ixgbe/if_fdir.c +++ b/sys/dev/ixgbe/if_fdir.c @@ -37,33 +37,33 @@ #ifdef IXGBE_FDIR void -ixgbe_init_fdir(struct adapter *adapter) +ixgbe_init_fdir(struct ixgbe_softc *sc) { u32 hdrm = 32 << fdir_pballoc; - if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) + if (!(sc->feat_en & IXGBE_FEATURE_FDIR)) return; - adapter->hw.mac.ops.setup_rxpba(&adapter->hw, 0, hdrm, + sc->hw.mac.ops.setup_rxpba(&sc->hw, 0, hdrm, PBA_STRATEGY_EQUAL); - ixgbe_init_fdir_signature_82599(&adapter->hw, fdir_pballoc); + ixgbe_init_fdir_signature_82599(&sc->hw, fdir_pballoc); } /* ixgbe_init_fdir */ void ixgbe_reinit_fdir(void *context) { if_ctx_t ctx = context; - struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ifnet *ifp = iflib_get_ifp(ctx); - if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) + if (!(sc->feat_en & IXGBE_FEATURE_FDIR)) return; - if (adapter->fdir_reinit != 1) /* Shouldn't happen */ + if (sc->fdir_reinit != 1) /* Shouldn't happen */ return; - ixgbe_reinit_fdir_tables_82599(&adapter->hw); - adapter->fdir_reinit = 0; + ixgbe_reinit_fdir_tables_82599(&sc->hw); + sc->fdir_reinit = 0; /* re-enable flow director interrupts */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); + IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); /* Restart the interface */ ifp->if_drv_flags |= IFF_DRV_RUNNING; } /* ixgbe_reinit_fdir */ @@ -80,7 +80,7 @@ ixgbe_reinit_fdir(void *context) void ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) { - struct adapter *adapter = txr->adapter; + struct ixgbe_softc *sc = txr->sc; struct ix_queue *que; struct ip *ip; struct tcphdr *th; @@ -134,12 +134,12 @@ ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) common.flex_bytes ^= etype; common.ip ^= ip->ip_src.s_addr ^ ip->ip_dst.s_addr; - que = &adapter->queues[txr->me]; + que = &sc->queues[txr->me]; /* * This assumes the Rx queue and Tx * queue are bound to the same CPU */ - ixgbe_fdir_add_signature_filter_82599(&adapter->hw, + ixgbe_fdir_add_signature_filter_82599(&sc->hw, input, common, que->msix); } /* ixgbe_atr */ diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 42523f82cc01..b3960a129c29 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -109,87 +109,82 @@ static pci_vendor_info_t ixgbe_vendor_info_array[] = PVID_END }; -static void *ixgbe_register(device_t dev); -static int ixgbe_if_attach_pre(if_ctx_t ctx); -static int ixgbe_if_attach_post(if_ctx_t ctx); -static int ixgbe_if_detach(if_ctx_t ctx); -static int ixgbe_if_shutdown(if_ctx_t ctx); -static int ixgbe_if_suspend(if_ctx_t ctx); -static int ixgbe_if_resume(if_ctx_t ctx); - -static void ixgbe_if_stop(if_ctx_t ctx); -void ixgbe_if_enable_intr(if_ctx_t ctx); -static void ixgbe_if_disable_intr(if_ctx_t ctx); -static void ixgbe_link_intr_enable(if_ctx_t ctx); -static int ixgbe_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t qid); -static void ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr); -static int ixgbe_if_media_change(if_ctx_t ctx); +static void *ixgbe_register(device_t); +static int ixgbe_if_attach_pre(if_ctx_t); +static int ixgbe_if_attach_post(if_ctx_t); +static int ixgbe_if_detach(if_ctx_t); +static int ixgbe_if_shutdown(if_ctx_t); +static int ixgbe_if_suspend(if_ctx_t); +static int ixgbe_if_resume(if_ctx_t); + +static void ixgbe_if_stop(if_ctx_t); +void ixgbe_if_enable_intr(if_ctx_t); +static void ixgbe_if_disable_intr(if_ctx_t); +static void ixgbe_link_intr_enable(if_ctx_t); +static int ixgbe_if_rx_queue_intr_enable(if_ctx_t, uint16_t); +static void ixgbe_if_media_status(if_ctx_t, struct ifmediareq *); +static int ixgbe_if_media_change(if_ctx_t); static int ixgbe_if_msix_intr_assign(if_ctx_t, int); -static int ixgbe_if_mtu_set(if_ctx_t ctx, uint32_t mtu); -static void ixgbe_if_crcstrip_set(if_ctx_t ctx, int onoff, int strip); -static void ixgbe_if_multi_set(if_ctx_t ctx); -static int ixgbe_if_promisc_set(if_ctx_t ctx, int flags); -static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, - uint64_t *paddrs, int nrxqs, int nrxqsets); -static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, - uint64_t *paddrs, int nrxqs, int nrxqsets); -static void ixgbe_if_queues_free(if_ctx_t ctx); -static void ixgbe_if_timer(if_ctx_t ctx, uint16_t); -static void ixgbe_if_update_admin_status(if_ctx_t ctx); -static void ixgbe_if_vlan_register(if_ctx_t ctx, u16 vtag); -static void ixgbe_if_vlan_unregister(if_ctx_t ctx, u16 vtag); -static int ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req); -static bool ixgbe_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event); -int ixgbe_intr(void *arg); +static int ixgbe_if_mtu_set(if_ctx_t, uint32_t); +static void ixgbe_if_crcstrip_set(if_ctx_t, int, int); +static void ixgbe_if_multi_set(if_ctx_t); +static int ixgbe_if_promisc_set(if_ctx_t, int); +static int ixgbe_if_tx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int); +static int ixgbe_if_rx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int); +static void ixgbe_if_queues_free(if_ctx_t); +static void ixgbe_if_timer(if_ctx_t, uint16_t); +static void ixgbe_if_update_admin_status(if_ctx_t); +static void ixgbe_if_vlan_register(if_ctx_t, u16); +static void ixgbe_if_vlan_unregister(if_ctx_t, u16); +static int ixgbe_if_i2c_req(if_ctx_t, struct ifi2creq *); +static bool ixgbe_if_needs_restart(if_ctx_t, enum iflib_restart_event); +int ixgbe_intr(void *); /************************************************************************ * Function prototypes ************************************************************************/ -#if __FreeBSD_version >= 1100036 static uint64_t ixgbe_if_get_counter(if_ctx_t, ift_counter); -#endif -static void ixgbe_enable_queue(struct adapter *adapter, u32 vector); -static void ixgbe_disable_queue(struct adapter *adapter, u32 vector); -static void ixgbe_add_device_sysctls(if_ctx_t ctx); -static int ixgbe_allocate_pci_resources(if_ctx_t ctx); -static int ixgbe_setup_low_power_mode(if_ctx_t ctx); +static void ixgbe_enable_queue(struct ixgbe_softc *, u32); +static void ixgbe_disable_queue(struct ixgbe_softc *, u32); +static void ixgbe_add_device_sysctls(if_ctx_t); +static int ixgbe_allocate_pci_resources(if_ctx_t); +static int ixgbe_setup_low_power_mode(if_ctx_t); -static void ixgbe_config_dmac(struct adapter *adapter); -static void ixgbe_configure_ivars(struct adapter *adapter); -static void ixgbe_set_ivar(struct adapter *adapter, u8 entry, u8 vector, - s8 type); +static void ixgbe_config_dmac(struct ixgbe_softc *); +static void ixgbe_configure_ivars(struct ixgbe_softc *); +static void ixgbe_set_ivar(struct ixgbe_softc *, u8, u8, s8); static u8 *ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *); -static bool ixgbe_sfp_probe(if_ctx_t ctx); +static bool ixgbe_sfp_probe(if_ctx_t); -static void ixgbe_free_pci_resources(if_ctx_t ctx); +static void ixgbe_free_pci_resources(if_ctx_t); -static int ixgbe_msix_link(void *arg); -static int ixgbe_msix_que(void *arg); -static void ixgbe_initialize_rss_mapping(struct adapter *adapter); -static void ixgbe_initialize_receive_units(if_ctx_t ctx); -static void ixgbe_initialize_transmit_units(if_ctx_t ctx); +static int ixgbe_msix_link(void *); +static int ixgbe_msix_que(void *); +static void ixgbe_initialize_rss_mapping(struct ixgbe_softc *); +static void ixgbe_initialize_receive_units(if_ctx_t); +static void ixgbe_initialize_transmit_units(if_ctx_t); -static int ixgbe_setup_interface(if_ctx_t ctx); -static void ixgbe_init_device_features(struct adapter *adapter); -static void ixgbe_check_fan_failure(struct adapter *, u32, bool); +static int ixgbe_setup_interface(if_ctx_t); +static void ixgbe_init_device_features(struct ixgbe_softc *); +static void ixgbe_check_fan_failure(struct ixgbe_softc *, u32, bool); static void ixgbe_sbuf_fw_version(struct ixgbe_hw *, struct sbuf *); -static void ixgbe_print_fw_version(if_ctx_t ctx); -static void ixgbe_add_media_types(if_ctx_t ctx); -static void ixgbe_update_stats_counters(struct adapter *adapter); -static void ixgbe_config_link(if_ctx_t ctx); -static void ixgbe_get_slot_info(struct adapter *); -static void ixgbe_check_wol_support(struct adapter *adapter); -static void ixgbe_enable_rx_drop(struct adapter *); -static void ixgbe_disable_rx_drop(struct adapter *); - -static void ixgbe_add_hw_stats(struct adapter *adapter); -static int ixgbe_set_flowcntl(struct adapter *, int); -static int ixgbe_set_advertise(struct adapter *, int); -static int ixgbe_get_advertise(struct adapter *); -static void ixgbe_setup_vlan_hw_support(if_ctx_t ctx); -static void ixgbe_config_gpie(struct adapter *adapter); -static void ixgbe_config_delay_values(struct adapter *adapter); +static void ixgbe_print_fw_version(if_ctx_t); +static void ixgbe_add_media_types(if_ctx_t); +static void ixgbe_update_stats_counters(struct ixgbe_softc *); +static void ixgbe_config_link(if_ctx_t); +static void ixgbe_get_slot_info(struct ixgbe_softc *); +static void ixgbe_check_wol_support(struct ixgbe_softc *); +static void ixgbe_enable_rx_drop(struct ixgbe_softc *); +static void ixgbe_disable_rx_drop(struct ixgbe_softc *); + +static void ixgbe_add_hw_stats(struct ixgbe_softc *); +static int ixgbe_set_flowcntl(struct ixgbe_softc *, int); +static int ixgbe_set_advertise(struct ixgbe_softc *, int); +static int ixgbe_get_advertise(struct ixgbe_softc *); +static void ixgbe_setup_vlan_hw_support(if_ctx_t); +static void ixgbe_config_gpie(struct ixgbe_softc *); +static void ixgbe_config_delay_values(struct ixgbe_softc *); /* Sysctl handlers */ static int ixgbe_sysctl_flowcntl(SYSCTL_HANDLER_ARGS); @@ -237,7 +232,7 @@ static device_method_t ix_methods[] = { }; static driver_t ix_driver = { - "ix", ix_methods, sizeof(struct adapter), + "ix", ix_methods, sizeof(struct ixgbe_softc), }; devclass_t ix_devclass; @@ -293,7 +288,7 @@ static device_method_t ixgbe_if_methods[] = { static SYSCTL_NODE(_hw, OID_AUTO, ix, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "IXGBE driver parameters"); static driver_t ixgbe_if_driver = { - "ixgbe_if", ixgbe_if_methods, sizeof(struct adapter) + "ixgbe_if", ixgbe_if_methods, sizeof(struct ixgbe_softc) }; static int ixgbe_max_interrupt_rate = (4000000 / IXGBE_LOW_LATENCY); @@ -412,33 +407,33 @@ static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int ntxqs, int ntxqsets) { - struct adapter *adapter = iflib_get_softc(ctx); - if_softc_ctx_t scctx = adapter->shared; + struct ixgbe_softc *sc = iflib_get_softc(ctx); + if_softc_ctx_t scctx = sc->shared; struct ix_tx_queue *que; int i, j, error; - MPASS(adapter->num_tx_queues > 0); - MPASS(adapter->num_tx_queues == ntxqsets); + MPASS(sc->num_tx_queues > 0); + MPASS(sc->num_tx_queues == ntxqsets); MPASS(ntxqs == 1); /* Allocate queue structure memory */ - adapter->tx_queues = + sc->tx_queues = (struct ix_tx_queue *)malloc(sizeof(struct ix_tx_queue) * ntxqsets, M_IXGBE, M_NOWAIT | M_ZERO); - if (!adapter->tx_queues) { + if (!sc->tx_queues) { device_printf(iflib_get_dev(ctx), "Unable to allocate TX ring memory\n"); return (ENOMEM); } - for (i = 0, que = adapter->tx_queues; i < ntxqsets; i++, que++) { + for (i = 0, que = sc->tx_queues; i < ntxqsets; i++, que++) { struct tx_ring *txr = &que->txr; /* In case SR-IOV is enabled, align the index properly */ - txr->me = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool, + txr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i); - txr->adapter = que->adapter = adapter; + txr->sc = que->sc = sc; /* Allocate report status array */ txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_IXGBE, M_NOWAIT | M_ZERO); @@ -457,13 +452,13 @@ ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, txr->total_packets = 0; /* Set the rate at which we sample packets */ - if (adapter->feat_en & IXGBE_FEATURE_FDIR) + if (sc->feat_en & IXGBE_FEATURE_FDIR) txr->atr_sample = atr_sample_rate; } device_printf(iflib_get_dev(ctx), "allocated for %d queues\n", - adapter->num_tx_queues); + sc->num_tx_queues); return (0); @@ -480,32 +475,32 @@ static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nrxqs, int nrxqsets) { - struct adapter *adapter = iflib_get_softc(ctx); + struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que; int i; - MPASS(adapter->num_rx_queues > 0); - MPASS(adapter->num_rx_queues == nrxqsets); + MPASS(sc->num_rx_queues > 0); + MPASS(sc->num_rx_queues == nrxqsets); MPASS(nrxqs == 1); /* Allocate queue structure memory */ - adapter->rx_queues = + sc->rx_queues = (struct ix_rx_queue *)malloc(sizeof(struct ix_rx_queue)*nrxqsets, M_IXGBE, M_NOWAIT | M_ZERO); - if (!adapter->rx_queues) { + if (!sc->rx_queues) { device_printf(iflib_get_dev(ctx), "Unable to allocate TX ring memory\n"); return (ENOMEM); } - for (i = 0, que = adapter->rx_queues; i < nrxqsets; i++, que++) { + for (i = 0, que = sc->rx_queues; i < nrxqsets; i++, que++) { struct rx_ring *rxr = &que->rxr; /* In case SR-IOV is enabled, align the index properly */ - rxr->me = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool, + rxr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i); - rxr->adapter = que->adapter = adapter; + rxr->sc = que->sc = sc; /* get the virtual and physical address of the hw queues */ rxr->tail = IXGBE_RDT(rxr->me); @@ -516,7 +511,7 @@ ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, } device_printf(iflib_get_dev(ctx), "allocated for %d rx queues\n", - adapter->num_rx_queues); + sc->num_rx_queues); return (0); } /* ixgbe_if_rx_queues_alloc */ @@ -527,13 +522,13 @@ ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, static void ixgbe_if_queues_free(if_ctx_t ctx) { - struct adapter *adapter = iflib_get_softc(ctx); - struct ix_tx_queue *tx_que = adapter->tx_queues; - struct ix_rx_queue *rx_que = adapter->rx_queues; + struct ixgbe_softc *sc = iflib_get_softc(ctx); + struct ix_tx_queue *tx_que = sc->tx_queues; + struct ix_rx_queue *rx_que = sc->rx_queues; int i; if (tx_que != NULL) { - for (i = 0; i < adapter->num_tx_queues; i++, tx_que++) { + for (i = 0; i < sc->num_tx_queues; i++, tx_que++) { struct tx_ring *txr = &tx_que->txr; if (txr->tx_rsq == NULL) break; @@ -542,12 +537,12 @@ ixgbe_if_queues_free(if_ctx_t ctx) txr->tx_rsq = NULL; } - free(adapter->tx_queues, M_IXGBE); - adapter->tx_queues = NULL; + free(sc->tx_queues, M_IXGBE); + sc->tx_queues = NULL; } if (rx_que != NULL) { - free(adapter->rx_queues, M_IXGBE); - adapter->rx_queues = NULL; + free(sc->rx_queues, M_IXGBE); + sc->rx_queues = NULL; } } /* ixgbe_if_queues_free */ @@ -555,15 +550,15 @@ ixgbe_if_queues_free(if_ctx_t ctx) * ixgbe_initialize_rss_mapping ************************************************************************/ static void -ixgbe_initialize_rss_mapping(struct adapter *adapter) +ixgbe_initialize_rss_mapping(struct ixgbe_softc *sc) { - struct ixgbe_hw *hw = &adapter->hw; + struct ixgbe_hw *hw = &sc->hw; u32 reta = 0, mrqc, rss_key[10]; int queue_id, table_size, index_mult; int i, j; u32 rss_hash_config; - if (adapter->feat_en & IXGBE_FEATURE_RSS) { + if (sc->feat_en & IXGBE_FEATURE_RSS) { /* Fetch the configured RSS key */ rss_getkey((uint8_t *)&rss_key); } else { @@ -574,7 +569,7 @@ ixgbe_initialize_rss_mapping(struct adapter *adapter) *** 5363 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sun Sep 26 18:32: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 31BF267DCA9; Sun, 26 Sep 2021 18:32: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 4HHZB50rN2z4rLK; Sun, 26 Sep 2021 18:32: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 EEDC0225C9; Sun, 26 Sep 2021 18:32: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 18QIWCCw021884; Sun, 26 Sep 2021 18:32:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18QIWCMK021883; Sun, 26 Sep 2021 18:32:12 GMT (envelope-from git) Date: Sun, 26 Sep 2021 18:32:12 GMT Message-Id: <202109261832.18QIWCMK021883@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 15d077995bd2 - main - ixgbe: whitespace cleanup pass MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15d077995bd2c56b7b1742ea2d4e9070ff7e9427 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, 26 Sep 2021 18:32:13 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=15d077995bd2c56b7b1742ea2d4e9070ff7e9427 commit 15d077995bd2c56b7b1742ea2d4e9070ff7e9427 Author: Kevin Bowling AuthorDate: 2021-09-26 18:29:00 +0000 Commit: Kevin Bowling CommitDate: 2021-09-26 18:29:02 +0000 ixgbe: whitespace cleanup pass Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32131 --- sys/dev/ixgbe/if_ix.c | 6 +- sys/dev/ixgbe/if_ixv.c | 6 +- sys/dev/ixgbe/ix_txrx.c | 2 - sys/dev/ixgbe/ixgbe.h | 500 ++++++++++++++++++++++-------------------------- 4 files changed, 230 insertions(+), 284 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index b3960a129c29..43b6a6e78b4c 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -32,7 +32,6 @@ ******************************************************************************/ /*$FreeBSD$*/ - #include "opt_inet.h" #include "opt_inet6.h" #include "opt_rss.h" @@ -49,7 +48,6 @@ ************************************************************************/ char ixgbe_driver_version[] = "4.0.1-k"; - /************************************************************************ * PCI Device ID Table * @@ -405,7 +403,7 @@ static struct if_shared_ctx ixgbe_sctx_init = { ************************************************************************/ static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int ntxqs, int ntxqsets) + int ntxqs, int ntxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = sc->shared; @@ -473,7 +471,7 @@ fail: ************************************************************************/ static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int nrxqs, int nrxqsets) + int nrxqs, int nrxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que; diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index f2bae7a14cad..1c01add0347b 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -244,7 +244,7 @@ ixv_register(device_t dev) ************************************************************************/ static int ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int ntxqs, int ntxqsets) + int ntxqs, int ntxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = sc->shared; @@ -303,7 +303,7 @@ ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, ************************************************************************/ static int ixv_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, - int nrxqs, int nrxqsets) + int nrxqs, int nrxqsets) { struct ixgbe_softc *sc = iflib_get_softc(ctx); struct ix_rx_queue *que; @@ -1014,7 +1014,7 @@ ixv_identify_hardware(if_ctx_t ctx) static int ixv_if_msix_intr_assign(if_ctx_t ctx, int msix) { - struct ixgbe_softc *sc = iflib_get_softc(ctx); + struct ixgbe_softc *sc = iflib_get_softc(ctx); device_t dev = iflib_get_dev(ctx); struct ix_rx_queue *rx_que = sc->rx_queues; struct ix_tx_queue *tx_que; diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 983bf86ba820..14e0fce11970 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -32,7 +32,6 @@ ******************************************************************************/ /*$FreeBSD$*/ - #ifndef IXGBE_STANDALONE_BUILD #include "opt_inet.h" #include "opt_inet6.h" @@ -41,7 +40,6 @@ #include "ixgbe.h" - /************************************************************************ * Local Function prototypes ************************************************************************/ diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 4c5e6946567a..8581b01b4a37 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -33,11 +33,9 @@ ******************************************************************************/ /*$FreeBSD$*/ - #ifndef _IXGBE_H_ #define _IXGBE_H_ - #include #include #include @@ -99,10 +97,10 @@ * bytes. Performance tests have show the 2K value to be optimal for top * performance. */ -#define DEFAULT_TXD 2048 -#define PERFORM_TXD 2048 -#define MAX_TXD 4096 -#define MIN_TXD 64 +#define DEFAULT_TXD 2048 +#define PERFORM_TXD 2048 +#define MAX_TXD 4096 +#define MIN_TXD 64 /* * RxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the @@ -114,40 +112,40 @@ * against the system mbuf pool limit, you can tune nmbclusters * to adjust for this. */ -#define DEFAULT_RXD 2048 -#define PERFORM_RXD 2048 -#define MAX_RXD 4096 -#define MIN_RXD 64 +#define DEFAULT_RXD 2048 +#define PERFORM_RXD 2048 +#define MAX_RXD 4096 +#define MIN_RXD 64 /* Alignment for rings */ -#define DBA_ALIGN 128 +#define DBA_ALIGN 128 /* * This is the max watchdog interval, ie. the time that can * pass between any two TX clean operations, such only happening * when the TX hardware is functioning. */ -#define IXGBE_WATCHDOG (10 * hz) +#define IXGBE_WATCHDOG (10 * hz) /* * This parameters control when the driver calls the routine to reclaim * transmit descriptors. */ -#define IXGBE_TX_CLEANUP_THRESHOLD(_a) ((_a)->num_tx_desc / 8) -#define IXGBE_TX_OP_THRESHOLD(_a) ((_a)->num_tx_desc / 32) +#define IXGBE_TX_CLEANUP_THRESHOLD(_a) ((_a)->num_tx_desc / 8) +#define IXGBE_TX_OP_THRESHOLD(_a) ((_a)->num_tx_desc / 32) /* These defines are used in MTU calculations */ -#define IXGBE_MAX_FRAME_SIZE 9728 -#define IXGBE_MTU_HDR (ETHER_HDR_LEN + ETHER_CRC_LEN) -#define IXGBE_MTU_HDR_VLAN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ - ETHER_VLAN_ENCAP_LEN) -#define IXGBE_MAX_MTU (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR) -#define IXGBE_MAX_MTU_VLAN (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN) +#define IXGBE_MAX_FRAME_SIZE 9728 +#define IXGBE_MTU_HDR (ETHER_HDR_LEN + ETHER_CRC_LEN) +#define IXGBE_MTU_HDR_VLAN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ + ETHER_VLAN_ENCAP_LEN) +#define IXGBE_MAX_MTU (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR) +#define IXGBE_MAX_MTU_VLAN (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN) /* Flow control constants */ -#define IXGBE_FC_PAUSE 0xFFFF -#define IXGBE_FC_HI 0x20000 -#define IXGBE_FC_LO 0x10000 +#define IXGBE_FC_PAUSE 0xFFFF +#define IXGBE_FC_HI 0x20000 +#define IXGBE_FC_LO 0x10000 /* * Used for optimizing small rx mbufs. Effort is made to keep the copy @@ -159,82 +157,65 @@ * modern Intel CPUs, results in 40 bytes wasted and a significant drop * in observed efficiency of the optimization, 97.9% -> 81.8%. */ -#if __FreeBSD_version < 1002000 -#define MPKTHSIZE (sizeof(struct m_hdr) + sizeof(struct pkthdr)) -#endif -#define IXGBE_RX_COPY_HDR_PADDED ((((MPKTHSIZE - 1) / 32) + 1) * 32) -#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED) -#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - MPKTHSIZE) +#define IXGBE_MPKTHSIZE (sizeof(struct m_hdr) + sizeof(struct pkthdr)) -/* Keep older OS drivers building... */ -#if !defined(SYSCTL_ADD_UQUAD) -#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD -#endif +#define IXGBE_RX_COPY_HDR_PADDED ((((IXGBE_MPKTHSIZE - 1) / 32) + 1) * 32) +#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED) +#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - IXGBE_MPKTHSIZE) /* Defines for printing debug information */ -#define DEBUG_INIT 0 -#define DEBUG_IOCTL 0 -#define DEBUG_HW 0 - -#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") -#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) -#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) -#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") -#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) -#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) -#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") -#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) -#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) - -#define MAX_NUM_MULTICAST_ADDRESSES 128 -#define IXGBE_82598_SCATTER 100 -#define IXGBE_82599_SCATTER 32 -#define IXGBE_TSO_SIZE 262140 -#define IXGBE_RX_HDR 128 -#define IXGBE_VFTA_SIZE 128 -#define IXGBE_BR_SIZE 4096 -#define IXGBE_QUEUE_MIN_FREE 32 -#define IXGBE_MAX_TX_BUSY 10 -#define IXGBE_QUEUE_HUNG 0x80000000 - -#define IXGBE_EITR_DEFAULT 128 +#define DEBUG_INIT 0 +#define DEBUG_IOCTL 0 +#define DEBUG_HW 0 + +#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n") +#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A) +#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B) +#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n") +#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A) +#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) +#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") +#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) +#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) + +#define MAX_NUM_MULTICAST_ADDRESSES 128 +#define IXGBE_82598_SCATTER 100 +#define IXGBE_82599_SCATTER 32 +#define IXGBE_TSO_SIZE 262140 +#define IXGBE_RX_HDR 128 +#define IXGBE_VFTA_SIZE 128 +#define IXGBE_BR_SIZE 4096 +#define IXGBE_QUEUE_MIN_FREE 32 +#define IXGBE_MAX_TX_BUSY 10 +#define IXGBE_QUEUE_HUNG 0x80000000 + +#define IXGBE_EITR_DEFAULT 128 /* Supported offload bits in mbuf flag */ -#if __FreeBSD_version >= 1000000 -#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ - CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ - CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) -#elif __FreeBSD_version >= 800000 -#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) -#else -#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP) -#endif +#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ + CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ + CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) #define IXGBE_CAPS (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | IFCAP_TSO | \ - IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \ - IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \ - IFCAP_VLAN_HWFILTER | IFCAP_WOL) - -/* Backward compatibility items for very old versions */ -#ifndef pci_find_cap -#define pci_find_cap pci_find_extcap -#endif + IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \ + IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \ + IFCAP_VLAN_HWFILTER | IFCAP_WOL) #ifndef DEVMETHOD_END -#define DEVMETHOD_END { NULL, NULL } +#define DEVMETHOD_END { NULL, NULL } #endif /* * Interrupt Moderation parameters */ -#define IXGBE_LOW_LATENCY 128 -#define IXGBE_AVE_LATENCY 400 -#define IXGBE_BULK_LATENCY 1200 +#define IXGBE_LOW_LATENCY 128 +#define IXGBE_AVE_LATENCY 400 +#define IXGBE_BULK_LATENCY 1200 /* Using 1FF (the max value), the interval is ~1.05ms */ -#define IXGBE_LINK_ITR_QUANTA 0x1FF -#define IXGBE_LINK_ITR ((IXGBE_LINK_ITR_QUANTA << 3) & \ - IXGBE_EITR_ITR_INT_MASK) +#define IXGBE_LINK_ITR_QUANTA 0x1FF +#define IXGBE_LINK_ITR ((IXGBE_LINK_ITR_QUANTA << 3) & \ + IXGBE_EITR_ITR_INT_MASK) /************************************************************************ @@ -244,60 +225,60 @@ * which the driver should load. ************************************************************************/ typedef struct _ixgbe_vendor_info_t { - unsigned int vendor_id; - unsigned int device_id; - unsigned int subvendor_id; - unsigned int subdevice_id; - unsigned int index; + unsigned int vendor_id; + unsigned int device_id; + unsigned int subvendor_id; + unsigned int subdevice_id; + unsigned int index; } ixgbe_vendor_info_t; struct ixgbe_bp_data { - u32 low; - u32 high; - u32 log; + u32 low; + u32 high; + u32 log; }; /* */ struct ixgbe_dma_alloc { - bus_addr_t dma_paddr; - caddr_t dma_vaddr; - bus_dma_tag_t dma_tag; - bus_dmamap_t dma_map; - bus_dma_segment_t dma_seg; - bus_size_t dma_size; - int dma_nseg; + bus_addr_t dma_paddr; + caddr_t dma_vaddr; + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + bus_dma_segment_t dma_seg; + bus_size_t dma_size; + int dma_nseg; }; struct ixgbe_mc_addr { - u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS]; - u32 vmdq; + u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS]; + u32 vmdq; }; /* * The transmit ring, one per queue */ struct tx_ring { - struct ixgbe_softc *sc; + struct ixgbe_softc *sc; union ixgbe_adv_tx_desc *tx_base; - uint64_t tx_paddr; - u32 tail; - qidx_t *tx_rsq; - qidx_t tx_rs_cidx; - qidx_t tx_rs_pidx; - qidx_t tx_cidx_processed; - uint8_t me; + uint64_t tx_paddr; + u32 tail; + qidx_t *tx_rsq; + qidx_t tx_rs_cidx; + qidx_t tx_rs_pidx; + qidx_t tx_cidx_processed; + uint8_t me; /* Flow Director */ - u16 atr_sample; - u16 atr_count; + u16 atr_sample; + u16 atr_count; - u32 bytes; /* used for AIM */ - u32 packets; + u32 bytes; /* used for AIM */ + u32 packets; /* Soft Stats */ - u64 tso_tx; - u64 total_packets; + u64 tso_tx; + u64 total_packets; }; @@ -305,29 +286,29 @@ struct tx_ring { * The Receive ring, one per rx queue */ struct rx_ring { - struct ix_rx_queue *que; - struct ixgbe_softc *sc; - u32 me; - u32 tail; + struct ix_rx_queue *que; + struct ixgbe_softc *sc; + u32 me; + u32 tail; union ixgbe_adv_rx_desc *rx_base; - bool hw_rsc; - bool vtag_strip; - uint64_t rx_paddr; - bus_dma_tag_t ptag; + bool hw_rsc; + bool vtag_strip; + uint64_t rx_paddr; + bus_dma_tag_t ptag; - u32 bytes; /* Used for AIM calc */ - u32 packets; + u32 bytes; /* Used for AIM calc */ + u32 packets; /* Soft stats */ - u64 rx_irq; - u64 rx_copies; - u64 rx_packets; - u64 rx_bytes; - u64 rx_discarded; - u64 rsc_num; + u64 rx_irq; + u64 rx_copies; + u64 rx_packets; + u64 rx_bytes; + u64 rx_discarded; + u64 rsc_num; /* Flow Director */ - u64 flm; + u64 flm; }; /* @@ -336,67 +317,67 @@ struct rx_ring { */ struct ix_rx_queue { struct ixgbe_softc *sc; - u32 msix; /* This queue's MSIX vector */ + u32 msix; /* This queue's MSIX vector */ u32 eitr_setting; struct resource *res; void *tag; int busy; struct rx_ring rxr; - struct if_irq que_irq; + struct if_irq que_irq; u64 irqs; }; struct ix_tx_queue { struct ixgbe_softc *sc; - u32 msix; /* This queue's MSIX vector */ + u32 msix; /* This queue's MSIX vector */ struct tx_ring txr; }; -#define IXGBE_MAX_VF_MC 30 /* Max number of multicast entries */ +#define IXGBE_MAX_VF_MC 30 /* Max number of multicast entries */ struct ixgbe_vf { - u_int pool; - u_int rar_index; - u_int maximum_frame_size; - uint32_t flags; - uint8_t ether_addr[ETHER_ADDR_LEN]; - uint16_t mc_hash[IXGBE_MAX_VF_MC]; - uint16_t num_mc_hashes; - uint16_t default_vlan; - uint16_t vlan_tag; - uint16_t api_ver; + u_int pool; + u_int rar_index; + u_int maximum_frame_size; + uint32_t flags; + uint8_t ether_addr[ETHER_ADDR_LEN]; + uint16_t mc_hash[IXGBE_MAX_VF_MC]; + uint16_t num_mc_hashes; + uint16_t default_vlan; + uint16_t vlan_tag; + uint16_t api_ver; }; /* Our softc structure */ struct ixgbe_softc { - struct ixgbe_hw hw; - struct ixgbe_osdep osdep; - if_ctx_t ctx; - if_softc_ctx_t shared; -#define num_tx_queues shared->isc_ntxqsets -#define num_rx_queues shared->isc_nrxqsets -#define max_frame_size shared->isc_max_frame_size -#define intr_type shared->isc_intr + struct ixgbe_hw hw; + struct ixgbe_osdep osdep; + if_ctx_t ctx; + if_softc_ctx_t shared; +#define num_tx_queues shared->isc_ntxqsets +#define num_rx_queues shared->isc_nrxqsets +#define max_frame_size shared->isc_max_frame_size +#define intr_type shared->isc_intr - device_t dev; - struct ifnet *ifp; + device_t dev; + struct ifnet *ifp; - struct resource *pci_mem; + struct resource *pci_mem; /* * Interrupt resources: this set is * either used for legacy, or for Link * when doing MSI-X */ - struct if_irq irq; - void *tag; - struct resource *res; + struct if_irq irq; + void *tag; + struct resource *res; - struct ifmedia *media; - int if_flags; - int msix; + struct ifmedia *media; + int if_flags; + int msix; - u16 num_vlans; + u16 num_vlans; /* * Shadow VFTA table, this is needed because @@ -404,31 +385,31 @@ struct ixgbe_softc { * a soft reset and the driver needs to be able * to repopulate it. */ - u32 shadow_vfta[IXGBE_VFTA_SIZE]; + u32 shadow_vfta[IXGBE_VFTA_SIZE]; /* Info about the interface */ - int advertise; /* link speeds */ - int enable_aim; /* adaptive interrupt moderation */ - bool link_active; - u16 num_segs; - u32 link_speed; - bool link_up; - u32 vector; - u16 dmac; - u32 phy_layer; + int advertise; /* link speeds */ + int enable_aim; /* adaptive interrupt moderation */ + bool link_active; + u16 num_segs; + u32 link_speed; + bool link_up; + u32 vector; + u16 dmac; + u32 phy_layer; /* Power management-related */ - bool wol_support; - u32 wufc; + bool wol_support; + u32 wufc; /* Mbuf cluster size */ - u32 rx_mbuf_sz; + u32 rx_mbuf_sz; /* Support for pluggable optics */ - bool sfp_probe; + bool sfp_probe; /* Flow Director */ - int fdir_reinit; + int fdir_reinit; u32 task_requests; @@ -442,125 +423,94 @@ struct ixgbe_softc { struct ix_rx_queue *rx_queues; /* Multicast array memory */ - struct ixgbe_mc_addr *mta; + struct ixgbe_mc_addr *mta; /* SR-IOV */ - int iov_mode; - int num_vfs; - int pool; - struct ixgbe_vf *vfs; + int iov_mode; + int num_vfs; + int pool; + struct ixgbe_vf *vfs; /* Bypass */ - struct ixgbe_bp_data bypass; + struct ixgbe_bp_data bypass; /* Misc stats maintained by the driver */ - unsigned long dropped_pkts; - unsigned long mbuf_header_failed; - unsigned long mbuf_packet_failed; - unsigned long watchdog_events; - unsigned long link_irq; + unsigned long dropped_pkts; + unsigned long mbuf_header_failed; + unsigned long mbuf_packet_failed; + unsigned long watchdog_events; + unsigned long link_irq; union { struct ixgbe_hw_stats pf; struct ixgbevf_hw_stats vf; } stats; -#if __FreeBSD_version >= 1100036 + /* counter(9) stats */ - u64 ipackets; - u64 ierrors; - u64 opackets; - u64 oerrors; - u64 ibytes; - u64 obytes; - u64 imcasts; - u64 omcasts; - u64 iqdrops; - u64 noproto; -#endif + u64 ipackets; + u64 ierrors; + u64 opackets; + u64 oerrors; + u64 ibytes; + u64 obytes; + u64 imcasts; + u64 omcasts; + u64 iqdrops; + u64 noproto; + /* Feature capable/enabled flags. See ixgbe_features.h */ - u32 feat_cap; - u32 feat_en; + u32 feat_cap; + u32 feat_en; }; /* Precision Time Sync (IEEE 1588) defines */ -#define ETHERTYPE_IEEE1588 0x88F7 -#define PICOSECS_PER_TICK 20833 -#define TSYNC_UDP_PORT 319 /* UDP port for the protocol */ -#define IXGBE_ADVTXD_TSTAMP 0x00080000 - -/* For backward compatibility */ -#if !defined(PCIER_LINK_STA) -#define PCIER_LINK_STA PCIR_EXPRESS_LINK_STA -#endif +#define ETHERTYPE_IEEE1588 0x88F7 +#define PICOSECS_PER_TICK 20833 +#define TSYNC_UDP_PORT 319 /* UDP port for the protocol */ +#define IXGBE_ADVTXD_TSTAMP 0x00080000 /* Stats macros */ -#if __FreeBSD_version >= 1100036 -#define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count) -#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count) -#define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count) -#define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count) +#define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count) +#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count) +#define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count) +#define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count) #define IXGBE_SET_COLLISIONS(sc, count) -#define IXGBE_SET_IBYTES(sc, count) (sc)->ibytes = (count) -#define IXGBE_SET_OBYTES(sc, count) (sc)->obytes = (count) -#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count) -#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count) -#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count) -#else -#define IXGBE_SET_IPACKETS(sc, count) (sc)->ifp->if_ipackets = (count) -#define IXGBE_SET_IERRORS(sc, count) (sc)->ifp->if_ierrors = (count) -#define IXGBE_SET_OPACKETS(sc, count) (sc)->ifp->if_opackets = (count) -#define IXGBE_SET_OERRORS(sc, count) (sc)->ifp->if_oerrors = (count) -#define IXGBE_SET_COLLISIONS(sc, count) (sc)->ifp->if_collisions = (count) -#define IXGBE_SET_IBYTES(sc, count) (sc)->ifp->if_ibytes = (count) -#define IXGBE_SET_OBYTES(sc, count) (sc)->ifp->if_obytes = (count) -#define IXGBE_SET_IMCASTS(sc, count) (sc)->ifp->if_imcasts = (count) -#define IXGBE_SET_OMCASTS(sc, count) (sc)->ifp->if_omcasts = (count) -#define IXGBE_SET_IQDROPS(sc, count) (sc)->ifp->if_iqdrops = (count) -#endif +#define IXGBE_SET_IBYTES(sc, count) (sc)->ibytes = (count) +#define IXGBE_SET_OBYTES(sc, count) (sc)->obytes = (count) +#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count) +#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count) +#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count) /* External PHY register addresses */ -#define IXGBE_PHY_CURRENT_TEMP 0xC820 -#define IXGBE_PHY_OVERTEMP_STATUS 0xC830 +#define IXGBE_PHY_CURRENT_TEMP 0xC820 +#define IXGBE_PHY_OVERTEMP_STATUS 0xC830 /* Sysctl help messages; displayed with sysctl -d */ -#define IXGBE_SYSCTL_DESC_ADV_SPEED \ - "\nControl advertised link speed using these flags:\n" \ - "\t0x1 - advertise 100M\n" \ - "\t0x2 - advertise 1G\n" \ - "\t0x4 - advertise 10G\n" \ - "\t0x8 - advertise 10M\n\n" \ - "\t100M and 10M are only supported on certain adapters.\n" - -#define IXGBE_SYSCTL_DESC_SET_FC \ - "\nSet flow control mode using these values:\n" \ - "\t0 - off\n" \ - "\t1 - rx pause\n" \ - "\t2 - tx pause\n" \ - "\t3 - tx and rx pause" - -#define IXGBE_SYSCTL_DESC_RX_ERRS \ - "\nSum of the following RX errors counters:\n" \ - " * CRC errors,\n" \ - " * illegal byte error count,\n" \ - " * checksum error count,\n" \ - " * missed packet count,\n" \ - " * length error count,\n" \ - " * undersized packets count,\n" \ - " * fragmented packets count,\n" \ - " * oversized packets count,\n" \ - " * jabber count." - -/* Workaround to make 8.0 buildable */ -#if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504 -static __inline int -drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (1); -#endif - return (!buf_ring_empty(br)); -} -#endif +#define IXGBE_SYSCTL_DESC_ADV_SPEED \ + "\nControl advertised link speed using these flags:\n" \ + "\t0x1 - advertise 100M\n" \ + "\t0x2 - advertise 1G\n" \ + "\t0x4 - advertise 10G\n" \ + "\t0x8 - advertise 10M\n\n" \ + "\t100M and 10M are only supported on certain adapters.\n" + +#define IXGBE_SYSCTL_DESC_SET_FC \ + "\nSet flow control mode using these values:\n" \ + "\t0 - off\n" \ + "\t1 - rx pause\n" \ + "\t2 - tx pause\n" \ + "\t3 - tx and rx pause" + +#define IXGBE_SYSCTL_DESC_RX_ERRS \ + "\nSum of the following RX errors counters:\n" \ + " * CRC errors,\n" \ + " * illegal byte error count,\n" \ + " * checksum error count,\n" \ + " * missed packet count,\n" \ + " * length error count,\n" \ + " * undersized packets count,\n" \ + " * fragmented packets count,\n" \ + " * oversized packets count,\n" \ + " * jabber count." /* * This checks for a zero mac addr, something that will be likely