All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Disable IOAPIC earlier during shutdown
@ 2015-12-01 16:13 Ross Lagerwall
  2015-12-01 16:26 ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Ross Lagerwall @ 2015-12-01 16:13 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Ross Lagerwall

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.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/arch/x86/smp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 50ff6c2..5dfdc96 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -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();
-- 
2.4.3

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

* Re: [PATCH] x86: Disable IOAPIC earlier during shutdown
  2015-12-01 16:13 [PATCH] x86: Disable IOAPIC earlier during shutdown Ross Lagerwall
@ 2015-12-01 16:26 ` Jan Beulich
  2015-12-01 16:38   ` Andrew Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2015-12-01 16:26 UTC (permalink / raw)
  To: Ross Lagerwall; +Cc: Andrew Cooper, xen-devel

>>> On 01.12.15 at 17:13, <ross.lagerwall@citrix.com> 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.
> 
> 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

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

* Re: [PATCH] x86: Disable IOAPIC earlier during shutdown
  2015-12-01 16:26 ` Jan Beulich
@ 2015-12-01 16:38   ` Andrew Cooper
  2015-12-01 16:48     ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2015-12-01 16:38 UTC (permalink / raw)
  To: Jan Beulich, Ross Lagerwall; +Cc: xen-devel

On 01/12/15 16:26, Jan Beulich wrote:
>>>> On 01.12.15 at 17:13, <ross.lagerwall@citrix.com> 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.
>>
>> 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

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

* Re: [PATCH] x86: Disable IOAPIC earlier during shutdown
  2015-12-01 16:38   ` Andrew Cooper
@ 2015-12-01 16:48     ` Jan Beulich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2015-12-01 16:48 UTC (permalink / raw)
  To: Andrew Cooper, Ross Lagerwall; +Cc: xen-devel

>>> On 01.12.15 at 17:38, <andrew.cooper3@citrix.com> wrote:
> On 01/12/15 16:26, Jan Beulich wrote:
>>>>> On 01.12.15 at 17:13, <ross.lagerwall@citrix.com> 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.
>>>
>>> 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.

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

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-01 16:13 [PATCH] x86: Disable IOAPIC earlier during shutdown Ross Lagerwall
2015-12-01 16:26 ` Jan Beulich
2015-12-01 16:38   ` Andrew Cooper
2015-12-01 16:48     ` Jan Beulich

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.