Commit 32603ba372 for qemu.org
commit 32603ba372266f9a32cd56f4c5d7137ea00fdf15
Author: Lukas Straub <lukasstraub2@web.de>
Date: Mon Mar 2 12:45:25 2026 +0100
colo: Fix crash during device vmstate load
With colo we load device vmstate during each checkpoint, on top of
a vm that was already running. Some devices expect a reset before
loading vmstate on such a previously running vm.
This fixes a crash when using COLO with Q35 machine.
The reset adds 10-20ms overhead to the checkpointing proces in my
testing.
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Link: https://lore.kernel.org/qemu-devel/20260302-colo_unit_test_multifd-v11-10-d653fb3b1d80@web.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
diff --git a/migration/colo.c b/migration/colo.c
index 96102c9d0f..dc7cfa81ef 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -729,6 +729,12 @@ static void colo_incoming_process_checkpoint(MigrationIncomingState *mis,
bql_lock();
vmstate_loading = true;
+ /*
+ * With colo we load device vmstate during each checkpoint, on top of
+ * a vm that was already running. Some devices expect a reset before
+ * loading vmstate on such a previously running vm.
+ */
+ qemu_system_reset(SHUTDOWN_CAUSE_SNAPSHOT_LOAD);
colo_flush_ram_cache();
ret = qemu_load_device_state(fb, errp);
if (ret < 0) {