]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/metag/kernel/smp.c
metag: smp: don't spin waiting for CPU to start
[karo-tx-linux.git] / arch / metag / kernel / smp.c
index 09979f203a4d1b85018ccdec0cb05607be048b9a..e413875cf6d2d7e5866daae7ab31d64a466c4e05 100644 (file)
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 #include <linux/atomic.h>
+#include <linux/completion.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
@@ -62,6 +63,8 @@ static DEFINE_PER_CPU(struct ipi_data, ipi_data) = {
 
 static DEFINE_SPINLOCK(boot_lock);
 
+static DECLARE_COMPLETION(cpu_running);
+
 /*
  * "thread" is assumed to be a valid Meta hardware thread ID.
  */
@@ -235,20 +238,12 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
         */
        ret = boot_secondary(thread, 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))
                        ret = -EIO;
@@ -391,6 +386,7 @@ asmlinkage void secondary_start_kernel(void)
         * OK, now it's safe to let the boot CPU continue
         */
        set_cpu_online(cpu, true);
+       complete(&cpu_running);
 
        /*
         * Enable local interrupts.