[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Cleanup system restart code, and wait 10ms for APs to offline.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1189444178 -3600
# Node ID 154769114a82c4051b196bdfe7fdea4b159d339f
# Parent  aaae02dbe2697f0103adf5dd396b6a80eef420dc
x86: Cleanup system restart code, and wait 10ms for APs to offline.
Signed-off-by: Joseph Cihula <joseph.cihula@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/machine_kexec.c |    3 ---
 xen/arch/x86/shutdown.c      |    8 +-------
 xen/arch/x86/smp.c           |   34 ++++++++++++++++++++++------------
 3 files changed, 23 insertions(+), 22 deletions(-)

diff -r aaae02dbe269 -r 154769114a82 xen/arch/x86/machine_kexec.c
--- a/xen/arch/x86/machine_kexec.c      Mon Sep 10 17:49:58 2007 +0100
+++ b/xen/arch/x86/machine_kexec.c      Mon Sep 10 18:09:38 2007 +0100
@@ -82,9 +82,6 @@ static void __machine_reboot_kexec(void 
 
     smp_send_stop();
 
-    disable_IO_APIC();
-    hvm_cpu_down();
-
     machine_kexec(image);
 }
 
diff -r aaae02dbe269 -r 154769114a82 xen/arch/x86/shutdown.c
--- a/xen/arch/x86/shutdown.c   Mon Sep 10 17:49:58 2007 +0100
+++ b/xen/arch/x86/shutdown.c   Mon Sep 10 18:09:38 2007 +0100
@@ -216,18 +216,12 @@ void machine_restart(void)
             safe_halt();
     }
 
-    /*
-     * Stop all CPUs and turn off local APICs and the IO-APIC, so
-     * other OSs see a clean IRQ state.
-     */
     smp_send_stop();
-    disable_IO_APIC();
-    hvm_cpu_down();
 
     /* Rebooting needs to touch the page at absolute address 0. */
     *((unsigned short *)__va(0x472)) = reboot_mode;
 
-    if (reboot_thru_bios <= 0)
+    if ( reboot_thru_bios <= 0 )
     {
         for ( ; ; )
         {
diff -r aaae02dbe269 -r 154769114a82 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c        Mon Sep 10 17:49:58 2007 +0100
+++ b/xen/arch/x86/smp.c        Mon Sep 10 18:09:38 2007 +0100
@@ -319,23 +319,33 @@ int on_selected_cpus(
 
 static void stop_this_cpu (void *dummy)
 {
+    disable_local_APIC();
+    hvm_cpu_down();
+
     cpu_clear(smp_processor_id(), cpu_online_map);
+
+    for ( ; ; )
+        __asm__ __volatile__ ( "hlt" );
+}
+
+/*
+ * Stop all CPUs and turn off local APICs and the IO-APIC, so other OSs see a 
+ * clean IRQ state.
+ */
+void smp_send_stop(void)
+{
+    int timeout = 10;
+
+    smp_call_function(stop_this_cpu, NULL, 1, 0);
+
+    /* Wait 10ms for all other CPUs to go offline. */
+    while ( (num_online_cpus() > 1) && (timeout-- > 0) )
+        mdelay(1);
 
     local_irq_disable();
     disable_local_APIC();
+    disable_IO_APIC();
     hvm_cpu_down();
-
-    for ( ; ; )
-        __asm__ __volatile__ ( "hlt" );
-}
-
-void smp_send_stop(void)
-{
-    /* Stop all other CPUs in the system. */
-    smp_call_function(stop_this_cpu, NULL, 1, 0);
-
-    local_irq_disable();
-    disable_local_APIC();
     local_irq_enable();
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.