diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c index 01e48a1133..f9772dc2ab 100644 --- a/xen/arch/x86/crash.c +++ b/xen/arch/x86/crash.c @@ -169,15 +169,20 @@ static void nmi_shootdown_cpus(void) */ iommu_crash_shutdown(); - __stop_this_cpu(); + if ( num_online_cpus() > 1 ) + { + __stop_this_cpu(); - /* This is a bit of a hack due to the problems with the x2apic_enabled - * variable, but we can't do any better without a significant refactoring - * of the APIC code */ - x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC); + /* + * This is a bit of a hack due to the problems with the x2apic_enabled + * variable, but we can't do any better without a significant + * refactoring of the APIC code + */ + x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC); - disable_IO_APIC(); - hpet_disable(); + disable_IO_APIC(); + hpet_disable(); + } } void machine_crash_shutdown(void) diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c index e0292b9577..6fb39a0a24 100644 --- a/xen/arch/x86/smp.c +++ b/xen/arch/x86/smp.c @@ -302,23 +302,31 @@ static void stop_this_cpu(void *dummy) */ void smp_send_stop(void) { - int timeout = 10; + unsigned int cpu = smp_processor_id(); - local_irq_disable(); - fixup_irqs(cpumask_of(smp_processor_id()), 0); - local_irq_enable(); + if ( num_online_cpus() > 1 ) + { + int timeout = 10; - smp_call_function(stop_this_cpu, NULL, 0); + local_irq_disable(); + fixup_irqs(cpumask_of(cpu), 0); + local_irq_enable(); - /* Wait 10ms for all other CPUs to go offline. */ - while ( (num_online_cpus() > 1) && (timeout-- > 0) ) - mdelay(1); + smp_call_function(stop_this_cpu, NULL, 0); - local_irq_disable(); - disable_IO_APIC(); - hpet_disable(); - __stop_this_cpu(); - local_irq_enable(); + /* Wait 10ms for all other CPUs to go offline. */ + while ( (num_online_cpus() > 1) && (timeout-- > 0) ) + mdelay(1); + } + + if ( cpu_online(cpu) ) + { + local_irq_disable(); + disable_IO_APIC(); + hpet_disable(); + __stop_this_cpu(); + local_irq_enable(); + } } void smp_send_nmi_allbutself(void)