Skip to content

Commit

Permalink
vfio/migration: Refactor vfio_save_state() return value
Browse files Browse the repository at this point in the history
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: https://lore.kernel.org/r/20240304105339.20713-3-avihaih@nvidia.com
Signed-off-by: Peter Xu <peterx@redhat.com>
  • Loading branch information
avihai1122 authored and xzpeter committed Mar 11, 2024
1 parent 4e1871c commit 3f6ed59
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions hw/vfio/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3f6ed59

Please sign in to comment.