]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 months agoriscv: add more dump features to GENERIC
Mitchell Horne [Tue, 5 Dec 2023 19:29:31 +0000 (15:29 -0400)]
riscv: add more dump features to GENERIC

Match what is provided by default on other architectures.

Reviewed by: jrtc27
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42911

7 months agoriscv: tweak SoC-specific conf organization
Mitchell Horne [Tue, 5 Dec 2023 19:28:59 +0000 (15:28 -0400)]
riscv: tweak SoC-specific conf organization

Hide some lines from the main GENERIC files by mimicking arm64's model.

I do not have any intention of creating a std.riscv or SIFIVE
configuration file at this time.

Reviewed by: jrtc27
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42910

7 months agoCirrus-CI: forcably upgrade pkg to latest
Jose Luis Duran [Tue, 5 Dec 2023 19:04:04 +0000 (19:04 +0000)]
Cirrus-CI: forcably upgrade pkg to latest

make packages requires the latest pkg for now so force that.

Differential Revision: https://reviews.freebsd.org/D42908

7 months agoCirrus-CI: fix git usage by build user
Brooks Davis [Tue, 5 Dec 2023 19:03:35 +0000 (19:03 +0000)]
Cirrus-CI: fix git usage by build user

The git checkout it owned by root, but builds are run as "user".  git
refuses to operate in such an environment unless the directory is
trusted so make "user" trust it.

Fixes CI after 99b8c0c35b0fcc633649209621243d678a13542a.

Sponsored by: DARPA

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42903

7 months agobhnd: Correct the softc size in the siba_bhndb_driver definition
Mark Johnston [Tue, 5 Dec 2023 18:47:03 +0000 (13:47 -0500)]
bhnd: Correct the softc size in the siba_bhndb_driver definition

struct siba_bhndb_softc embeds struct siba_softc and adds an extra
field, "quirks".  In practice, this bug was harmless since "quirks" is
unconditionally initialized during driver attach and would have lived in
the redzone of the softc allocation, but KASAN catches the out-of-bounds
access.

PR: 275515
Reported by: Frank Hilgendorf <frank.hilgendorf@posteo.de>
MFC after: 1 week

7 months agopf: remove incorrect fragmentation check
Kristof Provost [Wed, 29 Nov 2023 18:06:31 +0000 (19:06 +0100)]
pf: remove incorrect fragmentation check

We do not need to check PFDESC_IP_REAS while tracking TCP state.
Moreover, this check incorrectly considers no-data packets (e.g. RST) to
be in-window when this flag is not set.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Approved by: so
Security: FreeBSD-SA-23:17.pf

7 months agovmstat: fix column names broken in c168508655720
Maxim Sobolev [Tue, 5 Dec 2023 01:39:21 +0000 (17:39 -0800)]
vmstat: fix column names broken in c168508655720

Loss of the trailing space in the multi-line format string has
resulted in column name being emitted as "FAILSLEEP", instead of
two columns "FAIL" and "SLEEP".

7 months agopkgbase: propagate SRCRELDATE to the packages correctly
Baptiste Daroussin [Mon, 4 Dec 2023 08:22:02 +0000 (09:22 +0100)]
pkgbase: propagate SRCRELDATE to the packages correctly

MFC After: 3 days
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D42892

7 months agoRemove never implemented sbrk and sstk syscalls
Brooks Davis [Mon, 4 Dec 2023 20:36:08 +0000 (20:36 +0000)]
Remove never implemented sbrk and sstk syscalls

Both system calls were stubs returning EOPNOTSUPP and libc did not
provide _ or __sys_ prefixed symbols.  The actual implementation of
sbrk(2) is on top of the undocumented break(2) system call.

Technically this is a change in ABI, but no non-contrived program ever
called these syscalls.

Reviewed by: kib, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42872

7 months agohpts: remove from opt_inet.h
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:47 +0000 (10:19 -0800)]
hpts: remove from opt_inet.h

No conditionally compilable code left.  The hpts.ko is fully functional.

Reviewed by: imp, tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42859

7 months agokern/subr_trap.c: repair the HPTS performance hack in userret()
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
kern/subr_trap.c: repair the HPTS performance hack in userret()

It wasn't functional as subr_trap.c doesn't include opt_inet.h.  Put a
better comment provided by gallatin@ in place of the old one.  The idea
is to use userret() as a cheap place to call a soft clock.  This approach
saves CPU on busy machines and saves power on idle machines.
An alternative would be to constantly schedule callouts.  Running with
neither callouts nor the soft clock ruins HPTS precision.

Reviewed by: tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42860

7 months agohpts/lro: make tcp_lro_flush_tcphpts() and tcp_run_hpts() pointers
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
hpts/lro: make tcp_lro_flush_tcphpts() and tcp_run_hpts() pointers

Rename tcp_run_hpts() to tcp_hpts_softlock() to better describe its
function.  This makes loadable hpts.ko working correctly with LRO.

Reviewed by: tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42858

7 months agotcp/hpts: make stacks responsible for clearing themselves out HPTS
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
tcp/hpts: make stacks responsible for clearing themselves out HPTS

There already is the tfb_tcp_timer_stop_all method that is supposed to stop
all time events associated with a given tcpcb by given stack.  Some time
ago it was doing actual callout_stop().  Today bbr/rack just mark their
internal state as inactive in their tfb_tcp_timer_stop_all methods, but
tcpcb stays in HPTS wheel and potentially called in from HPTS.  Change the
methods to also call tcp_hpts_remove().  Note: I'm not sure if internal
flag is still relevant once we are out of HPTS wheel.

Call the method when connection goes into TCP_CLOSED state, instead of
calling it later when tcpcb is freed.  Also call it when we switch between
stacks.

Reviewed by: tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42857

7 months agohpts: make stacks responsible for tcp_hpts_init()
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
hpts: make stacks responsible for tcp_hpts_init()

Those stacks that use HPTS should care about init, not generic code.

Reviewed by: imp, tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42856

7 months agohpts: don't ifdef tcp_in_hpts()
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
hpts: don't ifdef tcp_in_hpts()

This small inline function is always available.

Reviewed by: imp, tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42855

7 months agolro: separate HPTS specific code into tcp_lro_hpts.c
Gleb Smirnoff [Mon, 4 Dec 2023 18:19:46 +0000 (10:19 -0800)]
lro: separate HPTS specific code into tcp_lro_hpts.c

Put same copyright header as tcp_hpts.c has, since all this code
was developed by Randall Stewart <rrs@FreeBSD.org> as a part of
the HPTS work.  Also copy Mellanox copyright from tcp_lro.c as
Hans Petter Selasky also participated in restructuring the code.

Reviewed by: imp, tuexen, rrs
Differential Revision: https://reviews.freebsd.org/D42854

7 months agoif_tuntap: fix NOIP build
Gleb Smirnoff [Mon, 4 Dec 2023 18:18:56 +0000 (10:18 -0800)]
if_tuntap: fix NOIP build

Note: this removes one TUNDEBUG() for the sake of not having one more
ifdefed variable declaration and for the overall code brevity.  The call
from tuntap into LRO can be so easily traced with dtrace(1) that an
80-ish printf(9)-based debugging can be omitted.

Fixes: 99c79cab422705f92f05a2924a29bdf823372ebf

7 months agoMerge commit 989879f8fded from llvm git (by Paul Walker):
Dimitry Andric [Mon, 4 Dec 2023 17:59:02 +0000 (18:59 +0100)]
Merge commit 989879f8fded from llvm git (by Paul Walker):

  [Clang] Allow C++11 style initialisation of SVE types.

  Fixes https://github.com/llvm/llvm-project/issues/63223

  Differential Revision: https://reviews.llvm.org/D153560

Requested by: andrew
MFC after: 3 days

7 months agoossl: Remove a stray __FBSDID("$FreeBSD$")
Mark Johnston [Mon, 4 Dec 2023 17:29:30 +0000 (12:29 -0500)]
ossl: Remove a stray __FBSDID("$FreeBSD$")

Fixes: 44f8e1e8530e ("ossl: Add support for armv7")

7 months agoossl: Move arm_arch.h to a common subdirectory
Mark Johnston [Mon, 4 Dec 2023 17:29:11 +0000 (12:29 -0500)]
ossl: Move arm_arch.h to a common subdirectory

OpenSSL itself keeps only a single copy of this header.  Do the same in
sys/crypto/openssl to avoid the extra maintenance burden.  This requires
adjusting the include paths for generated asm files.

No functional change intended.

Reported by: jrtc27
Reviewed by: jhb
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D42866

7 months agozfs tests: Silence clang warning
Jose Luis Duran [Tue, 7 Nov 2023 15:05:15 +0000 (12:05 -0300)]
zfs tests: Silence clang warning

"assigning to 'pattern_t *' from 'const pattern_t *' discards qualifiers"

Reviewed by: asomers
Reported by: clang
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42791

7 months agopkgbase: kill circular dependency
Baptiste Daroussin [Mon, 4 Dec 2023 16:27:51 +0000 (17:27 +0100)]
pkgbase: kill circular dependency

clang was set to depend on clang-dev, but clang-dev already depends
on clang by design

MFC After: 3 days

7 months agopci_vendors: update to 2023-11-11
Baptiste Daroussin [Mon, 4 Dec 2023 10:51:59 +0000 (11:51 +0100)]
pci_vendors: update to 2023-11-11

7 months agopkgbase: create source package
Baptiste Daroussin [Fri, 17 Nov 2023 16:19:39 +0000 (17:19 +0100)]
pkgbase: create source package

FreeBSD-src for all the sources but the kernel
FreeBSD-src-sys just for the kernel

MFC After: 3 days
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D42651

7 months agoautofs: media: Always use sync option for fat*
Emmanuel Vadot [Fri, 1 Dec 2023 09:27:59 +0000 (10:27 +0100)]
autofs: media: Always use sync option for fat*

Users of autofs for removable media expect to be able to copy files and
directly remove the media without having the need to call sync(8) or umount(8).
Only do that for fat/ntfs filesystems.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D42494
Reviewed by: rew (older version)

7 months agonfscl: Fix comment for commit 6aded1e6b2e5
Rick Macklem [Mon, 4 Dec 2023 00:12:14 +0000 (16:12 -0800)]
nfscl: Fix comment for commit 6aded1e6b2e5

Commit 6aded1e6b2e5 fixed a rare case when handling an NFSv4
Rename reply when delegations are in use.  This patch fixes the
associated comment.

MFC after: 2 weeks

7 months agonfscl: Fix processing of a rare Rename reply case
Rick Macklem [Sun, 3 Dec 2023 23:31:01 +0000 (15:31 -0800)]
nfscl: Fix processing of a rare Rename reply case

When delegations are enabled (they are not by default in
the FreeBSD NFSv4 server), rename will check for and return
delegations.  If the second of these DelegReturn operations
were to fail (they rarely do), then the code would not retry
the rename with returning delegations, as it is intended to do.

The patch fixes the problem, since the DelegReturn reply status
is the second iteration of the loop and not the first iteration.

As noted, this bug would have rarely manifested a problem, since
DelegReturn operations do not normally fail.

MFC after: 2 weeks

7 months agorelease/Makefile.vm: Rework emulator-portinstall
Colin Percival [Sun, 3 Dec 2023 21:39:30 +0000 (13:39 -0800)]
release/Makefile.vm: Rework emulator-portinstall

The emulator-portinstall target now unconditionally ensures that qemu
is installed; but is only invoked if needed (aka. when cross building
VM images).

MFC After: 3 days
MFC With: 97bd53ef4d20 ("Fix duplicate rc.conf files")

7 months agoIncrease UFS/FFS maximum link count from 32767 to 65530.
Kirk McKusick [Sun, 3 Dec 2023 20:36:42 +0000 (12:36 -0800)]
Increase UFS/FFS maximum link count from 32767 to 65530.

The link count for a UFS/FFS inode is stored in a signed 16-bit
integer. Thus the maximum link count has been 32767.

This limit has been recently hit by the poudriere build system when
doing a ports build as it needs one directory per port and the
number of ports recently passed 32767.

A long-term solution would be to use one of the spare 32-bit fields
in the inode to store the link count. However, the UFS1 format does
not have a spare and adding the spare in UFS2 would make it hard
to make it compatible when running on older kernels that use the
original link count field. So this patch uses the much simpler
approach of changing the existing link count field from a signed
16-bit value to an unsigned 16-bit value. It has the fewest lines
of code changes. The only thing that changes is the type in the
dinode and inode structures and the definition of UFS_LINK_MAX. It
has the added benefit that it works with both UFS1 and UFS2.

It allows easy backward compatibility. Indeed it is backward
compatibility that is the primary reason to go with this approach.
If a filesystem with the new organization is mounted on an older
kernel, it still needs to work. Thus if we move the new link count
to a new field, we still need to maintain the old link count as
best as possible even when running on a kernel that knows about the
larger link counts. And we would have to carry this overhead for
the indefinite future.

If we have a new link-count field, we will have to add a new
filesystem flag to indicate that we are running with larger link
counts. We will also need to add of one of the new-feature flags
to say that we have larger link counts. Older kernels clear the
new-feature flags that they do not know about, so when a filesystem
is used on an older kernel and then moved back to a newer one, the
newer one will know that the new link counts have not been maintained
and that it will be necessary to run a full fsck on the filesystem
to correct the link counts before it can be mounted.

With this change, older kernels will generally work with the bigger
counts. While it will not itself allow the link count to exceed
32767, it will have no problem working with inodes that have a link
count greater than 32767. Since it tests that i_nlink <= UFS_LINK_MAX,
counts that are bigger than 32767 will appear negative, so will
still pass the test. Of course, if they ever drop below 32767, they
will no longer be able to exceed 32767. The one issue is if the
link count ever exceeds 65535 then it will wrap to zero and the
older kernel will be none the wiser. But this corner case is likely
to be very rare since these kernels and the applications running
on them do not expect to be able to get link counts over 32767. And
over time, the use of new filesystems on older kernels will become
rarer and rarer.

Reported-by: Mark Millard running poudriere on the ports tree
Reviewed-by: kib, olce.freebsd_certner.fr
Tested-by: Peter Holm, Mark Millard
MFC-after:   2 weeks
Differential Revision: https://reviews.freebsd.org/D42767

7 months agopatch: fix locate_hunk in empty files
Pedro F. Giffuni [Sun, 3 Dec 2023 17:33:03 +0000 (12:33 -0500)]
patch: fix locate_hunk in empty files

if `first_guess' is zero then main() assumes that locate_hunk has failed
and aborts the patch operation.  Instead, make sure to return 1 (the
line number) so that the patch operation can continue.

Issue originally found by Neels Hofmeyr in the regress suite of the diff
implementation for got, where the tests assume that applying a diff with
`patch' and then again with `patch -R' yields back the original file.

Obtained from: OpenBSD (CVS patch.c,v 1.71)

7 months agousbdevs: add quirk for WD MyPassport Ultra External HDD
Eugene Grosbein [Sun, 3 Dec 2023 16:48:34 +0000 (23:48 +0700)]
usbdevs: add quirk for WD MyPassport Ultra External HDD

WD MyPassport Ultra External HDD needs quirk
UQ_MSC_NO_TEST_UNIT_READY to attach.

MFC after: 3 days

7 months agomlx5: Fix HCA cap 2 query
Patrisious Haddad [Thu, 11 May 2023 09:48:26 +0000 (12:48 +0300)]
mlx5: Fix HCA cap 2 query

Previously we were trying to set hca_cap_2 without checking if
sw_vhca_id_valid max value, which is the only settable value inside
hca_cap_2, and seeing that we dont have driver support for sw_vhca_id
yet there is no need to set hca_cap_2 at all, it is enough to query it.

Fixes: 7b959396ca6fae5635260131eedb9bc19f2726a3 ("mlx5: Introduce new destination type TABLE_TYPE")
MFC after: 3 days

7 months agoperiodic/daily/480.leapfile-ntpd: only attempt to refresh leap-seconds.list
Xin LI [Sun, 3 Dec 2023 07:00:32 +0000 (23:00 -0800)]
periodic/daily/480.leapfile-ntpd: only attempt to refresh leap-seconds.list
when ntpd is enabled.

The leap-seconds.list is used exclusively by ntpd, therefore, do not bother
to perform the fetch when ntpd is not enabled.

PR: conf/275419
Reviewed by: cy, michaelo, imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42875

7 months agosound: remove Legacy Hardware section from man page
Ed Maste [Sat, 2 Dec 2023 21:10:16 +0000 (16:10 -0500)]
sound: remove Legacy Hardware section from man page

Support for "old legacy ISA cards" was removed in 9054e296819f and
preceeding commits.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 months agowpa: ctrl_iface set sendbuf size
Bjoern A. Zeeb [Sun, 12 Nov 2023 20:33:41 +0000 (20:33 +0000)]
wpa: ctrl_iface set sendbuf size

In order to avoid running into the default net.local.dgram.maxdgram
of 2K currently when calling sendto(2) try to set the sndbuf size to
the maximum ctrl message size.
While on 14 and 15 this does not actually raise the limit anymore (and
be7c095ac99ad29fd72b780c7d58949a38656c66 raised it for syslogd and this),
FreeBSD 13 still requires this change and it will work as expected there.
In addition we always ensure a large enough send buffer this way
independent of kernel defaults.
The problem occured, e.g., when the scan_list result had enough BSSIDs
so the text output would exceed 2048 bytes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
PR: 274990
Reviewed by: cy, adrian (with previous comment)
Differential Revision: https://reviews.freebsd.org/D42558

7 months agotcp: properly initialize LRD while accepting session in syncache
Richard Scheffenegger [Sat, 2 Dec 2023 11:15:37 +0000 (12:15 +0100)]
tcp: properly initialize LRD while accepting session in syncache

Inherit the setting from the listener socket in syncache_socket.

MFC after:             2 weeks
Reviewed By:           tuexen, #transport
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42874

7 months agolibclang_rt: Update Makefile.depend
Ka Ho Ng [Sat, 2 Dec 2023 09:15:53 +0000 (04:15 -0500)]
libclang_rt: Update Makefile.depend

MFC after: 3 days

7 months agotermcap.small: Include xterm-256color
Ka Ho Ng [Sat, 2 Dec 2023 05:55:56 +0000 (00:55 -0500)]
termcap.small: Include xterm-256color

MFC after: 7 days
Reviewed by: imp, jhb
Differential Revision: https://reviews.freebsd.org/D42784

7 months agoarmv8rng: Don't require toolchain to support FEAT_RNG
Jessica Clarke [Fri, 1 Dec 2023 23:59:07 +0000 (23:59 +0000)]
armv8rng: Don't require toolchain to support FEAT_RNG

We have the mechanism in place to support encoding system registers
explicitly, so use that rather than requiring LLVM 13+, which breaks our
current set of GitHub CI builds.

Fixes: 9eecef052155 ("Add an Armv8 rndr random number provider")

7 months agounix/dgram: bump maximum datagram size limit to 8k
Gleb Smirnoff [Fri, 1 Dec 2023 23:37:29 +0000 (15:37 -0800)]
unix/dgram: bump maximum datagram size limit to 8k

This is important for wpa_supplicant operation on a crowded network.

Note: we actually need an API to increase maximum datagram size on a
socket.  Previously SO_SNDBUF magically acted like that, but that was
an undocumented "feature".

Also move the comment to the proper line.  Previously it was the receive
buffer that imposed the limit.  Now notion of buffer size and maximum
datagram are separate.

Reviewed by: bz, tuexen, karels
Differential Revision: https://reviews.freebsd.org/D42830
PR: 274990

7 months agoLinuxKPI: 802.11: bring in some HT code
Bjoern A. Zeeb [Thu, 26 Oct 2023 21:14:44 +0000 (21:14 +0000)]
LinuxKPI: 802.11: bring in some HT code

Fix defines and structures to use proper types.

Bring in basic ni->sta synchronization, some channel width handling,
and overload the net80211 functions so that we can talk to
driver/firmware to setup parameters.  We will likely not need one
or two of those but it is good for tracing currently.

Cover HT and bits of VHT code in LinuxKPI behind apropriate #ifdef
which are currently not enabled (like LKPI_80211_HW_CRYPTO) until
confirmed to work.
Last, IEEE80211_AMPDU_RX_START made some firmware unhappy.

This will allow others to work on it and test as well.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

7 months agosysproto.h: regen after c1c8afd04e34d
Brooks Davis [Fri, 1 Dec 2023 21:45:42 +0000 (21:45 +0000)]
sysproto.h: regen after c1c8afd04e34d

7 months agosysvipc: Fix 32-bit compat on !i386
Brooks Davis [Fri, 1 Dec 2023 20:48:29 +0000 (20:48 +0000)]
sysvipc: Fix 32-bit compat on !i386

The various time fields are time_t's which are only 32-bit on i386.

Fixing the old versions is probably of little use, but it's more correct
and in theory there could be powerpc binaries from 6.x.

PR: 240035
Fixes: fbb273bc05bef Properly support for FreeBSD 4 32bit System V shared memory.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42870

7 months agomakesyscalls: add COMPAT14 support
Brooks Davis [Fri, 1 Dec 2023 20:00:39 +0000 (20:00 +0000)]
makesyscalls: add COMPAT14 support

Reviewed by: kevans, imp
Fixes: 84d12f887c91f Add a COMPAT_FREEBSD14 kernel option
Differential Revision: https://reviews.freebsd.org/D42861

7 months agoarm64: Add register definitions for MDCR_EL2
Mark Johnston [Fri, 1 Dec 2023 18:28:58 +0000 (13:28 -0500)]
arm64: Add register definitions for MDCR_EL2

This is needed to support the bhyve gdb stub implementation on arm64.

Reviewed by: andrew
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D42867

7 months agosigaction.2: clarify that fork isn't async-signal-safe, but _Fork is
Alan Somers [Fri, 1 Dec 2023 15:19:24 +0000 (08:19 -0700)]
sigaction.2: clarify that fork isn't async-signal-safe, but _Fork is

[skip ci]

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42865

7 months agobhyve: Fix a leak that happens when we fail to load a hostfwd rule
Mark Johnston [Fri, 1 Dec 2023 14:46:31 +0000 (09:46 -0500)]
bhyve: Fix a leak that happens when we fail to load a hostfwd rule

Reported by: Coverity
Fixes: c5359e2af5ab ("bhyve: Add a slirp network backend")

7 months agostress2: Handle a define with comments
Peter Holm [Fri, 1 Dec 2023 09:37:13 +0000 (10:37 +0100)]
stress2: Handle a define with comments

7 months agoofed: garbage collect now unused sdp_sockaddr()
Gleb Smirnoff [Fri, 1 Dec 2023 05:50:16 +0000 (21:50 -0800)]
ofed: garbage collect now unused sdp_sockaddr()

Submitted by: zlei

7 months agotools/net80211: add mlme_assoc
Bjoern A. Zeeb [Fri, 1 Dec 2023 01:37:25 +0000 (01:37 +0000)]
tools/net80211: add mlme_assoc

mlme_assoc is a tool to trigger net80211::ieee80211_sta_join1() calls
which in certain conditions cause problems to the LinuxKPI 802.11 compat
code (but also believed to possibly cause problems in case of race to
other firmware based drivers).  This has proven to be a good reproducer
for the problem even on setups which otherwise could run for days without
hitting it.

Sponsored by: The FreeBSD Foundation
PR: 271979

7 months agoiicbus: add compat32 support for I2C ioctls
Stephen J. Kiernan [Wed, 29 Nov 2023 19:20:45 +0000 (14:20 -0500)]
iicbus: add compat32 support for I2C ioctls

Some of the I2C ioctl request structures contain pointers and need to
handle requests from 32-bit applications on 64-bit kernels.

Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D42836

7 months agocam: Make cam.h self-contained for userland
Warner Losh [Fri, 1 Dec 2023 01:18:59 +0000 (18:18 -0700)]
cam: Make cam.h self-contained for userland

We reference FILE * here, but don't include stdio.h. Do so (both of
these are in !_KERNEL blocks).

Sponsored by: Netflix

7 months agocam: Remove prototype for cam_sim_alloc_dev
Warner Losh [Fri, 1 Dec 2023 01:17:30 +0000 (18:17 -0700)]
cam: Remove prototype for cam_sim_alloc_dev

The implementation was removed in dcd5dea96509, but the prototype was
not. Correct that oversight.

Fixes: dcd5dea96509
Sponsored by: Netflix

7 months agortld: add a test for RTLD_DEEPBIND
Kyle Evans [Fri, 1 Dec 2023 01:26:09 +0000 (19:26 -0600)]
rtld: add a test for RTLD_DEEPBIND

This tests that with RTLD_DEEPBIND, symbols are looked up in all of the
object's needed objects before the global object.

PR: 275393
Reviewed by: kib
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D42843

7 months agoath: Revert "Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process"
Bjoern A. Zeeb [Fri, 3 Nov 2023 21:52:35 +0000 (21:52 +0000)]
ath: Revert "Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process"

This reverts commit 6c3e93cb5a4aa4b8a2d8d4d326f2a7c34d3a4458 for
sys/dev/ath/if_ath.c only.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 months agoRevert "[ath] Attempt to fix epoch handling."
Bjoern A. Zeeb [Fri, 3 Nov 2023 21:50:31 +0000 (21:50 +0000)]
Revert "[ath] Attempt to fix epoch handling."

This reverts commit af2441fbc7fa9e522e7f8697e5a181bdd4ff9e00.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 months agoRevert "Enter the network epoch in USB WiFi drivers when processing input"
Bjoern A. Zeeb [Fri, 3 Nov 2023 21:31:29 +0000 (21:31 +0000)]
Revert "Enter the network epoch in USB WiFi drivers when processing input"

This reverts commit 17c328b6aebfa03cd1c2cbfbbc617e3b341bf1e4.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 months agoRevert "Widen EPOCH(9) usage in USB WLAN drivers."
Bjoern A. Zeeb [Fri, 3 Nov 2023 21:27:15 +0000 (21:27 +0000)]
Revert "Widen EPOCH(9) usage in USB WLAN drivers."

This reverts commit 21c4082de9e2cf9a0fd81a9a981ab06022956847.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 months agoRevert "Widen EPOCH(9) usage in PCI WLAN drivers."
Bjoern A. Zeeb [Fri, 3 Nov 2023 21:19:26 +0000 (21:19 +0000)]
Revert "Widen EPOCH(9) usage in PCI WLAN drivers."

This reverts commit b65f813c1ab99448278961c5ca80dc422b1eae29.
As a side effect this also seems to fix wtap which seems to have
lost the epoch over the input path in between.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 months agonet80211: move net_epoch into net80211
Bjoern A. Zeeb [Sun, 29 Oct 2023 14:25:23 +0000 (14:25 +0000)]
net80211: move net_epoch into net80211

Move the net_epoch into net80211 around the if_input calls and out of
the driver (in this first case LinuxKPI).  This reduces coverage but
also allows us to alloc in calls like (*ampdu_rx_start) which do not
actually pass data up the stack.

The follow-up commits will revert b65f813c1ab99448278961c5ca80dc422b1eae29,
21c4082de9e2cf9a0fd81a9a981ab06022956847,
17c328b6aebfa03cd1c2cbfbbc617e3b341bf1e4,
af2441fbc7fa9e522e7f8697e5a181bdd4ff9e00,
and 6c3e93cb5a4aa4b8a2d8d4d326f2a7c34d3a4458 for ath.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Tested by: few (rtwn, ath, iwlwifi, ...)
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D42427

7 months agosort: test against all month formats in month-sort
Christos Margiolis [Fri, 1 Dec 2023 00:30:10 +0000 (02:30 +0200)]
sort: test against all month formats in month-sort

The CLDR specification [1] defines three possible month formats:

- Abbreviation (e.g Jan, Ιαν)
- Full (e.g January, Ιανουαρίου)
- Standalone (e.g January, Ιανουάριος)

Many languages use different case endings depending on whether the month
is referenced as a standalone word (nominative case), or in date context
(genitive, partitive, etc.). sort(1)'s -M option currently sorts months
by testing input against only the abbrevation format, which is
essentially a substring of the full format. While this works fine for
languages like English, where there are no cases, for languages where
there is a different case ending between the abbreviation/full and
standalone formats, it is not sufficient.

For example, in Greek, "May" can take the following forms:

Abbreviation: Μαΐ (genitive case)
Full: Μαΐου (genitive case)
Standalone: Μάιος (nominative case)

If we use the standalone format in Greek, sort(1) will not able to match
"Μαΐ" to "Μάιος" and the sort will fail.

This change makes sort(1) test against all three formats. It also works
when the input contains mixed formats.

[1] https://cldr.unicode.org/translation/date-time/date-time-patterns

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D42847

7 months agotcp: for LRD move sysctl from tcp.do_lrd tp tcp.sack.lrd, remove sockopt
Richard Scheffenegger [Thu, 30 Nov 2023 20:10:14 +0000 (21:10 +0100)]
tcp: for LRD move sysctl from tcp.do_lrd tp tcp.sack.lrd, remove sockopt

Moving lrd sysctl to the tcp.sack branch, since LRD only works with SACK.
Remove the sockopt to programmatically control LRD per session.

Reviewed By:           #transport, tuexen, rrs
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42851

7 months agoRTLD_DEEPBIND: make lookup not just symbolic, but walk all refobj' DAGs
Konstantin Belousov [Wed, 29 Nov 2023 18:30:59 +0000 (20:30 +0200)]
RTLD_DEEPBIND: make lookup not just symbolic, but walk all refobj' DAGs

before starting the walk over the global list.  Effectively we visit
needed objects first as well, instead of just the object itself.
This seems to better match the semantic offered by the glibc flag.

Reported by: kevans
PR: 275393
Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42841

7 months agonet80211: ieee80211_dump_node() check for channel to be set
Bjoern A. Zeeb [Thu, 30 Nov 2023 18:20:22 +0000 (18:20 +0000)]
net80211: ieee80211_dump_node() check for channel to be set

Avoid panics in case ieee80211_dump_node() gets called before a
channel context is set.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 months agoossl: Add AES-GCM support for NEON-enabled armv7
Mark Johnston [Thu, 30 Nov 2023 17:46:54 +0000 (12:46 -0500)]
ossl: Add AES-GCM support for NEON-enabled armv7

This provides substantially higher throughput than the fallback
implementation.

Reviewed by: jhb
MFC after: 3 months
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D41305

7 months agoossl: Add support for armv7
Mark Johnston [Thu, 30 Nov 2023 17:46:08 +0000 (12:46 -0500)]
ossl: Add support for armv7

OpenSSL provides implementations of several AES modes which use
bitslicing and can be accelerated on CPUs which support the NEON
extension.  This patch adds arm platform support to ossl(4) and provides
an AES-CBC implementation, though bsaes_cbc_encrypt() only implements
decryption.  The real goal is to provide an accelerated AES-GCM
implementation; this will be added in a subsequent patch.

Initially derived from https://reviews.freebsd.org/D37420.

Reviewed by: jhb
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D41304

7 months agoossl: Fix some bugs in the fallback AES-GCM implementation
Mark Johnston [Wed, 29 Nov 2023 20:08:12 +0000 (15:08 -0500)]
ossl: Fix some bugs in the fallback AES-GCM implementation

gcm_*_aesni() are used when the AVX512 implementation is not available.
Fix two bugs which manifest when handling operations spanning multiple
segments:
- Avoid underflow when the length of the input is smaller than the
  residual.
- In gcm_decrypt_aesni(), ensure that we begin the operation at the
  right offset into the input and output buffers.

Reviewed by: jhb
Fixes: 9b1d87286c78 ("ossl: Add a fallback AES-GCM implementation using AES-NI")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42838

7 months agosockets: don't malloc/free sockaddr memory on getpeername/getsockname
Gleb Smirnoff [Thu, 30 Nov 2023 16:30:55 +0000 (08:30 -0800)]
sockets: don't malloc/free sockaddr memory on getpeername/getsockname

Just like it was done for accept(2) in cfb1e92912b4, use same approach
for two simplier syscalls that return socket addresses.  Although,
these two syscalls aren't performance critical, this change generalizes
some code between 3 syscalls trimming code size.

Following example of accept(2), provide VNET-aware and INVARIANT-checking
wrappers sopeeraddr() and sosockaddr() around protosw methods.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D42694

7 months agosockets: don't malloc/free sockaddr memory on accept(2)
Gleb Smirnoff [Thu, 30 Nov 2023 16:30:55 +0000 (08:30 -0800)]
sockets: don't malloc/free sockaddr memory on accept(2)

Let the accept functions provide stack memory for protocols to fill it in.
Generic code should provide sockaddr_storage, specialized code may provide
smaller structure.

While rewriting accept(2) make 'addrlen' a true in/out parameter, reporting
required length in case if provided length was insufficient.  Our manual
page accept(2) and POSIX don't explicitly require that, but one can read
the text as they do.  Linux also does that. Update tests accordingly.

Reviewed by: rscheff, tuexen, zlei, dchagin
Differential Revision: https://reviews.freebsd.org/D42635

7 months agotcp: enable LRD by default
Richard Scheffenegger [Thu, 30 Nov 2023 04:33:50 +0000 (05:33 +0100)]
tcp: enable LRD by default

Lost Retransmission Detection was added as a
feature in May 2021, but disabled by default.

Enabling the feature by default to reduce the
flow completion time by avoiding RTOs when
retransmissions get lost too.

Reviewed By:           tuexen, #transport, zlei
MFC after:             10 weeks
Sponsored by:          NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D42845

7 months agovm: Add kva_alloc_aligned
Andrew Turner [Wed, 29 Nov 2023 12:54:49 +0000 (12:54 +0000)]
vm: Add kva_alloc_aligned

Add a function like kva_alloc that allows us to specify the alignment
of the virtual address space returned.

Reviewed by: alc, kib, markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42788

7 months agovm: Use vmem_xalloc in kva_alloc
Andrew Turner [Wed, 29 Nov 2023 12:11:37 +0000 (12:11 +0000)]
vm: Use vmem_xalloc in kva_alloc

The kernel_arena used in kva_alloc has the qcache disabled. vmem_alloc
will first try to use the qcache before falling back to vmem_xalloc.

Rather than trying to use the qcache in vmem_alloc just call
vmem_xalloc directly.

Reviewed by: alc, kib, markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42831

7 months agoUnbreak build from ed31b3f4a146 (misapplied diff).
Jamie Gritton [Thu, 30 Nov 2023 01:27:37 +0000 (17:27 -0800)]
Unbreak build from ed31b3f4a146 (misapplied diff).

Differential Revision: <https://reviews.freebsd.org/D28150

7 months agojail: Don't allow jail_set(2) to resurrect dying jails.
Jamie Gritton [Thu, 30 Nov 2023 00:12:13 +0000 (16:12 -0800)]
jail: Don't allow jail_set(2) to resurrect dying jails.

Currently, a prison in "dying" state (removed but still holding
resources) can be brought back to alive state via "jail -d", or
the JAIL_DYING flag to jail_set(2).  This seemed like a good idea
at the time.

Its main use was to improve support for specifying the jid when
creating a jail, which also seemed like a good idea at the time.
But resurrecting a jail that was partway through thr process of
shutting down is trouble waiting to happen.

This patch deprecates that flag, leaving it as a no-op for creating
jails (but still useful for looking at dying jails).  It sill allows
creating a new jail with the same jid as a dying one, but will renumber
the old one in that case.  That's imperfect, but allows for current
behavior.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D28150

7 months agosmbus: add compat32 support for SMB ioctls
Stephen J. Kiernan [Wed, 29 Nov 2023 19:33:59 +0000 (14:33 -0500)]
smbus: add compat32 support for SMB ioctls

Some of the SMB ioctl request structures contain pointers and need to
handle requests from 32-bit applications on 64-bit kernels.

Obtained from: Juniper Networks, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42837

7 months agozfs: merge openzfs/zfs@a03ebd9be
Martin Matuska [Wed, 29 Nov 2023 22:07:33 +0000 (23:07 +0100)]
zfs: merge openzfs/zfs@a03ebd9be

Notable upstream pull request merges:
 #15517 2a27fd411 ZIL: Assert record sizes in different places
 #15557 b94ce4e17 module/icp/asm-arm/sha2: fix compiling on armv5/6
 #15557 4340f69be module/icp/asm-arm/sha2: auto detect __ARM_ARCH
 #15603 a03ebd9be ZIL: Call brt_pending_add() replaying TX_CLONE_RANGE
 #15606 1c38cdfe9 zdb: fix printf() length for uint64_t devid

Obtained from: OpenZFS
OpenZFS commit: a03ebd9beec6243682557fa692c12b1061fc58bd

7 months agotail: Clean up error messages.
Dag-Erling Smørgrav [Wed, 29 Nov 2023 21:48:57 +0000 (22:48 +0100)]
tail: Clean up error messages.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D42842

7 months agotail: Fix heap overflow in -F case.
Dag-Erling Smørgrav [Wed, 29 Nov 2023 21:48:50 +0000 (22:48 +0100)]
tail: Fix heap overflow in -F case.

The number of events we track can vary over time, but we only allocate
enough space for the exact number of events we are tracking when we
first begin, resulting in a trivially reproducable heap overflow.  Fix
this by allocating enough space for the greatest possible number of
events (two per file) and clean up the code a bit.

Also add a test case which triggers the aforementioned heap overflow,
although we don't currently have a way to detect it.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude, markj
Differential Revision: https://reviews.freebsd.org/D42839

7 months agoiwlwififw: add firmware for the Bz/B200 chipset
Bjoern A. Zeeb [Wed, 29 Nov 2023 21:33:23 +0000 (21:33 +0000)]
iwlwififw: add firmware for the Bz/B200 chipset

The iwlwifi driver already supports the chipset as "Bz TBD"
(also in 14.0).  Add the firmware for it.  Successfully tested
for 0x8086/0x272b/0x8086/0x00f4 on arm64 thanks to donated
hardware [1].

    Firmware was obtained from linux-firmware at
    9552083a783e5e48b90de674d4e3bf23bb855ab0 .

Sponsored by: The FreeBSD Foundation
Sponsored by: Martin Hoehne / minipci.biz (B200 card) [1]
MFC after: 3 days

7 months agolinuxkpi: Include <linux/rbtree.h> from <linux/hrtimer.h> and <linux/mm_types.h>
Jean-Sébastien Pédron [Wed, 29 Nov 2023 18:38:54 +0000 (19:38 +0100)]
linuxkpi: Include <linux/rbtree.h> from <linux/hrtimer.h> and <linux/mm_types.h>

[Why]
Some files in DRM rely on this indirect include to use `struct rb_*`.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42835

7 months agovt(4): Call post-switch callback after replacing the backend
Jean-Sébastien Pédron [Wed, 29 Nov 2023 18:34:48 +0000 (19:34 +0100)]
vt(4): Call post-switch callback after replacing the backend

[Why]
For instance, it gives a chance to the new backend to refresh the
screen. This is needed by the vt_drmfb backend and `drm_fb_helper`.

This change was lost when I posted changes to reviews.freebsd.org and it
broken the amdgpu driver... Thanks to manu@ for reporting the problem
and wulf@ to find out the missing change!

Tested by: manu
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42834

7 months agoZIL: Call brt_pending_add() replaying TX_CLONE_RANGE
Alexander Motin [Wed, 29 Nov 2023 18:51:34 +0000 (13:51 -0500)]
ZIL: Call brt_pending_add() replaying TX_CLONE_RANGE

zil_claim_clone_range() takes references on cloned blocks before ZIL
replay.  Later zil_free_clone_range() drops them after replay or on
dataset destroy.  The total balance is neutral.  It means on actual
replay we must take additional references, which would stay in BRT.

Without this blocks could be freed prematurely when either original
file or its clone are destroyed.  I've observed BRT being emptied
and the feature being deactivated after ZIL replay completion, which
should not have happened.  With the patch I see expected stats.

Reviewed-by: Kay Pedersen <mail@mkwg.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15603

7 months agox86: Support multiple PCI MCFG regions
John Baldwin [Wed, 29 Nov 2023 18:32:39 +0000 (10:32 -0800)]
x86: Support multiple PCI MCFG regions

In particular, this enables support for PCI config access for domains
(segments) other than 0.

Reported by: cperciva
Tested by: cperciva (m7i.metal-48xl AWS instance)
Reviewed by: imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D42828

7 months agox86: Refactor pcie_cfgregopen
John Baldwin [Wed, 29 Nov 2023 18:32:16 +0000 (10:32 -0800)]
x86: Refactor pcie_cfgregopen

Split out some bits of pcie_cfgregopen that only need to be executed
once into helper functions in preparation for supporting multiple MCFG
entries.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42829

7 months agopci_cfgreg: Add a PCI domain argument to the low-level register API
John Baldwin [Wed, 29 Nov 2023 18:31:47 +0000 (10:31 -0800)]
pci_cfgreg: Add a PCI domain argument to the low-level register API

This commit changes the API of pci_cfgreg(read|write) to add a domain
argument (referred to as a segment in ACPI parlance) (note that this
is not the same as a NUMA domain, but something PCI-specific).  This
does not yet enable access to domains other than 0, but updates the
API to support domains.

Places that use hard-coded bus/slot/function addresses have been
updated to hardcode a domain of 0.  A few places that have the PCI
domain (segment) available such as the acpi_pcib_acpi.c Host-PCI
bridge driver pass the PCI domain.

The hpt27xx(4) and hptnr(4) drivers fail to attach to a device not on
domain 0 since they provide APIs to their binary blobs that only
permit bus/slot/function addressing.

The x86 non-ACPI PCI bus drivers all hardcode a domain of 0 as they do
not support multiple domains.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42827

7 months agoagp_amd64: Use <machine/pci_cfgreg.h> rather than bare prototypes
John Baldwin [Wed, 29 Nov 2023 18:31:16 +0000 (10:31 -0800)]
agp_amd64: Use <machine/pci_cfgreg.h> rather than bare prototypes

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D42826

7 months agoFix zoneid when USER_NS is disabled
Wraithh [Wed, 29 Nov 2023 17:55:17 +0000 (19:55 +0200)]
Fix zoneid when USER_NS is disabled

getzoneid() should return GLOBAL_ZONEID instead of 0 when USER_NS is disabled.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ilkka Sovanto <github@ilkka.kapsi.fi>
Closes #15560

7 months agoZTS: get_persistent_disk_name can return truncated names
VaibhavB [Wed, 29 Nov 2023 17:34:29 +0000 (23:04 +0530)]
ZTS: get_persistent_disk_name can return truncated names

Instead of using only the 3rd element return the entire string after
the split to handle device names with dashes.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Vaibhav Bhanawat <vaibhav.bhanawat@delphix.com>
Closes #15567

7 months agozdb: fix printf() length for uint64_t devid
Martin Matuška [Wed, 29 Nov 2023 17:18:30 +0000 (18:18 +0100)]
zdb: fix printf() length for uint64_t devid

Bug introduced in 213d6829673.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Warner Losh <imp@FreeBSD.org>
Signed-off-by: Martin Matuska <mm@FreeBSD.org>
Closes #15606

7 months agopf: fix mem leaks upon vnet destroy
Igor Ostapenko [Wed, 29 Nov 2023 12:35:41 +0000 (13:35 +0100)]
pf: fix mem leaks upon vnet destroy

Add missing cleanup actions:
- remove user defined anchor rulesets
- remove user defined ether anchor rulesets
- remove tables linked to user defined anchors
- deal with wildcard anchor peculiarities to get them removed correctly

PR: 274310
Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42747

7 months agoossl: Keep mutable AES-GCM state on the stack
Mark Johnston [Wed, 29 Nov 2023 17:51:55 +0000 (12:51 -0500)]
ossl: Keep mutable AES-GCM state on the stack

ossl(4)'s AES-GCM implementation keeps mutable state in the session
structure, together with the key schedule.  This was done for
convenience, as both are initialized together.  However, some OCF
consumers, particularly ZFS, assume that requests may be dispatched to
the same session in parallel.  Without serialization, this results in
incorrect output.

Fix the problem by explicitly copying per-session state onto the stack
at the beginning of each operation.

PR: 275306
Reviewed by: jhb
Fixes: 9a3444d91c70 ("ossl: Add a VAES-based AES-GCM implementation for amd64")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42783

7 months agoopenzfs: unbreak 32-bit builds.
Warner Losh [Wed, 29 Nov 2023 15:26:29 +0000 (08:26 -0700)]
openzfs: unbreak 32-bit builds.

32-bit builds are broken. fix that by using PRIu64 instead of a
bare '%lu.'

Feel free to revert when upstream has this fixed. I'm agnostic as to the
proper fix, but don't have the time to fight upstreaming this on top of
everything else.

7 months agozfsd: fault disks that generate too many I/O delay events
Alan Somers [Wed, 12 Jul 2023 20:46:27 +0000 (14:46 -0600)]
zfsd: fault disks that generate too many I/O delay events

If ZFS reports that a disk had at least 8 I/O operations over 60s that
were each delayed by at least 30s (implying a queue depth > 4 or I/O
aggregation, obviously), fault that disk.  Disks that respond this
slowly can degrade the entire system's performance.

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D42825

7 months agompi3mr: Minor tweak to task queue pausing
Warner Losh [Wed, 29 Nov 2023 01:50:57 +0000 (18:50 -0700)]
mpi3mr: Minor tweak to task queue pausing

Use a while loop with cancel / drain to make sure that all tasks have
completed before proceeding to reset.

Suggested by: jhb
Sponsored by: Netflix

7 months agompi3mr: Assume dma_hiaddr is BUS_SPACE_MAXADDR
Warner Losh [Wed, 29 Nov 2023 01:50:52 +0000 (18:50 -0700)]
mpi3mr: Assume dma_hiaddr is BUS_SPACE_MAXADDR

No sense having a variable for this. So use BUS_SPACE_MAXADDR and remove
dma_hiaddr from softc.

Suggested by: jhb
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42808

7 months agompi3mr: Replace can't happen DataLength == 0 with an assert
Warner Losh [Wed, 29 Nov 2023 01:50:47 +0000 (18:50 -0700)]
mpi3mr: Replace can't happen DataLength == 0 with an assert

Replace the test for DataLength == 0 with an assert. It can't happen,
but an assert doesn't hurt. Emacs removed some trailing white space too.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42807

7 months agompi3mr: Use template for main busdma tag.
Alexander Motin [Wed, 29 Nov 2023 01:50:39 +0000 (18:50 -0700)]
mpi3mr: Use template for main busdma tag.

Use the simpler template code for the parent busdma tag for all I/O to
this card.

Reviewed by: mav, jhb, imp
Differential Revision: https://reviews.freebsd.org/D42607

7 months agompi3mr: Make these bus_dmamap_load calls synchronous
Alexander Motin [Wed, 29 Nov 2023 01:50:30 +0000 (18:50 -0700)]
mpi3mr: Make these bus_dmamap_load calls synchronous

These calls "should" all be synchrounous. There's no bouncing that's
needed for them (at least in the typical case that we have a sane card
that has more bits of dma addresses decoded than we have memory), so
there's no errors possible. Ensure these calls are really synchronous
with BUS_DMA_NOWAIT flags (which should never fail now that the
bus_dmamem_alloc() has succeeded).

Reviewed by: mav, jhb, imp
Differential Revision: https://reviews.freebsd.org/D42606

7 months agompi3mr: Fix MAXPHYS usage
Alexander Motin [Wed, 29 Nov 2023 01:50:24 +0000 (18:50 -0700)]
mpi3mr: Fix MAXPHYS usage

This usage is obsolete. Replace with maximum bus space size. maxphys
will sort itself out at higher levels.

Reviewed by: mav, jhb, imp
Differential Revision: https://reviews.freebsd.org/D42605

7 months agompi3mr: Add firmware version
Warner Losh [Wed, 29 Nov 2023 01:50:10 +0000 (18:50 -0700)]
mpi3mr: Add firmware version

Publish the firmware version on the card like we do for mps/mpr.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D42588