From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 6B2A71FF0B2 for ; Tue, 08 Sep 2026 16:22:16 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 8C81F21602; Tue, 08 Sep 2026 16:22:09 +0200 (CEST) Message-ID: Date: Tue, 8 Sep 2026 16:22:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH qemu v2 6/9] savevm-async: free migration vmdesc To: Erik Fastermann , pve-devel@lists.proxmox.com References: <20260907094744.131193-1-e.fastermann@proxmox.com> <20260907094744.131193-7-e.fastermann@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20260907094744.131193-7-e.fastermann@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1788877318580 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.706 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: ELWAO5MUPU3B35FT2VJ3GOWFJJW2GDRL X-Message-ID-Hash: ELWAO5MUPU3B35FT2VJ3GOWFJJW2GDRL X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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"); > +}