all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Erik Fastermann <e.fastermann@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Erik Fastermann <e.fastermann@proxmox.com>
Subject: [PATCH qemu v2 0/9] savevm-async: fix stuck paused vm after snapshot
Date: Mon,  7 Sep 2026 11:47:34 +0200	[thread overview]
Message-ID: <20260907094744.131193-1-e.fastermann@proxmox.com> (raw)

Snapshotting a paused VM left it in finish-migrate, where it stayed
until the VM was restarted. Fix this by storing the run state instead
and put it back, similar to migration_iteration_finish().

While working on that, I noticed some memory leaks and other issues,
which I found by using sanitizer tools like ASAN and reading the code
and docs.

Changes since the RFC:
* store the run state via runstate_get() and restore it instead of
  skipping the transition into finish-migrate (Thanks @Fiona)
* refuse a snapshot while an incoming migration is pending, which
  migrate_prepare() already does, otherwise the restore aborts
* fixed multiple memory leaks
* fixed multiple discarded error messages
* removed raw uses of allocators
* folded the changes into the relevant debian/patches

Future work:

* Once SAVE_STATE_ERROR is set, no new snapshot can be started and
  savevm-start fails with "VM snapshot already started" until the VM is
  restarted. Resetting that state looks difficult and could introduce
  new bugs. A couple of people ran into this before, see [0] and [1].
  It would definitely be nicer if a single failed snapshot did not
  block further snapshots until a VM restart.

* TSAN flags a data race on snap_state.bs_pos. Probably simply fixed
  by using atomics. There might be some other issues in savevm-async,
  but I have to check this in more detail.

Note that patch 9 touches the same lines as [2].

[0] https://forum.proxmox.com/threads/snapshot-creation-issue.176090/
[1] https://forum.proxmox.com/threads/snapshot-fails-to-cleanup-and-prevents-future-snapshots.144757/
[2] https://lore.proxmox.com/all/20260714142629.277917-2-f.ebner@proxmox.com/


Erik Fastermann (9):
  d/patches: normalize header of pbs-restore no-cache patch
  pbs-restore: keep callback data on the stack
  migration/qemu-file: allocate buffer with g_malloc
  migration/pbs-state: check allocation of incoming state buffer
  savevm-async: drop QIOChannel reference
  savevm-async: free migration vmdesc
  savevm-async: release resources on start failure path
  savevm-async: include reason when file open fails
  savevm-async: restore run state from before snapshot

 ...async-for-background-state-snapshots.patch | 111 +++++++++++++-----
 ...add-optional-buffer-size-to-QEMUFile.patch |  29 ++---
 ...estore-new-command-to-restore-from-p.patch |  16 +--
 ...igrate-dirty-bitmap-state-via-savevm.patch |  25 ++--
 ...se-migration-blocker-check-for-snaps.patch |   4 +-
 ...no-cache-flag-to-skip-host-page-cach.patch |   7 +-
 6 files changed, 129 insertions(+), 63 deletions(-)

--
2.47.3




             reply	other threads:[~2026-09-07  9:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  9:47 Erik Fastermann [this message]
2026-09-07  9:47 ` [PATCH qemu v2 1/9] d/patches: normalize header of pbs-restore no-cache patch Erik Fastermann
2026-09-07  9:47 ` [PATCH qemu v2 2/9] pbs-restore: keep callback data on the stack Erik Fastermann
2026-09-07  9:47 ` [PATCH qemu v2 3/9] migration/qemu-file: allocate buffer with g_malloc Erik Fastermann
2026-09-07  9:47 ` [PATCH qemu v2 4/9] migration/pbs-state: check allocation of incoming state buffer Erik Fastermann
2026-09-07  9:47 ` [PATCH qemu v2 5/9] savevm-async: drop QIOChannel reference Erik Fastermann
2026-09-08 14:22   ` Fiona Ebner
2026-09-07  9:47 ` [PATCH qemu v2 6/9] savevm-async: free migration vmdesc Erik Fastermann
2026-09-08 14:22   ` Fiona Ebner
2026-09-07  9:47 ` [PATCH qemu v2 7/9] savevm-async: release resources on start failure path Erik Fastermann
2026-09-07  9:47 ` [PATCH qemu v2 8/9] savevm-async: include reason when file open fails Erik Fastermann
2026-09-07  9:47 ` [PATCH qemu v2 9/9] savevm-async: restore run state from before snapshot Erik Fastermann
2026-09-08 14:22   ` Fiona Ebner
2026-09-08 14:21 ` partially-applied: [PATCH qemu v2 0/9] savevm-async: fix stuck paused vm after snapshot Fiona Ebner

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=20260907094744.131193-1-e.fastermann@proxmox.com \
    --to=e.fastermann@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal