All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] runstate: don't move to prelaunch on reset if postmigrate
@ 2026-06-27 12:22 Vladimir Sementsov-Ogievskiy
  2026-06-29 14:24 ` Peter Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2026-06-27 12:22 UTC (permalink / raw)
  To: pbonzini; +Cc: peterx, farosas, qemu-devel, vsementsov

As comment says, runstate can change in parallel. We check
for FINISH_MIGRATE, but actually migration may proceed up
to POSTMIGRATE.

We should check for POSTMIGRATE as well, otherwise there is
a race, if reset is in progress, and source may finish migration
in PRELAUNCH state, which is unexpected for user.

Seems correct to handle POSTMIGRATE the same way as FINISH_MIGRATE
in this logic, as POSTMIGRATE is continuation for FINISH_MIGRATE.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 system/runstate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/system/runstate.c b/system/runstate.c
index 18e585be47..cee1aeae05 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -921,7 +921,8 @@ static bool main_loop_should_exit(int *status)
          */
         if (!runstate_check(RUN_STATE_RUNNING) &&
                 !runstate_check(RUN_STATE_INMIGRATE) &&
-                !runstate_check(RUN_STATE_FINISH_MIGRATE)) {
+                !runstate_check(RUN_STATE_FINISH_MIGRATE) &&
+                !runstate_check(RUN_STATE_POSTMIGRATE)) {
             runstate_set(RUN_STATE_PRELAUNCH);
         }
     }
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-29 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-27 12:22 [PATCH] runstate: don't move to prelaunch on reset if postmigrate Vladimir Sementsov-Ogievskiy
2026-06-29 14:24 ` Peter Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.