@@ -241,7 +241,7 @@ int __cpu_disable(void)
return 0;
}
-static DECLARE_COMPLETION(cpu_died);
+static atomic_t cpu_died;
/*
* called on the thread which is asking for a CPU to be shutdown -
@@ -249,7 +249,17 @@ static DECLARE_COMPLETION(cpu_died);
*/
void __cpu_die(unsigned int cpu)
{
- if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
+ unsigned long deadline = jiffies + msecs_to_jiffies(5000);
+ char ret = 0;
+
+ while (time_before(jiffies, deadline)) {
+ ret = atomic_dec_and_test(&cpu_died);
+ if (ret)
+ break;
+ schedule_timeout_interruptible(1);
+ }
+ atomic_set(&cpu_died, 0);
+ if (!ret) {
pr_err("CPU%u: cpu didn't die\n", cpu);
return;
}
@@ -295,7 +305,7 @@ void arch_cpu_idle_dead(void)
* this returns, power and/or clocks can be removed at any point
* from this CPU and its cache by platform_cpu_kill().
*/
- complete(&cpu_died);
+ atomic_set(&cpu_died, 1);
/*
* Ensure that the cache lines associated with that completion are