aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-18 15:59:45 +0000
committerAndrew Dodd <atd7@cornell.edu>2012-11-13 19:15:50 -0500
commit5ddd587f9564e31f0767b3f352aadbba5ab69e9e (patch)
tree77b3edc3d8cc1339283ee44cf94f5532305c245b /arch/arm/kernel
parent3c3b858c0168ae826525595ef2fb5d275484f989 (diff)
downloadkernel_samsung_smdk4412-5ddd587f9564e31f0767b3f352aadbba5ab69e9e.tar.gz
kernel_samsung_smdk4412-5ddd587f9564e31f0767b3f352aadbba5ab69e9e.tar.bz2
kernel_samsung_smdk4412-5ddd587f9564e31f0767b3f352aadbba5ab69e9e.zip
ARM: SMP: use a timing out completion for cpu hotplug
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 ffc8fb6cb4c..e550be97ebf 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -58,6 +58,8 @@ enum ipi_msg_type {
IPI_CPU_BACKTRACE,
};
+static DECLARE_COMPLETION(cpu_running);
+
int __cpuinit __cpu_up(unsigned int cpu)
{
struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu);
@@ -117,20 +119,12 @@ int __cpuinit __cpu_up(unsigned int cpu)
*/
ret = boot_secondary(cpu, idle);
if (ret == 0) {
- unsigned long timeout;
-
/*
* CPU was successfully started, wait for it
* to come online or time out.
*/
- timeout = jiffies + HZ;
- while (time_before(jiffies, timeout)) {
- if (cpu_online(cpu))
- break;
-
- udelay(10);
- barrier();
- }
+ wait_for_completion_timeout(&cpu_running,
+ msecs_to_jiffies(1000));
if (!cpu_online(cpu)) {
pr_crit("CPU%u: failed to come online\n", cpu);
@@ -328,9 +322,10 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
/*
* OK, now it's safe to let the boot CPU continue. Wait for
* the CPU migration code to notice that the CPU is online
- * before we continue.
+ * before we continue - which happens after __cpu_up returns.
*/
set_cpu_online(cpu, true);
+ complete(&cpu_running);
/*
* Setup the percpu timer for this CPU.