Re: [PATCH] KVM: x86: skip userspace IOAPIC EOI exit when Directed EOI is enabled

From: Khushit Shah

Date: Fri Oct 31 2025 - 08:47:42 EST


Hi Sean,

Thanks for the reply.

> On 25 Oct 2025, at 1:51 AM, Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> Make it a quirk instead of a capability. This is definitely a KVM bug, it's just
> unfortunately one that we can't fix without breaking userspace :-/

I don’t think this approach fully addresses the issue.

For example, consider the same Windows guest running with a userspace
I/O APIC that has no EOI registers. The guest will set the Suppress EOI
Broadcast bit because KVM advertises support for it (see
kvm_apic_set_version).

If the quirk is enabled, an interrupt storm will occur.
If the quirk is disabled, userspace will never receive the EOI
notification.

For context, Windows with CG the interrupt in the following order:
1. Interrupt for L2 arrives.
2. L1 APIC EOIs the interrupt.
3. L1 resumes L2 and injects the interrupt.
4. L2 EOIs after servicing.
5. L1 performs the I/O APIC EOI.

Guest is not doing anything theoretically wrong here.

The root issue is that KVM advertises support for EOI broadcast
suppression without knowing whether userspace supports it.

Even my previous proposal doesn’t completely solve this. A potential
way to fix it without breaking userspace would be to let userspace
explicitly indicate whether it supports EOI broadcast suppression
(i.e. whether it implements EOI registers). By default, KVM should
assume userspace does *not* support EOI broadcast suppression,
contrary to the current behavior.

This way, unmodified userspace remains unaffected, and updated
userspace can opt in when it truly supports EOI broadcast suppression.

Am I missing something?

Regards,
Khushit