Skip to content

Commit

Permalink
smp/hotplug: Replace BUG_ON and react useful
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner committed Jul 11, 2017
1 parent 9cd4f1a commit dea1d0f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ static int bringup_wait_for_ap(unsigned int cpu)

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

/* Unpark the stopper thread and the hotplug thread of the target cpu */
stop_machine_unpark(cpu);
Expand Down

0 comments on commit dea1d0f

Please sign in to comment.