From: Peter Xu <peterx@redhat.com>
To: Lukas Straub <lukasstraub2@web.de>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Zhang Chen <zhangckid@gmail.com>,
Hailiang Zhang <zhanghailiang@xfusion.com>,
Markus Armbruster <armbru@redhat.com>,
Li Zhijian <lizhijian@fujitsu.com>,
"Dr. David Alan Gilbert" <dave@treblig.org>
Subject: Re: [PATCH v5 03/16] colo: Setup ram cache in normal migration path
Date: Mon, 9 Feb 2026 11:10:02 -0500 [thread overview]
Message-ID: <aYoG2rzTkfk6SDiR@x1.local> (raw)
In-Reply-To: <20260203-colo_unit_test_multifd-v5-3-57508b7389f6@web.de>
On Tue, Feb 03, 2026 at 11:15:09AM +0100, Lukas Straub wrote:
> Since
> 121ccedc2b migration: block incoming colo when capability is disabled
>
> x-colo capability needs to be always enabled on the incoming side.
> So migration_incoming_colo_enabled() and migrate_colo() are equivalent
> with migrate_colo() being easier to reason about since it is always true
> during the whole migration.
>
> Use migrate_colo() to initialize the ram cache in the normal migration path.
>
> Reviewed-by: Fabiano Rosas <farosas@suse.de>
> Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Since the goal of this patch is to drop the COLO migration command, this
looks an improvement indeed,
Reviewed-by: Peter Xu <peterx@redhat.com>
I'll still comment though for possible future updates..
> ---
> migration/migration.c | 18 ++++++++++++++----
> migration/savevm.c | 14 +-------------
> 2 files changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index b103a82fc0b83009d01d238ff16c0a542d83509f..a73d842ad8b060dc84273ade36ef7dc8b87421f3 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -630,10 +630,6 @@ int migration_incoming_enable_colo(Error **errp)
> return -EINVAL;
> }
>
> - if (ram_block_discard_disable(true)) {
> - error_setg(errp, "COLO: cannot disable RAM discard");
> - return -EBUSY;
> - }
> migration_colo_enabled = true;
> return 0;
> }
> @@ -770,6 +766,20 @@ process_incoming_migration_co(void *opaque)
>
> assert(mis->from_src_file);
>
> + if (migrate_colo()) {
> + if (ram_block_discard_disable(true)) {
IMHO this is something we could have done at migrate_incoming and fail the
QMP command directly, rather than waiting until this late.
> + error_setg(&local_err, "COLO: cannot disable RAM discard");
> + goto fail;
> + }
> +
> + ret = colo_init_ram_cache(&local_err);
This might be more suitable to be put in ram's load_setup() (which should
happen at the initial migration phase, before colo taking snapshots), then
I believe this function can be unexported too.
> + if (ret) {
> + error_prepend(&local_err, "failed to init colo RAM cache: %d: ",
> + ret);
> + goto fail;
> + }
> + }
> +
> mis->largest_page_size = qemu_ram_pagesize_largest();
> postcopy_state_set(POSTCOPY_INCOMING_NONE);
> migrate_set_state(&mis->state, MIGRATION_STATUS_SETUP,
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 3dc812a7bbb4e8f5321114c9919d4619798fed5e..0353ac2d0de819b6547a1f771e6a4c3b8fb1e4ef 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2407,19 +2407,7 @@ static int loadvm_process_enable_colo(MigrationIncomingState *mis,
> Error **errp)
> {
> ERRP_GUARD();
> - int ret;
> -
> - ret = migration_incoming_enable_colo(errp);
> - if (ret < 0) {
> - return ret;
> - }
> -
> - ret = colo_init_ram_cache(errp);
> - if (ret) {
> - error_prepend(errp, "failed to init colo RAM cache: %d: ", ret);
> - migration_incoming_disable_colo();
> - }
> - return ret;
> + return migration_incoming_enable_colo(errp);
> }
>
> static int loadvm_postcopy_handle_switchover_start(Error **errp)
>
> --
> 2.39.5
>
--
Peter Xu
next prev parent reply other threads:[~2026-02-09 16:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-03 10:15 [PATCH v5 00/16] migration: Add COLO multifd support and COLO migration unit test Lukas Straub
2026-02-03 10:15 ` [PATCH v5 01/16] MAINTAINERS: Add myself as maintainer for COLO migration framework Lukas Straub
2026-02-03 10:15 ` [PATCH v5 02/16] MAINTAINERS: Remove Hailiang Zhang from " Lukas Straub
2026-02-03 10:15 ` [PATCH v5 03/16] colo: Setup ram cache in normal migration path Lukas Straub
2026-02-09 16:10 ` Peter Xu [this message]
2026-02-03 10:15 ` [PATCH v5 04/16] colo: Replace migration_incoming_colo_enabled() with migrate_colo() Lukas Straub
2026-02-09 16:11 ` Peter Xu
2026-02-03 10:15 ` [PATCH v5 05/16] colo: Remove ENABLE_COLO loadvm command functions Lukas Straub
2026-02-09 16:13 ` Peter Xu
2026-02-10 13:28 ` Lukas Straub
2026-02-10 14:38 ` Peter Xu
2026-02-10 15:34 ` Lukas Straub
2026-02-03 10:15 ` [PATCH v5 06/16] colo: Don't send ENABLE_COLO command Lukas Straub
2026-02-09 16:17 ` Peter Xu
2026-02-10 13:29 ` Lukas Straub
2026-02-03 10:15 ` [PATCH v5 07/16] ram: Remove colo special-casing Lukas Straub
2026-02-09 16:19 ` Peter Xu
2026-02-03 10:15 ` [PATCH v5 08/16] Move ram state receive into multifd_ram_state_recv() Lukas Straub
2026-02-09 16:20 ` Peter Xu
2026-02-03 10:15 ` [PATCH v5 09/16] multifd: Add COLO support Lukas Straub
2026-02-04 18:13 ` Fabiano Rosas
2026-02-09 16:25 ` Peter Xu
2026-02-03 10:15 ` [PATCH v5 10/16] Call colo_release_ram_cache() after multifd threads terminate Lukas Straub
2026-02-09 16:27 ` Peter Xu
2026-02-03 10:15 ` [PATCH v5 11/16] colo: Fix crash during device vmstate load Lukas Straub
2026-02-03 10:15 ` [PATCH v5 12/16] migration-test: Add COLO migration unit test Lukas Straub
2026-02-09 15:56 ` Peter Xu
2026-02-03 10:15 ` [PATCH v5 13/16] Convert colo main documentation to restructuredText Lukas Straub
2026-02-06 7:47 ` Zhang Chen
2026-02-03 10:15 ` [PATCH v5 14/16] qemu-colo.rst: Miscellaneous changes Lukas Straub
2026-02-06 7:52 ` Zhang Chen
2026-02-03 10:15 ` [PATCH v5 15/16] qemu-colo.rst: Add my copyright Lukas Straub
2026-02-03 10:15 ` [PATCH v5 16/16] qemu-colo.rst: Simplify the block replication setup 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=aYoG2rzTkfk6SDiR@x1.local \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=farosas@suse.de \
--cc=lizhijian@fujitsu.com \
--cc=lukasstraub2@web.de \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhangckid@gmail.com \
--cc=zhanghailiang@xfusion.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.