From: Fabiano Rosas <farosas@suse.de>
To: Peter Xu <peterx@redhat.com>, qemu-devel@nongnu.org
Cc: peterx@redhat.com, Lukas Straub <lukasstraub2@web.de>,
Prasad Pandit <ppandit@redhat.com>,
Juraj Marcin <jmarcin@redhat.com>
Subject: Re: [PATCH v2 16/24] migration: Split qemu_savevm_state_complete_precopy_non_iterable()
Date: Wed, 28 Jan 2026 12:22:44 -0300 [thread overview]
Message-ID: <875x8lg3sr.fsf@suse.de> (raw)
In-Reply-To: <20260127185254.3954634-17-peterx@redhat.com>
Peter Xu <peterx@redhat.com> writes:
> Split the function, making itself to be the helper to dump all non-iterable
> device states (early_vmsd excluded). Move the precopy end logic out to the
> two callers that need it.
>
> With it, we can remove the in_postcopy parameter. Meanwhile, renaming the
> function to be qemu_savevm_state_non_iterable(): we don't need the keyword
> "complete" because non-iterable doesn't iterate anyway, and we don't need
> precopy because we moved precopy specialties out.
>
> NOTE: this patch introduced one new migrate_get_current() user; will be
> removed in follow up patch.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> migration/savevm.h | 3 +--
> migration/migration.c | 7 +++++--
> migration/savevm.c | 12 ++++--------
> 3 files changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/migration/savevm.h b/migration/savevm.h
> index f957f851ef..57b96133d5 100644
> --- a/migration/savevm.h
> +++ b/migration/savevm.h
> @@ -74,8 +74,7 @@ int qemu_loadvm_state_main(QEMUFile *f, MigrationIncomingState *mis,
> Error **errp);
> int qemu_load_device_state(QEMUFile *f, Error **errp);
> int qemu_loadvm_approve_switchover(void);
> -int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
> - bool in_postcopy);
> +int qemu_savevm_state_non_iterable(QEMUFile *f);
>
> bool qemu_loadvm_load_state_buffer(const char *idstr, uint32_t instance_id,
> char *buf, size_t len, Error **errp);
> diff --git a/migration/migration.c b/migration/migration.c
> index e3f1cc7b2e..c6e54d2a3f 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2545,7 +2545,7 @@ static int postcopy_start(MigrationState *ms, Error **errp)
> */
> qemu_savevm_send_postcopy_listen(fb);
>
> - ret = qemu_savevm_state_complete_precopy_non_iterable(fb, true);
> + ret = qemu_savevm_state_non_iterable(fb);
> if (ret) {
> error_setg(errp, "Postcopy save non-iterable device states failed");
> goto fail_closefb;
> @@ -3678,9 +3678,12 @@ static void *bg_migration_thread(void *opaque)
> goto fail;
> }
>
> - if (qemu_savevm_state_complete_precopy_non_iterable(fb, false)) {
> + if (qemu_savevm_state_non_iterable(fb)) {
> goto fail;
> }
> +
> + qemu_savevm_state_end_precopy(s, fb);
> +
> /*
> * Since we are going to get non-iterable state data directly
> * from s->bioc->data, explicit flush is needed here.
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 41560b97a4..e1918d4f38 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1691,8 +1691,7 @@ void qemu_savevm_state_end_precopy(MigrationState *s, QEMUFile *f)
> qemu_savevm_state_vm_desc(s, f);
> }
>
> -int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
> - bool in_postcopy)
> +int qemu_savevm_state_non_iterable(QEMUFile *f)
> {
> MigrationState *ms = migrate_get_current();
> int64_t start_ts_each, end_ts_each;
> @@ -1724,11 +1723,6 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
> end_ts_each - start_ts_each);
> }
>
> - if (!in_postcopy) {
> - /* Postcopy stream will still be going */
> - qemu_savevm_state_end_precopy(ms, f);
> - }
> -
> trace_vmstate_downtime_checkpoint("src-non-iterable-saved");
>
> return 0;
> @@ -1743,11 +1737,13 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f)
> return ret;
> }
>
> - ret = qemu_savevm_state_complete_precopy_non_iterable(f, false);
> + ret = qemu_savevm_state_non_iterable(f);
> if (ret) {
> return ret;
> }
>
> + qemu_savevm_state_end_precopy(migrate_get_current(), f);
> +
> return qemu_fflush(f);
> }
Reviewed-by: Fabiano Rosas <farosas@suse.de>
next prev parent reply other threads:[~2026-01-28 15:23 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 18:52 [PATCH v2 00/24] migration: small cleanup series Peter Xu
2026-01-27 18:52 ` [PATCH v2 01/24] migration: Introduce qemu_savevm_send_* helpers Peter Xu
2026-01-27 18:52 ` [PATCH v2 02/24] migration: Use qemu_savevm_send_header() in qemu_save_device_state() Peter Xu
2026-01-27 18:52 ` [PATCH v2 03/24] migration: Remove one migration_in_colo_state() occurance Peter Xu
2026-01-27 18:52 ` [PATCH v2 04/24] migration/savevm: Remove SaveStateEntry.is_ram Peter Xu
2026-01-27 18:52 ` [PATCH v2 05/24] migration/colo: Unwrap qemu_savevm_live_state() Peter Xu
2026-01-27 18:52 ` [PATCH v2 06/24] migration: Remove call to send switchover start event in colo/savevm Peter Xu
2026-01-28 15:07 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 07/24] colo: Forbid VM resume during checkpointing Peter Xu
2026-01-27 18:52 ` [PATCH v2 08/24] migration/colo: Use the RAM iterable helper directly Peter Xu
2026-01-27 18:52 ` [PATCH v2 09/24] migration/colo: Document qemu_fflush(fb) Peter Xu
2026-01-28 15:08 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 10/24] migration: Drop iterable_only in qemu_savevm_state_complete_precopy Peter Xu
2026-01-27 18:52 ` [PATCH v2 11/24] migration: Drop qemu_file_set_error() when save non-iterable fails Peter Xu
2026-01-28 15:08 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 12/24] migration/colo: Send device states without copying buffer Peter Xu
2026-01-28 15:12 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 13/24] migration/postcopy: " Peter Xu
2026-01-28 15:18 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 14/24] migration: Introduce qemu_savevm_state_end() Peter Xu
2026-01-28 15:22 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 15/24] migration: Provide helper for save vm description Peter Xu
2026-01-28 15:22 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 16/24] migration: Split qemu_savevm_state_complete_precopy_non_iterable() Peter Xu
2026-01-28 15:22 ` Fabiano Rosas [this message]
2026-01-27 18:52 ` [PATCH v2 17/24] migration: qemu_savevm_state_complete_precopy() take MigrationState* Peter Xu
2026-01-28 15:22 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 18/24] migration: Cleanup error propagates in qemu_savevm_state_setup() Peter Xu
2026-01-28 15:23 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 19/24] migration: Refactor qemu_savevm_state_setup() Peter Xu
2026-01-28 19:35 ` Fabiano Rosas
2026-01-28 20:36 ` Peter Xu
2026-01-28 21:36 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 20/24] migration: Introduce qemu_savevm_state_active() Peter Xu
2026-02-02 15:07 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 21/24] migration/bg-snapshot: Cleanup error paths Peter Xu
2026-01-28 19:45 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 22/24] migration: Make qemu_savevm_state_non_iterable() take errp Peter Xu
2026-01-28 19:52 ` Fabiano Rosas
2026-01-27 18:52 ` [PATCH v2 23/24] migration: Simplify qemu_save_device_state() Peter Xu
2026-01-28 19:55 ` Fabiano Rosas
2026-02-02 14:28 ` Peter Xu
2026-01-27 18:52 ` [PATCH v2 24/24] migration/colo/xen: Use generic helpers in qemu_save_device_state() Peter Xu
2026-02-02 15:14 ` Fabiano Rosas
2026-01-30 18:22 ` [PATCH v2 00/24] migration: small cleanup series Lukas Straub
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=875x8lg3sr.fsf@suse.de \
--to=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=lukasstraub2@web.de \
--cc=peterx@redhat.com \
--cc=ppandit@redhat.com \
--cc=qemu-devel@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.