Commit Graph

296327 Commits

Author SHA1 Message Date
Olivier Certner 34740937f7 queue: New debug macros for STAILQ
The new STAILQ_ASSERT_EMPTY() macro allows callers to assert that some
STAILQ is empty.  It leverages the new QMD_STAILQ_CHECK_EMPTY() internal
macro.

QMD_STAILQ_CHECK_EMPTY() is a check for empty STAILQ, where heads's
'stqh_last' field must point to the 'stqh_first' one.  Use it in
STAILQ_ASSERT_EMPTY().

QMD_STAILQ_CHECK_TAIL() checks that the tail pointed by 'head' does not
have a next element.  It is similar to the already existing
QMD_TAILQ_CHECK_TAIL(), but without the superfluous 'field' argument and
clearer documentation.  Use it in STAILQ_INSERT_TAIL().

Approved by:    markj (mentor)
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46889
2024-12-16 15:42:26 +01:00
Olivier Certner 9dc5b3dbb0 refcount: Constify refcount_load()
Reviewed by:    markj
Approved by:    markj (mentor)
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46888
2024-12-16 15:42:26 +01:00
Olivier Certner 5e9a82e898 atomics: Constify loads
In order to match reality, allow using these functions with pointers on
const objects, and bring us closer to C11.

Remove the '+' modifier in the atomic_load_acq_64_i586()'s inline asm
statement's constraint for '*p' (the value to load).  CMPXCHG8B always
writes back some value, even when the value exchange does not happen in
which case what was read is written back.  atomic_load_acq_64_i586()
further takes care of the operation atomically writing back the same
value that was read in any case.  All in all, this makes the inline
asm's write back undetectable by any other code, whether executing on
other CPUs or code on the same CPU before and after the call to
atomic_load_acq_64_i586(), except for the fact that CMPXCHG8B will
trigger a #GP(0) if the memory address is part of a read-only mapping.
This unfortunate property is however out of scope of the C abstract
machine, and in particular independent of whether the 'uint64_t' pointed
to is declared 'const' or not.

Approved by:    markj (mentor)
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46887
2024-12-16 15:42:26 +01:00
Olivier Certner 4a26b63145 osd: Constify signature of osd_register()
This makes it clear that 'methods' (if not NULL) points to an array that
won't be modified.  Internally, this array is indeed copied into the
given OSD type's larger array of all methods for all slots.

Reviewed by:    jamie
Approved by:    markj (mentor)
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46886
2024-12-16 15:42:20 +01:00
Konstantin Belousov f870740008 ip6_output(): if mtu is not yet computed for ipsec hook, use ifp mtu
Sponsored by:	NVidia networking
2024-12-16 14:10:29 +02:00
Emmanuel Vadot 94e94d2ddd UPDATING: Add a notes for iwm(4) firmware and pkgbase users
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-12-16 10:46:05 +01:00
Emmanuel Vadot af0a81b647 iwm: Stop shipping firmware as kernel module
Since we can load raw firmware start shipping them as is.
This also remove the uuencode format that don't add any value and garbage
collect old firmwares version.
For pkgbase users they are now in the FreeBSD-firmware-iwm package.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-12-16 10:44:47 +01:00
Emmanuel Vadot 11f3da5655 pkgbase: Remove /boot/firmware from bootloader package
For now we don't ship anything in /boot/firmware, but some up coming commit
will ship wifi drivers in it and we want them to be in their own package.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-12-16 10:44:45 +01:00
Konstantin Belousov 58d1fdfaa9 amd iommu: remove unused function
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-12-16 00:49:52 +02:00
Ariel Ehrenberg 2fb2c03512 mlx5_core: fix "no space" error on sriov enablement
Change POOL_NEXT_SIZE define value from 0 to BIT(30), since this define
is used to request the available maximum sized flow table, and zero doesn't
make sense for it, whereas many places in the driver use zero explicitly
expecting the smallest table size possible but instead due to this
define they end up allocating the biggest table size unawarely.

Sponsored by:	NVidia networking
2024-12-16 00:27:53 +02:00
Ariel Ehrenberg 29a9d7c6ce mlx5_core: fix panic on sriov enablement
Align the code of fdb steering with flow steering core
and add missing parts in namespace initialization and
in prio logic

PR:	281714
Sponsored by:	NVidia networking
2024-12-16 00:27:31 +02:00
Bojan Novković 3342e5967d i386: Fix incorrect NMI handler invocations
Fixes:	459dc42
2024-12-15 18:47:52 +01:00
Warner Losh 70236f02f0 Revert "jemalloc: Reduce diffs to 5.2.1 revert to using JEMALLOC_FALLTHROUGH"
This reverts commit 7bcf5319c1.

Turns out this is needed for gcc, at least through gcc 14. This wasn't
documented it the import when it came in, so revert with this note.

Sponsored by:		Netflix
2024-12-15 09:23:59 -07:00
Bojan Novković d5ce54dddf hwpmc_x86: Register interrupt handler using the dynamic NMI registration interface
Register the PCINT handler using the nmi_{register, remove}_handler
interfaces (introduced in D46421) in preparation for hwt(4)'s
Intel Processor Trace backend. No functional change intended.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D47989
2024-12-15 16:39:36 +01:00
Bojan Novković 7bcaff0522 x86: Add routines for querying XSAVE feature information
This patch adds several routines that track and expose information
about various XSAVE-related features. More specifically, it adds the
ability to check whether a given XFEATURE is supported and which XSAVE
extensions are supported. Furthermore, it adds several routines for
calculating the size and offsets within a save area given a XSAVE
feature bitmap.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D47394
2024-12-15 16:39:36 +01:00
Bojan Novković 0c4fa0bdcf x86: Add definitions for some Intel Processor Trace bits
This patch adds definitions for Intel PT-related MSRs and
several PT feature bits.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D46419
2024-12-15 16:39:36 +01:00
Bojan Novković 593e874e61 amd64: Add wrappers for XRSTORS and XSAVES
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46984
2024-12-15 16:39:36 +01:00
Bojan Novković 04e8326721 x86: Allow sharing of perfomance counter interrupts
This patch refactors the Performance Counter interrupt setup code to
allow sharing the interrupt line between multiple drivers.
More specifically, Performance Counter interrupts are used by both
hwpmc(4) and hwt(4)'s upcoming Intel Processor Trace backend.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46420
2024-12-15 16:39:36 +01:00
Bojan Novković 459dc42787 x86: Refactor kernel-mode NMI handling
This refactor aims to add the ability to share performance counter
interrupts by refactoring the kernel-mode NMI handler. The handler now
allows multiple drivers to service the same interrupt (e.g. hwpmc(4)
and hwt(4)'s Intel Processor Trace backend).

Reviewed by:	kib, avg
Differential Revision:	https://reviews.freebsd.org/D46421
2024-12-15 16:39:36 +01:00
Kyle Evans 74ecdf86d8 Tweak ppoll() to include 1003.1-2024 visibility, take two
Note in the manpage that the 2024 edition finally added ppoll(), and
also add the appropriate declarations for the correct versions of
_POSIX_C_SOURCE (via __POSIX_VISIBLE).

Differential Revision:	https://reviews.freebsd.org/D48043
2024-12-14 22:40:16 -06:00
Kyle Evans 1a2a0db0a9 tests: kern: improve logsigexit test
Use dmesg(8) instead rather than relying on a particular syslogd
configuration, and just skip the test if we can't access the msgbuf.

While we're here, remove some debugging output that we don't actually
need.
2024-12-14 22:40:15 -06:00
Warner Losh 1d69498623 depend-cleanup: Fix test arg
-e follows the symlink to see if the file exists. I tested on the wrong
tree, so it appeared to work for me. Change to -h which see if the link
is there or not. The file will never not be a link if present.

Fixes: 42ee30f19c
Noticed by: Herbert Skuhra
Sponsored by: Netflix
2024-12-14 13:56:10 -07:00
Kyle Evans da5aed38d8 Revert "Tweak ppoll() to include 1003.1-2024 visibility"
This reverts commit 212d7f439a.  A last
minute change to remove __BSD_VISIBLE unearthed some breakage that I
failed to re-test.  Sigh.
2024-12-14 01:05:09 -06:00
Kyle Evans 9647bf2423 tests: kern: add some tests for recently added logsigexit
We don't bother tweaking the sysctl in these tests, we'll just try with
it forced both on and off via proccontrol(1).  This could be problematic
in the face of pid wrapping if we got really unfortunate, but the
potential solutions need careful consideration- you probably don't want
to assume a certain velocity of messages into syslog, so just checking
the last N lines is probably similarly flakey.
2024-12-13 23:18:31 -06:00
Kyle Evans dabf006a63 Add per-process flag to disable logsigexit
I added a third value for kern.logsigexit to mean 'auto' as an abundance
of caution, but I don't know how much it matters -- that can be easily
consolidated back to boolean-ish.

This is primarily targeted towards people running test suites under CI
(e.g. buildbot, jenkins). Oftentimes tests entail segfaults that are
expected, and logs get spammed -- this can be particularly high volume
depending on the application. Per-process control of this behavior is
desirable because they may still want to be logging legitimate
segfaults, so the system-wide atomic bomb kern.logsigexit=0 is not a
great option.

This adds a process flag to disable it, controllable via
procctl(2)/proccontrol(1); the latter knows it as "sigexitlog" due to
its length, but it's referred to almost everywhere else as
"sigexit_log."

Reviewed by:	kib (earlier version), pstef
Differential Revision:	https://reviews.freebsd.org/D21903
2024-12-13 23:18:30 -06:00
Kyle Evans 86b4df97d0 cat: report copy_file_range() errors with the read filename
The error may be due to an error while writing, but it's more helpful to
report what we were trying to from rather than "stdout" for these
errors.  Noticed because of what happens now when `cat` gets an EISDIR
for reading from a dirfd:

kevans@ifrit:~$ cat /etc
cat: stdout: Is a directory

which, after this change, becomes:

kevans@aarch64-dev:~$ cat /etc
cat: /etc: Is a directory

Reviewed by:	allanjude, des, mm
Differential Revision:	https://reviews.freebsd.org/D41784
2024-12-13 22:32:54 -06:00
Kyle Evans 17aec740b0 devmatch: do nothing if booted in safe mode
Safe mode may be enabled because of some problem discovered with a kmod,
thus wanting to avoid devmatch.  Honor it and let the user deal with
the fallout of not autoloading modules.  We've at least made it to
userland and the user demonstrably has a local console as they selected
safe mode in the first place, so this shouldn't be fatal if we don't,
e.g., load a necessary NIC driver.
2024-12-13 22:31:38 -06:00
Kyle Evans 48b05b8fc2 loader: set boot_safe when safe mode is selected
This may be used to disable or limit functionality of some services
when safe mode is selected. The particular value of boot_safe should not
be considered significant, only its presence in the environment.

Reviewed by:	imp, tsoome
Differential Revision:	https://reviews.freebsd.org/D32172
2024-12-13 22:31:28 -06:00
Kyle Evans 212d7f439a Tweak ppoll() to include 1003.1-2024 visibility
Note in the manpage that the 2024 edition finally added ppoll(), and
also add the appropriate declarations for the correct versions of
_POSIX_C_SOURCE.

Differential Revision:	https://reviews.freebsd.org/D48043
2024-12-13 22:15:19 -06:00
Adrian Chadd 35e63136a8 rtwn: add a register value for R92C_FPGA0_POWER_SAVE, and other bits
* add a register value for the R92C_FPGA0_POWER_SAVE register
* add the field names and mask
* add a mask for the 40MHz upper/lower bits in R92C_RMRR; I think
  I need to debug and overhaul the 20/40MHz config path to get 40MHz
  working right.

Local testing:

* rtl8188eu, sta mode
* rtl8192cu, sta mode
2024-12-13 18:17:52 -08:00
Adrian Chadd 7b71689c9c rtwn: update RTL8812AU/RTL8821AU receive path to include VHT info
* RX frames with short-GI can be either HT or VHT
* Add placeholders for RX VHT rate, PHY type, etc

Differential Revision:	https://reviews.freebsd.org/D47902
2024-12-13 18:17:40 -08:00
Adrian Chadd 7722d5e214 rtwn: add RTL8812/RTL8821 VHT80 channel programming, spur management
* add VHT80 channel programming
* add VHT80 spur management, sync with Linux rtw88

Obtained from: Linux rtw88

Differential Revision:	https://reviews.freebsd.org/D47901
2024-12-13 18:17:27 -08:00
Warner Losh 59e013a52c jemalloc: Retire SWAP_RESERVE_* compat shims
We no longer need these compat shims. They were needed for FreeBSD 12
and earlier.

Sponsored by:		Netflix
2024-12-13 16:04:40 -07:00
Warner Losh db589b5de6 jemalloc: Retire ifdef for ELF_BSDF_VMNOOVERCOMMIT
ELF_BSDF_VMNOOVERCOMMIT was introduced in time for stable/13 (but not
stable/12), so is now in all supported branches. We're highly unlikely
to merge future versions to stable/13 let alone anything earlier.

Sponsored by:		Netflix
2024-12-13 16:04:40 -07:00
Warner Losh 7bcf5319c1 jemalloc: Reduce diffs to 5.2.1 revert to using JEMALLOC_FALLTHROUGH
In the import of 5.2.1 (c5ad81420c), JEMALLOC_FALLTHROUGH was changed
to break (judging by the tagged upstream sources). This changes it back
to upstream. No functional change: this is just a textual change (though
the fallthrough macro doesn't expand to break).

Sponsored by:		Netflix
2024-12-13 16:04:40 -07:00
Warner Losh 7fdf597e96 jemalloc: Move generated files into lib/libc tree
Make it easire to update jemalloc by moving the FreeBSD specific files
and the generated files into lib/libc. This allows us to regenerate them
more easily, and emphasizes a bit that we may have to regenerate stuff
from upstream.

This is necessary to also unthin the import from the vendor branch as
well (which will be needed to simplify the imports in the future since
we are trying to use contrib/jemalloc for two different things).

No functional change.

Sponsored by:		Netflix
2024-12-13 16:04:39 -07:00
Warner Losh 42ee30f19c depend-cleanup.sh: Need to delete jemalloc.3 in objtree
With the jemalloc.3 move into the tree (it's a generated file that we
don't/can't generate as part of the build), we need to remove it from
the .OBJDIR or make gets confused about how to build it (honestly for
reasons unknown).

Sponsored by:		Netflix
2024-12-13 16:04:34 -07:00
Warner Losh b55f5e1c4a jemalloc: Move generated jemalloc.3 into lib/libc tree
The more generated things that are in contrib/jemalloc tree, the more
chances for interference goes way up. So, move this file into our
lib/libc tree. I didn't add a 'generated file' line / info, but this is
funky enough I don't think we need that. We do add things to the man
page, and that should be tracked in the contrib/jemalloc tree to allow
better importing experience.

Sponsored by:		Netflix
2024-12-13 15:58:31 -07:00
Mark Johnston 9269057967 linuxkpi: Fix a lock leak in lkpi_sta_scan_to_auth()
PR:		283015
Reviewed by:	bz
MFC after:	1 week
Fixes:		0936c648ad ("LinuxKPI: 802.11: update the ni/lsta reference cycle")
Differential Revision:	https://reviews.freebsd.org/D47949
2024-12-13 20:28:13 +00:00
joyu liao 6e55ba5b31 Export the kernel API pgrp_calc_jobc
Summary: Export the kernel API pgrp_calc_jobc for use by other modules or functions.

Reviewed By: kib
Obtained from:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D47539
2024-12-13 13:25:46 -05:00
Ed Maste 41adc5f29b release: Always use NO_ROOT for distribute* and package*
We used to have two different code paths for generating release media
dist sets, one which expected to run as root, and one which did not.
It was possible that the two different paths could generate different
results.

We can use the path that does not *require* root also when running as
root, so use it always.  We'll want to do eventually do the same for all
release targets, but these ones are an easy place to start.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48041
2024-12-13 12:08:01 -05:00
John Baldwin 91c6231246 timeradd.3: Add missing .Pp after .Ed
This ensures a blank line between the end of the struct timeval
definition and the following paragraph.  Formatting change only.

Sponsored by:	Chelsio Communications
2024-12-13 11:53:51 -05:00
John Baldwin 7c89253bda vmm: Initialize error in vmmdev_rw
CID:		1568045
Reported by:	Coverity Scan
Reviewed by:	markj
Fixes:		4008758105 vmm: Validate credentials when opening a vmmdev
Differential Revision:	https://reviews.freebsd.org/D48073
2024-12-13 11:52:31 -05:00
Doug Rabson e2fc29e539 release: fix architecture for OCI images
PR:			283260
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D48051
2024-12-13 16:47:05 +00:00
Ed Maste f6575ed0de Makefile.inc1: Require DISTDIR be set for make distributeworld
distributeworld is the target used to stage world for building dist sets
for release targets, and is not really intended for end-user use.  If
DISTDIR is not set we would attempt to write to the root directory.
Error out in this case, serving as an assertion that an internal target
is not being used incorrectly.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48030
2024-12-13 10:22:01 -05:00
Alan Somers 9899985293 fusefs: FUSE_NOTIFY_INVAL_* must busy the mountpoint
Unusually, the FUSE_NOTIFY_INVAL_INODE and FUSE_NOTIFY_INVAL_ENTRY
messages are fully asynchronous.  The server sends them to the kernel
unsolicited.  That means that unlike every other fuse message coming
from the server, these two arrive to a potentially unbusied mountpoint.
So they must explicitly busy it.  Otherwise a page fault could result if
the mountpoint were being unmounted.

Reported by:	JSML4ThWwBID69YC@protonmail.com
MFC after:	2 weeks
2024-12-13 07:08:30 -07:00
Olivier Certner 8ae6247aa9 ext2fs: 'struct ufid': Re-order fields and unpack
Re-ordering the fields suppresses the trailing padding which was causing
the structure to overflow 'struct fid'.

While here, re-indent in a more visually pleasing way.

Reviewed by:    rmacklem, emaste, markj
Approved by:    markj (mentor)
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D47955
2024-12-13 15:04:50 +01:00
Olivier Certner cf0ede7203 tarfs: 'struct tarfs_fid': Switch 'gen' to 'u_int', avoid packing
As the 'gen' field in 'struct tarfs_node' (and then 'struct tarfs_fid')
is filled with arc4random() which returns an unsigned int, change its
type in both structures.  This allows reordering fields in 'struct
tarfs_fid' to reduce its size, finally avoiding the use of '__packed' to
ensure it fits into 'struct fid'.

While here, remove the 'data0' field which wasn't necessary from the
start.

Reviewed by:    markj, rmacklem, des
Approved by:    markj (mentor)
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D47954
2024-12-13 15:04:42 +01:00
Pat Maddox a1097094c4 newvers: Set explicit git revision length
The --short flag is configurable. Setting an explicit length supports
reproducible builds.

Signed-off-by: Pat Maddox <pat@patmaddox.com>
Reviewed by: emaste, imp
Differential revision: https://github.com/freebsd/freebsd-src/pull/1547
2024-12-13 08:06:10 -05:00
Andrew Turner 38cb1ba863 conf: Add acpi_pci.c to the arm64 build
Reviewed by:	jhb, emaste, cperciva
Relnotes:	yes (Support PCIe hotplug on arm64)
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48049
2024-12-12 18:00:56 +00:00