Hi Joao,

>-----Original Message-----
>From: Joao Martins <joao.m.mart...@oracle.com>
>Subject: Re: [PATCH] vfio: Allow live migration with VFIO devices which use
>iommu dirty tracking
>
>On 08/08/2025 05:09, Zhenzhong Duan wrote:
>> Commit e46883204c38 ("vfio/migration: Block migration with vIOMMU")
>> introduces a migration blocker when vIOMMU is enabled, because we need
>> to calculate the IOVA ranges for device dirty tracking. But this is
>> unnecessary for iommu dirty tracking.
>>
>> Limit the vfio_viommu_preset() check to those devices which use device
>> dirty tracking. This allows live migration with VFIO devices which use
>> iommu dirty tracking.
>>
>
>The subject of the patch is a little misleading because LM is already allowed
>with VFIO devices and IOMMU dirty tracking. Yet the patch is about VMs with
>vIOMMU that get this blocked due to VF device dirty tracking. I suggest
>instead:
>
>vfio/migration: Allow live migration with vIOMMU without VFs using device
>dirty
>tracking
>
>... It's longer but I think it rings a bit more honest on what we are doing :)

Sure, will update subject.

>
>> Introduce a helper vfio_device_dirty_pages_disabled() to facilicate it.
>>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com>
>
>This is unfortunately not enough to unblock vIOMMU migration with
>IOMMUs.
>Have a look at the first four patches of this series:
>
>       https://github.com/jpemartins/qemu/commits/vfio-migration-viommu/
>
>These 4 are meant do this (41d778dda00^..d27e5a5db5f4). Feel free to pick
>them
>up. I hope to take care of the rest of the series; though I have been heavily
>preempted internally that I hadn't had the time to clear this series but I 
>think
>it's finally coming to an end

Thanks, that help much, we have internal team in intel needing this relax with
vIOMMU enabled.
I'll pick your first 4 patches with mine and send an update.

>
>The gist of these first four patches is essentially that we need to query the
>dirty bitmap before unmap, and we have an extra optimization that let us
>simply
>read the Dirty bit (without clearing it) and so the query is much faster as you
>don't have a TLB flush.

I see the legacy backend use dma_unmap_bitmap to do the same thing in one 
ioctl(),
will you add that support in kernel?
IIUC, between query and unmap, there is a window in which we will miss dirty 
pages
if a buggy guest still raises DMA.

>
>I think you can replace the fourth patch with yours as yours it's much
>cleaner/simpler.

OK, will do.

Thanks
Zhenzhong

>
>Mine was specific to IOMMUFD given that perpectual dirty tracking (type1)
>required forcefully enabling migration to let it go through. But I think it's 
>ok
>for both to work
>
>       Joao

Reply via email to