sound: Scale PCM secondary buffers by byte rate
The fixed 128 KiB secondary buffer cap dates from stereo-sized streams.
High channel-count or high sample-width OSS streams can consume most of
that budget in one graph quantum, leaving too little room for capture
catch-up or playback headroom.
Keep 128 KiB as the low-rate floor, but derive the effective soft-ring
cap from the channel byte rate, clamped to 4 MiB. Use that per-channel
cap when resizing the soft buffer and when clamping
SNDCTL_DSP_SETFRAGMENT requests.
Also clamp SNDCTL_DSP_LOW_WATER to the current soft-buffer size so an
impossible readiness threshold cannot make poll/select wait forever.
MFC after: 3 weeks
Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D58064
cuse: Fix server reference leak in cuse_client_open()
If the server is closing (or the device node is going away), or if
devfs_set_cdevpriv() fails, cuse_client_open() returns with the server
reference taken at the top of the function still held and the newly
allocated client still linked on pcs->hcli. Since cuse_client_free()
has not been registered as the cdevpriv destructor at that point,
nothing ever undoes this work: every open() that races the is_closing
window permanently leaks one server reference and one cuse_client.
A leaked reference is fatal on server exit: cuse_server_free()
busy-waits in an uninterruptible pause("W", hz) loop until pcs->refs
drops to 1, which now never happens, so the exiting server process
(e.g. virtual_oss(8)) is left wedged in state "D", immune to SIGKILL,
cuse.ko is pinned (kldunload hangs too), and only a reboot recovers.
Before 634e578ac7b0 the is_closing error path dropped the reference by
calling devfs_clear_cdevpriv(), which ran the cuse_client_free()
destructor. That commit moved devfs_set_cdevpriv() after the
[14 lines not shown]
snd_uaudio: Don't let an idle stream reprogram a shared UAC2 clock
Some UAC2 devices expose a single Clock Source entity that is shared
between their playback and capture interfaces (it appears in both the
output and input clock bitmaps). On such a device uaudio(4) programs
the sample rate for both directions when a stream starts. If playback
runs at a 44.1 kHz-family rate while the idle capture channel is left
at its 48 kHz-family default, the capture
SET_CUR(UA20_CS_SAM_FREQ_CONTROL) is issued after the playback one and
overwrites the rate on the shared clock. The device then runs at
~48 kHz while the playback stream carries 44.1 kHz data. Consuming
samples faster than they arrive, the device repeatedly runs out of
data, loses sync with the playback stream, and re-locks onto it
(audible dropouts, front-panel play/idle flicker). The 48 kHz family
is unaffected because both directions then agree on the rate.
Fix it in three parts:
- Add a shared-clock guard: before issuing SET_CUR to a clock id, if
[28 lines not shown]
icmp: Verify redirect gateway with fib-aware ifa selection
During call to `icmp_verify_redirect_gateway()` ensure using
fib-aware source address selection function.
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D58409
.git-blame-ignore-revs: Fix hash for sys/kern/kern_cpu.c whitespace changes
Really fill in the hash of the MFCed commit, removing the placeholder
I forgot to update before commit.
This is a direct commit to stable/14.
Fixes: 83e087e0ea21 (".git-blame-ignore-revs: sys/kern/kern_cpu.c whitespace changes")
Sponsored by: The FreeBSD Foundation
.git-blame-ignore-revs: Fix hash for sys/kern/kern_cpu.c whitespace changes
Really fill in the hash of the MFCed commit, removing the placeholder
I forgot to update before commit.
This is a direct commit to stable/15.
Fixes: bd13516d400b (".git-blame-ignore-revs: sys/kern/kern_cpu.c whitespace changes")
Sponsored by: The FreeBSD Foundation
acpi_cpu(4): Call ACPI_GET_FEATURES() on a reset 'features' variable
This is to prevent child drivers from using the features returned by
previous drivers (in an arbitrary order). None of the existing ones do
that, so this is purely defensive.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 664ad9ac4c9047d29d5f37d43174e1b469e2ec80)
x86/local_apic.c: Fiddle with thermal LVT slot only if supported
The thermal LVT slot does not necessarily exist.
According to Intel's Software Developers Manual, for Intel processors
supporting 64-bit operation (amd64), probably even the earliest ones
should have a local APIC with such a slot (the slot was introduced with
Pentium 4 and Xeon processors according to the manual, and the 64-bit
implementation in some later versions of them). AMD's Architecture
Programmer's Manual also seems to imply that all AMD processors
supporting amd64 should have the slot too. So this change may not be
needed when i386's code is dropped, but it does not hurt to have it, and
it might ease possible MFCs.
Change the signature of lapic_enable_thermal() so that it can report
failure (if there is no local APIC or if there is no thermal LVT slot).
Reviewed by: bnovkov, kib
MFC after: 2 weeks
[4 lines not shown]
i386: provide PCPU pc_small_core for amd64 compat
Provide pc_small_core for i386 too to fix an i386 build break from x86
code referring to it. It won't be set.
Reviewed by: aokblast, kib
Fixes: 7b26353a59d6 ("hwpstate_intel: Disable package control on hybrid CPU")
Differential Revision: https://reviews.freebsd.org/D58335
(cherry picked from commit 29d15d658d175139196d821b123c30a5b58e135e)
i386: supply thermal interrupt handler
This fixes a build break for i386.
Reviewed by: kib, olce, Koine Yuusuke <koinec at yahoo.co.jp>
Fixes: 87ba088fa310 ("x86/local_apic.c: Add support for installing a thermal interrupt handler")
Differential Revision: https://reviews.freebsd.org/D58332
(cherry picked from commit cb325dcedfa291c9bfe350a513694df3776a17a4)
x86/local_apic.c: Factor out version read and max LVT slot computation
This makes the code slightly more compact and easier to read.
No functional change intended.
Reviewed by: bnovkov
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58110
(cherry picked from commit 060ecf296664fd150328ac6dcdc24764a427bc3a)
x86/local_apic.c: Thermal interrupt support: Additional style fixes
Rename handler function type 'lapic_thermal_handle_function' to the
shorter 'lapic_thermal_handler_t'. Move it closer to the function
declaration block where it is used. Make it a true function type (no
pointer) and add explicit pointer marks on usage.
Rename 'lapic_thermal_function_value' to the more immediately clear
'lapic_thermal_function_arg'. In lapic_thermal_enable(), use 'func_arg'
as the argument name for the handler argument, which at least refers to
function 'func', rather than the generic 'value'.
Finally, rename the global handler variable from
'lapic_thermal_function_ptr' to the shorter 'lapic_thermal_function'
(dynamic functions can be referenced only through a pointer).
MFC with: 87ba088fa310 ("x86/local_apic.c: Add support for installing a thermal interrupt handler")
Sponsored by: The FreeBSD Foundation
(cherry picked from commit e1f4a8cb8656e64a1fe2b1ab519821b14c4985a0)
files: riscv, arm64: Remove redundant 'ofw_cpu.c'
Should have been removed when that line was moved from 'files.arm' to
'files'.
Fixes: 14e1a2cd295d ("Move ofw_cpu file to the main files conf file.")
MFC after: 2 weeks
Event: Halifax Hackathon 202606
Location: Seat 36K in AC667, over Maine near Canadian border
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 10213f01773f22ab948ec1e87c880b1d19a1fc45)
x86/local_apic.c: Add support for installing a thermal interrupt handler
The thermal interrupt is initially masked.
Thermal interrupt handling is enabled by calling lapic_enable_thermal(),
which installs a (single) handler.
[olce: Wrote the commit message.]
Reviewed by: kib, olce
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D44454
(cherry picked from commit 87ba088fa3108dd180008a04f25760ec71476c87)
ps.1: Fix broken comment line
While here, remove the long-unused dash in the first line.
Reviewed by: ziaee, olce
Fixes: ddf144a04b53 ("ps.1: Revamp: Explain general principles, update to match reality")
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D58038
(cherry picked from commit 759ce9a2b38e1de70c14c81dee7e245bf0bc6b94)
acpi_hpet(4): Remove unused 'acpi_hpet_disabled' boolean
Same reason as for the previous commit to acpi_cpu(4). This boolean is
not used anywhere. Disabling acpi_hpet(4) can be done through the
regular ACPI disable mechanism (using the 'debug.acpi.disabled' tunable,
see acpi_disabled()).
Reviewed by: emaste (implicit)
Fixes: ac3ede5371af ("x86/xen: remove PVHv1 code")
MFC after: 3 days
Event: Halifax Hackathon 202606
Location: Dalhousie CS Faculty building
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 25df388574ac1d295f4014825de0df1d65cbdc53)
acpi_timer(4): Remove unused 'acpi_timer_disabled' boolean
Same reason as for the previous commit to acpi_cpu(4). This boolean is
not used anywhere. Disabling acpi_timer(4) can be done through the
regular ACPI disable mechanism (using the 'debug.acpi.disabled' tunable,
see acpi_disabled()).
Reviewed by: emaste (implicit)
Fixes: ac3ede5371af ("x86/xen: remove PVHv1 code")
MFC after: 3 days
Event: Halifax Hackathon 202606
Location: Dalhousie CS Faculty building
Sponsored by: The FreeBSD Foundation
(cherry picked from commit ad26a56cf2f55967cc73d04a6ea17c27892d3141)
acpi_cpu(4): Remove unused 'acpi_cpu_disabled' boolean
It is not used anywhere. Disabling acpi_cpu(4) can be done through the
regular ACPI disable mechanism (using the 'debug.acpi.disabled' tunable,
see acpi_disabled()).
Reviewed by: emaste, obiwac
Fixes: ac3ede5371af ("x86/xen: remove PVHv1 code")
MFC after: 3 days
Event: Halifax Hackathon 202606
Location: Dalhousie CS Faculty building
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57888
(cherry picked from commit 98a77972381c6bb5ceda375fd1db7dccb3a1c89e)
sched_ule: Fix off by one in preempt_thresh definition
Since 'preempt_thresh' is set to PRI_MIN_KERN by default, and comparison
of the considered thread's priority with that threshold is done with
'<=', PRI_MIN_KERN threads actually can preempt other threads, contrary
to other non-interrupt kernel ones (between PRI_MIN_KERN + 1 and
PRI_MAX_KERN).
So, replace the comparison operator '<=' by '<'. The alternative would
be to change the default value, but changing the comparison instead has
the benefit to be consistent with the 0 setting (which forbids
preemption entirely), since allowing only threads with priority 0 to
preempt becomes possible.
Consequently, we also change the default value for the FULL_PREEMPTION
option by adding 1 to PRI_MAX_IDLE (in practice, that does not make any
difference in the current setting, since no preemption will happen if
the new priority value is not strictly lower than the current one, and
PRI_MAX_IDLE is PRI_MAX, the highest possible priority).
[10 lines not shown]
sched_ule: sched_priority(): More accurate __unused annotation
Change a '__unused' to '__diagused', which is more precise for that use.
No functional change.
MFC after: 1 week
Event: Halifax Hackathon 202606
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 83a6946595829407c80075f33e49329d1b621522)
sched_ule: sched_clock(): Remove a superfluous space
MFC after: 1 week
Event: Halifax Hackathon 202606
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 5f376d52f2c86fd19e3f774a02c4b0debeb3f2cf)
acpi: Suffix acpi_sleep_enable() with '_locked'
For clarification. This function assumes that the acpi mutex is held,
contrary to acpi_sleep_disable().
No functional change (intended).
Reviewed by: obiwac
Event: Halifax Hackathon 202606
Sponsored by: The FreeBSD Foundation
Pull Request: https://github.com/OlCe2/freebsd-src/pull/8
(cherry picked from commit 3b3911aaf834824f2de0db9fc7d0b9e2b3c089b4)
acpi: Constify thanks to AcpiGetHandle() taking a constant pathname
Make the ACPI interface's functions evaluate_object() and get_property()
take a constant pathname (by substituting ACPI_STRING with 'const char
*').
This allows to remove some __DECONST().
No functional change (intended).
Reviewed by: obiwac
Event: Halifax Hackathon 202606
Sponsored by: The FreeBSD Foundation
Pull Request: https://github.com/OlCe2/freebsd-src/pull/8
(cherry picked from commit a12d069ef37fd60538b6f46372b194e6cf117250)
14.5: Update stable/14 to -PRERELEASE
This marks the start of the FreeBSD 14.5 release cycle; the stable/14
tree is now in "code slush".
Developers are encouraged to prioritize fixing bugs (and/or merging bug
fixes from HEAD) over new features at this time. Commit approval from
re@ is not required but if new features introduce problems they may be
removed from the release.
Approved by: re (implicit)
Sponsored by: OpenSats Initiative
getpgrp(2), getsid(2): allow to call on zombies
Also be more protective in getsid().
Reported by: arrowd
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differrential revision: https://reviews.freebsd.org/D58393
Fix namespace listing for old NVMe devices
Commit 9e1db51d4b5fc made nvmecontrol devlist get list of active
namespaces from the device instead of iterating through all possible
IDs. The problem is that this request is not supported before NVMe
1.1, and in particular by Intel Optane 905P drives. This change
reintroduces iteration for devices before NVMe 1.2.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D58010
tests/sys/pmc: only build if MK_PMC != no
This unbreaks the build when pmc support is explicitly disabled via the
aforementioned build knob.
MFC after: 10 days
Fixes: 2cfd82f74 ("hwpmc: add regression tests for ...")
Differential Revision: https://reviews.freebsd.org/D58401