aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 42bd331ee0ab..3046a503242c 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -348,11 +348,13 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
348 unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0; 348 unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
349 struct task_struct *idle; 349 struct task_struct *idle;
350 350
351 if (cpu_online(cpu) || !cpu_present(cpu))
352 return -EINVAL;
353
354 cpu_hotplug_begin(); 351 cpu_hotplug_begin();
355 352
353 if (cpu_online(cpu) || !cpu_present(cpu)) {
354 ret = -EINVAL;
355 goto out;
356 }
357
356 idle = idle_thread_get(cpu); 358 idle = idle_thread_get(cpu);
357 if (IS_ERR(idle)) { 359 if (IS_ERR(idle)) {
358 ret = PTR_ERR(idle); 360 ret = PTR_ERR(idle);
@@ -601,6 +603,11 @@ cpu_hotplug_pm_callback(struct notifier_block *nb,
601 603
602static int __init cpu_hotplug_pm_sync_init(void) 604static int __init cpu_hotplug_pm_sync_init(void)
603{ 605{
606 /*
607 * cpu_hotplug_pm_callback has higher priority than x86
608 * bsp_pm_callback which depends on cpu_hotplug_pm_callback
609 * to disable cpu hotplug to avoid cpu hotplug race.
610 */
604 pm_notifier(cpu_hotplug_pm_callback, 0); 611 pm_notifier(cpu_hotplug_pm_callback, 0);
605 return 0; 612 return 0;
606} 613}