Re: [PATCH v1] iommu/amd: Prevent spurious IRQ disable on high-rate GALog MSIs
From: Vasant Hegde
Date: Mon Nov 23 2026 - 06:08:41 EST
Mina, Sairaj,
On 11/4/2026 2:49 PM, Sairaj Kodilkar wrote:
> On 11/1/2026 11:51 AM, Mina Almasry wrote:
>> On AMD EPYC (Turin) hosts with AVIC enabled, passed-through SR-IOV VFs
>> in KVM guests log interrupts targeting non-running vCPUs into the IOMMU
>> Guest Virtual APIC Log (GALog) ring buffer and signal the host via an
>> edge-triggered IntCapXT MSI (AMD-Vi*-GA).
>>
>> Both __iommu_setup_intcapxt() and iommu_setup_msi() register their
>> handlers via request_threaded_irq(..., NULL, thread_fn, IRQF_ONESHOT,
>> ...), using irq_default_primary_handler() (which returns
>> IRQ_WAKE_THREAD), while intcapxt_irqdomain_alloc() sets handle_edge_irq
>> which does not mask edge-triggered MSIs during oneshot thread execution.
>>
>> Previously, amd_iommu_handle_irq() cleared MMIO_STATUS_OFFSET at the top
>> of the while (status & mask) loop before calling int_handler(iommu)
>> (iommu_poll_ga_log()). Under overcommitted multi-VM TCP_RR workloads
>> (1,000 to 10,000 flows across 4-8 VMs with vCPU overcommit), new VF
>> interrupts for non-running vCPUs arrive while iommu_poll_ga_log() is
>> draining the ring buffer, causing GALogInt to transition 0 -> 1 and fire
>> additional hardware edge MSIs while the IRQ thread is still inside
>> amd_iommu_handle_irq(). Because desc->threads_handled only increments in
>> irq_thread_fn() after action->thread_fn() returns, note_interrupt()
>> (kernel/irq/spurious.c) accounts every intermediate edge MSI as IRQ_NONE
>> (desc->irqs_unhandled++). Once desc->irqs_unhandled exceeds 99,900 out
>> of 100,000 interrupts, __report_bad_irq() logs "irq <N>: nobody cared"
>> and permanently disables the IOMMU GALog IRQ, breaking guest VF MSI-X
>> wakeups.
.../...
>
> We also encountered same issue recently, I think right way to fix is to
> address the underlying root cause -->
> 1. GALOG is a circular buffer and any new entries created by the IOMMU
> can be handled in a single interrupt.
> 2. In an high interrupt rate environment The ga-log handler keeps
> looping without incrementing threads_handled.
> 3. This causes note_interrupt to disable irq since it thinks that
> handler is stuck.
>
> The solution that I had in mind (not sure if its a right way) is to
> break the while loop inside amd_iommu_handle_irq() after certain number
> of iterations.
>
> This works because.
> 1. We enable the interrupts before processing the entries
> 2. Any new interrupts that arrive during the entry processing will set
> IRQTF_RUNTHREAD.
> 3. If we break the loop after that, the irq_thread_fn() will increment
> threads_handled.
> 4. And irq_wait_for_interrupt() will return true because it sees
> IRQTF_RUNTHREAD and irq_thread() will call the handler again.
>
> Although I am not sure what should be a right value for number of
> iterations, the initial tests with 10000 iterations resolves this issue
> but increases the interrupt latency.
I did look into errata, spec and kernel change history.
Orignnial commit: d3263bc29706 iommu/amd: Workaround for ERBT1312 (Joerg) never
had continuous loop issue.
Later Commit 3f398bc7762a iommu/AMD: Per-thread IOMMU Interrupt Handling
(Suravee) introduced this continuous loop issue.
Of course we have bunch of follow up patches which tried to improve interrupt
handler path.
Looking into the errata, looks like its with MSI Interrupt generation mode only.
I don' think newer INTCAPX (x2apic mode) has this issue (I will double check
with HW folks).
So IOMMU is configured with x2apic interrupt mode, then I am tempted to break
this continuous loop. Other option is to wait until interrupt bit like GAInt
becomes zero. But in stressed environment this may result in overflow issue.
@Sairaj, Can you try above approach and see if that works?
-Vasant