aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/smp.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-11-30 06:07:35 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-12-20 10:09:10 -0500
commit3c030beabf937b1d3b4ecaedfd1fb2f1e2aa0c70 (patch)
tree3cac64838c83ecc2d0d070be268fb087dffd8d4b /arch/arm/kernel/smp.c
parent2c0136dba4e43b0916ccc9ecc7f11e6d6b73f046 (diff)
ARM: CPU hotplug: move cpu_killed completion to core code
We always need to wait for the dying CPU to reach a safe state before taking it down, irrespective of the requirements of the platform. Move the completion code into the ARM SMP hotplug code rather than having each platform re-implement this. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/smp.c')
-rw-r--r--arch/arm/kernel/smp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index a30c4094db3a..8c81ff9b3732 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -24,6 +24,7 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/percpu.h> 25#include <linux/percpu.h>
26#include <linux/clockchips.h> 26#include <linux/clockchips.h>
27#include <linux/completion.h>
27 28
28#include <asm/atomic.h> 29#include <asm/atomic.h>
29#include <asm/cacheflush.h> 30#include <asm/cacheflush.h>
@@ -238,12 +239,20 @@ int __cpu_disable(void)
238 return 0; 239 return 0;
239} 240}
240 241
242static DECLARE_COMPLETION(cpu_died);
243
241/* 244/*
242 * called on the thread which is asking for a CPU to be shutdown - 245 * called on the thread which is asking for a CPU to be shutdown -
243 * waits until shutdown has completed, or it is timed out. 246 * waits until shutdown has completed, or it is timed out.
244 */ 247 */
245void __cpu_die(unsigned int cpu) 248void __cpu_die(unsigned int cpu)
246{ 249{
250 if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
251 pr_err("CPU%u: cpu didn't die\n", cpu);
252 return;
253 }
254 printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
255
247 if (!platform_cpu_kill(cpu)) 256 if (!platform_cpu_kill(cpu))
248 printk("CPU%u: unable to kill\n", cpu); 257 printk("CPU%u: unable to kill\n", cpu);
249} 258}
@@ -263,9 +272,12 @@ void __ref cpu_die(void)
263 local_irq_disable(); 272 local_irq_disable();
264 idle_task_exit(); 273 idle_task_exit();
265 274
275 /* Tell __cpu_die() that this CPU is now safe to dispose of */
276 complete(&cpu_died);
277
266 /* 278 /*
267 * actual CPU shutdown procedure is at least platform (if not 279 * actual CPU shutdown procedure is at least platform (if not
268 * CPU) specific 280 * CPU) specific.
269 */ 281 */
270 platform_cpu_die(cpu); 282 platform_cpu_die(cpu);
271 283