]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
vfio/migration: Report only stop-copy size in vfio_state_pending_exact()
authorAvihai Horon <avihaih@nvidia.com>
Sun, 20 Oct 2024 13:01:06 +0000 (16:01 +0300)
committerCédric Le Goater <clg@redhat.com>
Wed, 23 Oct 2024 12:46:24 +0000 (14:46 +0200)
vfio_state_pending_exact() is used to update migration core how much
device data is left for the device migration. Currently, the sum of
pre-copy and stop-copy sizes of the VFIO device are reported.

The pre-copy size is obtained via the VFIO_MIG_GET_PRECOPY_INFO ioctl,
which returns the amount of device data available to be transferred
while the device is in the PRE_COPY states.

The stop-copy size is obtained via the VFIO_DEVICE_FEATURE_MIG_DATA_SIZE
ioctl, which returns the total amount of device data left to be
transferred in order to complete the device migration.

According to the above, current implementation is wrong -- it reports
extra overlapping data because pre-copy size is already contained in
stop-copy size. Fix it by reporting only stop-copy size.

Fixes: eda7362af959 ("vfio/migration: Add VFIO migration pre-copy support")
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
hw/vfio/migration.c

index 17199b73aeea02545338b41b180edade2ec2ddcc..992dc3b1025729877d9fbe6ce9a4dbaf4dbd8a07 100644 (file)
@@ -576,9 +576,6 @@ static void vfio_state_pending_exact(void *opaque, uint64_t *must_precopy,
 
     if (vfio_device_state_is_precopy(vbasedev)) {
         vfio_query_precopy_size(migration);
-
-        *must_precopy +=
-            migration->precopy_init_size + migration->precopy_dirty_size;
     }
 
     trace_vfio_state_pending_exact(vbasedev->name, *must_precopy, *can_postcopy,