qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] vfio: relax the vIOMMU check
@ 2025-10-17  8:22 Zhenzhong Duan
  2025-10-17  8:22 ` [PATCH v2 1/8] vfio/iommufd: Add framework code to support getting dirty bitmap before unmap Zhenzhong Duan
                   ` (7 more replies)
  0 siblings, 8 replies; 34+ messages in thread
From: Zhenzhong Duan @ 2025-10-17  8:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: alex.williamson, clg, mst, jasowang, yi.l.liu,
	clement.mathieu--drif, eric.auger, joao.m.martins, avihaih,
	xudong.hao, giovanni.cabiddu, mark.gross, arjan.van.de.ven,
	Zhenzhong Duan

Hi,

This series relax the vIOMMU check and allows live migration with vIOMMU
without VFs using device dirty tracking. It's rewritten based on first 4
patches of [1] from Joao.

Currently what block us is the lack of dirty bitmap query with iommufd
before unmap. By adding that query and handle some corner case we can
relax the check.

Based on vfio-next branch:

patch1-2: add dirty bitmap query with iommufd
patch3:   a renaming cleanup
patch4-5: unmap_bitmap optimization
patch6:   fix large iommu notification triggered unmap_bitmap failure
patch7:   add a blocker if VM memory is really quite large for unmap_bitmap
patch8:   relax vIOMMU check


We tested VM live migration (running QAT workload in VM) with QAT
device passthrough, below matrix configs:
1.Scalable mode vIOMMU + IOMMUFD cdev mode
2.Scalable mode vIOMMU + legacy VFIO mode
3.legacy mode vIOMMU + IOMMUFD cdev mode
4.legacy mode vIOMMU + legacy VFIO mode

[1] https://github.com/jpemartins/qemu/commits/vfio-migration-viommu/

Thanks
Zhenzhong

Changelog:
v2:
- add backend_flag parameter to pass DIRTY_BITMAP_NO_CLEAR (Joao, Cedric)
- add a cleanup patch to rename vfio_dma_unmap_bitmap (Cedric)
- add blocker if unmap_bitmap limit check fail (Liuyi)


Joao Martins (1):
  vfio: Add a backend_flag parameter to
    vfio_contianer_query_dirty_bitmap()

Zhenzhong Duan (7):
  vfio/iommufd: Add framework code to support getting dirty bitmap
    before unmap
  vfio/iommufd: Query dirty bitmap before DMA unmap
  vfio/container-legacy: rename vfio_dma_unmap_bitmap() to
    vfio_legacy_dma_unmap_get_dirty_bitmap()
  vfio/iommufd: Add IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR flag support
  intel_iommu: Fix unmap_bitmap failure with legacy VFIO backend
  vfio/migration: Add migration blocker if VM memory is too large to
    cause unmap_bitmap failure
  vfio/migration: Allow live migration with vIOMMU without VFs using
    device dirty tracking

 include/hw/vfio/vfio-container.h |  8 ++++--
 include/hw/vfio/vfio-device.h    | 10 +++++++
 include/system/iommufd.h         |  2 +-
 backends/iommufd.c               |  5 ++--
 hw/i386/intel_iommu.c            | 42 +++++++++++++++++++++++++++++
 hw/vfio-user/container.c         |  5 ++--
 hw/vfio/container-legacy.c       | 15 ++++++-----
 hw/vfio/container.c              | 20 +++++++-------
 hw/vfio/device.c                 |  6 +++++
 hw/vfio/iommufd.c                | 46 ++++++++++++++++++++++++++++----
 hw/vfio/listener.c               |  6 ++---
 hw/vfio/migration.c              | 43 ++++++++++++++++++++++++++---
 backends/trace-events            |  2 +-
 hw/vfio/trace-events             |  2 +-
 14 files changed, 176 insertions(+), 36 deletions(-)

-- 
2.47.1



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

end of thread, other threads:[~2025-10-21  8:25 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17  8:22 [PATCH v2 0/8] vfio: relax the vIOMMU check Zhenzhong Duan
2025-10-17  8:22 ` [PATCH v2 1/8] vfio/iommufd: Add framework code to support getting dirty bitmap before unmap Zhenzhong Duan
2025-10-20  7:00   ` Cédric Le Goater
2025-10-20 12:44   ` Yi Liu
2025-10-17  8:22 ` [PATCH v2 2/8] vfio/iommufd: Query dirty bitmap before DMA unmap Zhenzhong Duan
2025-10-20  7:00   ` Cédric Le Goater
2025-10-20  8:14   ` Avihai Horon
2025-10-20 10:00     ` Duan, Zhenzhong
2025-10-20 12:45       ` Yi Liu
2025-10-20 13:04         ` Avihai Horon
2025-10-21  3:30           ` Yi Liu
2025-10-20 12:44   ` Yi Liu
2025-10-17  8:22 ` [PATCH v2 3/8] vfio/container-legacy: rename vfio_dma_unmap_bitmap() to vfio_legacy_dma_unmap_get_dirty_bitmap() Zhenzhong Duan
2025-10-20  7:00   ` Cédric Le Goater
2025-10-20 12:45   ` Yi Liu
2025-10-17  8:22 ` [PATCH v2 4/8] vfio: Add a backend_flag parameter to vfio_contianer_query_dirty_bitmap() Zhenzhong Duan
2025-10-20  7:01   ` Cédric Le Goater
2025-10-20 12:44   ` Yi Liu
2025-10-17  8:22 ` [PATCH v2 5/8] vfio/iommufd: Add IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR flag support Zhenzhong Duan
2025-10-20  7:01   ` Cédric Le Goater
2025-10-20 12:45   ` Yi Liu
2025-10-17  8:22 ` [PATCH v2 6/8] intel_iommu: Fix unmap_bitmap failure with legacy VFIO backend Zhenzhong Duan
2025-10-20  7:06   ` Cédric Le Goater
2025-10-20  7:38   ` Yi Liu
2025-10-20  8:03     ` Duan, Zhenzhong
2025-10-20  8:37       ` Yi Liu
2025-10-20 10:01         ` Duan, Zhenzhong
2025-10-17  8:22 ` [PATCH v2 7/8] vfio/migration: Add migration blocker if VM memory is too large to cause unmap_bitmap failure Zhenzhong Duan
2025-10-20  8:39   ` Cédric Le Goater
2025-10-20 10:07     ` Duan, Zhenzhong
2025-10-20 12:44   ` Yi Liu
2025-10-21  8:25     ` Duan, Zhenzhong
2025-10-17  8:22 ` [PATCH v2 8/8] vfio/migration: Allow live migration with vIOMMU without VFs using device dirty tracking Zhenzhong Duan
2025-10-20 12:46   ` Yi Liu

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