Hello,
On 8/26/26 00:49, Dongli Zhang wrote:
When the VFIO driver is vfio-pci, vfio_migration_query_flags() returns
-ENOTTY, so savevm_vfio_handlers is not registered or involved.
I was confused with this sentence. Here is a proposal :
When the kernel VFIO driver does not support migration (e.g. vfio-pci),
vfio_migration_query_flags() returns -ENOTTY and savevm_vfio_handlers
is never registered.
However, VFIO drivers that support live migration, such as mlx5_vfio_pci,
do support vfio_migration_query_flags(). In that case, savevm_vfio_handlers
is registered and may be used to save and load the VFIO migration stream.
This is expected for VFIO live migration, but not for cpr-exec or
cpr-transfer.
ok
Even after migration converges with
"migrate_set_parameter downtime-limit 1000000", the target still reports
the following error:
This is unclear to me. Can you rephrase ?
failed (load of migration failed: Invalid argument: Failed to load vmstate
version_id: 1, ret: -22)
Skip savevm_vfio_handlers for cpr-exec and cpr-transfer.
Signed-off-by: Dongli Zhang <[email protected]>
---
hw/vfio/migration.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 73c49d8c24..49aeaad516 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -723,6 +723,13 @@ static bool vfio_is_active_iterate(void *opaque)
return vfio_device_state_is_precopy(vbasedev);
}
+static bool vfio_is_active(void *opaque)
+{
+ MigMode mode = migrate_mode();
+
+ return mode != MIG_MODE_CPR_EXEC && mode != MIG_MODE_CPR_TRANSFER;
Let's introduce a new cpr helper :
static inline bool cpr_is_active(void *opaque)
{
MigMode mode = migrate_mode();
return mode == MIG_MODE_CPR_EXEC || mode == MIG_MODE_CPR_TRANSFER;
}
cpr_incoming_needed() becomes :
bool cpr_incoming_needed(void *opaque)
{
return cpr_is_active(opaque);
}
migrate_ram_is_ignored() could be adjusted too :
bool migrate_ram_is_ignored(RAMBlock *block)
{
- MigMode mode = migrate_mode();
return !qemu_ram_is_migratable(block) ||
- mode == MIG_MODE_CPR_TRANSFER ||
- mode == MIG_MODE_CPR_EXEC ||
+ cpr_is_active() ||
(migrate_ignore_shared() && qemu_ram_is_shared(block)
&& qemu_ram_is_named_file(block));
}
+}
+
/*
* Note about migration rate limiting: VFIO migration buffer size is currently
* limited to 1MB, so there is no need to check if migration rate exceeded (as
@@ -951,6 +958,7 @@ static const SaveVMHandlers savevm_vfio_handlers = {
.save_cleanup = vfio_save_cleanup,
.save_query_pending = vfio_state_pending,
.is_active_iterate = vfio_is_active_iterate,
+ .is_active = vfio_is_active,
and
.is_active = cpr_is_active,
Thanks,
C.
.save_live_iterate = vfio_save_iterate,
.save_complete = vfio_save_complete_precopy,
.save_state = vfio_save_state,