Commit graph

286304 commits

Author SHA1 Message Date
Bjoern A. Zeeb 530c13c540 tools/wlanstats: fix -Wunused-but-set-variable
The "allnodes" code is currently #if 0 so also #if 0 the setting of the
command line option and variable in order to keep wlanstats compiling.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-09-11 14:28:07 +00:00
Bjoern A. Zeeb c45d05b718 net80211: fix ddb print alignment
Add missing \ts after new lines to properly align output of ddb show
commands.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-09-11 14:28:04 +00:00
Dag-Erling Smørgrav 88a9b6e1ed libc: Don't assume signed char.
MFC after:	3 days
Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D41814
2023-09-11 13:18:25 +00:00
Li-Wen Hsu 4196186dbf
hyperv/vmbus: Flip a message to only be emitted on failure
This message is not very useful when things are working well.
Flip its meaning and let it only be emitted on failure.

While here, pet style(9).

Reviewed by:	mhorne, whu
Differential Revision:	https://reviews.freebsd.org/D41788
2023-09-11 16:51:46 +08:00
Doug Moore 6cec93da46 Revert "radix_trie: have vm_radix use pctrie code"
This reverts commit a494d30465.
2023-09-11 03:35:36 -05:00
Martin Matuska 3159b89b61 zfs: merge openzfs/zfs@0ee9b0239
Notable upstream pull request merges:
  #15251 Add more constraints for block cloning

Obtained from:	OpenZFS
OpenZFS commit:	0ee9b02390
2023-09-11 09:18:48 +02:00
Doug Moore a494d30465 radix_trie: have vm_radix use pctrie code
Implement everything currently in vm_radix.c with calls to functions
in subr_pctrie.c, asccessed via the interface provided by the
DEFINE_PCTRIE_SMR macro.

Reviewed by:	alc, markj
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D41344
2023-09-11 01:53:40 -05:00
Kristof Provost b6ce41118b pf: fix state leak
If we hit the csfailed case in pf_create_state() we may have allocated
a state, so we must also free it. While here reduce the amount of
duplicated cleanup code.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D41772
2023-09-10 22:40:22 +02:00
Xin LI 898496ee09 MFV: file 5.45.
MFC after:	3 days
2023-09-10 12:21:16 -07:00
Dag-Erling Smørgrav ef8abddf10 mkfile: getopt() returns an int, not a char.
MFC after:	3 days
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41804
2023-09-10 18:33:32 +00:00
Navdeep Parhar e203cb393f cxgbe(4): Fix tracing with netlink enabled kernels.
1. The tracing ifnet's name must match the nexus name.  One way to do
   this is to not use a unit number.

2. Do not hold the tracer lock around ether_ifattach or ether_ifdetach.
   netlink calls back into the driver (see stack below) and that leads
   to illegal lock recursion.

   tracer_ioctl
   if_ioctl
   get_operstate_ether
   get_operstate
   dump_iface
   rtnl_handle_ifevent
   rtnl_handle_ifattach
   if_attach_internal
   if_attach
   ether_ifattach
   t4_cloner_create

MFC after:	3 days
Sponsored by:	Chelsio Communications
2023-09-10 07:06:32 -07:00
Kristof Provost f415a5c1bd pfsync: fix state leak
If we receive a state with a route-to interface name set and we can't
find the interface we do not insert the state. However, in that case we
must still clean up the state (and state keys).
Do so, so we do not leak states.

Reviewed by:	Kajetan Staszkiewicz <vegeta@tuxpowered.net>
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D41779
2023-09-10 15:12:51 +02:00
Robert Clausecker b2618b651b lib/libc/amd64/string/memchr.S: fix behaviour with overly long buffers
When memchr(buf, c, len) is called with a phony len (say, SIZE_MAX),
buf + len overflows and we have buf + len < buf.  This confuses the
implementation and makes it return incorrect results.  Neverthless we
must support this case as memchr() is guaranteed to work even with
phony buffer lengths, as long as a match is found before the buffer
actually ends.

Sponsored by:	The FreeBSD Foundation
Reported by:	yuri, des
Tested by:	des
Approved by:	mjg (blanket, via IRC)
MFC after:	1 week
MFC to:		stable/14
PR:		273652
2023-09-10 08:52:59 -04:00
Jens Schweikhardt 4fc08109fe Correct the grammo in "will underlined". 2023-09-10 11:00:21 +02:00
Xin LI 72d4668c77 Vendor import of file 5.45. 2023-09-09 21:50:07 -07:00
Konstantin Belousov 3482f57f0f netpfil/pf/pf.c: fix build without dtrace
Sponsored by:	The FreeBSD Foundation
2023-09-10 01:00:27 +03:00
Konstantin Belousov 6df6facf44 shmfd: hide direct rangelock(9) use under a wrapper
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-09-10 01:00:06 +03:00
Mateusz Guzik a87c6962af ufs: restore name cache fast path lookup
Found by:	dchagin
Fixes:	f3c81b9738 ("ufs: add missing vop_fplookup ops")
2023-09-09 21:48:57 +00:00
Mateusz Guzik ef545fe7ba drm2: fix build after abs64 became global
Fixes: 229c65a83f ("kern: Globally define abs64")
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-09-09 20:50:55 +00:00
John Baldwin d0af08c4ba gic_acpi: Limit the number of CPUs to GIC_MAXCPU
madt_table_data contains an array of pointers for each CPU and was
allocated on the stack.  If MAXCPU is raised to a sufficiently large
value this can overflow the kernel stack.  Cap the stack growth by
using GIC_MAXCPU instead as for other parts of the gicv1/v2 driver in
commit a0e20c0ded.

Suggested by:	andrew
Reviewed by:	andrew, emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41800
2023-09-09 12:13:57 -07:00
Ed Maste 98b98ec1bc ftpd: add deprecation notice
Approved by:	gordon
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26447
2023-09-09 14:46:58 -04:00
Archimedes Gaviola 9888a79ada udl.4: note that "device videomode" is also required
Reviewed by:	emaste
2023-09-09 13:39:46 -04:00
ednadolski-ix 0ee9b02390
update max_variance limit in zdb_block_size_histogram test for CI
Commit 2d7843401a had previously
updated this hardcoded limit to allow for CI testing. As there
is no deterministic pass/fail value, the need has arisen for
one more small increase.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Edmund Nadolski <edmund.nadolski@ixsystems.com>
Closes #15252
2023-09-09 10:23:29 -07:00
Alexander Motin 5cc1876f14
Add more constraints for block cloning.
- We cannot clone into files with smaller block size if there is
more than one block, since we can not grow the block size.
 - Block size must be power-of-2 if destination offset != 0, since
there can be no multiple blocks of non-power-of-2 size.

The first should handle the case when destination file has several
blocks but still is not bigger than one block of the source file.
The second fixes panic in dmu_buf_hold_array_by_dnode() on attempt
to concatenate files with equal but non-power-of-2 block sizes.

While there, assert that error is reported if we made no progress.

Reviewed-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <rob.norris@klarasystems.com>
Reviewed-by: Kay Pedersen <mail@mkwg.de>
Reviewed-by: Umer Saleem <usaleem@ixsystems.com>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #15251
2023-09-09 10:22:36 -07:00
Warner Losh c1944a82ae cam: Remove extra break
Sponsored by:		Netflix
2023-09-09 11:13:25 -06:00
Warner Losh 4cd94c8afb atkbdc: Add additional heurstic for Chromebook keyboards
It turns out that that heurstic used to determine if we have a Google
coreboot, and thus have the i8042 emulation bugs, is incorrect. At least
one Acer "Peppy" Chromebook has an issue because Acer space'd out the
smbios.bios.version string we're using as part of the heuristic. So, if
the version starts with a space, then enable the workarounds if the
smbios.bios.reldate is 2018 or earlier. While not perfect, it should be
a reasonable dividing line and still allow newer core boot-based
machines that aren't Chromebooks to not have the workaround.

Tested by:	Matthias Apitz
Sponsored by:	Netflix
MFC After:	3 days (14.0 candiate)
2023-09-09 11:13:25 -06:00
Warner Losh 5657e065bc procdesc: Remove stray references to pdwait4
We've never had pdwait4, and have no plans of adding pdwait4. Remove the
stray references here.

Sponsored by:		Netflix
2023-09-09 11:13:24 -06:00
Zhenlei Huang c1b26df297 UPDATING: Document the change that enable vnet sysctl variables to be loader tunable 2023-09-09 16:15:27 +08:00
Zhenlei Huang 242fa308f3 carp: Explicitly mark tunnable net.inet.carp.allow with CTLFLAG_NOFETCH
With recent change 110113bc08, a vnet tunable can be initialized when
there is a corresponding kernel environment variable unless it is marked
with the flag CTLFLAG_NOFETCH.

The initialization may happen during early boot(linker preload), at that
time vnet0 has not been created. The hander carp_allow_sysctl() for the
tunable net.inet.carp.allow requires vnet, thus invoking it during early
boot will cause kernel panic.

The tunnable is initialized by vnet sysinit routine ipcarp_sysinit() so
let's just mark it with flag CTLFLAG_NOFETCH.

No functional change intended.

Fixes:		110113bc08 sysctl(9): Enable vnet sysctl variables to be loader tunable
MFC after:	2 week
Differential Revision:	https://reviews.freebsd.org/D41525
2023-09-09 16:10:32 +08:00
Zhenlei Huang 205821a70d kernel linker: Eliminate unneeded vnet propagation
The module preload happens before vnet0 creation, at this moment the vnet
list is empty thus invoking vnet_data_copy() during preload is a noop.

With recent change 110113bc08, for dynamic module load, aka via kldload,
linker will do vnet propagation right after registering sysctls which
happens after module load, then previous propagation (during module load)
is redundant.

No functional change intended.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D39852
2023-09-09 16:06:24 +08:00
Zhenlei Huang 110113bc08 sysctl(9): Enable vnet sysctl variables to be loader tunable
Complete phase two of 3da1cf1e88.

In 3da1cf1e88, the meaning of the flag CTLFLAG_TUN is extended to
automatically check if there is a kernel environment variable which
shall initialize the SYSCTL during early boot. It works for all SYSCTL
types both statically and dynamically created ones, except for the
SYSCTLs which belong to VNETs.

This change extends the meaning further, to allow it also works for
the SYSCTLs which belong to VNETs. A typical usage is
```
VNET_DEFINE_STATIC(int, foo) = 0;
SYSCTL_INT(_net, OID_AUTO, foo, CTLFLAG_RWTUN | CTLFLAG_VNET,
    &VNET_NAME(foo), 0, "Description of the foo loader tunable");
```

Note that the implementation has a limitation. It behaves the same way
as that of non-vnet loader tunables. That is, after the kernel or modules
being initialized, any changes (e.g. via kenv) to kernel environment
variable will not affect the corresponding vnet variable of subsequently
created VNETs. To overcome it, we can use TUNABLE_XXX_FETCH to fetch
the kernel environment variable into those vnet variables during vnet
constructing.

This change will fix the following SYSCTLs those belong to VNETs and
have CTLFLAG_TUN flag:
```
net.add_addr_allfibs
net.bpf.optimize_writers
net.inet.tcp.fastopen.ccache_buckets
net.link.bridge.inherit_mac
net.link.bridge.ipfw_arp
net.link.bridge.log_stp
net.link.bridge.pfil_bridge
net.link.bridge.pfil_local_phys
net.link.bridge.pfil_member
net.link.bridge.pfil_onlyip
net.link.lagg.default_use_flowid
net.link.lagg.default_use_numa
net.link.lagg.default_flowid_shift
net.link.lagg.lacp.debug
net.link.lagg.lacp.default_strict_mode
```

Although the following vnet SYSCTLs have CTLFLAG_TUN flag, theirs
values are re-fetched via TUNABLE_XXX_FETCH, thus are not affected
by this change.
```
net.inet.ip.reass_hashsize
net.inet.tcp.hostcache.cachelimit
net.inet.tcp.hostcache.hashsize
net.inet.tcp.hostcache.bucketlimit
net.inet.tcp.syncache.bucketlimit
net.inet.tcp.syncache.cachelimit
net.inet.tcp.syncache.hashsize
net.key.spdcache.maxentries
net.key.spdcache.threshold
```

In memoriam:	hselasky
Discussed with:	hselasky, glebius
Fixes:		3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag ...
MFC after:	2 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D39638
2023-09-09 16:06:23 +08:00
John Baldwin 9c80d66ec1 makeman: Use ${make} instead of plain make to compute ${requireds}
This is currently a no-op but can matter for downstreams whose ${make}
includes additional settings.

Reviewed by:	imp, emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41777
2023-09-08 16:36:52 -07:00
John Baldwin 3555be0124 Move kern_extattr_* prototypes to <sys/syscallsubr.h>
All of the kern_* prototypes belong in this header.  While here, sort
the prototypes by function name.

Reviewed by:	dchagin
Fixes:		6453d4240f vfs: Export exattr methods to reuse by Linuxulator
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41766
2023-09-08 16:36:28 -07:00
John Baldwin 3b5fc5eead riscv: Print stval in dump_regs for fatal exceptions
Reviewed by:	mhorne, markj
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41700
2023-09-08 16:35:59 -07:00
John Baldwin 897e564361 cxgbe t4_tls: Call t4_rcvd_locked from do_rx_tls_cmp
Similar to dcfddc8dc0, replace the
simpler, inlined version with the full version.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D41690
2023-09-08 16:31:38 -07:00
John Baldwin 75af2d951c cxgbe t4_tls: Don't bother returning RX credits for a protocol receive error
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D41689
2023-09-08 16:31:25 -07:00
John Baldwin dcfddc8dc0 cxgbe tom: Call t4_rcvd_locked from do_rx_data to return RX credits
In particular, the kernel RPC layer used by the NFS client never
invokes pru_rcvd since it always reads data from the socket upcall
via MSG_SOCALLBCK which avoids calling pru_rcvd.  As a result, on an
NFS client connection managed by t4_tom, RX credits were never
returned to the TOE connection to open the TCP window resulting in
connection hangs.

To fix, expand the set of conditions in do_rx_data where RX credits
are returned to match those in t4_rcvd_locked by calling the function
directly.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D41688
2023-09-08 16:31:21 -07:00
Robert Clausecker 2a4096b012 share/man/man7/simd.7: documend simd-enhanced memchr(3), strnlen(3)
Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision: https://reviews.freebsd.org/D41598
2023-09-08 17:22:31 -04:00
Robert Clausecker 331737281c lib/libc/amd64/string: implement strnlen(3) trough memchr(3)
Now that we have an optimised memchr(3), we can use it to implement
strnlen(3) with better perofrmance.

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41598
2023-09-08 17:22:31 -04:00
Robert Clausecker de12a689fa lib/libc/amd64/string: add memchr(3) scalar, baseline implementation
This is conceptually similar to strchr(3), but there are
slight changes to account for the buffer having an explicit
buffer length.

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41598
2023-09-08 17:22:20 -04:00
Robert Clausecker a559ef1ac8 share/man/man7/simd.7: document simd-enhanced strspn(3)
Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision: https://reviews.freebsd.org/D41567
2023-09-08 17:21:59 -04:00
Robert Clausecker 7084133cde lib/libc/amd64/string: add strspn(3) scalar, x86-64-v2 implementation
This is conceptually very similar to the strcspn(3) implementations
from D41557, but we can't do the fast paths the same way.

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41567
2023-09-08 17:21:59 -04:00
Robert Clausecker 468adddd75 lib/libc/tests/string: derive strspn(3) tests from strcspn(3) tests
To cover the new optimised amd64 strspn(3) SIMD implementation, extend
the previously written strcspn(3) unit test to also cover strspn(3).

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41567
2023-09-08 17:21:59 -04:00
Robert Clausecker 35a5359406 lib/libc/tests/string: add unit tests for strcspn(3)
We currently use the NetBSD test suite to cover strcspn(3).  It only
contains a very rudimentary test of this function.  This all new set
of unit tests for the FreeBSD test suite should cover many more edge
cases relating to alignment issues.

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision: https://reviews.freebsd.org/D41557
2023-09-08 17:21:31 -04:00
Robert Clausecker 5fe2597b23 share/man/man7/simd.7: document simd-enhanced strcspn(3)
Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41557
2023-09-08 17:20:19 -04:00
Robert Clausecker 474408bb79 lib/libc/amd64/string: add strcspn(3) scalar, x86-64-v2 implementation
This changeset adds both a scalar and an x86-64-v2 implementation
of the strcspn(3) function to libc. A baseline implementation does not
appear to be feasible given the requirements of the function.

The scalar implementation is similar to the generic libc implementation,
but expands the bit set into a byte set to reduce latency, improving
performance. This approach could probably be backported to the generic
C version to benefit other platforms.

The x86-64-v2 implementation is built around the infamous pcmpistri
instruction. An alternative implementation based on the Muła/Langdale
algorithm [1] was prototyped, but performed worse than the pcmpistri
approach except for sets of more than 16 characters with long input
strings.

All implementations provide special cases for the empty set (reduces to
strlen as well as single-character sets (reduces to strchr). The
x86-64-v2 kernel falls back to the scalar implementation for sets of
more than 32 characters. This limit could be raised by additional
multiples of 16 through the use of additional pcmpistri code paths, but
I consider this case to be too rare to be of importance.

[1]: http://0x80.pl/articles/simd-byte-lookup.html

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
MFC after:	1 week
MFC to:		stable/14
Differential Revision:	https://reviews.freebsd.org/D41557
2023-09-08 17:20:19 -04:00
Li-Wen Hsu 604f6bf022
powerpcspe: Fix build
Copy _fpmath.h from powerpc, which is the same as the one in powerpc64.

Sponsored by:	The FreeBSD Foundation
2023-09-09 04:46:25 +08:00
Michael Tuexen 1e81a4e7e8 sctp: don't call sctp_ulp_notify() recursively
This does not work with the new locking scheme.

MFC after:	3 days
2023-09-08 21:19:59 +02:00
Dag-Erling Smørgrav caf5283fc9 grep: Suppress EISDIR when reading.
MFC after:	1 week
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
2023-09-08 18:19:46 +00:00
Felix Palmen 1621861810 committers-ports.dot: Fix entry for jbo
Joel Bodenmann's entry accidentally went to the alumni section, and I
didn't notice from the context Phab provides. Fix this.

Fixes:		b4b89476fa Add myself as ports committer [...]
Pointy hat to:	zirias
2023-09-08 16:39:47 +02:00