Skip to content

RFC Support dynamic MSI-X allocation

Jing Liu qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3vfio/pci: detect the support of dynamic MSI-X allocationhw/vfio/pci.c hw/vfio/pci.h hw/vfio/trace-events+15 -012 replies
2/3vfio/pci: enable vector on dynamic MSI-X allocationhw/vfio/pci.c+27 -133 replies
3/3vfio/pci: dynamic MSI-X allocation in interrupt restoringhw/vfio/pci.c+32 -02 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by.

PatchReinette Chatre
1/3
2/3T-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH RFC v1 0/3] Support dynamic MSI-X allocation

Before kernel v6.5, dynamic allocation of MSI-X interrupts was not supported. Qemu therefore when allocating a new interrupt, should first release all previously allocated interrupts (including disable of MSI-X) and re-allocate all interrupts that includes the new one.

The kernel series [1] adds the support of dynamic MSI-X allocation to vfio-pci and uses the existing flag VFIO_IRQ_INFO_NORESIZE to guide user space, that when dynamic MSI-X is supported the flag is cleared.

This series makes the behavior for VFIO PCI devices when dynamic MSI-X allocation is supported. When guest unmasks an interrupt, Qemu can directly allocate an interrupt on host for this and has nothing to do with the previously allocated ones. Therefore, host only allocates interrupts for those unmasked (enabled) interrupts inside guest when dynamic MSI-X allocation is supported by device.

During migration restore, Qemu calls vfio_enable_vectors() to enable MSI-X and interrupts. Since the API causes that a number of irqs set to host kernel are all allocated when enabling MSI-X, to avoid this, one possible way is that Qemu first sets vector 0 to host kernel to enable MSI-X with an invalid fd. After MSI-X enabling, the API can decide which should be allocated via the event fd value. In this way, the interrupts allocation on target would be the same as migration source.

Jing Liu (2):
vfio/pci: enable vector on dynamic MSI-X allocation vfio/pci: dynamic MSI-X allocation in interrupt restoring

Reinette Chatre (1):
vfio/pci: detect the support of dynamic MSI-X allocation

 hw/vfio/pci.c        | 84 +++++++++++++++++++++++++++++++++++++-------
 hw/vfio/pci.h        |  1 +
 hw/vfio/trace-events |  2 ++
 3 files changed, 74 insertions(+), 13 deletions(-)
Signature · 1 line
2.27.0