]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cpu: Make atomic hotplug callbacks run with interrupts disabled on UP
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 27 Nov 2025 14:47:23 +0000 (15:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:41 +0000 (14:03 +0100)
commitd0fab03390ae1b2f56f9592bc79442d5ecac0dd2
tree5f4b7cf6abcc1972ced2c01549a290d774f6295c
parentefd65e2e2fd96f7aaa5cb07d79bbbfcfc80aa552
cpu: Make atomic hotplug callbacks run with interrupts disabled on UP

[ Upstream commit c94291914b200e10c72cef23c8e4c67eb4fdbcd9 ]

On SMP systems the CPU hotplug callbacks in the "starting" range are
invoked while the CPU is brought up and interrupts are still
disabled. Callbacks which are added later are invoked via the
hotplug-thread on the target CPU and interrupts are explicitly disabled.

In the UP case callbacks which are added later are invoked directly without
the thread indirection. This is in principle okay since there is just one
CPU but those callbacks are invoked with interrupt disabled code. That's
incorrect as those callbacks assume interrupt disabled context.

Disable interrupts before invoking the callbacks on UP if the state is
atomic and interrupts are expected to be disabled.  The "save" part is
required because this is also invoked early in the boot process while
interrupts are disabled and must not be enabled prematurely.

Fixes: 06ddd17521bf1 ("sched/smp: Always define is_percpu_thread() and scheduler_ipi()")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/20251127144723.ev9DuXXR@linutronix.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/cpu.c