Re: [PATCH] kvm: Check irqchip mode before assign irqfd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 05, 2019 at 04:56:42PM +0800, Peter Xu wrote:
> When assigning kvm irqfd we didn't check the irqchip mode but we allow
> KVM_IRQFD to succeed with all the irqchip modes.  However it does not
> make much sense to create irqfd even without the kernel chips.  Let's
> provide a arch-dependent helper to check whether a specific irqfd is
> allowed by the arch.  At least for x86, it should make sense to check:
> 
> - when irqchip mode is NONE, all irqfds should be disallowed, and,
> 
> - when irqchip mode is SPLIT, irqfds that are with resamplefd should
>   be disallowed.
> 
> For either of the case, previously we'll silently ignore the irq or
> the irq ack event if the irqchip mode is incorrect.  However that can
> cause misterious guest behaviors and it can be hard to triage.  Let's
> fail KVM_IRQFD even earlier to detect these incorrect configurations.
> 
> CC: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> CC: Radim Krčmář <rkrcmar@xxxxxxxxxx>
> CC: Alex Williamson <alex.williamson@xxxxxxxxxx>
> CC: Eduardo Habkost <ehabkost@xxxxxxxxxx>
> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>

Note: haven't tested, but IIUC QEMU's vfio will naturally fall back to
no-irqfd mode (actually virtio seems to also have this but virtio
should not be affected after all) if the KVM_IRQFD ioctl failed so I
feel like this patch could also at least fix the broken guests
reported besides any future fixes from QEMU side on the issue:

https://bugs.launchpad.net/qemu/+bug/1826422

Thanks,

-- 
Peter Xu



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux