public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH qemu v3 0/4] savevm-async: fix stuck paused vm after snapshot
@ 2026-09-14 10:46 Erik Fastermann
  2026-09-14 10:46 ` [PATCH qemu v3 1/4] savevm-async: free migration vmdesc Erik Fastermann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Erik Fastermann @ 2026-09-14 10:46 UTC (permalink / raw)
  To: pve-devel; +Cc: Erik Fastermann

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

Changes since v2 (Thanks @Fiona for the feedback):
* dropped patches 1-5, which were already applied [3]
* guard migration_state_cleanup() in qmp_savevm_start() failure case
* added comment when attempting to set RUN_STATE_SAVE_VM

Future work:

* Fiona mentioned that similar bugs to the ones I found also exist in
  upstream QEMU. I will look into submitting patches.

* 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. I added a Bugzilla entry
  [4].

* 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 that has to be checked in more detail. I added a Bugzilla entry
  [5].

Note that patch 4 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/
[3] https://lore.proxmox.com/pve-devel/20260907094744.131193-1-e.fastermann@proxmox.com/
[4] https://bugzilla.proxmox.com/show_bug.cgi?id=8037
[5] https://bugzilla.proxmox.com/show_bug.cgi?id=8038


Erik Fastermann (4):
  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 | 116 ++++++++++++++----
 ...add-optional-buffer-size-to-QEMUFile.patch |   6 +-
 ...se-migration-blocker-check-for-snaps.patch |   4 +-
 3 files changed, 94 insertions(+), 32 deletions(-)

-- 
2.47.3




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

end of thread, other threads:[~2026-09-14 10:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 10:46 [PATCH qemu v3 0/4] savevm-async: fix stuck paused vm after snapshot Erik Fastermann
2026-09-14 10:46 ` [PATCH qemu v3 1/4] savevm-async: free migration vmdesc Erik Fastermann
2026-09-14 10:46 ` [PATCH qemu v3 2/4] savevm-async: release resources on start failure path Erik Fastermann
2026-09-14 10:46 ` [PATCH qemu v3 3/4] savevm-async: include reason when file open fails Erik Fastermann
2026-09-14 10:46 ` [PATCH qemu v3 4/4] savevm-async: restore run state from before snapshot Erik Fastermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal