Re: [PATCH v5 07/21] KVM: selftests: Verify IRQ bypass works in IRQ test
From: Sean Christopherson
Date: Thu Jun 04 2026 - 15:25:35 EST
On Thu, Jun 04, 2026, Sean Christopherson wrote:
> The shortlog is at best misleading. There are zero guarantees that IRQ bypass
> is supported and enabled.
>
> On Thu, Jun 04, 2026, Josh Hilke wrote:
> > From: David Matlack <dmatlack@xxxxxxxxxx>
> >
> > Trigger interrupts from a VFIO device instead of emulating interrupts
>
> It's not emulating, it's synthesizing. Emulating implies there's a device of
> some kind that the test is mimicking.
>
> > using KVM eventfds. This verifies that guests receive interrupts via IRQ
> > bypass.
>
> No, it verifies that delivery of a VFIO MSI-X through VFIO=>KVM works, and *may*
> verify IRQ bypass. And all of that very much relies on the eventfds to be in
> place.
>
> > @@ -119,7 +160,17 @@ int main(int argc, char **argv)
> > vm = vm_create_with_vcpus(nr_vcpus, guest_code, vcpus);
> > vm_install_exception_handler(vm, vector, guest_irq_handler);
> >
> > - eventfd = kvm_new_eventfd();
> > + if (device_bdf) {
> > + iommu = iommu_init(default_iommu_mode);
>
> This needs:
>
> diff --git tools/testing/selftests/kvm/irq_test.c tools/testing/selftests/kvm/irq_test.c
> index cf4568718cee..2e7e100d4815 100644
> --- tools/testing/selftests/kvm/irq_test.c
> +++ tools/testing/selftests/kvm/irq_test.c
> @@ -235,6 +235,8 @@ int main(int argc, char **argv)
> }
>
> if (device_bdf) {
> + __open_path_or_exit("/dev/iommu", O_RDONLY, "Is IOMMUFD available?");
> +
> iommu = iommu_init(default_iommu_mode);
*sigh*
<rant>
This is beyond frustating. I have A PERFECTLY FUNCTIONAL KERNEL, but this test
VERY SUBTLY "defaults" to IOMMUFD. ARGH!!!!!
And to make matters worse, if I enable CONFIG_IOMMUFD, but don't enable
CONFIG_VFIO_DEVICE_CDEV, then AFAICT, I can't do a damn thing with VFIO. I dunno,
I can't get IOMMUFD to work even with that.
Worst of all, the changelog SAYS BLOODY NOTHING ABOUT THIS.
</rant>
Please, for the love of all that is holy, when sending stuff upstream, think about
how your code will impact people and environments outside the world of Google.
And more importantly, *test* your code beyond Google's highly curated environment.