sched/wait: remove the __add_wait_queue_*exclusive() helpers
Each has one or two special-case users. Open-code them there: set
WQ_FLAG_EXCLUSIVE and queue the entry directly, with a note on why the
caller doesn't use add_wait_queue_exclusive().
I think all cases (eventpoll, orangefs and ubifs) are unnecessary and
could just use the regular ordering, but I'll leave that to those
maintainers to sort out.
Cc: Oleg Nesterov <oleg at redhat.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Juri Lelli <juri.lelli at redhat.com>
Cc: Vincent Guittot <vincent.guittot at linaro.org>
Cc: Alexander Viro <viro at zeniv.linux.org.uk> # eventpoll
Cc: Christian Brauner <brauner at kernel.org> # eventpoll
Cc: Jan Kara <jack at suse.cz> # eventpoll
Cc: Mike Marshall <hubcap at omnibond.com> # orangefs
[2 lines not shown]
sched/wait: remove __add_wait_queue_entry_tail()
__add_wait_queue() and __add_wait_queue_entry_tail() are now the same.
Cc: Oleg Nesterov <oleg at redhat.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Juri Lelli <juri.lelli at redhat.com>
Cc: Vincent Guittot <vincent.guittot at linaro.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
sched/wait: always queue new waiters at the tail
Non-exclusive waiters have been added at the head and exclusive ones at
the tail, so that an exclusive wakeup stopping early still woke every
non-exclusive waiter.
That only matters for waiters that mix both kinds on one queue like
read() and poll() on a pipe - and even then it doesn't actually buy
anything but complexity and fragility of the code.
An exclusive reader consumes the event, the poller had nothing to see,
so there's no real point in keeping the two ordered.
The pointless ordering results in a special rule for everybody adding
themselves to the wait queue, and that rule has not been consistently
followed anyway (see for example do_wait_intr() and do_wait_intr_irq())
So just queue everyone in FIFO order. LIFO might be better for
throughput, but every time we've ever tried that optimization in real
[22 lines not shown]
io_uring/poll: don't claim real exclusivity for EPOLLEXCLUSIVE
Same problem as epoll: an EPOLLEXCLUSIVE poll request returns 1 from
io_poll_wake() (even when it lost the ownership race and does nothing),
which stops the wakeup walk, but posting a CQE doesn't consume the
event.
Waiters queued behind it can sleep with the event pending.
Use WQ_FLAG_POLL_EXCLUSIVE, so only one io_uring entry is woken but real
waiters are not skipped.
Reported-by: Mani Tofigh <mt4022 at columbia.edu>
Cc: Jens Axboe <axboe at kernel.dk>
Cc: Oleg Nesterov <oleg at redhat.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Juri Lelli <juri.lelli at redhat.com>
Cc: Vincent Guittot <vincent.guittot at linaro.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
eventpoll: don't claim real exclusivity for EPOLLEXCLUSIVE
An EPOLLEXCLUSIVE entry that wakes an epoll_wait()er returns 1, and
because it was queued as an exclusive waiter that stops the wakeup walk.
But nothing makes the epoll user consume the event: it may be killed,
time out, pick another ready fd, or just not read. Anything queued
behind the entry - a blocked pipe reader, an accept()er, a recv()er -
then sleeps with the event pending.
Queue it with WQ_FLAG_POLL_EXCLUSIVE instead: still only one epoll
instance is woken per wakeup, but real waiters are not skipped.
Reported-by: Mani Tofigh <mt4022 at columbia.edu>
Cc: Christian Brauner <brauner at kernel.org>
Cc: Oleg Nesterov <oleg at redhat.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Juri Lelli <juri.lelli at redhat.com>
[2 lines not shown]
sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters
An exclusive waiter whose wake function returns a positive return value
to indicate that it has successfully been woken up stops the wakeup
walk, on the understanding that it will handle the event.
However, user space consumers - like eventpoll or io_uring - want to be
woken up, and want to avoid the thundering herd issue. So they used an
exclusive wait - but without any actual guarantee that they will then
meaningfully handle the event.
So the wakeup could be lost, and real waiters would be left pending.
Add a separate flag for these kind of "exclusive poll" cases, which is
effectively what these user space waiters are. Only the first such
entry that accepts a wakeup is woken, as now, but they don't count
against nr_exclusive and it doesn't stop the walk.
Wake-all (nr_exclusive == 0, including POLLFREE) still calls every entry.
[9 lines not shown]
sctp: don't let a blocked reader take write-space wakeups
sctp_wait_for_packet() waits exclusively on sk_sleep() with the default
autoremove wake function, so it accepts any wakeup and consumes it.
Then __sctp_write_space() sends EPOLLOUT with a wake-one wakeup:
sctp_wait_for_packet() wakes up, finds no data, goes back to sleep, and
the walk stops.
End result: anybody else queued behind it that was waiting for EPOLLOUT
will never see it.
Filter on EPOLLIN | EPOLLERR like receiver_wake_function() in
net/core/datagram.c. State changes (using sock_def_wakeup()) use an
unkeyed wake-all and still get through and will ignore the exclusive
nature of sctp_wait_for_packet().
Cc: Oleg Nesterov <oleg at redhat.com>
Cc: Marcelo Ricardo Leitner <marcelo.leitner at gmail.com>
[5 lines not shown]
Merge tag 'hid-for-linus-2026112301' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina:
"Mostly functional code fixes all over the place, plus a few new device
IDs support.
The amount of patches is slightly higher than I'd like to see for rc4,
and there are two reasons for it -- the amount of patches is much
higher overall, due to all the AI fixes coming to the driver land, and
both myself and Benjamin have been pretty much unable to process
incoming patches for a past couple weeks for various reasons; but
we're getting back on track"
* tag 'hid-for-linus-2026112301' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (42 commits)
HID: nintendo: release the player ID when LED setup fails
HID: quirks: add ALWAYS_POLL quirk for Keychron Link receiver
HID: wacom: Prevent NULL dereference in wireless work
HID: intel-thc-hid: intel-quickspi: validate GET REPORT response size
HID: apple: Add "F108Pro Dongle" to the list of non-apple keyboards
[16 lines not shown]
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm fixes from Paolo Bonzini:
"A large set of fixes, mostly for Arm but almost all architectures
are represented.
arm64 MMU fixes:
- Correctly sanitise the TCR_EL2 register
- Stop advertising LPA2 to NV guest when it isn't supported
- Correctly convert EH2==0's view of TCR_EL2 into the E2H==1 format
- Make sure an EL2 mapping is immediately visible to the hypervisor
code, as we don't necessarily require ETS
- Address a horrible situation where a guest can livelock when trying
to solve a permission fault whilst the underlying S2 PTs have AF=0
[192 lines not shown]
Merge tag 'perf-tools-fixes-for-v7.4-1-2026-11-22' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
Pull perf tools fixes from Arnaldo Carvalho de Melo:
- perf record: skip affinity for per-thread mmap buffers and reject CPU
indices at the mask size, avoiding out-of-bounds bitmap accesses.
- perf test: use software events for system-wide tests, mark the LBR
test exclusive, and fix probe_vfs_getname debuginfo detection via a
dry run.
- perf build: add -lzstd to the libbfd feature fallback for static
binutils, and pass OUTPUT explicitly when building internal
libraries.
- perf trace beauty: split the KVM ioctl table by direction so read and
write ioctls sharing a number no longer conflict at build time.
- perf kvm: fix arm64 VM-exit duration accounting by pairing kvm_exit
[45 lines not shown]
Merge tag 'riscv-for-linus-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Paul Walmsley:
- Fix a bug in the context switch code that can allow the switched-to
task to inadvertently inherit the supervisor user memory access
privilege from the switched-from task
- Protect the regs->status RMW sequences in the vector register context
switch code, to fix a potential floating point state corruption bug
- Fix the return values from the early boot unaligned access speed
detection functions called by __setup() to return 0 on failure,
rather than an error code, as 0 is what __setup() expects to receive
upon an error
- Prevent the DTB from being potentially overwritten early in boot by
reserving it in memblock before scanning the /reserved-memory section
of the DTB
[29 lines not shown]
Merge tag 'edac_urgent_for_v7.4_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras
Pull EDAC fix from Borislav Petkov:
- Fix an array out-of-bounds access in i5000_edac
* tag 'edac_urgent_for_v7.4_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
EDAC/i5000: Fix slot number passed to determine_mtr()
Merge tag 'spi-fix-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown:
"One core fix here, for error handling with runtime PM when a transfer
fails. That was seen by a couple of people on actual systems and the
fix verified.
There's also a fix for a quirk in the fsl-lpspi driver which needs a
bitfield widening on newer chips to work properly"
* tag 'spi-fix-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
spi: fsl-lpspi: expand FCR TWATER and RXWATER bit fields to 4 bits
spi: Fix runtime PM imbalance on pump transfer message error
Merge tag 'regulator-fix-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown:
"A few fairly routine fixes for device specific issues, incorrect
information about the hardware and one case where some of the hardware
register access needs more serialisation"
* tag 'regulator-fix-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
regulator: mt6363: Serialize BUCK_TOP key access
regulator: axp20x: AXP313A: set ramp_delay
regulator: tps65132: Fix incorrect bits for VNEG/VPOS discharge
Merge tag 'rust-fixes-7.4-4' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux
Pull Rust fixes from Miguel Ojeda:
"Toolchain and infrastructure:
- Disable function merging in all cases to fix broken MODVERSIONS
information with gendwarfksyms, wrong backtraces and possibly
issues with pahole/BTF due to lost debug information.
- x86: emit the expected 'cs' prefix for RETPOLINE builds by passing
the '-Zindirect-branch-cs-prefix' flag we added to 'rustc', which
fixes boot failures (with 'spectre_v2=retpoline,lfence') and code
corruption (with paranoid FineIBT).
- Fix objtool warnings for the upcoming Rust 1.101.0 (expected
2026-12-24) by adding more 'noreturn' functions.
'kernel' crate:
[15 lines not shown]
Merge tag 'parisc-for-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc fixes from Helge Deller:
"Fix a register corruption with the 32-bit dynamic ftrace, and
prevent a lockdep assertion failure in the timer tick"
* tag 'parisc-for-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: Fix register corruption in 32-bit dynamic ftrace
parisc: irq: Trace hardirq state in do_cpu_irq_mask()
Merge tag 'x86-urgent-2026-11-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar:
- Add Intel Coral Rapids and Razor Lake CPU models (Tony Luck)
- Update the table of Intel SNC capable CPU models with
Granite Rapids "D" CPUs (Tony Luck)
- Fix MSI interrupt affinity configuration (Weitao Wang)
- Do not treat cache hierarchy MCE errors as memory errors,
to fix false offlining of healthy RAM pages (Adrian Schlegel)
- Enable ROX also when CONFIG_STRICT_KERNEL_RWX is present
(Richard Weinberger)
* tag 'x86-urgent-2026-11-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/Kconfig: Enable ROX also when STRICT_KERNEL_RWX is present
[4 lines not shown]
Merge tag 'sched-urgent-2026-11-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fixes from Ingo Molnar:
- Fix cfs_rq::idle handling (Peter Zijlstra)
- Avoid transient double accounting for delayed tasks (K Prateek Nayak)
- Lift cgroup update locking to core to fix sched-ext locking
divergence (Michal Blaszczyk)
* tag 'sched-urgent-2026-11-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched: Lift cgroup update locking to core to prevent CFS/SCX divergence
sched/fair: Avoid transient double accounting for delayed tasks
sched/fair: Make cfs_rq::idle the sum of ancestor tg::idle
sched/fair: Use guard in sched_group_set_idle()
Merge tag 'input-for-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov:
- A fix in input core to tear down force-feedback devices synchronously
on unregistration, preventing use-after-free and faults in unloaded
modules if userspace holds an event node open across driver unbind
- A fix for the da7280 haptic driver to stop advertising FF_GAIN
capability without implementing gain control, preventing a NULL
pointer dereference when userspace writes a gain event
- A fix for the goodix touchscreen driver hardening backup reference
length validation against malformed device configurations to prevent
invalid memory writes during probe and suspend
- A fix for the max77693-haptic driver to disable the chip bias if
enabling the motor regulator fails when opening the device
[27 lines not shown]
Merge tag 'sysctl-7.04-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl
Pull sysctl fix from Joel Granados:
"Fix sysctl jiffy / milliseconds conversion:
- Writing a previously read value "X" shall keep the same "X" value
- Remove truncation that was causing incorrect saturation of valid
timeouts"
* tag 'sysctl-7.04-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl:
sysctl: Do jiffy / ms conversion in ulong space
Merge tag 'landlock-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux
Pull Landlock fixes from Mickaël Salaün:
- prevent composed rulesets from denying link and rename operations
that each ruleset allows separately;
- close capability-mediation gaps for low-address mappings, inheritable
capabilities, the admin memory reserve, and PR_SET_SECUREBITS, so LSM
capability denials apply consistently;
- distinguish namespace creation from entry in denial records and
expose the checked capability context to BPF tracepoint consumers, so
they can interpret denials correctly.
* tag 'landlock-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux:
landlock: Add missing EINVAL case in the doc for landlock_add_rule
clang-format: Fix formatting of guard()
landlock: Document namespace denial operations
[16 lines not shown]
Merge tag 'xfs-fixes-7.4-rc4' of git://git.kernel.org:/pub/scm/fs/xfs/xfs-linux
Pull xfs fixes from Carlos Maiolino:
"Mostly this includes fixes for a few races, an ordering problem during
init/teardown of proc/sysfs, missing locks, etc"
* tag 'xfs-fixes-7.4-rc4' of git://git.kernel.org:/pub/scm/fs/xfs/xfs-linux:
xfs: test for realtime and reflink under the pNFS locks
xfs: don't enable DAX on zoned inodes
xfs: restart faults racing with realtime flag changes
xfs: take the MMAPLOCK in xfs_fileattr_set()
xfs: refuse fallocate racing with realtime flag changes
xfs: test for always COW after the dio write checks
xfs: refuse writes to files racing with realtime inode flag changes
xfs: test for reflink after the dio write checks
xfs: properly order xfsstats proc/sysfs init and teardown
xfs: remove unused variable in xrep_tempfile_copyin()
xfs: remove unused variable in xchk_stats_estimate_bufsize()
xfs: fix f_bfree underflow in statfs()
[8 lines not shown]
Merge tag 'cifs-fixes-7.4-rc4' of https://git.manguebit.org/linux
Pull smb client fixes from Paulo Alcantara:
"The main ones are a server-triggerable use-after-free and two fixes
that stop the client from accepting SMB2 responses and read data with
a bad signature; the rest are a couple of busy-inode-on-unmount races
and some metadata fixes.
- Fix a use-after-free in the netfs write collector that a malicious
or broken server can trigger by returning a write count larger than
the request
- Reject SMB2 responses whose signature fails verification instead of
using them, so a tampered response on a signed connection is no
longer accepted
- Don't return read data whose signature failed verification when the
read lands at the remote end of file
[26 lines not shown]
Merge tag 'trace-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fixes from Steven Rostedt:
- Do not WARN when trace_rb_cpu_prepare() fails to allocate on CPU
startup
The per CPU ring buffers are allocated when a new CPU comes online.
If the system is under memory pressure it shouldn't trigger a WARN_ON
if the buffer fails to allocate. Switch the WARN to a pr_warn()
message.
- Copy trace_marker to all instances even if one fails
Each instance can set a flag that it wants what is written into the
trace_marker file to be copied to its ring buffer. Currently, if one
of the instances has tracing disabled, the copy will fail. The loop
that copies to each ring buffer detects this failure and stops
copying to the rest of the instances. This is not what is expected as
[268 lines not shown]
Merge tag 'powerpc-7.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Madhavan Srinivasan:
- powerpc32/bpf: return false from bpf_jit_supports_fsession() on ppc32
- PPC32: Fix hard_irq_disable to follow tracing and lockdep state
- KVM: PPC: Book3S HV: Clean up on uvmem initialization failure
- KVM: PPC: BookE: Load FP and Altivec before enabling the interrupts
- KVM: PPC: Hard disable interrupts before guest entry
- KVM: PPC: BookE: Use vcpu_err() instead of printk() in kvmppc_dump_vcpu()
- MAINTAINERS updates
- misc fixes and cleanups
[25 lines not shown]
Merge tag 'fbdev-for-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev fixes from Helge Deller:
"Various small fixes, all scheduled for backport, which fix
out-of-bound accesses, improves the parameter checks or fix
use-after-free accesses in fm2fb, radeonfb, cobalt_lcdfb, valkyriefb,
sstfb.
vgacon now falls back to the dummy console if mapping the VGA memory
fails, which fixes a crash on Alpha, and fix one sleeping in atomic
context bug which is triggered by the blinking cursor"
* tag 'fbdev-for-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var()
fbdev: smscufx: allocate the size advertised in smem_len
fbdev: smscufx: keep the usb_device alive while ufx_data is in use
fbdev: smscufx: don't free registered framebuffer on probe error
fbdev: cobalt_lcdfb: Don't read info after framebuffer_release()
fbdev: valkyriefb: keep the framebuffer mapping size fixed
[7 lines not shown]
riscv: unaligned: fix __setup handlers
Returning -EINVAL from a __setup() callback cause invalid
unaligned_scalar_speed= and unaligned_vector_speed=
values to be treated as handled. obsolete_checksetup() treats any
non-zero return value from setup_func() as success, so an unrecognized
argument is silently accepted instead of being reported as an unknown
boot option.
__setup() handlers return 0 on failure.
Fixes: aecb09e091dc ("riscv: Add parameter for skipping access speed tests")
Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev at mobileye.com>
Reviewed-by: Jisheng Zhang <jszhang at kernel.org>
Link: https://patch.msgid.link/20261111-fix-riscv-unaligned-v1-1-0722514fc1e4@mobileye.com
Cc: stable at vger.kernel.org
Signed-off-by: Paul Walmsley <pjw at kernel.org>
riscv: mm: reserve the DTB before scanning reserved memory
early_init_fdt_scan_reserved_mem() allocates memory from memblock while
it scans /reserved-memory: the reserved_mem array, and the regions that
are placed dynamically by size. On RISC-V the DTB was only reserved
after that scan, so memblock could hand out the memory the DTB occupies
while the DTB was still being parsed.
Reserve the DTB before the scan, so that memblock never allocates from
it.
Fixes: ef69d2559fe9 ("riscv: Move early dtb mapping into the fixmap region")
Closes: https://lore.kernel.org/all/b71ac175-fba5-4f61-bbdb-0b98dec9ccee@samsung.com/
Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
Link: https://patch.msgid.link/20261104104604.3370384-1-m.szyprowski@samsung.com
Cc: stable at vger.kernel.org
Signed-off-by: Paul Walmsley <pjw at kernel.org>
riscv: dts: spacemit: k1: Correct missing space
Correct minor style issue around white-space - missing space.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at oss.qualcomm.com>
Reviewed-by: Yixun Lan <dlan at kernel.org>
Reviewed-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>
Link: https://patch.msgid.link/20261113185214.182695-4-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Paul Walmsley <pjw at kernel.org>