]> git.ipfire.org Git - thirdparty/qemu.git/commit
migration: Introduce POSTCOPY_DEVICE state
authorJuraj Marcin <jmarcin@redhat.com>
Mon, 3 Nov 2025 18:32:57 +0000 (19:32 +0100)
committerPeter Xu <peterx@redhat.com>
Mon, 3 Nov 2025 21:04:10 +0000 (16:04 -0500)
commit7b842fe354c63feaffc63c850b28c3610a0c90d2
tree8a26b2d3b703fc9d066f1c54555d1f05b9ccf543
parent0680dd185b3265a948e1863cdc52c65f72b994d9
migration: Introduce POSTCOPY_DEVICE state

Currently, when postcopy starts, the source VM starts switchover and
sends a package containing the state of all non-postcopiable devices.
When the destination loads this package, the switchover is complete and
the destination VM starts. However, if the device state load fails or
the destination side crashes, the source side is already in
POSTCOPY_ACTIVE state and cannot be recovered, even when it has the most
up-to-date machine state as the destination has not yet started.

This patch introduces a new POSTCOPY_DEVICE state which is active while
the destination machine is loading the device state, is not yet running,
and the source side can be resumed in case of a migration failure.
Return-path is required for this state to function, otherwise it will be
skipped in favor of POSTCOPY_ACTIVE.

To transition from POSTCOPY_DEVICE to POSTCOPY_ACTIVE, the source
side uses a PONG message that is a response to a PING message processed
just before the POSTCOPY_RUN command that starts the destination VM.
Thus, this feature is effective even if the destination side does not
yet support this new state.

Signed-off-by: Juraj Marcin <jmarcin@redhat.com>
Link: https://lore.kernel.org/r/20251103183301.3840862-9-jmarcin@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
migration/migration.c
migration/migration.h
migration/postcopy-ram.c
migration/savevm.c
migration/savevm.h
migration/trace-events
qapi/migration.json
tests/qemu-iotests/194
tests/qtest/migration/precopy-tests.c