git: 8aaffd78c0f5 - main - Add dummymbuf module for testing purposes

2024-08-15 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8aaffd78c0f517985c12fd1e3cbceeb6c6b98ef5

commit 8aaffd78c0f517985c12fd1e3cbceeb6c6b98ef5
Author: Igor Ostapenko 
AuthorDate: 2024-08-14 12:45:38 +
Commit: Kristof Provost 
CommitDate: 2024-08-15 07:28:13 +

Add dummymbuf module for testing purposes

Reviewed by:kp
Differential Revision:  https://reviews.freebsd.org/D45928
---
 share/man/man4/Makefile|   1 +
 share/man/man4/dummymbuf.4 | 209 
 sys/conf/files |   1 +
 sys/modules/Makefile   |   1 +
 sys/modules/dummymbuf/Makefile |   9 +
 sys/net/dummymbuf.c| 436 +
 6 files changed, 657 insertions(+)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 4e685cac3ecf..6195211d2eb9 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -135,6 +135,7 @@ MAN=aac.4 \
ds1307.4 \
ds3231.4 \
${_dtrace_provs} \
+   dummymbuf.4 \
dummynet.4 \
edsc.4 \
ehci.4 \
diff --git a/share/man/man4/dummymbuf.4 b/share/man/man4/dummymbuf.4
new file mode 100644
index ..844a7c0565bd
--- /dev/null
+++ b/share/man/man4/dummymbuf.4
@@ -0,0 +1,209 @@
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
+.\" Copyright (c) 2024 Igor Ostapenko 
+.\"
+.\" 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.
+.\"
+.\" Note: The date here should be updated whenever a non-trivial
+.\" change is made to the manual page.
+.Dd August 2, 2024
+.Dt DUMMYMBUF 4
+.Os
+.Sh NAME
+.Nm dummymbuf
+.Nd "mbuf alteration pfil hooks"
+.Sh SYNOPSIS
+To compile the driver into the kernel,
+place the following line in the
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device dummymbuf"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dummymbuf_load="YES"
+.Ed
+.Sh DESCRIPTION
+This module is intended to test networking code in the face of unusual mbuf
+layouts.
+The special
+.Xr pfil 9
+hooks are provided for mbuf alteration and can be listed with
+.Xr pfilctl 8
+as follows:
+.Bd -literal -offset indent
+Hook  Type
+   dummymbuf:ethernet Ethernet
+   dummymbuf:inet6IPv6
+   dummymbuf:inet IPv4
+.Ed
+.Pp
+To activate a hook it must be linked to the respective
+.Xr pfil 9
+head.
+.Xr pfilctl 8
+can be used for the linking.
+.Pp
+Each time a hook is invoked it reads a single shared set of
+.Sx RULES
+from
+.Va net.dummymbuf.rules
+sysctl.
+The rules are evaluated sequentially and each matching rule performs the
+specified operation over the mbuf.
+.Pp
+After every successfully applied operation the
+.Va net.dummymbuf.hits
+sysctl counter is increased.
+.Pp
+A hook returns an altered mbuf for further processing, but it drops a packet
+if rules parsing or an operation fails.
+Also, the first mbuf of the original chain may be changed.
+.Pp
+The module is
+.Xr VNET 9
+based, hence every
+.Xr jail 2
+provides its own set of hooks and sysctl variables.
+.Sh RULES
+The set of rules is a semicolon separated list.
+An empty string is treated as a parsing failure.
+A rule conceptually has two parts, filter and operation, with the following
+syntax:
+.Bd -literal -offset indent
+{inet | inet6 | ethernet} {in | out}  [ ];
+.Ed
+.Ss Filter
+The first word of a rule matches
+.Xr pfil 9
+type.
+The second matches packet's direction, and the third matches the network
+interface a packet is coming from.
+.Ss Operation
+An operation may have arguments separated fro

git: 09b7a038628c - main - pf tests: Add 'mbuf' test for (*m0)->m_len < sizeof(struct ip) cases

2024-08-15 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=09b7a038628c65cab6d6ca27f640d818af8822f5

commit 09b7a038628c65cab6d6ca27f640d818af8822f5
Author: Igor Ostapenko 
AuthorDate: 2024-08-14 12:47:28 +
Commit: Kristof Provost 
CommitDate: 2024-08-15 07:28:13 +

pf tests: Add 'mbuf' test for (*m0)->m_len < sizeof(struct ip) cases

Reviewed by:kp
Differential Revision:  https://reviews.freebsd.org/D45927
---
 tests/sys/netpfil/pf/Makefile |  1 +
 tests/sys/netpfil/pf/mbuf.sh  | 97 +++
 2 files changed, 98 insertions(+)

diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile
index f4dd36d9e35d..4a16642a967b 100644
--- a/tests/sys/netpfil/pf/Makefile
+++ b/tests/sys/netpfil/pf/Makefile
@@ -24,6 +24,7 @@ ATF_TESTS_SH+=altq \
macro \
map_e \
match \
+   mbuf \
modulate \
names \
nat \
diff --git a/tests/sys/netpfil/pf/mbuf.sh b/tests/sys/netpfil/pf/mbuf.sh
new file mode 100644
index ..082de08b0838
--- /dev/null
+++ b/tests/sys/netpfil/pf/mbuf.sh
@@ -0,0 +1,97 @@
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2024 Igor Ostapenko 
+#
+# 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.
+
+. $(atf_get_srcdir)/utils.subr
+
+dummymbuf_init()
+{
+   if ! kldstat -q -m dummymbuf; then
+   atf_skip "This test requires dummymbuf"
+   fi
+}
+
+atf_test_case "inet_in_mbuf_len" "cleanup"
+inet_in_mbuf_len_head()
+{
+   atf_set descr 'Test that pf can handle inbound with the first mbuf with 
m_len < sizeof(struct ip)'
+   atf_set require.user root
+}
+inet_in_mbuf_len_body()
+{
+   pft_init
+   dummymbuf_init
+
+   epair=$(vnet_mkepair)
+   ifconfig ${epair}a 192.0.2.1/24 up
+
+   # Set up a simple jail with one interface
+   vnet_mkjail alcatraz ${epair}b
+   jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up
+
+   # Sanity check
+   atf_check -s exit:0 -o ignore ping -c1 192.0.2.2
+
+   # Should be denied
+   jexec alcatraz pfctl -e
+   pft_set_rules alcatraz \
+   "block"
+   atf_check -s not-exit:0 -o ignore ping -c1 -t1 192.0.2.2
+
+   # Should be allowed by from/to addresses
+   pft_set_rules alcatraz \
+   "block" \
+   "pass in from 192.0.2.1 to 192.0.2.2"
+   atf_check -s exit:0 -o ignore ping -c1 192.0.2.2
+
+   # Should still work for m_len=0
+   jexec alcatraz pfilctl link -i dummymbuf:inet inet
+   jexec alcatraz sysctl net.dummymbuf.rules="inet in ${epair}b pull-head 
0;"
+   atf_check_equal "0" "$(jexec alcatraz sysctl -n net.dummymbuf.hits)"
+   atf_check -s exit:0 -o ignore ping -c1 192.0.2.2
+   atf_check_equal "1" "$(jexec alcatraz sysctl -n net.dummymbuf.hits)"
+
+   # m_len=1
+   jexec alcatraz sysctl net.dummymbuf.rules="inet in ${epair}b pull-head 
1;"
+   jexec alcatraz sysctl net.dummymbuf.hits=0
+   atf_check -s exit:0 -o ignore ping -c1 192.0.2.2
+   atf_check_equal "1" "$(jexec alcatraz sysctl -n net.dummymbuf.hits)"
+
+   # m_len=19
+   # provided IPv4 basic header is 20 bytes long, it should impact the dst 
addr
+   jexec alcatraz sysctl net.dummymbuf.rules="inet in ${epair}b pull-head 
19;"
+   jexec alcatraz sysctl net.dummymbuf.hits=0
+   atf_check -s exit:0 -o ignore ping -c1 192.0.2.2
+   atf_check_equal "1" "$(jexec alcatraz sysctl -n net.dummymbuf.hits)"
+}
+inet_in_mbuf_len_cleanup()
+{
+   pft_cleanup
+}
+
+atf_init_test_cases()
+{
+   atf_add_test_case "inet_in_mbuf_len"
+}



git: 6c479edc6164 - main - pf: Fix indentation in struct pf_ksrc_node

2024-08-15 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6c479edc6164fec696c534962bdda04fe21437e3

commit 6c479edc6164fec696c534962bdda04fe21437e3
Author: Kajetan Staszkiewicz 
AuthorDate: 2024-08-15 07:35:41 +
Commit: Kristof Provost 
CommitDate: 2024-08-15 07:36:18 +

pf: Fix indentation in struct pf_ksrc_node

This is a purely cosmetic change to simplify future diffs.

Reviewed by:kp
Differential Revision:  https://reviews.freebsd.org/D46298
---
 sys/net/pfvar.h | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index eecd61f960c8..eeded1e900a6 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -884,21 +884,21 @@ SLIST_HEAD(pf_krule_slist, pf_krule_item);
 
 struct pf_ksrc_node {
LIST_ENTRY(pf_ksrc_node) entry;
-   struct pf_addr   addr;
-   struct pf_addr   raddr;
+   struct pf_addr   addr;
+   struct pf_addr   raddr;
struct pf_krule_slistmatch_rules;
-   union pf_krule_ptr rule;
-   struct pfi_kkif *rkif;
-   counter_u64_tbytes[2];
-   counter_u64_tpackets[2];
-   u_int32_tstates;
-   u_int32_tconn;
-   struct pf_threshold conn_rate;
-   u_int32_tcreation;
-   u_int32_texpire;
-   sa_family_t  af;
-   u_int8_t ruletype;
-   struct mtx  *lock;
+   union pf_krule_ptr   rule;
+   struct pfi_kkif *rkif;
+   counter_u64_tbytes[2];
+   counter_u64_tpackets[2];
+   u_int32_tstates;
+   u_int32_tconn;
+   struct pf_threshold  conn_rate;
+   u_int32_tcreation;
+   u_int32_texpire;
+   sa_family_t  af;
+   u_int8_t ruletype;
+   struct mtx  *lock;
 };
 #endif
 



git: 1fc0dac54cb4 - main - pf: Convert struct pf_addr_wrap before sending it over netlink

2024-08-15 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1fc0dac54cb444d6c22102d7bbc23545de459e0f

commit 1fc0dac54cb444d6c22102d7bbc23545de459e0f
Author: Kajetan Staszkiewicz 
AuthorDate: 2024-08-15 09:07:27 +
Commit: Kristof Provost 
CommitDate: 2024-08-15 09:11:59 +

pf: Convert struct pf_addr_wrap before sending it over netlink

The struct pf_addr_wrap when used inside of kernel operates on pointers to
tables or interfaces. When reading a ruleset the struct must contain
counters calculated from the aforementioned tables and interfaces. Both the
pointers and the resulting counters are stored in an union and thus can't be
present in the struct at the same time.

The original ioctl code handles this by making a copy of struct pf_addr_wrap
for pool addresses, accessing the table or interface structures by their
pointers, calculating the counter values and storing them in place of those
pointers in the copy. Then this copy is sent over ioctl.

Use this mechanism for netlink too. Create a copy of src/dst addresses. Use
the existing function pf_addr_copyout() to convert pointers to counters both
for src/dst and pool addresses.

Reviewed by:kp
Differential Revision:  https://reviews.freebsd.org/D46291
---
 sys/net/pfvar.h   |  1 +
 sys/netpfil/pf/pf_ioctl.c |  3 +--
 sys/netpfil/pf/pf_nl.c| 23 +++
 3 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index eeded1e900a6..863883c2d61e 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -2533,6 +2533,7 @@ intpf_ioctl_get_addr(struct 
pfioc_pooladdr *);
 
 voidpf_krule_free(struct pf_krule *);
 voidpf_krule_clear_counters(struct pf_krule *);
+voidpf_addr_copyout(struct pf_addr_wrap *);
 #endif
 
 /* The fingerprint functions can be linked into userland programs (tcpdump) */
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index 959ebdf94cd4..5467ebbed2eb 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -129,7 +129,6 @@ static void  pf_hash_rule_addr(MD5_CTX *, struct 
pf_rule_addr *);
 static int  pf_commit_rules(u_int32_t, int, char *);
 static int  pf_addr_setup(struct pf_kruleset *,
struct pf_addr_wrap *, sa_family_t);
-static void pf_addr_copyout(struct pf_addr_wrap *);
 static void pf_src_node_copy(const struct pf_ksrc_node *,
struct pf_src_node *);
 #ifdef ALTQ
@@ -1525,7 +1524,7 @@ pf_addr_setup(struct pf_kruleset *ruleset, struct 
pf_addr_wrap *addr,
return (error);
 }
 
-static void
+void
 pf_addr_copyout(struct pf_addr_wrap *addr)
 {
 
diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c
index 060cd5e39852..6e752159b4bd 100644
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -416,7 +416,6 @@ static bool
 nlattr_add_addr_wrap(struct nl_writer *nw, int attrtype, struct pf_addr_wrap 
*a)
 {
int off = nlattr_add_nested(nw, attrtype);
-   int num;
 
nlattr_add_in6_addr(nw, PF_AT_ADDR, &a->v.a.addr.v6);
nlattr_add_in6_addr(nw, PF_AT_MASK, &a->v.a.mask.v6);
@@ -425,22 +424,10 @@ nlattr_add_addr_wrap(struct nl_writer *nw, int attrtype, 
struct pf_addr_wrap *a)
 
if (a->type == PF_ADDR_DYNIFTL) {
nlattr_add_string(nw, PF_AT_IFNAME, a->v.ifname);
-   num = 0;
-   if (a->p.dyn != NULL)
-   num = a->p.dyn->pfid_acnt4 + a->p.dyn->pfid_acnt6;
-   nlattr_add_u32(nw, PF_AT_DYNCNT, num);
+   nlattr_add_u32(nw, PF_AT_DYNCNT, a->p.dyncnt);
} else if (a->type == PF_ADDR_TABLE) {
-   struct pfr_ktable *kt;
-
nlattr_add_string(nw, PF_AT_TABLENAME, a->v.tblname);
-   num = -1;
-   kt = a->p.tbl;
-   if ((kt->pfrkt_flags & PFR_TFLAG_ACTIVE) &&
-   kt->pfrkt_root != NULL)
-   kt = kt->pfrkt_root;
-   if (kt->pfrkt_flags & PFR_TFLAG_ACTIVE)
-   num = kt->pfrkt_cnt;
-   nlattr_add_u32(nw, PF_AT_TBLCNT, num);
+   nlattr_add_u32(nw, PF_AT_TBLCNT, a->p.tblcnt);
}
 
nlattr_set_len(nw, off);
@@ -462,9 +449,13 @@ NL_DECLARE_ATTR_PARSER(rule_addr_parser, nla_p_ruleaddr);
 static bool
 nlattr_add_rule_addr(struct nl_writer *nw, int attrtype, struct pf_rule_addr 
*r)
 {
+   struct pf_addr_wrap aw = {0};
int off = nlattr_add_nested(nw, attrtype);
 
-   nlattr_add_addr_wrap(nw, PF_RAT_ADDR, &r->addr);
+   bcopy(&(r->addr), &aw, sizeof(struct pf_addr_wrap));
+   pf_addr_copyout(&aw);
+
+   nlattr_add_addr_wrap(nw, PF_RAT_ADDR, &aw);
nlattr_add_u16(nw, PF_RAT_SRC_PORT, r->port[0]);
nlattr_add_

git: 9aeee9486a07 - main - pf tests: basic test for sticky-address configuration on rules

2024-08-15 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9aeee9486a07078698d65f254d7b414abd96cfff

commit 9aeee9486a07078698d65f254d7b414abd96cfff
Author: Kristof Provost 
AuthorDate: 2024-08-15 09:10:09 +
Commit: Kristof Provost 
CommitDate: 2024-08-15 09:11:59 +

pf tests: basic test for sticky-address configuration on rules

There was a bug in pf_handle_get_addr() where it confused the counter and
pointer in the pf_addr_wrap.p union, causing panics. Test for this.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/route_to.sh | 25 +
 1 file changed, 25 insertions(+)

diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh
index 5f47cea39b01..305ca4c8eddd 100644
--- a/tests/sys/netpfil/pf/route_to.sh
+++ b/tests/sys/netpfil/pf/route_to.sh
@@ -786,6 +786,30 @@ dummynet_double_cleanup()
pft_cleanup
 }
 
+atf_test_case "sticky" "cleanup"
+sticky_head()
+{
+   atf_set descr 'Set and retrieve a rule with sticky-address'
+   atf_set require.user root
+}
+
+sticky_body()
+{
+   pft_init
+
+   vnet_mkjail alcatraz
+
+   pft_set_rules alcatraz \
+   "pass in quick log on n_test_h_rtr route-to (n_srv_h_rtr 
) sticky-address from any to  keep state"
+
+   jexec alcatraz pfctl -qvvsr
+}
+
+sticky_cleanup()
+{
+   pft_cleanup
+}
+
 atf_init_test_cases()
 {
atf_add_test_case "v4"
@@ -802,4 +826,5 @@ atf_init_test_cases()
atf_add_test_case "ifbound_reply_to_rdr_dummynet"
atf_add_test_case "dummynet_frag"
atf_add_test_case "dummynet_double"
+   atf_add_test_case "sticky"
 }



git: 29dc93491496 - main - zfs: merge openzfs/zfs@d2ccc2155

2024-08-15 Thread Martin Matuska
The branch main has been updated by mm:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=29dc9349149657d6f00f1f5fc3ade589525e0d38

commit 29dc9349149657d6f00f1f5fc3ade589525e0d38
Merge: 9aeee9486a07 d2ccc2155217
Author: Martin Matuska 
AuthorDate: 2024-08-15 11:24:01 +
Commit: Martin Matuska 
CommitDate: 2024-08-15 11:30:31 +

zfs: merge openzfs/zfs@d2ccc2155

Notable upstream pull request merges:
 #16431 244ea5c48 Add missing kstats to dataset kstats

Obtained from:  OpenZFS
OpenZFS commit: d2ccc2155217bfdd7e19db4480d981a8f3fad46f

 sys/contrib/openzfs/config/kernel-blk-queue.m4 | 28 +++
 .../openzfs/config/kernel-make-request-fn.m4   | 21 ++
 sys/contrib/openzfs/config/kernel-mm-page-size.m4  | 17 -
 sys/contrib/openzfs/config/kernel-mm-pagemap.m4| 36 +
 .../openzfs/config/kernel-register_sysctl_table.m4 | 59 +++
 sys/contrib/openzfs/config/kernel.m4   |  6 ++
 .../include/os/linux/kernel/linux/blkdev_compat.h  | 35 +
 .../include/os/linux/kernel/linux/mm_compat.h  |  7 ++
 sys/contrib/openzfs/module/os/linux/spl/spl-proc.c | 53 --
 .../openzfs/module/os/linux/zfs/zfs_vnops_os.c | 29 ++--
 sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c  | 85 +-
 .../functional/alloc_class/alloc_class.kshlib  |  2 +-
 .../block_cloning/block_cloning_rlimit_fsize.ksh   |  2 +-
 .../functional/fault/suspend_resume_single.ksh |  2 +-
 .../upgrade/upgrade_projectquota_001_pos.ksh   | 19 -
 sys/modules/zfs/zfs_config.h   | 19 -
 sys/modules/zfs/zfs_gitrev.h   |  2 +-
 17 files changed, 350 insertions(+), 72 deletions(-)

diff --cc sys/contrib/openzfs/config/kernel-mm-pagemap.m4
index ,466b6fa07d9a..466b6fa07d9a
mode 00,100644..100644
--- a/sys/contrib/openzfs/config/kernel-mm-pagemap.m4
+++ b/sys/contrib/openzfs/config/kernel-mm-pagemap.m4
diff --cc sys/modules/zfs/zfs_config.h
index 631c83fe8bab,..2508de5421df
mode 100644,00..100644
--- a/sys/modules/zfs/zfs_config.h
+++ b/sys/modules/zfs/zfs_config.h
@@@ -1,1239 -1,0 +1,1254 @@@
 +/*
 + */
 +
 +/* zfs_config.h.  Generated from zfs_config.h.in by configure.  */
 +/* zfs_config.h.in.  Generated from configure.ac by autoheader.  */
 +
 +/* Define to 1 if translation of program messages to the user's native
 +   language is requested. */
 +/* #undef ENABLE_NLS */
 +
 +/* bio_end_io_t wants 1 arg */
 +/* #undef HAVE_1ARG_BIO_END_IO_T */
 +
 +/* lookup_bdev() wants 1 arg */
 +/* #undef HAVE_1ARG_LOOKUP_BDEV */
 +
 +/* submit_bio() wants 1 arg */
 +/* #undef HAVE_1ARG_SUBMIT_BIO */
 +
 +/* bdi_setup_and_register() wants 2 args */
 +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */
 +
 +/* vfs_getattr wants 2 args */
 +/* #undef HAVE_2ARGS_VFS_GETATTR */
 +
 +/* zlib_deflate_workspacesize() wants 2 args */
 +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */
 +
 +/* bdi_setup_and_register() wants 3 args */
 +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */
 +
 +/* vfs_getattr wants 3 args */
 +/* #undef HAVE_3ARGS_VFS_GETATTR */
 +
 +/* vfs_getattr wants 4 args */
 +/* #undef HAVE_4ARGS_VFS_GETATTR */
 +
 +/* kernel has access_ok with 'type' parameter */
 +/* #undef HAVE_ACCESS_OK_TYPE */
 +
 +/* posix_acl has refcount_t */
 +/* #undef HAVE_ACL_REFCOUNT */
 +
 +/* add_disk() returns int */
 +/* #undef HAVE_ADD_DISK_RET */
 +
 +/* Define if host toolchain supports AES */
 +#define HAVE_AES 1
 +
 +/* Define if you have [rt] */
 +#define HAVE_AIO_H 1
 +
 +#ifdef __amd64__
 +#ifndef RESCUE
 +/* Define if host toolchain supports AVX */
 +#define HAVE_AVX 1
 +#endif
 +
 +/* Define if host toolchain supports AVX2 */
 +#define HAVE_AVX2 1
 +
 +/* Define if host toolchain supports AVX512BW */
 +#define HAVE_AVX512BW 1
 +
 +/* Define if host toolchain supports AVX512CD */
 +#define HAVE_AVX512CD 1
 +
 +/* Define if host toolchain supports AVX512DQ */
 +#define HAVE_AVX512DQ 1
 +
 +/* Define if host toolchain supports AVX512ER */
 +#define HAVE_AVX512ER 1
 +
 +/* Define if host toolchain supports AVX512F */
 +#define HAVE_AVX512F 1
 +
 +/* Define if host toolchain supports AVX512IFMA */
 +#define HAVE_AVX512IFMA 1
 +
 +/* Define if host toolchain supports AVX512PF */
 +#define HAVE_AVX512PF 1
 +
 +/* Define if host toolchain supports AVX512VBMI */
 +#define HAVE_AVX512VBMI 1
 +
 +/* Define if host toolchain supports AVX512VL */
 +#define HAVE_AVX512VL 1
 +#endif
 +
 +/* backtrace() is available */
 +/* #undef HAVE_BACKTRACE */
 +
 +/* bdevname() is available */
 +/* #undef HAVE_BDEVNAME */
 +
 +/* bdev_check_media_change() exists */
 +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */
 +
 +/* bdev_file_open_by_path() exists */
 +/* #undef HAVE_BDEV_FILE_OPEN_BY_PATH */
 +
 +/* bdev_*_io_acct() available */
 +/* #undef HAVE_BDEV_IO_ACCT_63 */
 +
 +/* bdev_*_io_acct() available */
 +/* #undef HAVE_BDEV_IO_ACCT_OLD */
 +
 +/* bdev_kobj() exists */
 +/* #undef HAVE_BDEV_

git: 8cc528c682d7 - main - tcp cc: clean up some un-used cc_var flags

2024-08-15 Thread Cheng Cui
The branch main has been updated by cc:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8cc528c682d7560303415c18274f151e415658f1

commit 8cc528c682d7560303415c18274f151e415658f1
Author: Cheng Cui 
AuthorDate: 2024-08-14 19:30:10 +
Commit: Cheng Cui 
CommitDate: 2024-08-15 13:33:04 +

tcp cc: clean up some un-used cc_var flags

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D46299
---
 sys/netinet/cc/cc.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/netinet/cc/cc.h b/sys/netinet/cc/cc.h
index 63381f4b5ca3..d78c61bde2fe 100644
--- a/sys/netinet/cc/cc.h
+++ b/sys/netinet/cc/cc.h
@@ -104,10 +104,10 @@ struct cc_var {
 #defineCCF_ACKNOW  0x0008  /* Will this ack be sent now? */
 #defineCCF_IPHDR_CE0x0010  /* Does this packet set CE bit? 
*/
 #defineCCF_TCPHDR_CWR  0x0020  /* Does this packet set CWR 
bit? */
-#defineCCF_MAX_CWND0x0040  /* Have we reached maximum 
cwnd? */
-#defineCCF_CHG_MAX_CWND0x0080  /* CUBIC max_cwnd changed, for 
K */
-#defineCCF_USR_IWND0x0100  /* User specified initial 
window */
-#defineCCF_USR_IWND_INIT_NSEG  0x0200  /* Convert segs to bytes on 
conn init */
+#defineCCF_UNUSED1 0x0040
+#defineCCF_UNUSED2 0x0080
+#defineCCF_UNUSED3 0x0100
+#defineCCF_UNUSED4 0x0200
 #define CCF_HYSTART_ALLOWED0x0400  /* If the CC supports it Hystart is 
allowed */
 #define CCF_HYSTART_CAN_SH_CWND0x0800  /* Can hystart when going CSS 
-> CA slam the cwnd */
 #define CCF_HYSTART_CONS_SSTH  0x1000  /* Should hystart use the more 
conservative ssthresh */



git: bef079254f3d - main - arm64: Clamp segment sizes properly in bounce_bus_dmamap_load_buffer()

2024-08-15 Thread Mark Johnston
The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bef079254f3dcf443a61b4c2605cc6e2dcaf043f

commit bef079254f3dcf443a61b4c2605cc6e2dcaf043f
Author: Mark Johnston 
AuthorDate: 2024-08-15 14:17:40 +
Commit: Mark Johnston 
CommitDate: 2024-08-15 14:19:22 +

arm64: Clamp segment sizes properly in bounce_bus_dmamap_load_buffer()

Commit 099b59515499 ("Improve loading of multipage aligned buffers.")
modified bounce_bus_dmamap_load_buffer() with the assumption that busdma
memory allocations are physically contiguous, which is not always true:
bounce_bus_dmamem_alloc() will allocate memory with
kmem_alloc_attr_domainset() in some cases, and this function is not
guaranteed to return contiguous memory.

The damage seems to have been mitigated for most consumers by clamping
the segment size to maxsegsz, but this was removed in commit
a77e1f0f81df ("busdma: better handling of small segment bouncing"); in
practice, it seems busdma memory is often allocated with maxsegsz ==
PAGE_SIZE.  In particular, after commit a77e1f0f81df I see occasional
random kernel memory corruption when benchmarking TCP through mlx5
interfaces.

Fix the problem by using separate flags for contiguous and
non-contiguous busdma memory allocations, and using that to decide
whether to clamp.

Fixes:  099b59515499 ("Improve loading of multipage aligned buffers.")
Fixes:  a77e1f0f81df ("busdma: better handling of small segment bouncing")
Sponsored by:   Klara, Inc.
Sponsored by:   Stormshield
Differential Revision:  https://reviews.freebsd.org/D46238
---
 sys/arm64/arm64/busdma_bounce.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c
index da605d4e21f5..abfd5c195857 100644
--- a/sys/arm64/arm64/busdma_bounce.c
+++ b/sys/arm64/arm64/busdma_bounce.c
@@ -63,7 +63,9 @@
 enum {
BF_COULD_BOUNCE = 0x01,
BF_MIN_ALLOC_COMP   = 0x02,
-   BF_KMEM_ALLOC   = 0x04,
+   BF_KMEM_ALLOC_PAGES = 0x04,
+   BF_KMEM_ALLOC_CONTIG= 0x08,
+   BF_KMEM_ALLOC   = BF_KMEM_ALLOC_PAGES | BF_KMEM_ALLOC_CONTIG,
BF_COHERENT = 0x10,
 };
 
@@ -580,14 +582,14 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, 
int flags,
*vaddr = kmem_alloc_attr_domainset(
DOMAINSET_PREF(dmat->common.domain), dmat->alloc_size,
mflags, 0ul, dmat->common.lowaddr, attr);
-   dmat->bounce_flags |= BF_KMEM_ALLOC;
+   dmat->bounce_flags |= BF_KMEM_ALLOC_PAGES;
} else {
*vaddr = kmem_alloc_contig_domainset(
DOMAINSET_PREF(dmat->common.domain), dmat->alloc_size,
mflags, 0ul, dmat->common.lowaddr,
dmat->alloc_alignment != 0 ? dmat->alloc_alignment : 1ul,
dmat->common.boundary, attr);
-   dmat->bounce_flags |= BF_KMEM_ALLOC;
+   dmat->bounce_flags |= BF_KMEM_ALLOC_CONTIG;
}
if (*vaddr == NULL) {
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
@@ -856,7 +858,8 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, 
bus_dmamap_t map, void *buf,
 * Compute the segment size, and adjust counts.
 */
sgsize = buflen;
-   if ((map->flags & DMAMAP_FROM_DMAMEM) == 0)
+   if ((map->flags & DMAMAP_FROM_DMAMEM) == 0 ||
+   (dmat->bounce_flags & BF_KMEM_ALLOC_CONTIG) == 0)
sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK));
 
if (map->pagesneeded != 0 &&



git: ef9fc9609a1f - main - sys: Mark ACL conversion routines as __result_use_check

2024-08-15 Thread Ed Maste
The branch main has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ef9fc9609a1ff53047577aa7cf51246fc04c954b

commit ef9fc9609a1ff53047577aa7cf51246fc04c954b
Author: Pierre Pronchery 
AuthorDate: 2024-08-09 17:37:38 +
Commit: Ed Maste 
CommitDate: 2024-08-15 19:04:29 +

sys: Mark ACL conversion routines as __result_use_check

Both acl_copy_oldacl_into_acl() and acl_copy_acl_into_oldacl() may fail
in some circumstances (e.g., acl.acl_cnt exceeding the capacity of
OLDACL_MAX_ENTRIES).  This change marks both routines with
__result_use_check, enforcing check for errors by the caller.

Suggested by:   markj
Reviewed by:markj, emaste
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46254
---
 sys/sys/acl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/sys/acl.h b/sys/sys/acl.h
index c119cfabef32..d4770667fcf5 100644
--- a/sys/sys/acl.h
+++ b/sys/sys/acl.h
@@ -309,9 +309,9 @@ voidacl_nfs4_compute_inherited_acl(
const struct acl *parent_aclp,
struct acl *child_aclp, mode_t mode,
int file_owner_id, int is_directory);
-intacl_copy_oldacl_into_acl(const struct oldacl *source,
+int __result_use_check acl_copy_oldacl_into_acl(const struct oldacl *source,
struct acl *dest);
-intacl_copy_acl_into_oldacl(const struct acl *source,
+int __result_use_check acl_copy_acl_into_oldacl(const struct acl *source,
struct oldacl *dest);
 
 /*



git: 3cded0592208 - main - tmpfs: Fix OOB write when setting vfs.tmpfs.memory_percent

2024-08-15 Thread Jessica Clarke
The branch main has been updated by jrtc27:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3cded0592208b465761af6db5b7b7c21cb5b28c3

commit 3cded0592208b465761af6db5b7b7c21cb5b28c3
Author: Jessica Clarke 
AuthorDate: 2024-08-15 19:33:22 +
Commit: Jessica Clarke 
CommitDate: 2024-08-15 19:33:22 +

tmpfs: Fix OOB write when setting vfs.tmpfs.memory_percent

tmpfs_mem_percent is an int not a long, so on a 64-bit system this
writes 4 bytes past the end of the variable. The read above is correct,
so this was likely a copy paste error from sysctl_mem_reserved.

Found by:   CHERI
Fixes:  636592343c3e ("tmpfs: increase memory reserve to a percent 
of available memory + swap")
---
 sys/fs/tmpfs/tmpfs_subr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 3f74c383a171..a5eb865f2996 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -428,7 +428,7 @@ sysctl_mem_percent(SYSCTL_HANDLER_ARGS)
if ((unsigned) percent > 100)
return (EINVAL);
 
-   *(long *)arg1 = percent;
+   *(int *)arg1 = percent;
tmpfs_set_reserve_from_percent();
return (0);
 }



Re: git: b7ab6832cd98 - main - cat: disable building it with Casper

2024-08-15 Thread Alan Somers
According to the comment, this change was supposed to be temporary.
But it's been in place for 3.5 years.  Can it be reverted now?

On Sat, Jan 16, 2021 at 6:07 PM Mariusz Zaborski  wrote:
>
> Hello,
>
> Seems like your cat.o wasn't rebuild.
> Did you use NO_CLEAN flag?
> It seems to work on:
> https://github.com/freebsd/freebsd-src/runs/1715237892 and on my
> machine.
>
> Can you try doing:
> make buildenv
> cd bin/cat
> make clean
> make
>
> Thanks,
> Mariusz
>
> On Sun, 17 Jan 2021 at 01:58, Cy Schubert  wrote:
> >
> > In message <202101170021.10h0lzek066...@gitrepo.freebsd.org>, Mariusz
> > Zaborski
> > writes:
> > > The branch main has been updated by oshogbo:
> > >
> > > URL: 
> > > https://cgit.FreeBSD.org/src/commit/?id=b7ab6832cd988aff7f4e468e507c314d
> > > d7641638
> > >
> > > commit b7ab6832cd988aff7f4e468e507c314dd7641638
> > > Author: Mariusz Zaborski 
> > > AuthorDate: 2021-01-17 00:04:28 +
> > > Commit: Mariusz Zaborski 
> > > CommitDate: 2021-01-17 00:21:46 +
> > >
> > > cat: disable building it with Casper
> > >
> > > We want to measure what are the actual cost of sandboxing cat(1).
> > >
> > > Requested by:   mjg, cy, Mike Karels
> > > Discussed with: rwatson, markj
> > > ---
> > >  bin/cat/Makefile | 13 +++--
> > >  1 file changed, 7 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/bin/cat/Makefile b/bin/cat/Makefile
> > > index abfdcbcfbb2e..cce69d8aad9e 100644
> > > --- a/bin/cat/Makefile
> > > +++ b/bin/cat/Makefile
> > > @@ -15,11 +15,12 @@ CFLAGS+=-DBOOTSTRAP_CAT
> > >  HAS_TESTS=
> > >  SUBDIR.${MK_TESTS}+= tests
> > >
> > > -.if ${MK_CASPER} != "no" && !defined(RESCUE) && !defined(BOOTSTRAPPING)
> > > -LIBADD+=casper
> > > -LIBADD+=cap_fileargs
> > > -LIBADD+=cap_net
> > > -CFLAGS+=-DWITH_CASPER
> > > -.endif
> > > +# Temporary disable building cat with Casper.
> > > +#.if ${MK_CASPER} != "no" && !defined(RESCUE) && !defined(BOOTSTRAPPING)
> > > +#LIBADD+=casper
> > > +#LIBADD+=cap_fileargs
> > > +#LIBADD+=cap_net
> > > +#CFLAGS+=-DWITH_CASPER
> > > +#.endif
> > >
> > >  .include 
> > >
> >
> > Hi,
> >
> > Almost there.
> >
> > ld: error: undefined symbol: cap_init
> > >>> referenced by cat.c:154 (/opt/src/git-src/bin/cat/cat.c:154)
> > >>>   cat.o:(main)
> >
> > ld: error: undefined symbol: fileargs_cinit
> > >>> referenced by cat.c:158 (/opt/src/git-src/bin/cat/cat.c:158)
> > >>>   cat.o:(main)
> >
> > ld: error: undefined symbol: cap_service_open
> > >>> referenced by cat.c:131 (/opt/src/git-src/bin/cat/cat.c:131)
> > >>>   cat.o:(main)
> >
> > ld: error: undefined symbol: cap_net_limit_init
> > >>> referenced by cat.c:135 (/opt/src/git-src/bin/cat/cat.c:135)
> > >>>   cat.o:(main)
> >
> > ld: error: undefined symbol: cap_net_limit_name2addr_family
> > >>> referenced by cat.c:141 (/opt/src/git-src/bin/cat/cat.c:141)
> > >>>   cat.o:(main)
> > --- all_subdir_kerberos5 ---
> > --- libheimntlm.so.11.debug ---
> > objcopy --only-keep-debug libheimntlm.so.11.full libheimntlm.so.11.debug
> > --- libheimntlm.so.11 ---
> > objcopy --strip-debug --add-gnu-debuglink=libheimntlm.so.11.debug
> > libheimntlm.so.11.full libheimntlm.so.11
> > --- all_subdir_lib ---
> > --- init_test ---
> > (cd /opt/src/git-src/lib/csu/tests/dynamic &&  DEPENDFILE=.depend.init_test
> >  NO_SUBDIR=1 make -f /opt/src/git-src/lib/csu/tests/dynamic/Makefile
> > _RECURSING_PROGS=t  PROG=init_test )
> > --- all_subdir_bin ---
> > ld: error: undefined symbol: cap_net_limit
> > >>> referenced by cat.c:143 (/opt/src/git-src/bin/cat/cat.c:143)
> > >>>   cat.o:(main)
> >
> > ld: error: undefined symbol: cap_close
> > >>> referenced by cat.c:168 (/opt/src/git-src/bin/cat/cat.c:168)
> > >>>   cat.o:(main)
> >
> > ld: error: undefined symbol: fileargs_open
> > >>> referenced by cat.c:263 (/opt/src/git-src/bin/cat/cat.c:263)
> > >>>   cat.o:(scanfiles)
> >
> > ld: error: undefined symbol: fileargs_realpath
> > >>> referenced by cat.c:441 (/opt/src/git-src/bin/cat/cat.c:441)
> > >>>   cat.o:(scanfiles)
> >
> > ld: error: undefined symbol: cap_getaddrinfo
> > >>> referenced by cat.c:444 (/opt/src/git-src/bin/cat/cat.c:444)
> > >>>   cat.o:(scanfiles)
> >
> > ld: error: undefined symbol: cap_connect
> > >>> referenced by cat.c:468 (/opt/src/git-src/bin/cat/cat.c:468)
> > >>>   cat.o:(scanfiles)
> > cc: error: linker command failed with exit code 1 (use -v to see invocation)
> > *** [cat.full] Error code 1
> >
> > make[4]: stopped in /opt/src/git-src/bin/cat
> >
> > make[1]: stopped in /opt/src/git-src
> >
> > make: stopped in /opt/src/git-src
> > exiting RC=2: building amd64
> >
> >
> > --
> > 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.
> >
> >



git: 82cb2a4158fa - main - Update safe_eval.sh to support --export

2024-08-15 Thread Simon J. Gerraty
The branch main has been updated by sjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=82cb2a4158fa79ec230a5ab41a2f61c253e65c0b

commit 82cb2a4158fa79ec230a5ab41a2f61c253e65c0b
Author: Simon J. Gerraty 
AuthorDate: 2024-08-15 22:42:39 +
Commit: Simon J. Gerraty 
CommitDate: 2024-08-15 22:42:39 +

Update safe_eval.sh to support --export

This update allows

safe_dot --export file ...

to export any variables that get set.

Reviewed by: obrien
---
 libexec/rc/safe_eval.sh | 29 -
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/libexec/rc/safe_eval.sh b/libexec/rc/safe_eval.sh
index 10b6ed09c769..0e1410b771cb 100644
--- a/libexec/rc/safe_eval.sh
+++ b/libexec/rc/safe_eval.sh
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: BSD-2-Clause
 
 # RCSid:
-#  $Id: safe_eval.sh,v 1.12 2023/10/12 18:46:53 sjg Exp $
+#  $Id: safe_eval.sh,v 1.16 2024/08/15 02:28:30 sjg Exp $
 #
-#  @(#) Copyright (c) 2023 Simon J. Gerraty
+#  @(#) Copyright (c) 2023-2024 Simon J. Gerraty
 #
 #  This file is provided in the hope that it will
 #  be of use.  There is absolutely NO WARRANTY.
@@ -37,14 +37,33 @@ safe_eval() {
 eval `cat "$@" | safe_set`
 }
 
+##
+# safe_eval_export [file]
+#
+# eval variable assignments only from file
+# taking care to eliminate any shell meta chars
+# export any variables thus set
+#
+safe_eval_export() {
+eval `cat "$@" | safe_set | ${SED:-sed} 's/^\([^=]*\)=.*/&; export \1/'`
+}
+
 ##
 # safe_dot file [...]
 #
 # feed all "file" that exist to safe_eval
 #
 safe_dot() {
-local ef= f
-
+eval ${local:-:} ef ex f
+ef=
+ex=
+while :
+do
+case "$1" in
+--export) ex=_export; shift;;
+*) break;;
+esac
+done
 for f in "$@"
 do
 test -s $f || continue
@@ -52,7 +71,7 @@ safe_dot() {
 dotted="$dotted $f"
 done
 test -z "$ef" && return 1
-safe_eval $ef
+safe_eval$ex $ef
 return 0
 }
 



git: 8b21c469dbd6 - main - ng_ubt: Add blacklist entries for MediaTek MT7925

2024-08-15 Thread Kevin Lo
The branch main has been updated by kevlo:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8b21c469dbd6dd7d7222a726eed33f06162bf04f

commit 8b21c469dbd6dd7d7222a726eed33f06162bf04f
Author: Kevin Lo 
AuthorDate: 2024-08-16 02:03:19 +
Commit: Kevin Lo 
CommitDate: 2024-08-16 02:03:19 +

ng_ubt: Add blacklist entries for MediaTek MT7925

This controller requires firmware patch downloading to operate,
block ng_ubt attachment unless operational firmware is loaded.

Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D46302
---
 sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c 
b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
index 76a71e2f8d53..a63ccae3cc03 100644
--- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
+++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
@@ -443,6 +443,10 @@ static const STRUCT_USB_HOST_ID ubt_ignore_devs[] =
 */
{ USB_VPI(USB_VENDOR_INTEL2, 0x0032, 0) },
{ USB_VPI(USB_VENDOR_INTEL2, 0x0033, 0) },
+
+   /* MediaTek MT7925 */
+   { USB_VPI(USB_VENDOR_AZUREWAVE, 0x3602, 0) },
+   { USB_VPI(USB_VENDOR_AZUREWAVE, 0x3604, 0) },
 };
 
 /* List of supported bluetooth devices */



git: d5507f9e4366 - main - nvme: Separate total failures from I/O failures

2024-08-15 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d5507f9e436698ac17dc5ace7ef58493988a9b04

commit d5507f9e436698ac17dc5ace7ef58493988a9b04
Author: Warner Losh 
AuthorDate: 2024-08-14 22:55:49 +
Commit: Warner Losh 
CommitDate: 2024-08-16 02:22:18 +

nvme: Separate total failures from I/O failures

When it's a I/O failure, we can still send admin commands. Separate out
the admin failures and flag them as such so that we can still send admin
commands on half-failed drives.

Fixes: 9229b3105d88 (nvme: Fail passthrough commands right away in failed 
state)
Sponsored by: Netflix
---
 sys/amd64/conf/IOSCHED |2 +
 sys/amd64/conf/MPI3MR  |   10 +
 sys/arm64/conf/GENERIC16K  |4 +
 .../linuxkpi/common/include/linux/#compiler.h# |  117 +
 sys/contrib/dev/iwlwifi/fw/api/soc.h   |   35 +
 sys/contrib/zlib/contrib/asm686/README.686 |   51 +
 sys/contrib/zlib/contrib/asm686/match.S|  357 +
 sys/dev/ice/ice_sriov.c|  595 ++
 sys/dev/ice/ice_sriov.h|   64 +
 sys/dev/mps/mpi/mpi2_pci.h |  141 +
 sys/dev/nvme/nvme_ctrlr.c  |   46 +-
 sys/dev/nvme/nvme_private.h|1 +
 sys/dev/nvme/nvme_qpair.c  |   23 +-
 sys/dev/nvme/nvme_sim.c|   13 +-
 sys/dev/sound/pci/aureal.c |  686 ++
 sys/dev/sound/pci/aureal.h |   99 +
 sys/dev/sound/pci/ds1-fw.h | 1602 
 sys/dev/sound/pci/ds1.c| 1103 +++
 sys/dev/sound/pci/ds1.h|  146 +
 sys/dev/sound/pci/maestro.c| 2043 +
 sys/dev/sound/pci/maestro_reg.h|  381 +
 sys/kern/bsduser-syscalls.c| 8712 
 sys/modules/sound/driver/ds1/Makefile  |8 +
 sys/modules/sound/driver/maestro/Makefile  |8 +
 24 files changed, 16219 insertions(+), 28 deletions(-)

diff --git a/sys/amd64/conf/IOSCHED b/sys/amd64/conf/IOSCHED
new file mode 100644
index ..e15106bc4c1f
--- /dev/null
+++ b/sys/amd64/conf/IOSCHED
@@ -0,0 +1,2 @@
+include "GENERIC"
+options CAM_IOSCHED_DYNAMIC
diff --git a/sys/amd64/conf/MPI3MR b/sys/amd64/conf/MPI3MR
new file mode 100644
index ..99e5244cb49d
--- /dev/null
+++ b/sys/amd64/conf/MPI3MR
@@ -0,0 +1,10 @@
+include GENERIC
+
+device mpi3mr
+# All the debugging options
+options DEADLKRES # Enable the deadlock resolver
+options INVARIANTS # Enable calls of extra sanity checking
+options INVARIANT_SUPPORT # Extra sanity checks of internal structures, 
required by INVARIANTS
+options QUEUE_MACRO_DEBUG_TRASH # Trash queue(2) internal pointers on 
invalidation
+options WITNESS # Enable checks to detect deadlocks and cycles
+options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
diff --git a/sys/arm64/conf/GENERIC16K b/sys/arm64/conf/GENERIC16K
new file mode 100644
index ..9bf9e2dadb08
--- /dev/null
+++ b/sys/arm64/conf/GENERIC16K
@@ -0,0 +1,4 @@
+include"GENERIC"
+
+ident  GENERIC_16K
+
diff --git a/sys/compat/linuxkpi/common/include/linux/#compiler.h# 
b/sys/compat/linuxkpi/common/include/linux/#compiler.h#
new file mode 100644
index ..1177674aa68f
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/#compiler.h#
@@ -0,0 +1,117 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
+ * Copyright (c) 2015 François Tigeot
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIA

git: a233cb6914e6 - main - nvmecontrol: Accept -a {1,2,3,4} for sanitize command for nvme-cli compat

2024-08-15 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a233cb6914e68252baf143c5f1d6e01e3956e33e

commit a233cb6914e68252baf143c5f1d6e01e3956e33e
Author: Warner Losh 
AuthorDate: 2024-08-15 21:10:17 +
Commit: Warner Losh 
CommitDate: 2024-08-16 02:22:31 +

nvmecontrol: Accept -a {1,2,3,4} for sanitize command for nvme-cli compat

Linux's `nvme sanititze -a` takes a number, not a string. Accept 1-4 for
compatibility so vendor's recepies are easier to implmement.

Sponsored by: Netflix
---
 sbin/nvmecontrol/nvmecontrol.8 | 10 ++
 sbin/nvmecontrol/sanitize.c|  5 -
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8
index 713fcf092d64..cb3e8aa9080f 100644
--- a/sbin/nvmecontrol/nvmecontrol.8
+++ b/sbin/nvmecontrol/nvmecontrol.8
@@ -572,6 +572,16 @@ A failed sanitize operation can only be exited if it was
 run in the unrestricted completion mode, as provided by the
 .Fl U
 argument.
+.It 1, 2, 3, 4
+nvme-cli compatible
+.Fl a
+values for
+.Dq exitfailure ,
+.Dq block ,
+.Dq overwrite ,
+and
+.Dq crypto
+respectively.
 .El
 .It Fl c Ar passes
 The number of passes when performing an
diff --git a/sbin/nvmecontrol/sanitize.c b/sbin/nvmecontrol/sanitize.c
index ba89e138db83..e720c6d43497 100644
--- a/sbin/nvmecontrol/sanitize.c
+++ b/sbin/nvmecontrol/sanitize.c
@@ -130,8 +130,11 @@ sanitize(const struct cmd *f, int argc, char *argv[])
sanact = 3;
else if (strcmp(opt.sanact, "crypto") == 0)
sanact = 4;
+   else if ((sanact = (int)strtol(opt.sanact, NULL, 10) != 0)
+   && (sanact >= 1 && sanact <= 4))
+   ; /* compat with nvme sanitize -a number */
else {
-   fprintf(stderr, "Incorrect Sanitize Action value\n");
+   fprintf(stderr, "Incorrect Sanitize Action value: 
%s\n", opt.sanact);
arg_help(argc, argv, f);
}
}



Re: git: d5507f9e4366 - main - nvme: Separate total failures from I/O failures

2024-08-15 Thread Zhenlei Huang
Hi Warner,

I'm not sure but this change seems include lots of unintended changes ( maybe 
some local WIP ) .

> On Aug 16, 2024, at 10:30 AM, Warner Losh  wrote:
> 
> The branch main has been updated by imp:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=d5507f9e436698ac17dc5ace7ef58493988a9b04
> 
> commit d5507f9e436698ac17dc5ace7ef58493988a9b04
> Author: Warner Losh 
> AuthorDate: 2024-08-14 22:55:49 +
> Commit: Warner Losh 
> CommitDate: 2024-08-16 02:22:18 +
> 
>nvme: Separate total failures from I/O failures
> 
>When it's a I/O failure, we can still send admin commands. Separate out
>the admin failures and flag them as such so that we can still send admin
>commands on half-failed drives.
> 
>Fixes: 9229b3105d88 (nvme: Fail passthrough commands right away in failed 
> state)
>Sponsored by: Netflix
> ---
> sys/amd64/conf/IOSCHED |2 +
> sys/amd64/conf/MPI3MR  |   10 +
> sys/arm64/conf/GENERIC16K  |4 +
> .../linuxkpi/common/include/linux/#compiler.h# |  117 +
> sys/contrib/dev/iwlwifi/fw/api/soc.h   |   35 +
> sys/contrib/zlib/contrib/asm686/README.686 |   51 +
> sys/contrib/zlib/contrib/asm686/match.S|  357 +
> sys/dev/ice/ice_sriov.c|  595 ++
> sys/dev/ice/ice_sriov.h|   64 +
> sys/dev/mps/mpi/mpi2_pci.h |  141 +
> sys/dev/nvme/nvme_ctrlr.c  |   46 +-
> sys/dev/nvme/nvme_private.h|1 +
> sys/dev/nvme/nvme_qpair.c  |   23 +-
> sys/dev/nvme/nvme_sim.c|   13 +-
> sys/dev/sound/pci/aureal.c |  686 ++
> sys/dev/sound/pci/aureal.h |   99 +
> sys/dev/sound/pci/ds1-fw.h | 1602 
> sys/dev/sound/pci/ds1.c| 1103 +++
> sys/dev/sound/pci/ds1.h|  146 +
> sys/dev/sound/pci/maestro.c| 2043 +
> sys/dev/sound/pci/maestro_reg.h|  381 +
> sys/kern/bsduser-syscalls.c| 8712 
> sys/modules/sound/driver/ds1/Makefile  |8 +
> sys/modules/sound/driver/maestro/Makefile  |8 +
> 24 files changed, 16219 insertions(+), 28 deletions(-)
> 
> diff --git a/sys/amd64/conf/IOSCHED b/sys/amd64/conf/IOSCHED
> new file mode 100644
> index ..e15106bc4c1f
> --- /dev/null
> +++ b/sys/amd64/conf/IOSCHED
> @@ -0,0 +1,2 @@
> +include "GENERIC"
> +options CAM_IOSCHED_DYNAMIC
> diff --git a/sys/amd64/conf/MPI3MR b/sys/amd64/conf/MPI3MR
> new file mode 100644
> index ..99e5244cb49d
> --- /dev/null
> +++ b/sys/amd64/conf/MPI3MR
> @@ -0,0 +1,10 @@
> +include GENERIC
> +
> +device mpi3mr
> +# All the debugging options
> +options DEADLKRES # Enable the deadlock resolver
> +options INVARIANTS # Enable calls of extra sanity checking
> +options INVARIANT_SUPPORT # Extra sanity checks of internal structures, 
> required by INVARIANTS
> +options QUEUE_MACRO_DEBUG_TRASH # Trash queue(2) internal pointers on 
> invalidation
> +options WITNESS # Enable checks to detect deadlocks and cycles
> +options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
> diff --git a/sys/arm64/conf/GENERIC16K b/sys/arm64/conf/GENERIC16K
> new file mode 100644
> index ..9bf9e2dadb08
> --- /dev/null
> +++ b/sys/arm64/conf/GENERIC16K
> @@ -0,0 +1,4 @@
> +include  "GENERIC"
> +
> +identGENERIC_16K
> +
> diff --git a/sys/compat/linuxkpi/common/include/linux/#compiler.h# 
> b/sys/compat/linuxkpi/common/include/linux/#compiler.h#
> new file mode 100644
> index ..1177674aa68f
> --- /dev/null
> +++ b/sys/compat/linuxkpi/common/include/linux/#compiler.h#
> @@ -0,0 +1,117 @@
> +/*-
> + * Copyright (c) 2010 Isilon Systems, Inc.
> + * Copyright (c) 2010 iX Systems, Inc.
> + * Copyright (c) 2010 Panasas, Inc.
> + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
> + * Copyright (c) 2015 François Tigeot
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice unmodified, this list of conditions, and the following
> + *disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
>

Re: git: d5507f9e4366 - main - nvme: Separate total failures from I/O failures

2024-08-15 Thread Warner Losh
On Thu, Aug 15, 2024, 9:12 PM Zhenlei Huang  wrote:

> Hi Warner,
>
> I'm not sure but this change seems include lots of unintended changes (
> maybe some local WIP ) .
>

Git am somehow screwed me.  I'll fix.

Warner

> On Aug 16, 2024, at 10:30 AM, Warner Losh  wrote:
> >
> > The branch main has been updated by imp:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=d5507f9e436698ac17dc5ace7ef58493988a9b04
> >
> > commit d5507f9e436698ac17dc5ace7ef58493988a9b04
> > Author: Warner Losh 
> > AuthorDate: 2024-08-14 22:55:49 +
> > Commit: Warner Losh 
> > CommitDate: 2024-08-16 02:22:18 +
> >
> >nvme: Separate total failures from I/O failures
> >
> >When it's a I/O failure, we can still send admin commands. Separate
> out
> >the admin failures and flag them as such so that we can still send
> admin
> >commands on half-failed drives.
> >
> >Fixes: 9229b3105d88 (nvme: Fail passthrough commands right away in
> failed state)
> >Sponsored by: Netflix
> > ---
> > sys/amd64/conf/IOSCHED |2 +
> > sys/amd64/conf/MPI3MR  |   10 +
> > sys/arm64/conf/GENERIC16K  |4 +
> > .../linuxkpi/common/include/linux/#compiler.h# |  117 +
> > sys/contrib/dev/iwlwifi/fw/api/soc.h   |   35 +
> > sys/contrib/zlib/contrib/asm686/README.686 |   51 +
> > sys/contrib/zlib/contrib/asm686/match.S|  357 +
> > sys/dev/ice/ice_sriov.c|  595 ++
> > sys/dev/ice/ice_sriov.h|   64 +
> > sys/dev/mps/mpi/mpi2_pci.h |  141 +
> > sys/dev/nvme/nvme_ctrlr.c  |   46 +-
> > sys/dev/nvme/nvme_private.h|1 +
> > sys/dev/nvme/nvme_qpair.c  |   23 +-
> > sys/dev/nvme/nvme_sim.c|   13 +-
> > sys/dev/sound/pci/aureal.c |  686 ++
> > sys/dev/sound/pci/aureal.h |   99 +
> > sys/dev/sound/pci/ds1-fw.h | 1602 
> > sys/dev/sound/pci/ds1.c| 1103 +++
> > sys/dev/sound/pci/ds1.h|  146 +
> > sys/dev/sound/pci/maestro.c| 2043 +
> > sys/dev/sound/pci/maestro_reg.h|  381 +
> > sys/kern/bsduser-syscalls.c| 8712
> 
> > sys/modules/sound/driver/ds1/Makefile  |8 +
> > sys/modules/sound/driver/maestro/Makefile  |8 +
> > 24 files changed, 16219 insertions(+), 28 deletions(-)
> >
> > diff --git a/sys/amd64/conf/IOSCHED b/sys/amd64/conf/IOSCHED
> > new file mode 100644
> > index ..e15106bc4c1f
> > --- /dev/null
> > +++ b/sys/amd64/conf/IOSCHED
> > @@ -0,0 +1,2 @@
> > +include "GENERIC"
> > +options CAM_IOSCHED_DYNAMIC
> > diff --git a/sys/amd64/conf/MPI3MR b/sys/amd64/conf/MPI3MR
> > new file mode 100644
> > index ..99e5244cb49d
> > --- /dev/null
> > +++ b/sys/amd64/conf/MPI3MR
> > @@ -0,0 +1,10 @@
> > +include GENERIC
> > +
> > +device mpi3mr
> > +# All the debugging options
> > +options DEADLKRES # Enable the deadlock resolver
> > +options INVARIANTS # Enable calls of extra sanity checking
> > +options INVARIANT_SUPPORT # Extra sanity checks of internal structures,
> required by INVARIANTS
> > +options QUEUE_MACRO_DEBUG_TRASH # Trash queue(2) internal pointers on
> invalidation
> > +options WITNESS # Enable checks to detect deadlocks and cycles
> > +options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
> > diff --git a/sys/arm64/conf/GENERIC16K b/sys/arm64/conf/GENERIC16K
> > new file mode 100644
> > index ..9bf9e2dadb08
> > --- /dev/null
> > +++ b/sys/arm64/conf/GENERIC16K
> > @@ -0,0 +1,4 @@
> > +include  "GENERIC"
> > +
> > +identGENERIC_16K
> > +
> > diff --git a/sys/compat/linuxkpi/common/include/linux/#compiler.h#
> b/sys/compat/linuxkpi/common/include/linux/#compiler.h#
> > new file mode 100644
> > index ..1177674aa68f
> > --- /dev/null
> > +++ b/sys/compat/linuxkpi/common/include/linux/#compiler.h#
> > @@ -0,0 +1,117 @@
> > +/*-
> > + * Copyright (c) 2010 Isilon Systems, Inc.
> > + * Copyright (c) 2010 iX Systems, Inc.
> > + * Copyright (c) 2010 Panasas, Inc.
> > + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
> > + * Copyright (c) 2015 François Tigeot
> > + * All rights reserved.
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> > + * 1. Redistributions of source code must retain the above copyright
> > + *notice unmodified, this list of conditions, and the following
> > + *disclaimer.
> > + * 2. Redistributions in binary form must reproduce the above copyright
> > + *notice, this list of conditions and the following disclaimer in
> the
> > + *   

git: ce7fac64ba50 - main - Revert "nvme: Separate total failures from I/O failures"

2024-08-15 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ce7fac64ba508dee27f5fa09780debf09cc2

commit ce7fac64ba508dee27f5fa09780debf09cc2
Author: Warner Losh 
AuthorDate: 2024-08-16 03:29:53 +
Commit: Warner Losh 
CommitDate: 2024-08-16 03:29:53 +

Revert "nvme: Separate total failures from I/O failures"

All kinds of crazy stuff was mixed into this commit. Revert
it and do it again.

This reverts commit d5507f9e436698ac17dc5ace7ef58493988a9b04.

Sponsored by:   Netflix
---
 sys/amd64/conf/IOSCHED |2 -
 sys/amd64/conf/MPI3MR  |   10 -
 sys/arm64/conf/GENERIC16K  |4 -
 .../linuxkpi/common/include/linux/#compiler.h# |  117 -
 sys/contrib/dev/iwlwifi/fw/api/soc.h   |   35 -
 sys/contrib/zlib/contrib/asm686/README.686 |   51 -
 sys/contrib/zlib/contrib/asm686/match.S|  357 -
 sys/dev/ice/ice_sriov.c|  595 --
 sys/dev/ice/ice_sriov.h|   64 -
 sys/dev/mps/mpi/mpi2_pci.h |  141 -
 sys/dev/nvme/nvme_ctrlr.c  |   46 +-
 sys/dev/nvme/nvme_private.h|1 -
 sys/dev/nvme/nvme_qpair.c  |   23 +-
 sys/dev/nvme/nvme_sim.c|   13 +-
 sys/dev/sound/pci/aureal.c |  686 --
 sys/dev/sound/pci/aureal.h |   99 -
 sys/dev/sound/pci/ds1-fw.h | 1602 
 sys/dev/sound/pci/ds1.c| 1103 ---
 sys/dev/sound/pci/ds1.h|  146 -
 sys/dev/sound/pci/maestro.c| 2043 -
 sys/dev/sound/pci/maestro_reg.h|  381 -
 sys/kern/bsduser-syscalls.c| 8712 
 sys/modules/sound/driver/ds1/Makefile  |8 -
 sys/modules/sound/driver/maestro/Makefile  |8 -
 24 files changed, 28 insertions(+), 16219 deletions(-)

diff --git a/sys/amd64/conf/IOSCHED b/sys/amd64/conf/IOSCHED
deleted file mode 100644
index e15106bc4c1f..
--- a/sys/amd64/conf/IOSCHED
+++ /dev/null
@@ -1,2 +0,0 @@
-include "GENERIC"
-options CAM_IOSCHED_DYNAMIC
diff --git a/sys/amd64/conf/MPI3MR b/sys/amd64/conf/MPI3MR
deleted file mode 100644
index 99e5244cb49d..
--- a/sys/amd64/conf/MPI3MR
+++ /dev/null
@@ -1,10 +0,0 @@
-include GENERIC
-
-device mpi3mr
-# All the debugging options
-options DEADLKRES # Enable the deadlock resolver
-options INVARIANTS # Enable calls of extra sanity checking
-options INVARIANT_SUPPORT # Extra sanity checks of internal structures, 
required by INVARIANTS
-options QUEUE_MACRO_DEBUG_TRASH # Trash queue(2) internal pointers on 
invalidation
-options WITNESS # Enable checks to detect deadlocks and cycles
-options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
diff --git a/sys/arm64/conf/GENERIC16K b/sys/arm64/conf/GENERIC16K
deleted file mode 100644
index 9bf9e2dadb08..
--- a/sys/arm64/conf/GENERIC16K
+++ /dev/null
@@ -1,4 +0,0 @@
-include"GENERIC"
-
-ident  GENERIC_16K
-
diff --git a/sys/compat/linuxkpi/common/include/linux/#compiler.h# 
b/sys/compat/linuxkpi/common/include/linux/#compiler.h#
deleted file mode 100644
index 1177674aa68f..
--- a/sys/compat/linuxkpi/common/include/linux/#compiler.h#
+++ /dev/null
@@ -1,117 +0,0 @@
-/*-
- * Copyright (c) 2010 Isilon Systems, Inc.
- * Copyright (c) 2010 iX Systems, Inc.
- * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
- * Copyright (c) 2015 François Tigeot
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice unmodified, this list of conditions, and the following
- *disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF

git: 3d89acf59098 - main - nvme: Separate total failures from I/O failures

2024-08-15 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3d89acf59098cc7a7a118c8aed89e562f686d8ed

commit 3d89acf59098cc7a7a118c8aed89e562f686d8ed
Author: Warner Losh 
AuthorDate: 2024-08-14 22:55:49 +
Commit: Warner Losh 
CommitDate: 2024-08-16 03:31:20 +

nvme: Separate total failures from I/O failures

When it's a I/O failure, we can still send admin commands. Separate out
the admin failures and flag them as such so that we can still send admin
commands on half-failed drives.

Fixes: 9229b3105d88 (nvme: Fail passthrough commands right away in failed 
state)
Sponsored by: Netflix
---
 sys/dev/nvme/nvme_ctrlr.c   | 46 ++---
 sys/dev/nvme/nvme_private.h |  1 +
 sys/dev/nvme/nvme_qpair.c   | 23 +++
 sys/dev/nvme/nvme_sim.c | 13 -
 4 files changed, 55 insertions(+), 28 deletions(-)

diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index 270be61e2d36..4c1a3830aac0 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -232,7 +232,7 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller 
*ctrlr)
 }
 
 static void
-nvme_ctrlr_fail(struct nvme_controller *ctrlr)
+nvme_ctrlr_fail(struct nvme_controller *ctrlr, bool admin_also)
 {
int i;
 
@@ -242,7 +242,10 @@ nvme_ctrlr_fail(struct nvme_controller *ctrlr)
 * a different error, though when we fail, that hardly matters).
 */
ctrlr->is_failed = true;
-   nvme_qpair_fail(&ctrlr->adminq);
+   if (admin_also) {
+   ctrlr->is_failed_admin = true;
+   nvme_qpair_fail(&ctrlr->adminq);
+   }
if (ctrlr->ioq != NULL) {
for (i = 0; i < ctrlr->num_io_queues; i++) {
nvme_qpair_fail(&ctrlr->ioq[i]);
@@ -415,6 +418,7 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr)
 
TSENTER();
 
+   ctrlr->is_failed_admin = true;
nvme_ctrlr_disable_qpairs(ctrlr);
 
err = nvme_ctrlr_disable(ctrlr);
@@ -423,6 +427,8 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr)
 
err = nvme_ctrlr_enable(ctrlr);
 out:
+   if (err == 0)
+   ctrlr->is_failed_admin = false;
 
TSEXIT();
return (err);
@@ -435,11 +441,10 @@ nvme_ctrlr_reset(struct nvme_controller *ctrlr)
 
cmpset = atomic_cmpset_32(&ctrlr->is_resetting, 0, 1);
 
-   if (cmpset == 0 || ctrlr->is_failed)
+   if (cmpset == 0)
/*
-* Controller is already resetting or has failed.  Return
-*  immediately since there is no need to kick off another
-*  reset in these cases.
+* Controller is already resetting.  Return immediately since
+* there is no need to kick off another reset.
 */
return;
 
@@ -1090,7 +1095,7 @@ nvme_ctrlr_start(void *ctrlr_arg, bool resetting)
return;
 
if (resetting && nvme_ctrlr_identify(ctrlr) != 0) {
-   nvme_ctrlr_fail(ctrlr);
+   nvme_ctrlr_fail(ctrlr, false);
return;
}
 
@@ -1105,7 +1110,7 @@ nvme_ctrlr_start(void *ctrlr_arg, bool resetting)
if (resetting) {
old_num_io_queues = ctrlr->num_io_queues;
if (nvme_ctrlr_set_num_qpairs(ctrlr) != 0) {
-   nvme_ctrlr_fail(ctrlr);
+   nvme_ctrlr_fail(ctrlr, false);
return;
}
 
@@ -1123,12 +1128,12 @@ nvme_ctrlr_start(void *ctrlr_arg, bool resetting)
nvme_ctrlr_hmb_enable(ctrlr, true, true);
 
if (nvme_ctrlr_create_qpairs(ctrlr) != 0) {
-   nvme_ctrlr_fail(ctrlr);
+   nvme_ctrlr_fail(ctrlr, false);
return;
}
 
if (nvme_ctrlr_construct_namespaces(ctrlr) != 0) {
-   nvme_ctrlr_fail(ctrlr);
+   nvme_ctrlr_fail(ctrlr, false);
return;
}
 
@@ -1148,8 +1153,7 @@ nvme_ctrlr_start_config_hook(void *arg)
TSENTER();
 
if (nvme_ctrlr_hw_reset(ctrlr) != 0) {
-fail:
-   nvme_ctrlr_fail(ctrlr);
+   nvme_ctrlr_fail(ctrlr, true);
config_intrhook_disestablish(&ctrlr->config_hook);
return;
}
@@ -1162,13 +1166,15 @@ fail:
nvme_ctrlr_construct_io_qpairs(ctrlr) == 0)
nvme_ctrlr_start(ctrlr, false);
else
-   goto fail;
+   nvme_ctrlr_fail(ctrlr, false);
 
nvme_sysctl_initialize_ctrlr(ctrlr);
config_intrhook_disestablish(&ctrlr->config_hook);
 
-   ctrlr->is_initialized = true;
-   nvme_notify_new_controller(ctrlr);
+   if (!ctrlr->is_failed) {
+   ctrlr->is_initialized = true;
+   nvme_notify_new_controller(ctrlr);
+   }
TSEXIT();
 }
 
@@ -1185,7 +1191,7 @@ nvme_ctrlr_reset_task

Re: git: f44ff2aba2d6 - main - bhyve: Treat the COMMAND register for PCI passthru devices as emulated

2024-08-15 Thread Oleg Nauman
Hello,

I can confirm that net/wifibox fails to operate after f44ff2aba2d6

On Wed, Aug 14, 2024 at 4:17 AM Navdeep Parhar  wrote:
>
> On 7/31/24 7:50 AM, John Baldwin wrote:
> > The branch main has been updated by jhb:
> >
> > URL: 
> > https://cgit.FreeBSD.org/src/commit/?id=f44ff2aba2d64d1d9312cb55008dc90275ccdc04
> >
> > commit f44ff2aba2d64d1d9312cb55008dc90275ccdc04
> > Author: John Baldwin 
> > AuthorDate: 2024-07-31 14:50:33 +
> > Commit: John Baldwin 
> > CommitDate: 2024-07-31 14:50:33 +
> >
> >  bhyve: Treat the COMMAND register for PCI passthru devices as emulated
> >
> >  Don't pass through writes of the command register through to the
> >  physical device.  These registers do not need to be in sync, and in
> >  some cases (e.g. when the guest is sizing the BAR and temporarily
> >  disables decoding), the states need to diverge.
>
> This seems to break MSI-X interrupts for a device that is passed through
> to a VM.  That is, the device generates an interrupt but the driver in
> the VM never receives it.  Reverting this change fixes the problem.
>
> Regards,
> Navdeep
>
>