On 2026-10-02 13:02, Denis V. Lunev wrote: > From: Denis V. Lunev <[email protected]> > > Commit 7b842fe354c ("migration: Introduce POSTCOPY_DEVICE state") keeps > the source in POSTCOPY_DEVICE until the destination answers the > QEMU_VM_PING_PACKAGED_LOADED ping packaged right before > CMD_POSTCOPY_RUN. The destination answers it from the generic > MIG_CMD_PING handler as soon as it reads it, so the source's > postcopy-active means the device state is loaded, not that the > destination has left RUN_STATE_INMIGRATE. Management acting on the > destination once the source reports postcopy-active can still race > with loadvm_postcopy_handle_run_bh(). > > Record the ping in the MIG_CMD_PING handler instead of answering it, > and send the pong at the end of the run BH, after the run state change. > > The wire format is unchanged: the pong only arrives later, and an > older destination keeps answering at once, so mixed versions > interoperate. The cost is that the source stays in POSTCOPY_DEVICE for > the duration of the run BH, including block layer activation when the > destination autostarts. > > Suggested-by: Peter Xu <[email protected]> > Signed-off-by: Denis V. Lunev <[email protected]> > Cc: Peter Xu <[email protected]> > Cc: Fabiano Rosas <[email protected]> > Cc: Juraj Marcin <[email protected]> > --- > migration/migration.c | 1 + > migration/migration.h | 2 ++ > migration/savevm.c | 8 ++++++++ > 3 files changed, 11 insertions(+)
I have tested the patch and it does fix the issue where source becomes unrecoverable if destination dies in CPU sync, that I tried to fix. Reviewed-by: Juraj Marcin <[email protected]> Tested-by: Juraj Marcin <[email protected]>
