All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xen: arm: wait 1000ms for a CPU to come up, instead of forever
@ 2015-01-14 15:47 Ian Campbell
  2015-01-15 15:15 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Campbell @ 2015-01-14 15:47 UTC (permalink / raw)
  To: xen-devel; +Cc: julien.grall, tim, Ian Campbell, stefano.stabellini

Otherwise continue without it, which is preferable to the current
infinite hang.

Slightly tweak the grammar of a comment in the same function.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/smpboot.c |   27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index 14054ae..a96cda2 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -357,6 +357,7 @@ int __init cpu_up_send_sgi(int cpu)
 int __cpu_up(unsigned int cpu)
 {
     int rc;
+    s_time_t deadline;
 
     printk("Bringing up CPU%d\n", cpu);
 
@@ -369,7 +370,7 @@ int __cpu_up(unsigned int cpu)
     /* Tell the remote CPU which stack to boot on. */
     init_data.stack = idle_vcpu[cpu]->arch.stack;
 
-    /* Tell the remote CPU what is it's logical CPU ID */
+    /* Tell the remote CPU what its logical CPU ID is. */
     init_data.cpuid = cpu;
 
     /* Open the gate for this CPU */
@@ -386,12 +387,34 @@ int __cpu_up(unsigned int cpu)
         return rc;
     }
 
-    while ( !cpu_online(cpu) )
+    deadline = NOW() + MILLISECS(1000);
+
+    while ( !cpu_online(cpu) && NOW() < deadline )
     {
         cpu_relax();
         process_pending_softirqs();
     }
 
+    /*
+     * Nuke start of day info before checking one last time if the CPU
+     * actually came online. If it is not online it may still be
+     * trying to come up and may show up later unexpectedly.
+     *
+     * This doesn't completely avoid the possibility of the supposedly
+     * failed CPU trying to progress with another CPUs stack settings
+     * etc, but better than nothing, hopefully.
+     */
+    init_data.stack = NULL;
+    init_data.cpuid = ~0;
+    smp_up_cpu = MPIDR_INVALID;
+    clean_dcache(smp_up_cpu);
+
+    if ( !cpu_online(cpu) )
+    {
+        printk("CPU%d never came online\n", cpu);
+        return -EIO;
+    }
+
     return 0;
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-15 15:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-14 15:47 [PATCH v2] xen: arm: wait 1000ms for a CPU to come up, instead of forever Ian Campbell
2015-01-15 15:15 ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.