aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/smp.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-09-10 18:09:38 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-09-10 18:09:38 +0100
commit4694a6028ca07e4008a59b02a1d1f0aa9887a00b (patch)
tree7b74879d964afc8f96153b771d8857b2d814a527 /xen/arch/x86/smp.c
parent78569aa816df0cccdb0c8d7e5359a85e66337265 (diff)
downloadxen-4694a6028ca07e4008a59b02a1d1f0aa9887a00b.tar.gz
xen-4694a6028ca07e4008a59b02a1d1f0aa9887a00b.tar.bz2
xen-4694a6028ca07e4008a59b02a1d1f0aa9887a00b.zip
x86: Cleanup system restart code, and wait 10ms for APs to offline.
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com> Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/arch/x86/smp.c')
-rw-r--r--xen/arch/x86/smp.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 1d83a3aba3..550faf069b 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -319,23 +319,33 @@ int on_selected_cpus(
static void stop_this_cpu (void *dummy)
{
- cpu_clear(smp_processor_id(), cpu_online_map);
-
- local_irq_disable();
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)
{
- /* Stop all other CPUs in the system. */
+ 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();
local_irq_enable();
}