aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-18 10:59:45 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-03-24 05:38:51 -0400
commit149c24151e8577b2a033639722dc5734de5e6eaf (patch)
tree2147e5cde46ab5f57880284b713786db933fe42a /arch/arm/kernel
parent94e5a85b3be0ce109d26aa6812b2a02c518a0e4b (diff)
ARM: SMP: use a timing out completion for cpu hotplug
Rather than open-coding the jiffy-based wait, and polling for the secondary CPU to come online, use a completion instead. This removes the need to poll, instead we will be notified when the secondary CPU has initialized. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/smp.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 57db122a4f62..2b26dca2168b 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -58,6 +58,8 @@ enum ipi_msg_type {
58 IPI_CPU_STOP, 58 IPI_CPU_STOP,
59}; 59};
60 60
61static DECLARE_COMPLETION(cpu_running);
62
61int __cpuinit __cpu_up(unsigned int cpu) 63int __cpuinit __cpu_up(unsigned int cpu)
62{ 64{
63 struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu); 65 struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu);
@@ -98,20 +100,12 @@ int __cpuinit __cpu_up(unsigned int cpu)
98 */ 100 */
99 ret = boot_secondary(cpu, idle); 101 ret = boot_secondary(cpu, idle);
100 if (ret == 0) { 102 if (ret == 0) {
101 unsigned long timeout;
102
103 /* 103 /*
104 * CPU was successfully started, wait for it 104 * CPU was successfully started, wait for it
105 * to come online or time out. 105 * to come online or time out.
106 */ 106 */
107 timeout = jiffies + HZ; 107 wait_for_completion_timeout(&cpu_running,
108 while (time_before(jiffies, timeout)) { 108 msecs_to_jiffies(1000));
109 if (cpu_online(cpu))
110 break;
111
112 udelay(10);
113 barrier();
114 }
115 109
116 if (!cpu_online(cpu)) { 110 if (!cpu_online(cpu)) {
117 pr_crit("CPU%u: failed to come online\n", cpu); 111 pr_crit("CPU%u: failed to come online\n", cpu);
@@ -300,9 +294,10 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
300 /* 294 /*
301 * OK, now it's safe to let the boot CPU continue. Wait for 295 * OK, now it's safe to let the boot CPU continue. Wait for
302 * the CPU migration code to notice that the CPU is online 296 * the CPU migration code to notice that the CPU is online
303 * before we continue. 297 * before we continue - which happens after __cpu_up returns.
304 */ 298 */
305 set_cpu_online(cpu, true); 299 set_cpu_online(cpu, true);
300 complete(&cpu_running);
306 301
307 /* 302 /*
308 * Setup the percpu timer for this CPU. 303 * Setup the percpu timer for this CPU.