Andrew Turner [Tue, 23 Apr 2024 11:27:09 +0000 (12:27 +0100)]
dev/psci: Check all compat strings
When searching for the PSCI FDT node we only check a few compat strings.
Use the existing compat_data array to check all strings the driver may
attach to.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44913
Andrew Turner [Fri, 3 May 2024 16:17:25 +0000 (17:17 +0100)]
arm64: Flush the spintable release address
Ensure the spintable release address is written back from the cache
to memory. The other CPUs reading this may not be reading it with the
cache enabled so ensure it is written to the point of coherency
before issuing the wakeup sev.
As cpu_dcache_wbinv_range includes the needed barrier remove it from
the inline asm before the sev instruction.
Andrew Turner [Mon, 29 Apr 2024 14:23:42 +0000 (15:23 +0100)]
arm64: Support a shared release for spin-table
When releasing multiple CPUs that share a release address we need them
to wait for their turn to boot. Add a mechanism to do this by booting
them until they enable the TLB before waiting their turn to enter
init_secondary.
Alexander Ziaee [Fri, 10 May 2024 02:43:39 +0000 (20:43 -0600)]
sysexits: Tidy deprecated header and manual
<sysexits.h> was deprecated in the base system in a1432b4 for FreeBSD
8.0 and is retained only for backwards compatibility. Make that clear,
since sysexits(3) suggested using it since it was in style(9) prior
to this.
HP van Braam [Fri, 10 May 2024 02:13:03 +0000 (20:13 -0600)]
ahc(4): Default to memory mapped IO
When this driver was written it made sense to make this default to off,
but these days almost all BIOSses will do the right thing. Furthermore
non-mmio communication only works on Intel architectures.
So lets default to allowing mmio, but not change the semantics of the
AHC_ALLOW_MEMIO flag to not break existing installs. Also document the
already existing hint.ahc.<unit>.allow_memio.
Signed-off-by: HP van Braam <hp@tmm.cx>
Reviewed by: imp (small style tweak)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1219
Justine Tunney [Fri, 10 May 2024 01:55:45 +0000 (19:55 -0600)]
Fix memory corruption in C++ demangler
The __cxa_demangle_gnu3() and cpp_demangle_gnu3() functions segfault on
various libcxxabi test cases due to a copy and paste error. This change
fixes that.
This is a subset of https://github.com/libcxxrt/libcxxrt/pull/34 which
fixes the immediate problem.
Reviewed by: imp, emaste (I think)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1222
Rick Macklem [Fri, 10 May 2024 01:33:13 +0000 (18:33 -0700)]
nfscl: Do not do readahead for directories
For a very long time, the NFS client has done readahead for
directory blocks. Unlike data blocks, the readahead cannot
begin until the Readdir RPC reply has been received, since
the directory offset cookie in that Readdir RPC reply is needed.
As such, the readahead is serialized and does not seem to
provide any real benefit.
Recent testing/benchmarking shows that removing this
readahead code for Readdir does not have a negative impact
on performance.
Therefore, this patch deletes the readahead code for Readdir,
which simplifies the code and may make future changes simpler.
Simon J. Gerraty [Fri, 10 May 2024 01:29:43 +0000 (18:29 -0700)]
Allow -DNO_STRICT_REGEX to restore historic regex behavior
Allow restoring the behavior of '{' as described in regex(3).
Ie. only treat it as start of bounds if followed by a digit.
If NO_STRICT_REGEX is not defined, the behavior introduced by
commit a4a801688c909ef39cbcbc3488bc4fdbabd69d66 is retained,
otherwise the previous behavior is restored.
Introduce hw.bus.devctl_nomatch_enabled and use it to suppress NOMATCH
until devmatch runs
There's a lot of NOMATCH events generated at boot. We also run devmatch
once during early boot to load unmatched devices. To avoid redundant
work, don't start generating NOMATCH events until after devmatch runs.
Set hw.bus.devctl_nomatch_enabled=1 just before we run devmatch. The
kernel will suppress NOMATCH events until this is set to true.
This saves about 170ms from the boot on aarch64 running atop Apple
M-series processors and the VMWare Fusion hypervisor.
Reviewed by: imp, cperciva
MFC after: 3 days
Sponsored by: Google Summer of Code
Pull Request: https://github.com/freebsd/freebsd-src/pull/1213
Substantially reduce the number of signed/unsigned issues (warnings if
enabled). While these are presently disabled for FreeBSD, being able to
enable another warning would be good.
All architecture implementations actually want this to be unsigned.
INTRNG the equivalent is overtly unsigned. x86 and PowerPC merely avoid
the need to explicitly convert at several points.
While otherwise a handy potential approach, getting the trap frame via
the argument isn't documented and isn't supposed to be used. Adjust
pmu_intr() to instead use curthread->td_intr_frame, which is the proper
way.
sound: Add missing oss_mixerinfo devnode and legacy_device fields
They are missing from soundcard.h and are in fact used by some
applications, such as OSS' ossinfo(1):
http://manuals.opensound.com/developer/ossinfo.c.html
The new size for filler is chosen according to the most recent official
version of soundcard.h, which includes those 2 fields.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45137
According to the OSS manual, oss_sysinfo->numcards holds the number of
detected audio devices in the system, while the current ncards variable,
whose value is assigned to oss_sysinfo->numcards, holds the number of
currently registered devices only.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dev_submerge.ch, emaste
Differential Revision: https://reviews.freebsd.org/D45136
sound: Remove nmix variable from mixer_oss_mixerinfo()
nmix is used to compare against oss_mixerinfo->dev, which is a
user-supplied value to select the mixer device (if not -1, in which case
we'll select the default one) we want to fetch the information of. It is
also used to set oss_mixerinfo->dev in case it is -1.
However, nmix is at best redundant, since we have the loop counter
already (i), and confusing at worst.
For example, suppose a system with 3 mixer devices. We call
SNDCTL_MIXERINFO with oss_mixerinfo->dev=1, meaning we want to get
information for /dev/mixer1. Suppose /dev/mixer0 detaches while inside
the loop, so we'll hit the loop's "continue" case, and nmix won't get
incremented (i.e will stay 0 for now). At this point nmix counts 1
device less, so when it reaches 1, we'll be fetching /dev/mixer2's
information instead of /dev/mixer1's.
This is also true in case the mixer device disappears prior to the call
to mixer_oss_mixerinfo().
Simply remove nmix and use the loop counter to both set
oss_mixerinfo->dev and check against it in case a non -1 value is
supplied.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45135
Florian Walpen [Thu, 9 May 2024 18:36:40 +0000 (19:36 +0100)]
snd_hdsp(4): RME HDSP 9632 and HDSP 9652 sound card driver.
Add a sound(4) bridge device driver for the RME HDSP 9632 and HDSP 9652
sound cards. These cards require a nowadays rare PCI 32bit (not PCIe)
slot, but still see use due to their value and wealth of features.
The HDSP 9632 is mostly comparable to the newer HDSPe AIO, while the
HDSP 9652 is similar to the HDSPe RayDAT. These HDSPe PCIe cards are
supported by the snd_hdspe(4) driver which was taken as a starting point
for development of snd_hdsp(4).
Implementation is kept separately due to substantial differences in
hardware configuration and to allow easy removal in case PCI 32bit
support would be phased out in the future.
The snd_hdsp(4) kernel module is not enabled by default, and can be
loaded at runtime with kldload(8) or during boot via loader.conf(5).
Basic operation was tested with both cards, not including all optional
cable connectors and expansion boards. Features should be roughly on par
with the snd_hdspe(4) supported cards.
Michael Tuexen [Wed, 8 May 2024 22:17:13 +0000 (00:17 +0200)]
sctp: don't provide uninitialized memory to process_chunk_drop()
Right now, the code in process_chunk_drop() does not look the
the corresponding fields.
Therefore, no functional change intended.
Reported by: Coverity Scan
CID: 1472476
MFC after: 3 days
Michael Tuexen [Wed, 8 May 2024 21:41:17 +0000 (23:41 +0200)]
sctp: fix sctp_sendall() when an mbuf chain is provided
In this case uio is NULL, which needs to be checked and m must
be copied into the sctp_copy_all structure.
Reported by: Coverity Scan
CID: 1400449
MFC after: 3 days
Kristof Provost [Thu, 9 May 2024 11:52:22 +0000 (13:52 +0200)]
libpfctl: fix file descriptor leak
pfctl_get_rules_info() opened a netlink socket, but failed to close it again.
Fix this by factoring out the netlink-based function into a _h variant that
takes struct pfctl_handle, and implement pfctl_get_rules_info() based on that,
remembering to close the fd.
While here migrate all in-tree consumers to the _h variant.
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Roger Pau Monné [Thu, 2 May 2024 13:12:16 +0000 (15:12 +0200)]
xen/debug: remove usage of sbuf_{clear,finish}() on drained sbuf
Using sbuf_clear() on a drained sbuf is explicitly prohibited, and using
sbuf_finish() after printing a trace leads to a single trace being printed, as
after calling sbuf_finish() further attempts to use the same sbuf will lead to
a panic.
While there also switch to using xen_emergency_print() instead of attempting to
write directly to the hypervisor console. xen_emergency_print() can be
implemented per-arch to use a different mechanism than the console hypercall
(note the default implementation still uses the console hypercall).
Fixes: df62b8a25f47 ('xen: add a handler for the debug interrupt')
Sponsored by: Cloud Software Group
Reviewed by: markj
Differential review: https://reviews.freebsd.org/D45060
Colin Percival [Thu, 9 May 2024 07:52:25 +0000 (00:52 -0700)]
release: make dependencies, not recursive make
For historical reasons, the vm-release and cloudware-release targets
were written as recursive makes of ${VMTARGETS} and ${CLOUDTARGETS};
this worked fine until we started running `make release -jN` and
had both VM and cloud targets depending on ${QEMUTGT}, at which
point things exploded when we tried to build the port twice at the
same time.
Switch vm-release and cloudware-release to have make dependencies on
their individual components; this way a single make process runs and
is aware of the duplicate dependency (and only runs it once).
Adrian Chadd [Fri, 19 Apr 2024 14:05:44 +0000 (07:05 -0700)]
net80211: add new ciphers and RSN flags
These are the rest of the ciphers and RSN flags from 802.11-2016.
* add the rest of the ciphers from 802.11-2016
* add the rest of the RSN flags from 802.11-2016
Of special interest here are the extended key ID field for supporting
>1 unicast key (to support seamless rekeying w/out dropping frames)
and the MFP (management frame protection) config bits.
This is a no-op; no code is using these new fields.
(In particular, no code in net80211 uses the RSN capability bits;
but that will change when we start on MFP support.)
Adrian Chadd [Thu, 18 Apr 2024 01:47:07 +0000 (18:47 -0700)]
net80211: add driver / crypto methods to set the hardware / software cipher suites
Drivers currently announce hardware crypto cipher support by
setting up ic_cryptocaps.
This adds two public function calls:
* ieee80211_set_software_ciphers() - set the software cipher set;
* ieee80211_set_hardware_ciphers() - set the hardware cipher set.
For now these just call into the newly crypto routines to set the ciphers.
This then adds the two crypto routines, similarly named, to set
the hardware/software cipher suite.
This is a no-op right now - wep/tkip/ccmp are already set by default
so drivers aren't required to call these routines for software
encryption, and drivers already set ic_cryptocaps for hardware
encryption.
Adrian Chadd [Wed, 17 Apr 2024 01:55:28 +0000 (18:55 -0700)]
wpa: Remove the now not-needed local logic to hard-code cipher support
A previous commit now exposes the supported net80211 ciphers for the
given NIC, rather than the hardware cipher list. This is going to be
especially important moving forward when we add more cipher and key
management support.
Adrian Chadd [Wed, 17 Apr 2024 01:53:52 +0000 (18:53 -0700)]
net80211: add a new field specifically for announcing specific ciphers
This dates way, way back with the original net80211 support w/ atheros chips.
The earliest chip (AR5210) had limitations supporting software encryption.
It only had the four WEP slots, and not any keycache entries. So when
trying to do CCMP/TKIP encryption would be enabled and the key slots
would have nothing useful in them, resulting in garbage encryption/decryption.
I changed this back in 2012 to disable supporting hardware WEP for AR5210
so if_ath(4) / net80211 crypto is all done in software and yes,
I could do CCMP/TKIP on AR5210 in software.
Fast-forward to newer-ish hardware - the Qualcomm 11ac hardware.
Those also don't support pass-through keycache slots! Well, the hardware
does at that layer, but then there's a whole offload data path encap/decap
layer that's turning the frames from raw wifi into ethernet frames (for
"dumb" AP behaviours) or "wifi direct" frames (ie, "windows".)
This hides a bunch of header frame contents required for doing the software
encryption / decryption path.
But then if you enable the raw transmit/receive frame format it ALSO
bypasses the hardware encryption/decryption engine!
So for those NICs:
* If you want to do encryption, you can only use the firmware supported
ciphers w/ wifi direct or ethernet;
* If you want to use software encrypt/decrypt, you MUST disable all encryption
and instead use 100% software encryption.
The wpa_supplicant bsd driver code has a specific comment about this and
flips on supporting WEP/TKIP/CCMP, which is understandable but it doesn't
fix the ACTUAL intention of all of this stuff.
So:
* create a new field, ic_sw_cryptocaps
* populate it with the default supported set of ciphers for net80211
(right now wep, tkip, ccmp)
* Communicate the combination of both ic_sw_cryptocaps and ic_cryptocaps
to wpa_supplicant via the relevant devcap ioctl.
* Update manpage.
I'll follow this up with a driver_bsd.c change in wpa_supplicant to
trust this again, and then start adding the other cipher support there.
John Baldwin [Wed, 8 May 2024 23:05:39 +0000 (16:05 -0700)]
nvme: Explicitly align struct nvme_command on an 8 byte boundary
This was already true for most architectures due to uint64_t structure
members. However, i386 is special in that it only requires 4 byte
alignment for uint64_t. As a result, casts from struct nvme_command
to struct nvmf_fabric_cmd were raising a "cast increases alignment"
warning on i386. Explicitly aligning struct nvme_command pacifies
this warning on i386.
Tijl Coosemans [Wed, 8 May 2024 18:49:56 +0000 (20:49 +0200)]
linuxkpi: Make arch_io_*_memtype_wc amd64-only
Linux only implements these functions on x86. They return 0 on other
architectures. The FreeBSD implementation calls PHYS_TO_DMAP but this
panics on i386 because it does not have a direct map so return 0 on i386
as well for now. These functions are only used by graphics/drm-*-kmod
to mark the VRAM aperture write-combining but this is also accomplished
by a call to vm_phys_fictitious_reg_range so this change is sufficient
to fix drm-*-kmod on i386 for FreeBSD 14.1.
Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45125
Dimitry Andric [Wed, 8 May 2024 18:44:28 +0000 (20:44 +0200)]
Merge commit 73bb8d9d92f6 from llvm-project (by Jonathan Peyton):
[OpenMP] Fix child processes to use affinity_none (#91391)
When a child process is forked with OpenMP already initialized, the
child process resets its affinity mask and sets proc-bind-var to false
so that the entire original affinity mask is used. This patch corrects
an issue with the affinity initialization code setting affinity to
compact instead of none for this special case of forked children.
The test trying to catch this only testing explicit setting of
KMP_AFFINITY=none. Add test run for no KMP_AFFINITY setting.
Fixes: #91098
This should fix OpenMP processes sometimes getting stuck on a single CPU
core.
PR: 278845
Reported by: Cassidy B. Larson <cbl@cbl.us>
MFC after: 3 days
Dimitry Andric [Wed, 8 May 2024 16:55:08 +0000 (18:55 +0200)]
Merge commit 5300a6731e98 from llvm-project (by Jonathan Peyton):
[OpenMP] Fix re-locking hang found in issue 86684 (#88539)
This was initially reported here (including stacktraces):
https://stackoverflow.com/questions/78183545/does-compiling-imagick-with-openmp-enabled-in-freebsd-13-2-cause-sched-yield
If `__kmp_register_library_startup()` detects that another instance of
the library is present, `__kmp_is_address_mapped()` is eventually
called. which uses `kmpc_alloc()` to allocate memory. This function
calls `__kmp_entry_thread()` to access the thread-local memory pool,
which is a bad idea during initialization. This macro internally calls
`__kmp_get_global_thread_id_reg()` which sets the bootstrap lock at the
beginning (before calling `__kmp_register_library_startup()`).
The fix is to use `KMP_INTERNAL_MALLOC()`/`KMP_INTERNAL_FREE()` instead
of `kmpc_malloc()`/`kmpc_free()`. `KMP_INTERNAL_MALLOC` and
`KMP_INTERNAL_FREE` do not use any bootstrap locks. They just translate
to `malloc()`/`free()` and are meant to be used during library
initialization before other library-specific allocators have been
initialized.
Fixes: #86684
This should fix OpenMP processes sometimes getting locked with 100% CPU
usage, endlessly calling sched_yield(2).
PR: 278845
Reported by: Cassidy B. Larson <cbl@cbl.us>
MFC after: 3 days
Ed Maste [Tue, 7 May 2024 15:33:45 +0000 (11:33 -0400)]
smsc(4): update to mention Microchip
Microchip Technology acquired SMSC in 2012, and all current products
and datasheets refer to the devices supported by this driver as
Microchip parts. Mention SMSC in a parenthetical comment to explain
the driver's name.
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45115
Mark Johnston [Wed, 8 May 2024 16:02:38 +0000 (12:02 -0400)]
vmm: Start reconciling amd64 and arm64 copies of vmm_dev.c
Most of the code in vmm_dev.c and vmm.c can and should be shared between
amd64 and arm64 (and eventually riscv) rather than being duplicated. To
the end of adding a shared implementation in sys/dev/vmm, this patch
eliminates most of the differences between the two copies of vmm_dev.c.
- Remove an unneeded cdefs.h include.
- Simplify the amd64 implementation of vcpu_unlock_one().
- Simplify the arm64 implementation of vcpu_lock_one().
- Pass buffer sizes to alloc_memseg() and get_memseg() on arm64. On
amd64 this is needed for compat ioctls, but these functions should be
merged.
- Make devmem_mmap_single() stricter on arm64.
Mark Johnston [Wed, 8 May 2024 16:01:52 +0000 (12:01 -0400)]
bsdinstall: Stop loading cryptodev for ZFS installations
- zfs depends on the crypto module, not cryptodev, and most arm64 kernel
configs include std.dev, which includes "device crypto" anyway.
- This config works around a problem with kldxref lacking cross-target
support, but that has since been fixed.
- Loading cryptodev creates /dev/crypto, which gives unprivileged users
access to the kernel's opencrypto framework. Very few applications
need it, so we're needlessly increasing the kernel's surface area.
Thus, stop auto-loading cryptodev.
Reviewed by: kevans, allanjude, des
Differential Revision: https://reviews.freebsd.org/D45127
Brooks Davis [Wed, 8 May 2024 14:52:00 +0000 (15:52 +0100)]
ofed: don't expose symbols twice
ibv_init_wq and ibv_cleanup_wq are made visible with the
default_symver which puts them in the IBVERBS_1.1 ABI. Don't
try to expose them as IBVERBS_PRIVATE_14 symbols as GNU ld
complains with --no-undefined-symbol.
Brooks Davis [Wed, 8 May 2024 14:51:17 +0000 (15:51 +0100)]
soxstack: slience 32-bit gcc warning
Modern GCC complains when casting pointers to integers of a different
size (even a larger one). Switch from uint64_t to uintptr_t which will
always be the right size for a stack address instead of maybe being too
big.
Brooks Davis [Wed, 8 May 2024 14:49:13 +0000 (15:49 +0100)]
libthr: avoid varargs in fcntl and openat interposers
Align these signatures with the ones in syscalls.master (and thus
libsys.h). There's no reason to do va_args twice and in some ABIs
(e.g,, CheriABI) you can't access fixed arguments as varargs if you
weren't called with varargs signature.
tcp: add counter to track when SACK loss recovery uses TSO
Add a counter to track how frequently SACK has transmitted
more than one MSS using TSO. Instances when this will be
beneficial is the use of PRR, or when ACK thinning due to
GRO/LRO or ACK discards by the network are present.
While the SACK Scoreboard in the base stack limits
the number of holes by default to only 128 per connection
in order to prevent CPU load attacks by splitting SACKs,
filtering out SACK blocks of unusually small size can
further improve the actual processing of SACK loss recovery.
Kristof Provost [Mon, 6 May 2024 07:43:49 +0000 (09:43 +0200)]
pf: always mark states as unlinked before detaching them
Users have reported crashes in pf_test_state_udp() where at least one state key
is NULL.
That suggests that pf_detach_state() ran concurrently with pf_test_state_udp().
pf_test_state_udp() holds the state lock (aka the id lock), but
pf_detach_state() does not.
The intent is that detached states are not returned by STATE_LOOKUP/
pf_find_state(), as the state's timeout is set to PFTM_UNLINKED and thus
pf_find_state() does not find the state.
There are other paths to pf_detach_state() (outside of pf_unlink_state())
though, where we did not set the timeout to PFTM_UNLINKED. Fix those, and assert
that the timeout is set correctly when we enter pf_detach_state().
There is only one functional change here - we don't allow SIOCSVH (or
netlink request) to change sc->sc_version. I'm convinced that allowing
such a change doesn't brings any practical value, but creates enless
minefields in front of both developers and end users (sysadmins). If
you want to switch from VRRP to CARP or vice versa, you'd need to recreate
the VHID.
Oh, one tiny funtional change: carp_ioctl_set() won't modify any fields
if it returns EINVAL. Previously you could provide valid advbase with
invalid advskew - that used to modify advbase and return EINVAL.
All other changes is a sweep around not ever using CARP fields when
we are in VRRP mode and vice versa. Also adding assertions on sc_version
where necessary.
Do not send VRRP vars in CARP mode via NetLink and vice versa. However
in compat ioctl SIOCGVH for VRRP mode the CARP fields would be zeroes.
This allows to declare softc as union and thus prevent any future logic
deterioration wrt to mixing VRRP and CARP.
- Separate HMAC preparation (CARP specific) from tagging.
- In unicast mode (CARP specific) don't put tag at all.
- Don't put pointer to software context into the tag. Putting just vhid,
an integer value, is a safer design.
Allow carp(4) to use the VRRPv3 protocol (RFC 5798). We can distinguish carp and
VRRP based on the protocol version number (carp is 2, VRRPv3 is 3), and support
both from the carp(4) code.
Peter Jeremy [Wed, 8 May 2024 08:17:00 +0000 (18:17 +1000)]
mii: Add support for Realtek RTL8211F-VD PHY
The RTL8211F-VD is a replacement/upgrade for the RTL8211F. Based on
https://github.com/torvalds/linux/commit/bb726b753f75a4eeda291438f89dfd9b94783569,
the only difference is the lack of the PCR2 register, which FreeBSD
doesn't use.
This fixes autonegotiation problems using the RTL8211F with ukphy(4).
Reviewed by: manu, bz
MFC after: 1 month
Differential Revision: <https://reviews.freebsd.org/D45109
Alan Cox [Wed, 17 Apr 2024 16:39:46 +0000 (11:39 -0500)]
arm64 pmap: Add ATTR_CONTIGUOUS support [Part 3]
Introduce L3C promotion of base page mappings. When the base page size
is 4KB, use ATTR_CONTIGUOUS to promote 16 aligned, contiguous base page
mappings to a 64KB mapping. Alternatively, when the base page size is
16KB, use ATTR_CONTIGUOUS to promote 128 aligned, contiguous base page
mappings to a 2MB mapping.
Given the frequency of L3C counter updates, switch to per-CPU counters
to avoid cache line ping ponging.
Revise the L3C counter descriptions to reflect the fact that the size
of an L3C mapping varies depending on the base page size.
Gleb Smirnoff [Tue, 7 May 2024 21:15:49 +0000 (14:15 -0700)]
sockets: garbage collect PRCOREQUESTS and stale comment
The code deleted predates FreeBSD history. The comment deleted is 99%
outdated. Why KAME decided to use these constants instead of normal ones
also lost in centuries.
John Baldwin [Tue, 7 May 2024 20:48:06 +0000 (13:48 -0700)]
nvme: Bump the alignment of struct nvme_health_information_page to 8
This ensures that embedded uint64_t values used for statistics
counters are aligned when allocating a structure on the stack or as
part of a containing structure. In particular this quiets
-Waddress-of-packed-member warnings from GCC when compiling the code
in nvmfd to update the stats.
John Baldwin [Tue, 7 May 2024 20:45:51 +0000 (13:45 -0700)]
nvmecontrol: Fix a sign compare mismatch
Even though mqes (uint16_t) and queue_size (u_int) are both unsigned,
the expression 'mqes + 1' gets promoted to int which is signed. Keep
the value unsigned by explicitly promoting mqes to u_int before
incrementing the value.
Mitchell Horne [Wed, 14 Feb 2024 16:56:13 +0000 (12:56 -0400)]
busdma: better handling of small segment bouncing
Typically, when a DMA transaction requires bouncing, we will break up
the request into segments that are, at maximum, page-sized.
However, in the atypical case of a driver whose maximum segment size is
smaller than PAGE_SIZE, we end up inefficiently assigning each segment
its own bounce page. For example, the dwmmc driver has a maximum segment
size of 2048 (PAGE_SIZE / 2); a 4-page transfer ends up requiring 8
bounce pages in the current scheme.
We should attempt to batch segments into bounce pages more efficiently.
This is achieved by pushing all considerations of the maximum segment
size into the new _bus_dmamap_addsegs() function, which wraps
_bus_dmamap_addseg(). Thus we allocate the minimal number of bounce
pages required to complete the entire transfer, while still performing
the transfer with smaller-sized transactions.
For most drivers with a segment size >= PAGE_SIZE, this will have no
impact. For drivers like dwmmc mentioned above, this improves the memory
and performance efficiency when bouncing a large transfer.
Co-authored-by: jhb
Reviewed by: jhb
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45048
Mitchell Horne [Wed, 14 Feb 2024 17:01:15 +0000 (13:01 -0400)]
busdma: deduplicate _bus_dmamap_addseg() function
It is functionally identical in all implementations, so move the
function to subr_busdma_bounce.c. The KASSERT present in the x86 version
is now enabled for all architectures. It should be universally
applicable.
Reviewed by: jhb
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45047
Marko Zec [Tue, 7 May 2024 15:44:09 +0000 (17:44 +0200)]
fib_dxr: set fib_data field in struct dxr_aux early enough
Previously it was possible for dxr_build() to return with da->fd
unset in case of range_tbl or x_tbl malloc() failures. This
may have led to NULL ptr dereferencing in dxr_change_rib_batch().
Warner Losh [Tue, 7 May 2024 02:06:54 +0000 (20:06 -0600)]
boot1.efi: Don't redundantly include devpath.c
devpath.c is on both the comand line and in libefi. This is redundant
and was a mistake in 4cf36aa1017f9. It never should have been here. In
practice, this just means that the devpath.o from libefi.a goes unused.
This will cause problems with some upcoming changes (D44872) to enable
LTO to reduce the size of the binaries, so go ahead and make the change
now to reduce the changeset for that. No functional change indended.
Ed Maste [Tue, 7 May 2024 01:45:50 +0000 (21:45 -0400)]
dlopen(3): mention fdlopen for capsicum(4)
Capsicum-sandboxed applications generally cannot use dlopen, as absolute
and cwd-relative paths cannot be accessed. Mention that fdlopen is
useful for sandboxed applications.
PR: 277169
Reviewed by: markj, oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45108