All of lore.kernel.org
 help / color / mirror / Atom feed
From: Erik Fastermann <e.fastermann@proxmox.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-stable@nongnu.org,
	Erik Fastermann <e.fastermann@proxmox.com>
Subject: [PATCH] runstate: do not force prelaunch on reset during save-vm
Date: Wed, 16 Sep 2026 12:12:15 +0200	[thread overview]
Message-ID: <20260916101215.98436-1-e.fastermann@proxmox.com> (raw)

A reset processed while the VM sits in 'save-vm' aborts QEMU:

    invalid runstate transition: 'save-vm' -> 'prelaunch'

The window is reachable over QMP. dump-guest-memory with detach=true
stops the VM with vm_stop(RUN_STATE_SAVE_VM) in dump_init() and then
returns once dump_thread has been spawned, so the main loop keeps
running with the VM in 'save-vm' for the whole duration of the dump.
A system_reset in that window kills the guest, as
main_loop_should_exit() forces the run state to 'prelaunch'.

'save-vm' needs the same treatment as 'finish-migrate' in commit
1bd71dce4b ("runstate: ignore exit request in finish migrate state").
The reset cannot be applied to a run state whose only exits are back to
'running' or 'suspended', so leave it alone: dump_cleanup() ends it
with vm_start() once the dump thread is done.

Signed-off-by: Erik Fastermann <e.fastermann@proxmox.com>
---
 system/runstate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/system/runstate.c b/system/runstate.c
index d3e64d2b62..1d65a4d444 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -1075,7 +1075,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_SAVE_VM)) {
             runstate_set(RUN_STATE_PRELAUNCH);
         }
     }
-- 
2.47.3



             reply	other threads:[~2026-09-16 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 10:12 Erik Fastermann [this message]
2026-10-01  8:07 ` [PATCH] runstate: do not force prelaunch on reset during save-vm Erik Fastermann
2026-10-13 11:23 ` Erik Fastermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260916101215.98436-1-e.fastermann@proxmox.com \
    --to=e.fastermann@proxmox.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.