Skip to content

Commit dea1d0f

Browse files
committed
smp/hotplug: Replace BUG_ON and react useful
The move of the unpark functions to the control thread moved the BUG_ON() there as well. While it made some sense in the idle thread of the upcoming CPU, it's bogus to crash the control thread on the already online CPU, especially as the function has a return value and the callsite is prepared to handle an error return. Replace it with a WARN_ON_ONCE() and return a proper error code. Fixes: 9cd4f1a ("smp/hotplug: Move unparking of percpu threads to the control CPU") Rightfully-ranted-at-by: Linux Torvalds <torvalds@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 9cd4f1a commit dea1d0f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/cpu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ static int bringup_wait_for_ap(unsigned int cpu)
279279

280280
/* Wait for the CPU to reach CPUHP_AP_ONLINE_IDLE */
281281
wait_for_completion(&st->done);
282-
BUG_ON(!cpu_online(cpu));
282+
if (WARN_ON_ONCE((!cpu_online(cpu))))
283+
return -ECANCELED;
283284

284285
/* Unpark the stopper thread and the hotplug thread of the target cpu */
285286
stop_machine_unpark(cpu);

0 commit comments

Comments
 (0)