From: Eric Blake <eblake@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: qemu-devel@nongnu.org, Peter Xu <peterx@redhat.com>,
Fabiano Rosas <farosas@suse.de>,
Juraj Marcin <jmarcin@redhat.com>
Subject: Re: [PATCH v2 1/5] migration/postcopy: report COMPLETED only after the run BH has run
Date: Wed, 11 Nov 2026 10:20:13 -0600 [thread overview]
Message-ID: <avSVqo1zrRD-Ko13@redhat.com> (raw)
In-Reply-To: <20261110183257.2930908-2-den@openvz.org>
On Tue, Nov 10, 2026 at 07:32:53PM +0100, Denis V. Lunev wrote:
> From: Denis V. Lunev <den@openvz.org>
>
> The postcopy listen thread waits for main_thread_load_event before it
> reports COMPLETED. That event is set as soon as qemu_loadvm_state_main()
> returns in the main thread, while the run state is changed later, in
> loadvm_postcopy_handle_run_bh(). The listen thread can therefore report
> COMPLETED while the VM is still in RUN_STATE_INMIGRATE, easily so in a
> bitmap-only postcopy where it has little to load.
>
> Management reacting to COMPLETED then finds the VM still incoming: a
> blockdev-add creates an inactive node, since bds_tree_init() forces
> BDRV_O_INACTIVE in RUN_STATE_INMIGRATE, and attaching a device to it
> fails with "Block node is read-only". Precopy gets this right:
> process_incoming_migration_bh() changes the run state before it reports
> COMPLETED.
>
> Once CMD_POSTCOPY_RUN has scheduled the run BH, set the event at the
> end of the BH instead. qemu_loadvm_state() keeps setting it in every
> other case, including a load that failed before CMD_POSTCOPY_RUN. The
> postcopy state it checks only becomes RUNNING on the main thread, right
> before the BH is scheduled.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Cc: Peter Xu <peterx@redhat.com>
> Cc: Fabiano Rosas <farosas@suse.de>
> Cc: Juraj Marcin <jmarcin@redhat.com>
> ---
> migration/migration.h | 2 +-
> migration/savevm.c | 6 +++++-
> 2 files changed, 6 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
next prev parent reply other threads:[~2026-11-11 16:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 18:32 [PATCH v2 0/5] migration/postcopy: report destination states only after the run state change Denis V. Lunev
2026-11-10 18:32 ` [PATCH v2 1/5] migration/postcopy: report COMPLETED only after the run BH has run Denis V. Lunev
2026-11-11 16:20 ` Eric Blake [this message]
2026-11-10 18:32 ` [PATCH v2 2/5] migration/postcopy: set destination postcopy-active in the run BH Denis V. Lunev
2026-11-11 16:34 ` Eric Blake
2026-11-10 18:32 ` [PATCH v2 3/5] tests/qtest/migration: check the destination run state in postcopy tests Denis V. Lunev
2026-11-11 17:32 ` Eric Blake
2026-11-10 18:32 ` [PATCH v2 4/5] migration/postcopy: answer the package-loaded ping from the run BH Denis V. Lunev
2026-11-10 18:32 ` [PATCH v2 5/5] iotests/migrate-bitmaps-postcopy-test: cover postcopy with a return path Denis V. Lunev
2026-11-11 20:03 ` Eric Blake
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=avSVqo1zrRD-Ko13@redhat.com \
--to=eblake@redhat.com \
--cc=den@openvz.org \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=peterx@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.