]> git.ipfire.org Git - thirdparty/qemu.git/commit
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)
committerMichael Tokarev <mjt@tls.msk.ru>
Sun, 10 Nov 2024 08:09:26 +0000 (11:09 +0300)
commitf5a27139422b6c31ba6f8b7c8f23934f295d692e
treef0d73679041d02ff87e1828849877f7e01e30222
parent05f7fd01e2a91104f7c79515f1f7f3a563dcdbe6
vfio/migration: Report only stop-copy size in vfio_state_pending_exact()

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>
(cherry picked from commit 3b5948f808e3b99aedfa0aff45cffbe8b7ec07ed)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/vfio/migration.c