Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336668
b: refs/heads/master
c: 5e5041f
h: refs/heads/master
v: v3
  • Loading branch information
Yasuaki Ishimatsu authored and Rafael J. Wysocki committed Nov 14, 2012
1 parent 2932760 commit 3ba3993
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 73d4511a5f1e208399b2f7a058b73578c1977611
refs/heads/master: 5e5041f3527b36b58e864886ba34c179ad40ff92
14 changes: 14 additions & 0 deletions trunk/drivers/acpi/processor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,22 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr)
if (cpu_online(pr->id))
cpu_down(pr->id);

get_online_cpus();
/*
* The cpu might become online again at this point. So we check whether
* the cpu has been onlined or not. If the cpu became online, it means
* that someone wants to use the cpu. So acpi_processor_handle_eject()
* returns -EAGAIN.
*/
if (unlikely(cpu_online(pr->id))) {
put_online_cpus();
pr_warn("Failed to remove CPU %d, because other task "
"brought the CPU back online\n", pr->id);
return -EAGAIN;
}
arch_unregister_cpu(pr->id);
acpi_unmap_lsapic(pr->id);
put_online_cpus();
return (0);
}
#else
Expand Down
8 changes: 5 additions & 3 deletions trunk/kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3ba3993

Please sign in to comment.