x86/apic: Plug racy xAPIC access of CPU hotplug code
[cascardo/linux.git] / arch / x86 / kernel / smpboot.c
index c77acc6..60179ec 100644 (file)
@@ -702,11 +702,15 @@ wakeup_cpu_via_init_nmi(int cpu, unsigned long start_ip, int apicid,
        int id;
        int boot_error;
 
+       preempt_disable();
+
        /*
         * Wake up AP by INIT, INIT, STARTUP sequence.
         */
-       if (cpu)
-               return wakeup_secondary_cpu_via_init(apicid, start_ip);
+       if (cpu) {
+               boot_error = wakeup_secondary_cpu_via_init(apicid, start_ip);
+               goto out;
+       }
 
        /*
         * Wake up BSP by nmi.
@@ -726,6 +730,9 @@ wakeup_cpu_via_init_nmi(int cpu, unsigned long start_ip, int apicid,
                boot_error = wakeup_secondary_cpu_via_nmi(id, start_ip);
        }
 
+out:
+       preempt_enable();
+
        return boot_error;
 }