Merge tag 'smp-urgent-2025-12-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull CPU hotplug fix from Ingo Molnar:

 - Fix CPU hotplug callbacks to disable interrupts on UP kernels

* tag 'smp-urgent-2025-12-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  cpu: Make atomic hotplug callbacks run with interrupts disabled on UP
This commit is contained in:
Linus Torvalds
2025-12-14 06:12:46 +12:00

View File

@@ -249,6 +249,14 @@ static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state state,
return ret; return ret;
} }
/*
* The former STARTING/DYING states, ran with IRQs disabled and must not fail.
*/
static bool cpuhp_is_atomic_state(enum cpuhp_state state)
{
return CPUHP_AP_IDLE_DEAD <= state && state < CPUHP_AP_ONLINE;
}
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
static bool cpuhp_is_ap_state(enum cpuhp_state state) static bool cpuhp_is_ap_state(enum cpuhp_state state)
{ {
@@ -271,14 +279,6 @@ static inline void complete_ap_thread(struct cpuhp_cpu_state *st, bool bringup)
complete(done); complete(done);
} }
/*
* The former STARTING/DYING states, ran with IRQs disabled and must not fail.
*/
static bool cpuhp_is_atomic_state(enum cpuhp_state state)
{
return CPUHP_AP_IDLE_DEAD <= state && state < CPUHP_AP_ONLINE;
}
/* Synchronization state management */ /* Synchronization state management */
enum cpuhp_sync_state { enum cpuhp_sync_state {
SYNC_STATE_DEAD, SYNC_STATE_DEAD,
@@ -2364,7 +2364,14 @@ static int cpuhp_issue_call(int cpu, enum cpuhp_state state, bool bringup,
else else
ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL); ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL);
#else #else
ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL); if (cpuhp_is_atomic_state(state)) {
guard(irqsave)();
ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL);
/* STARTING/DYING must not fail! */
WARN_ON_ONCE(ret);
} else {
ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL);
}
#endif #endif
BUG_ON(ret && !bringup); BUG_ON(ret && !bringup);
return ret; return ret;