Merge tag 'for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / kernel / cpu.c
index 42bd331ee0abff1d542583e14beb20d91f6fae62..3046a503242c8eb67f031d445713a9e55c986e73 100644 (file)
@@ -348,11 +348,13 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
        unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
        struct task_struct *idle;
 
-       if (cpu_online(cpu) || !cpu_present(cpu))
-               return -EINVAL;
-
        cpu_hotplug_begin();
 
+       if (cpu_online(cpu) || !cpu_present(cpu)) {
+               ret = -EINVAL;
+               goto out;
+       }
+
        idle = idle_thread_get(cpu);
        if (IS_ERR(idle)) {
                ret = PTR_ERR(idle);
@@ -601,6 +603,11 @@ cpu_hotplug_pm_callback(struct notifier_block *nb,
 
 static int __init cpu_hotplug_pm_sync_init(void)
 {
+       /*
+        * cpu_hotplug_pm_callback has higher priority than x86
+        * bsp_pm_callback which depends on cpu_hotplug_pm_callback
+        * to disable cpu hotplug to avoid cpu hotplug race.
+        */
        pm_notifier(cpu_hotplug_pm_callback, 0);
        return 0;
 }