From: Cheng Yongkang <teel4res@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [BUG] KVM: irqfd: resampler EOI can go to the wrong GSI
Date: Sun, 15 Nov 2026 08:37:41 -0800 [thread overview]
Message-ID: <20261115163741.227220-1-teel4res@gmail.com> (raw)
Hi Paolo, Sean,
I hit two corner cases with resampling irqfds. Both need the VMM to
set up IRQ routing in an unusual way, so they may not be worth fixing.
They come from the same mechanism, so I am putting them in one mail.
On EOI, KVM maps the irqchip pin back to a GSI and signals that GSI's
resamplefd. The reverse map only keeps one GSI per pin, the last one
set up, and it follows the current routing table, not the one in use
when the interrupt was asserted.
1) Routing changed while a level interrupt is pending
GSI 16 asserts I/O APIC pin 16 through a resampling irqfd. Userspace
then swaps the routes of GSI 16 and GSI 17 with KVM_SET_GSI_ROUTING.
On EOI of pin 16, KVM signals GSI 17's resamplefd, and GSI 16's
resamplefd is never signalled.
2) Two GSIs routed to the same pin
GSI 24 and GSI 25 are both routed to I/O APIC pin 9, and each has a
resampling irqfd. When GSI 24 is asserted and the guest EOIs, KVM
signals GSI 25's resamplefd, and GSI 24's is never signalled.
Both were seen on v7.3. In both cases the owner of the silent
resamplefd is never told about the EOI, although api.rst says that
when the irqchip is resampled "the gsi is de-asserted and the user is
notified via kvm_irqfd.resamplefd". I could not find anything in the
KVM_IRQFD or KVM_SET_GSI_ROUTING documentation that forbids either
routing. setup_routing_entry() and the EOI path are unchanged in
next-20261113.
A fix probably needs two parts: reject a resampling irqfd, or a
routing table, that would make the pin resolve to a different GSI, and
keep a routing update from changing a pin that a resampler has
asserted. I have a draft series for that but it has not been built or
tested on the current tree, so I am asking first whether you want
this fixed and in which direction.
Thanks,
Cheng Yongkang
reply other threads:[~2026-11-15 16:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261115163741.227220-1-teel4res@gmail.com \
--to=teel4res@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®