Skip to content

Commit 4a298a4

Browse files
committed
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
2 parents cba09e3 + c942919 commit 4a298a4

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

kernel/cpu.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state state,
249249
return ret;
250250
}
251251

252+
/*
253+
* The former STARTING/DYING states, ran with IRQs disabled and must not fail.
254+
*/
255+
static bool cpuhp_is_atomic_state(enum cpuhp_state state)
256+
{
257+
return CPUHP_AP_IDLE_DEAD <= state && state < CPUHP_AP_ONLINE;
258+
}
259+
252260
#ifdef CONFIG_SMP
253261
static bool cpuhp_is_ap_state(enum cpuhp_state state)
254262
{
@@ -271,14 +279,6 @@ static inline void complete_ap_thread(struct cpuhp_cpu_state *st, bool bringup)
271279
complete(done);
272280
}
273281

274-
/*
275-
* The former STARTING/DYING states, ran with IRQs disabled and must not fail.
276-
*/
277-
static bool cpuhp_is_atomic_state(enum cpuhp_state state)
278-
{
279-
return CPUHP_AP_IDLE_DEAD <= state && state < CPUHP_AP_ONLINE;
280-
}
281-
282282
/* Synchronization state management */
283283
enum cpuhp_sync_state {
284284
SYNC_STATE_DEAD,
@@ -2364,7 +2364,14 @@ static int cpuhp_issue_call(int cpu, enum cpuhp_state state, bool bringup,
23642364
else
23652365
ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL);
23662366
#else
2367-
ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL);
2367+
if (cpuhp_is_atomic_state(state)) {
2368+
guard(irqsave)();
2369+
ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL);
2370+
/* STARTING/DYING must not fail! */
2371+
WARN_ON_ONCE(ret);
2372+
} else {
2373+
ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL);
2374+
}
23682375
#endif
23692376
BUG_ON(ret && !bringup);
23702377
return ret;

0 commit comments

Comments
 (0)