qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC v1 0/3] Support dynamic MSI-X allocation
@ 2023-07-27  7:24 Jing Liu
  2023-07-27  7:24 ` [PATCH RFC v1 1/3] vfio/pci: detect the support of " Jing Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Jing Liu @ 2023-07-27  7:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: alex.williamson, clg, pbonzini, kevin.tian, reinette.chatre,
	jing2.liu

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(-)

-- 
2.27.0



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-08-01  7:47 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-27  7:24 [PATCH RFC v1 0/3] Support dynamic MSI-X allocation Jing Liu
2023-07-27  7:24 ` [PATCH RFC v1 1/3] vfio/pci: detect the support of " Jing Liu
2023-07-27 16:58   ` Cédric Le Goater
2023-07-28  8:34     ` Liu, Jing2
2023-07-28  8:43       ` Cédric Le Goater
2023-07-31  3:57         ` Liu, Jing2
2023-07-31  7:25           ` Cédric Le Goater
2023-07-31  8:40             ` Liu, Jing2
2023-07-27 17:24   ` Alex Williamson
2023-07-28  8:09     ` Liu, Jing2
2023-07-28  8:27       ` Cédric Le Goater
2023-07-28 15:41         ` Alex Williamson
2023-07-28 15:51           ` Cédric Le Goater
2023-07-31  3:51           ` Liu, Jing2
2023-07-27  7:24 ` [PATCH RFC v1 2/3] vfio/pci: enable vector on " Jing Liu
2023-07-27 17:07   ` Cédric Le Goater
2023-07-27 17:25   ` Alex Williamson
2023-07-31  7:17     ` Liu, Jing2
2023-07-27  7:24 ` [PATCH RFC v1 3/3] vfio/pci: dynamic MSI-X allocation in interrupt restoring Jing Liu
2023-07-27 17:24   ` Alex Williamson
2023-08-01  7:45     ` Liu, Jing2

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).