]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/i386/kernel/smpboot.c
[PATCH] x86: check for online cpus before bringing them up
[linux-2.6-omap-h63xx.git] / arch / i386 / kernel / smpboot.c
index eba7f53f8b4a687c061601ea351943038a163c91..7007e1783797a1997765a3100950b5b41c2ee4a1 100644 (file)
@@ -1029,6 +1029,16 @@ int __devinit smp_prepare_cpu(int cpu)
        int     apicid, ret;
 
        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];
        if (apicid == BAD_APICID) {
                ret = -ENODEV;