[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/34] vfio/migration: Refactor vfio_save_state() return value
From: |
peterx |
Subject: |
[PULL 02/34] vfio/migration: Refactor vfio_save_state() return value |
Date: |
Mon, 11 Mar 2024 17:58:53 -0400 |
From: Avihai Horon <avihaih@nvidia.com>
Currently, vfio_save_state() returns 1 regardless of whether there is
more data to send or not. This was done to prevent a fast changing VFIO
device from potentially blocking other devices from sending their data,
as qemu_savevm_state_iterate() serialized devices.
Now that qemu_savevm_state_iterate() no longer serializes devices, there
is no need for that.
Refactor vfio_save_state() to return 0 if more data is available and 1
if no more data is available.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: 20240304105339.20713-3-avihaih@nvidia.com">https://lore.kernel.org/r/20240304105339.20713-3-avihaih@nvidia.com
Signed-off-by: Peter Xu <peterx@redhat.com>
---
hw/vfio/migration.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 50140eda87..0af783a589 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -529,11 +529,7 @@ static int vfio_save_iterate(QEMUFile *f, void *opaque)
trace_vfio_save_iterate(vbasedev->name, migration->precopy_init_size,
migration->precopy_dirty_size);
- /*
- * A VFIO device's pre-copy dirty_bytes is not guaranteed to reach zero.
- * Return 1 so following handlers will not be potentially blocked.
- */
- return 1;
+ return !migration->precopy_init_size && !migration->precopy_dirty_size;
}
static int vfio_save_complete_precopy(QEMUFile *f, void *opaque)
--
2.44.0
- [PULL 00/34] Migration 20240311 patches, peterx, 2024/03/11
- [PULL 01/34] migration: Don't serialize devices in qemu_savevm_state_iterate(), peterx, 2024/03/11
- [PULL 02/34] vfio/migration: Refactor vfio_save_state() return value,
peterx <=
- [PULL 03/34] vfio/migration: Add a note about migration rate limiting, peterx, 2024/03/11
- [PULL 04/34] migration/ram: add additional check, peterx, 2024/03/11
- [PULL 05/34] migration: Report error when shutdown fails, peterx, 2024/03/11
- [PULL 06/34] migration: Remove SaveStateHandler and LoadStateHandler typedefs, peterx, 2024/03/11
- [PULL 07/34] migration: Add documentation for SaveVMHandlers, peterx, 2024/03/11
- [PULL 08/34] migration: Do not call PRECOPY_NOTIFY_SETUP notifiers in case of error, peterx, 2024/03/11
- [PULL 09/34] migration/multifd: Don't fsync when closing QIOChannelFile, peterx, 2024/03/11
- [PULL 10/34] migration/rdma: Fix a memory issue for migration, peterx, 2024/03/11
- [PULL 11/34] physmem: Rename addr1 to more informative mr_addr in flatview_read/write() and similar, peterx, 2024/03/11
- [PULL 13/34] physmem: Factor out body of flatview_read/write_continue() loop, peterx, 2024/03/11