Commit Graph

306518 Commits

Author SHA1 Message Date
Enji Cooper ab9b047369 clang-format: adjust to sort C++ headers per style(9)
Many standard C++ headers do not have the .h file extension: some, such as
`iostream`, lack it; others have a .hpp file extension. Moreover, some
projects (like ATF/Kyua) also contain .ipp files, which are C++ "interface"
files.

Relax the regular expression to ensure that non-traditional C "system"
headers, C++ headers, etc, with angle brackets are sorted before
"local" headers.

MFC after:	1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54401
2026-01-30 20:14:10 -08:00
Gleb Smirnoff 9df110b11f tests/netinet: fix tests that depended on connect(in6addr_any)
Fixes:	627e126dbb
2026-01-30 13:31:13 -08:00
Mark Johnston 56e1cba88b ip6_mroute: Remove unnecessary casts
No functional change intended.

MFC after:	1 week
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
2026-01-30 20:39:34 +00:00
Mark Johnston 34c3e1d718 netstat: Fix whitespace in libxo output for multicast routes
Also fix some bogus libxo format strings in mroute6.c, and close a
couple of lists instead of opening them twice.

Fixes:		ade9ccfe21 ("Convert netstat to use libxo.")
MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
2026-01-30 20:30:58 +00:00
Konstantin Belousov 245157fd8a ktrcsw(): should not be called when the thread is owning interlock or on sleepq
The issue is that for ktrcsw() we lock the ktrace_mtx mutex while owning
the interlock from a subsystem that called msleep().  In particular, the
VM subsystem might call msleep() if page allocation failed.  This
establishes order VM locks (e.g. domain free queue lock) -> ktrace_mtx.
Calling free() while owning ktrace_mtx gives the reverse order.

Worse, msleep_spin_sbt() call s ktrcsw() while the thread is put on
sleep queue.  Then, since the mutex might be contested, the thread needs
to be put on turnstil, which cannot work.

Move the ktrcsw() call for switch-out after the wakeup, when the thread
does not yet re-obtained any locks.  From there, we call a special
version of ktrcsw(), which is passed the actual time when the context
switch occured.

The drawback is that the switch-out record is only written in the
ktrace.out file after the switch-in occurred, but this is probably not
too serious.

Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-30 20:45:48 +02:00
Colin Percival bda8028146 release: Ship firmware from kmods repo on DVD
The packages for X.Y-RELEASE are a snapshot of the quarterly branch
for stable/X, i.e. typically built on X.(Y-1)-RELEASE.  (The case of
Y=0 is an exception for obvious reasons.)  This works for most ports
but not for kernel modules, which may need to be built on the release
in question; this is why we have a separate "kmods" repository.

Make sure that we put the packages from the kmods repository onto the
mini-pkg-repo on the DVD rather than shipping unusable firmware.

Reviewed by:	bz
MFC after:	1 week
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52581
2026-01-30 09:41:51 -08:00
Andy Carrel 93d3ac1daa arm64: Fix kernel panic in get_arm64_sve during core dump
The coredump logic calls get_arm64_sve twice: once to get the note size,
and once to get the data. The note size calculation depended on the
volatile `PCB_FP_SVEVALID` flag. If this flag was cleared between the
two calls (e.g., due to a context switch clearing the flag to comply
with the ABI), the second call would expect a smaller buffer size than
the first, triggering a KASSERT panic ("invalid size").

Fix this by ensuring the SVE state is saved to the PCB before we decide
whether to use SVE or VFP.

PR: 292195
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D54532
2026-01-30 17:01:49 +00:00
Christos Margiolis c88f012faa lib/virtual_oss/sndio: Remove trailing backslash
Fixes:		d78291b0e9 ("lib/virtual_oss: don't (over)link to libsamplerate")
Reported by:	pkg-fallout
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
2026-01-30 18:25:02 +02:00
Christos Margiolis b9289743f4 src.opts: Remove MK_SOUND artifact
Fixes:		f74f891581 ("src.opts: Introduce MK_SOUND")
PR:		291853
Sponsored by:	The FreeBSD Foundation
MFC after:	4 days
2026-01-30 18:14:28 +02:00
Mark Johnston 1539a657ad ip6_output tests: Remove an unused import
No functional change intended.

MFC after:	1 week
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
2026-01-30 15:27:22 +00:00
Mark Johnston a03eabfebb ip6_mroute: Mark functions as static
No functional change intended.

MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
2026-01-30 15:25:52 +00:00
Timo Völker 574d46b25a epair: add VLAN_HWTAGGING
Add capability VLAN_HWTAGGING to the epair interface and enable it by
default.
When sending a packet over a VLAN interface that uses an epair
interface, the flag M_VLANTAG and the ether_vtag (which contains the
VLAN ID and/or PCP) are set in the mbuf to inform the hardware that
the VLAN header has to be added. The sending epair end does not need
to actually add a VLAN header. It can just pass the mbuf with this
setting to the other epair end, which receives the packet. The
receiving epair end can just pass the mbuf with this setting to the
upper layer. Due to this setting, the upper layer believes that there
was a VLAN header that has been removed by the interface.
If the packet later leaves the host, the outgoing physical interface
can add the VLAN header in hardware if it supports VLAN_HWTAGGING.
If not, the implementation of Ethernet or bridge adds the VLAN header
in software.

Reviewed by:		zlei, tuexen
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D52465
2026-01-30 11:54:33 +01:00
Michael Tuexen 33596d9255 dpaa2: add support for several interface counters
Add support for IFCOUNTER_IPACKETS, IFCOUNTER_OPACKETS,
IFCOUNTER_OBYTES, IFCOUNTER_OMCASTS, IFCOUNTER_OERRORS, and
IFCOUNTER_OQDROPS.
This allows tools like systat to report the incoming and outgoing
bandwidth.

Reviewed by:		dsl, Timo Völker
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D54893
2026-01-30 10:58:57 +01:00
Adrian Chadd 03e4cc9fde powerpc: explicitly cast the timebase printfs
This is causing compilation issues on powerpc:powerpc GENERIC.
2026-01-29 22:36:33 -08:00
Maxim Konovalov c443f5d1c2 intro.9: grammar 2026-01-30 04:51:24 +00:00
Maxim Konovalov 7f537f4ba8 intro.9: deduplicate vm_page Xrs
PR:		292820
Submitted by:	Kraytonian
MFC after:	1 week
2026-01-30 04:48:56 +00:00
Jose Luis Duran f54f362d62 nanobsd: embedded: Stub out experimental functions
Stub out both experimental functions introduced in ecc039be7f when
doing embedded builds.

Fixes:		ecc039be7f ("nanobsd: Add a NO_ROOT build option")
MFC after:	3 days
2026-01-30 01:42:00 +00:00
Jessica Clarke ba56760a47 Revert "src.opts.mk: Enable LLDB by default globally"
This breaks the riscv64 build; clearly the version we have in-tree is
not new enough to work. That or our build system needs tweaking. Either
way, we're not ready for this, and enabling it without testing was
misguided.

This reverts commit c59a47dc6c.
2026-01-30 01:11:13 +00:00
Abdelkader Boudih fdcd67be82 firmware: Fix inverted FIRMWARE_GET_NOWARN logic
The try_binary_file() function has inverted logic for the
FIRMWARE_GET_NOWARN flag.  When the flag is set (meaning "don't warn"),
the code sets warn=true and makes noise anyway.

Invert the assignment to warn to correctly suppress warnings when
FIRMWARE_GET_NOWARN is set.

Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D54955
2026-01-29 18:02:47 -06:00
Konstantin Belousov b249cb2b18 SCHED_4BSD: maybe_resched() cannot schedule ast() for curthread
maybe_resched() needs to schedule TDA_SCHED for curthread, but this
requires taking curthread lock while owning some other thread lock.
To avoid introducing the order:
- Use a scheduler-private TDP flag.
- Register an unconditional TDA_SCHED_PRIV for 4BSD.
When an AST needs to be scheduled, i.e. the current thread must do
context switch in the return to userspace path, set the flag.
Then the ast handler calls ast_scheduler(), which gives the same
effect as scheduling TDA_AST.

The overhead is a single function call on each userspace return, for
4BSD case.

Reported and tested by:	pho (previous version)
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54945
2026-01-30 01:26:16 +02:00
Konstantin Belousov 0730a05cd3 tuning.7: document schedulers knobs
Reviewed by:	emaste, olce, ziaee
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54951
2026-01-30 00:43:45 +02:00
Bjoern A. Zeeb 4b32fdb4a6 lindebugfs: check that name is set as otherwise pfs_alloc_node_flags() panics
I have hit the case multiple times that some LinuxKPI field may not be
set during driver bringup and lindebugfs would cause a panic.
The backtrace goes like:

  strlen() at strlen+0x54
  pfs_create_dir() at pfs_create_dir+0x41
  debugfs_create_dir() at debugfs_create_dir+0xa1
  ...

While the problem is clearly in LinuxKPI or the driver, we likely
should at least add an assert to pfs_create_dir() if name is NULL
like we have for pfs_add_node() but for lindebugfs at least make
this a graceful error and continue without creating the dir instead
of panicing.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	kevans
Differential Revision: https://reviews.freebsd.org/D54944
2026-01-29 19:35:23 +00:00
Konstantin Belousov 783b8a0fd8 kern/sched: deduplicate dtrace hook vars
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov 9409e86980 kern/sched: deduplicate sdt probes
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov a84a39dfe5 kern/sched: move duplicate preemption stat vars into sched_shim.c
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov 1322760fd1 sys: enable both SCHED_ULE and SCHED_4BSD for some configs
Globally enable both schedulers for LINT.
Enable both schedulers for GENERIC on amd64.

Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov ff870b783f sched_shim: restore kern.ccpu sysctl
It is apparently should be considered part of the ABI, and is used by
the base top(1).  But do not declare the ccpu variable in headers, it is
needed only by 4bsd. So put the variable definition into sched_shim.c to
make the kernel buildable without SCHED_4BSD.

Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov 5a6e0e31bc sysctl kern.sched.ule.topology_spec: allow to run if ULE is not initialized
Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov b602ba1b5f net/iflib.c: move out scheduler-depended code into the hook
Add sched_find_l2_neighbor().  This really should be not
scheduler-depended, in does not have anything to do with scheduler at
all.  But for now keep the same code structure.

Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov 1c4e16f6db x86/cpu_machdep.c: unconditionally fence
For !SCHED_ULE, even if the fence is not needed, it is harmless.

Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov c384b35e42 x86/local_apic.c: remove direct SCHED_ULE use
Move the code to decide on the timer accounting into the scheduler hook.
Since there were no inclusion of opt_sched.h, it is probably done
unconditionally anyway.

Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov 377c053a43 cpu_switch(): unconditionally wait on the blocked mutex transient
It is nop for 4BSD.

Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:56 +02:00
Konstantin Belousov ba8f429f42 kern/sched_shim.c: Add sysctl kern.sched.available
Reports all compiled-in schedulers.

Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov 8aa8289d99 sys: Move 4BSD sysctls under kern.sched.4bsd
Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov b125c4d130 sys: Make sched_4bsd a sched instance
Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov eb454937a3 sys: Move ULE sysctls under kern.sched.ule
Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov d14e018024 sys: Make sched_ule a sched instance
Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov 7efbfd6ff6 kern/sched_shim.c: provide required SYSINIT hooks
Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov bab24f22ba kern/sched_shim.c: Provide a scheduler selection machinery
Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov ce38acee8d Add kern/sched_shim.c
This is the infrastructure to allow scheduler implementation to be
selected on boot, supported by ifuncs.

The DEFINE_SHIM() macros and their usage provided by jrtc27@.

Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov 0b474a48dc sys/sched.h: add SCHED_STAT_DECLARE()
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov a556ec46d3 kern/sched_{ule,4bsd}.c: cleanup headers
Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov 610d7062c6 sched_4bsd: remove unused function sched_pctcpu_delta()
It is not used since c72188d85a.

Noted by:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:55 +02:00
Konstantin Belousov 8515934ce3 sys/sched.h: make sched_clear_tdname() function prototypes unconditional
There is no harm in having unused prototypes.

Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:54 +02:00
Konstantin Belousov 57bb132e98 maybe_preempt(): make static in sched_4bsd.c
Reviewed by:	olce
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:54 +02:00
Konstantin Belousov 23266bc992 amd64/machdep.c: remove extra empty line
Reviewed by:	olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:54 +02:00
Konstantin Belousov 03d61fe978 arm, riscv: add a preprocessor symbol indicating missed support of ifunc
in kernel.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54831
2026-01-29 20:11:54 +02:00
Bjoern A. Zeeb 5cfe09e3a4 LinuxKPI: 802.11: only announce netdev_features if any are set
Printing an empty netdev_features= line makes little sense even under
bootverbose.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-01-29 18:07:43 +00:00
Bjoern A. Zeeb 0762cf10fc usb: indentation (whitespace change only)
No functional change.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-01-29 18:07:43 +00:00
Artem Bunichev eb0fc67c45 src.conf.5: Cross-reference uname(1) manual page
Reviewed by:		emaste, ziaee
Differential Revision:	https://reviews.freebsd.org/D54688
2026-01-29 12:44:46 -05:00