Skip to contentSkip to conversation

x86: Disable IOAPIC earlier during shutdown

PATCH In review Ross Lagerwall 3 participants 4 messages Dec 1, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: Disable IOAPIC earlier during shutdown

Commit fc0c3fa2ad5c ("x86/IO-APIC: fix setup of Xen internally used IRQs (take 2)") introduced a regression on some hardware where Xen would hang during shutdown, repeating the following message:
APIC error on CPU0: 08(08), Receive accept error

This appears to be because an interrupt (in this case from the serial console) destined for a CPU other than the boot CPU is left unhandled so an APIC error on CPU 0 is generated instead.

To fix this, disable the IOAPIC before each CPU's local APIC is disabled so that these interrupts are not generated.

---
 xen/arch/x86/smp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
xen/arch/x86/smp.c +4 -1
index 50ff6c2..5dfdc96 100644
@@ -299,6 +299,10 @@ void smp_send_stop(void)
 {
     int timeout = 10;
 
+    local_irq_disable();
+    disable_IO_APIC();
+    local_irq_enable();
+
     smp_call_function(stop_this_cpu, NULL, 0);
 
     /* Wait 10ms for all other CPUs to go offline. */
@@ -306,7 +310,6 @@ void smp_send_stop(void)
         mdelay(1);
 
     local_irq_disable();
-    disable_IO_APIC();
     hpet_disable();
     __stop_this_cpu();
     local_irq_enable();
Signature · 1 line
2.4.3
#1 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 17:13, <[email protected]> wrote:

Commit fc0c3fa2ad5c ("x86/IO-APIC: fix setup of Xen internally used IRQs (take 2)") introduced a regression on some hardware where Xen would hang during shutdown, repeating the following message:
APIC error on CPU0: 08(08), Receive accept error

Quoted 6 lines

This appears to be because an interrupt (in this case from the serial console) destined for a CPU other than the boot CPU is left unhandled so an APIC error on CPU 0 is generated instead.

To fix this, disable the IOAPIC before each CPU's local APIC is disabled so that these interrupts are not generated.

But wouldn't a similar issue occur for MSI or MSI-like (IOMMU) interrupts? I.e. shouldn't we perhaps invoke fixup_irqs() after having restricted cpu_online_map to just CPU0?

Jan

#2 lore raw
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 17:13, <[email protected]> wrote:

Commit fc0c3fa2ad5c ("x86/IO-APIC: fix setup of Xen internally used IRQs (take 2)") introduced a regression on some hardware where Xen would hang during shutdown, repeating the following message:
APIC error on CPU0: 08(08), Receive accept error

This appears to be because an interrupt (in this case from the serial console) destined for a CPU other than the boot CPU is left unhandled so an APIC error on CPU 0 is generated instead.

Quoted 5 lines
Quoted 2 lines

To fix this, disable the IOAPIC before each CPU's local APIC is disabled so that these interrupts are not generated.

But wouldn't a similar issue occur for MSI or MSI-like (IOMMU) interrupts? I.e. shouldn't we perhaps invoke fixup_irqs() after having restricted cpu_online_map to just CPU0?

a fixup_irq()s in __stop_this_cpu() might do it, although there will be heavy lock contention on all the irq descriptors.

A better option would be to run fixup_irq()s once and make them all point to cpu0, then take the others down. This will probably involve passing a parameter to fixup_irq()s to conditionally override its use of the cpu_online_map.

~Andrew

#3 lore raw
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 17:38, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 17:13, <[email protected]> wrote:

Commit fc0c3fa2ad5c ("x86/IO-APIC: fix setup of Xen internally used IRQs (take 2)") introduced a regression on some hardware where Xen would hang during shutdown, repeating the following message:
APIC error on CPU0: 08(08), Receive accept error

This appears to be because an interrupt (in this case from the serial console) destined for a CPU other than the boot CPU is left unhandled so an APIC error on CPU 0 is generated instead.

Quoted 5 lines
Quoted 2 lines

To fix this, disable the IOAPIC before each CPU's local APIC is disabled so that these interrupts are not generated.

But wouldn't a similar issue occur for MSI or MSI-like (IOMMU) interrupts? I.e. shouldn't we perhaps invoke fixup_irqs() after having restricted cpu_online_map to just CPU0?

Quoted 7 lines

a fixup_irq()s in __stop_this_cpu() might do it, although there will be heavy lock contention on all the irq descriptors.

A better option would be to run fixup_irq()s once and make them all point to cpu0, then take the others down. This will probably involve passing a parameter to fixup_irq()s to conditionally override its use of the cpu_online_map.

The latter was what I actually had in mind, I just didn't check whether we can re-write cpu_online_map up front (which it looks like we can't). So yes, passing fixup_irqs() a cpumask would be the way to go.

Jan