public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Erik Fastermann <e.fastermann@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH qemu v2 6/9] savevm-async: free migration vmdesc
Date: Tue, 8 Sep 2026 16:22:05 +0200	[thread overview]
Message-ID: <e8dad3cd-2423-4aa0-bd05-88ed17b98aed@proxmox.com> (raw)
In-Reply-To: <20260907094744.131193-7-e.fastermann@proxmox.com>

Am 07.09.26 um 11:48 AM schrieb Erik Fastermann:
>  diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> @@ -149,10 +150,10 @@ index 0222d5ea6e..90d62d5723 100644
>   ), gnutls, zlib)
>  diff --git a/migration/savevm-async.c b/migration/savevm-async.c
>  new file mode 100644
> -index 0000000000..cab08643ad
> +index 0000000000..4f44c2f12d
>  --- /dev/null
>  +++ b/migration/savevm-async.c
> -@@ -0,0 +1,600 @@
> +@@ -0,0 +1,608 @@
>  +#include "qemu/osdep.h"
>  +#include "migration/channel-savevm-async.h"
>  +#include "migration/migration.h"
> @@ -261,6 +262,15 @@ index 0000000000..cab08643ad
>  +    return info;
>  +}
>  +
> ++static void migration_state_cleanup(MigrationState *ms, bool failed)
> ++{
> ++    migrate_set_state(&ms->state, MIGRATION_STATUS_SETUP,
> ++        failed ? MIGRATION_STATUS_FAILED : MIGRATION_STATUS_COMPLETED);
> ++    ms->to_dst_file = NULL;
> ++    /* see migration_cleanup_json_writer */
> ++    g_clear_pointer(&ms->vmdesc, json_writer_free);
> ++}
> ++
>  +static int save_snapshot_cleanup(void)
>  +{
>  +    int ret = 0;
> @@ -359,10 +369,7 @@ index 0000000000..cab08643ad
>  +    DPRINTF("timing: process_savevm_finalize (state saving) took %ld ms\n",
>  +        qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - start_time);
>  +
> -+    /* clear migration state */
> -+    migrate_set_state(&ms->state, MIGRATION_STATUS_SETUP,
> -+        ret || aborted ? MIGRATION_STATUS_FAILED : MIGRATION_STATUS_COMPLETED);
> -+    ms->to_dst_file = NULL;
> ++    migration_state_cleanup(ms, ret || aborted);
>  +
>  +    /*
>  +     * Same as in migration_iteration_finish(): saving RAM might've turned on CPU throttling for
> @@ -618,6 +625,8 @@ index 0000000000..cab08643ad
>  +    return;
>  +
>  +fail:
> ++    migration_state_cleanup(ms, true);

While fine in practice, because the implementations handle it, it reads
wrong to have the migrate_set_state() and g_clear_pointer(&ms->vmdesc,
...) calls when we fail before having a successful migrate_init(). Can
we guard this call based on whether we already have a successful init?

> ++
>  +    savevm_cleanup_iothread();
>  +    save_snapshot_error("setup failed");
>  +}




  reply	other threads:[~2026-09-08 14:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  9:47 [PATCH qemu v2 0/9] savevm-async: fix stuck paused vm after snapshot Erik Fastermann
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 [this message]
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=e8dad3cd-2423-4aa0-bd05-88ed17b98aed@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=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 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