On 15.8.2020 0.38, Ashok Raj wrote:
> When offlining CPU's, fixup_irqs() migrates all interrupts away from the
> outgoing CPU to an online CPU. Its always possible the device sent an
> interrupt to the previous CPU destination. Pending interrupt bit in IRR in
> lapic identifies such interrupts. apic_soft_disable() will not capture any
> new interrupts in IRR. This causes interrupts from device to be lost during
> cpu offline. The issue was found when explicitly setting MSI affinity to a
> CPU and immediately offlining it. It was simple to recreate with a USB
> ethernet device and doing I/O to it while the CPU is offlined. Lost
> interrupts happen even when Interrupt Remapping is enabled.
> 
> Current code does apic_soft_disable() before migrating interrupts.
> 
> native_cpu_disable()
> {
>       ...
>       apic_soft_disable();
>       cpu_disable_common();
>         --> fixup_irqs(); // Too late to capture anything in IRR.
> }
> 
> Just fliping the above call sequence seems to hit the IRR checks
> and the lost interrupt is fixed for both legacy MSI and when
> interrupt remapping is enabled.
> 
> 
> Fixes: 60dcaad5736f ("x86/hotplug: Silence APIC and NMI when CPU is dead")
> Link: https://lore.kernel.org/lkml/875zdarr4h....@nanos.tec.linutronix.de/
> Signed-off-by: Ashok Raj <ashok....@intel.com>
> 
> To: linux-kernel@vger.kernel.org
> To: Thomas Gleixner <t...@linutronix.de>
> Cc: Sukumar Ghorai <sukumar.gho...@intel.com>
> Cc: Srikanth Nandamuri <srikanth.nandam...@intel.com>
> Cc: Evan Green <evgr...@chromium.org>
> Cc: Mathias Nyman <mathias.ny...@linux.intel.com>
> Cc: Bjorn Helgaas <bhelg...@google.com>
> Cc: sta...@vger.kernel.org
> ---

This fixes the lost xhci interrupt for me.
Before this patch a msi interupt was lost after ~200 cycles of toggling CPUs
offline/online under heavy usb traffic.

With this patch I ran 3x2000 cycles without any issues (Comet lake, patch on 
top of 5.8)
Tried both with and without CONFIG_IRQ_REMAP. No issues seen.

Tested-by: Mathias Nyman <mathias.ny...@linux.intel.com>

Reply via email to