summaryrefslogtreecommitdiff
path: root/kernel/cpu.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-07-11 22:06:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-06 18:59:41 -0700
commit6b3d13fe67da15aca3186c11c016b6abd00f0469 (patch)
tree29e485c5dab27e143a94a69fb7d2f1ea11709048 /kernel/cpu.c
parent7b4e4b18ea64f95a8502199e792cbe75297c66ef (diff)
smp/hotplug: Replace BUG_ON and react useful
commit dea1d0f5f1284e3defee4b8484d9fc230686cd42 upstream. 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: 9cd4f1a4e7a8 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index b4b27629373c..26a4f74bff83 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -418,7 +418,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);