Commit 82c3c03a authored by Srivatsa Vaddagiri's avatar Srivatsa Vaddagiri Committed by Linus Torvalds

[PATCH] x86: check for online cpus before bringing them up

Bryce reported a bug wherein offlining CPU0 (on x86 box) and then
subsequently onlining it resulted in a lockup.

On x86, CPU0 is never offlined.  The subsequent attempt to online CPU0
doesn't take that into account.  It actually tries to bootup the already
booted CPU.  Following patch fixes the problem (as acknowledged by Bryce).
Please consider for inclusion in 2.6.16.

Check if cpu is already online.
Signed-off-by: default avatarSrivatsa Vaddagiri <vatsa@in.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8532159f
...@@ -1029,6 +1029,16 @@ int __devinit smp_prepare_cpu(int cpu) ...@@ -1029,6 +1029,16 @@ int __devinit smp_prepare_cpu(int cpu)
int apicid, ret; int apicid, ret;
lock_cpu_hotplug(); lock_cpu_hotplug();
/*
* On x86, CPU0 is never offlined. Trying to bring up an
* already-booted CPU will hang. So check for that case.
*/
if (cpu_online(cpu)) {
ret = -EINVAL;
goto exit;
}
apicid = x86_cpu_to_apicid[cpu]; apicid = x86_cpu_to_apicid[cpu];
if (apicid == BAD_APICID) { if (apicid == BAD_APICID) {
ret = -ENODEV; ret = -ENODEV;
......
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