Commit 2a58c527 authored by Thomas Gleixner's avatar Thomas Gleixner

cpu/hotplug: Fix smpboot thread ordering

Commit 931ef163 moved the smpboot thread park/unpark invocation to the
state machine. The move of the unpark invocation was premature as it depends
on work in progress patches.

As a result cpu down can fail, because rcu synchronization in takedown_cpu()
eventually requires a functional softirq thread. I never encountered the
problem in testing, but 0day testing managed to provide a reliable reproducer.

Remove the smpboot_threads_park() call from the state machine for now and put
it back into the original place after the rcu synchronization.

I'm embarrassed as I knew about the dependency and still managed to get it
wrong. Hotplug induced brain melt seems to be the only sensible explanation
for that.

Fixes: 931ef163 "cpu/hotplug: Unpark smpboot threads from the state machine"
Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
parent 5d8eb842
...@@ -706,8 +706,9 @@ static int takedown_cpu(unsigned int cpu) ...@@ -706,8 +706,9 @@ static int takedown_cpu(unsigned int cpu)
else else
synchronize_rcu(); synchronize_rcu();
/* Park the hotplug thread */ /* Park the smpboot threads */
kthread_park(per_cpu_ptr(&cpuhp_state, cpu)->thread); kthread_park(per_cpu_ptr(&cpuhp_state, cpu)->thread);
smpboot_park_threads(cpu);
/* /*
* Prevent irq alloc/free while the dying cpu reorganizes the * Prevent irq alloc/free while the dying cpu reorganizes the
...@@ -1206,7 +1207,7 @@ static struct cpuhp_step cpuhp_ap_states[] = { ...@@ -1206,7 +1207,7 @@ static struct cpuhp_step cpuhp_ap_states[] = {
[CPUHP_AP_SMPBOOT_THREADS] = { [CPUHP_AP_SMPBOOT_THREADS] = {
.name = "smpboot:threads", .name = "smpboot:threads",
.startup = smpboot_unpark_threads, .startup = smpboot_unpark_threads,
.teardown = smpboot_park_threads, .teardown = NULL,
}, },
[CPUHP_AP_NOTIFY_ONLINE] = { [CPUHP_AP_NOTIFY_ONLINE] = {
.name = "notify:online", .name = "notify:online",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment