From: Peter Xu <peterx@redhat.com>
To: Steve Sistare <steven.sistare@oracle.com>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
David Hildenbrand <david@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Eduardo Habkost <eduardo@habkost.net>,
Philippe Mathieu-Daude <philmd@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH V3 10/16] migration: split qmp_migrate
Date: Wed, 13 Nov 2024 16:11:30 -0500 [thread overview]
Message-ID: <ZzUWAnYARa_G2-J1@x1n> (raw)
In-Reply-To: <1730468875-249970-11-git-send-email-steven.sistare@oracle.com>
On Fri, Nov 01, 2024 at 06:47:49AM -0700, Steve Sistare wrote:
> Split qmp_migrate into start and finish functions. Finish will be
> called asynchronously in a subsequent patch, but for now, call it
> immediately. No functional change.
>
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> ---
> migration/migration.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 6dc7c09..86b3f39 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1521,6 +1521,7 @@ static void migrate_fd_error(MigrationState *s, const Error *error)
> static void migrate_fd_cancel(MigrationState *s)
> {
> int old_state ;
> + bool setup = (s->state == MIGRATION_STATUS_SETUP);
>
> trace_migrate_fd_cancel();
>
> @@ -1565,6 +1566,15 @@ static void migrate_fd_cancel(MigrationState *s)
> s->block_inactive = false;
> }
> }
> +
> + /*
> + * If qmp_migrate_finish has not been called, then there is no path that
> + * will complete the cancellation. Do it now.
> + */
> + if (setup && !s->to_dst_file) {
> + migrate_set_state(&s->state, s->state, MIGRATION_STATUS_CANCELLED);
> + vm_resume(s->vm_old_state);
> + }
Hmm.. this doesn't look like the right place to put this change.. as this
patch logically should bring no functional change if it's only about a new
helper split an existing function.
Meanwhile, this change also doesn't yet tell where does a vm_resume() came
from.. I'm really not sure whether this is correct at all, consider someone
does QMP "stop", migrate then quickly cancel it. I suppose it may
accidentally resume the VM which it shouldn't.
Not to mention checking "setup" early, and unconditionally modify the state
here no matter what it is (can it be things like FAILED now, then
overwritten by a CANCELLED)? But I'd confess that's not the problem of
this patch, but that migration state machine is currently still racy.. afaiu.
> }
>
> void migration_add_notifier_mode(NotifierWithReturn *notify,
> @@ -2072,6 +2082,9 @@ static bool migrate_prepare(MigrationState *s, bool resume, Error **errp)
> return true;
> }
>
> +static void qmp_migrate_finish(MigrationAddress *addr, bool resume_requested,
> + Error **errp);
> +
> void qmp_migrate(const char *uri, bool has_channels,
> MigrationChannelList *channels, bool has_detach, bool detach,
> bool has_resume, bool resume, Error **errp)
> @@ -2118,6 +2131,20 @@ void qmp_migrate(const char *uri, bool has_channels,
> return;
> }
>
> + qmp_migrate_finish(addr, resume_requested, errp);
> +
> + if (local_err) {
> + migrate_fd_error(s, local_err);
> + error_propagate(errp, local_err);
> + }
I don't see when local_err will be set at all until here.. maybe you meant
*errp, but then maybe we should drop local_err and use ERRP_GUARD().
> +}
> +
> +static void qmp_migrate_finish(MigrationAddress *addr, bool resume_requested,
> + Error **errp)
> +{
> + MigrationState *s = migrate_get_current();
> + Error *local_err = NULL;
> +
> if (!resume_requested) {
> if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) {
> return;
> --
> 1.8.3.1
>
--
Peter Xu
next prev parent reply other threads:[~2024-11-13 21:12 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 13:47 [PATCH V3 00/16] Live update: cpr-transfer Steve Sistare
2024-11-01 13:47 ` [PATCH V3 01/16] machine: anon-alloc option Steve Sistare
2024-11-01 14:06 ` Peter Xu
2024-11-04 10:39 ` David Hildenbrand
2024-11-04 10:45 ` David Hildenbrand
2024-11-04 17:38 ` Steven Sistare
2024-11-04 19:51 ` David Hildenbrand
2024-11-04 20:14 ` Peter Xu
2024-11-04 20:17 ` David Hildenbrand
2024-11-04 20:41 ` Peter Xu
2024-11-04 20:15 ` David Hildenbrand
2024-11-04 20:56 ` Steven Sistare
2024-11-04 21:36 ` David Hildenbrand
2024-11-06 20:12 ` Steven Sistare
2024-11-06 20:41 ` Peter Xu
2024-11-06 20:59 ` Steven Sistare
2024-11-06 21:21 ` Peter Xu
2024-11-07 14:03 ` Steven Sistare
2024-11-07 13:05 ` David Hildenbrand
2024-11-07 14:04 ` Steven Sistare
2024-11-07 16:19 ` David Hildenbrand
2024-11-07 18:13 ` Steven Sistare
2024-11-07 16:32 ` Peter Xu
2024-11-07 16:38 ` David Hildenbrand
2024-11-07 17:48 ` Peter Xu
2024-11-07 13:23 ` David Hildenbrand
2024-11-07 16:02 ` Steven Sistare
2024-11-07 16:26 ` David Hildenbrand
2024-11-07 16:40 ` Steven Sistare
2024-11-08 11:31 ` David Hildenbrand
2024-11-08 13:43 ` Peter Xu
2024-11-08 14:14 ` Steven Sistare
2024-11-08 14:32 ` Peter Xu
2024-11-08 14:18 ` David Hildenbrand
2024-11-08 15:01 ` Peter Xu
2024-11-08 13:56 ` Steven Sistare
2024-11-08 14:20 ` David Hildenbrand
2024-11-08 14:37 ` Steven Sistare
2024-11-08 14:54 ` David Hildenbrand
2024-11-08 15:07 ` Peter Xu
2024-11-08 15:09 ` David Hildenbrand
2024-11-08 15:15 ` David Hildenbrand
2024-11-01 13:47 ` [PATCH V3 02/16] migration: cpr-state Steve Sistare
2024-11-13 20:36 ` Peter Xu
2024-11-01 13:47 ` [PATCH V3 03/16] physmem: preserve ram blocks for cpr Steve Sistare
2024-11-01 13:47 ` [PATCH V3 04/16] hostmem-memfd: preserve " Steve Sistare
2024-11-01 13:47 ` [PATCH V3 05/16] migration: SCM_RIGHTS for QEMUFile Steve Sistare
2024-11-13 20:54 ` Peter Xu
2024-11-14 18:34 ` Steven Sistare
2024-11-01 13:47 ` [PATCH V3 06/16] migration: VMSTATE_FD Steve Sistare
2024-11-13 20:55 ` Peter Xu
2024-11-01 13:47 ` [PATCH V3 07/16] migration: cpr-transfer save and load Steve Sistare
2024-11-01 13:47 ` [PATCH V3 08/16] migration: cpr-uri parameter Steve Sistare
2024-11-01 13:47 ` [PATCH V3 09/16] migration: cpr-uri option Steve Sistare
2024-11-01 13:47 ` [PATCH V3 10/16] migration: split qmp_migrate Steve Sistare
2024-11-13 21:11 ` Peter Xu [this message]
2024-11-14 18:33 ` Steven Sistare
2024-11-01 13:47 ` [PATCH V3 11/16] migration: cpr-transfer mode Steve Sistare
2024-11-13 21:58 ` Peter Xu
2024-11-14 18:36 ` Steven Sistare
2024-11-14 19:04 ` Peter Xu
2024-11-19 19:50 ` Steven Sistare
2024-11-19 20:16 ` Peter Xu
2024-11-19 20:32 ` Steven Sistare
2024-11-19 20:51 ` Peter Xu
2024-11-19 21:03 ` Steven Sistare
2024-11-19 21:29 ` Peter Xu
2024-11-19 21:41 ` Steven Sistare
2024-11-19 21:48 ` Peter Xu
2024-11-19 21:51 ` Steven Sistare
2024-11-20 9:38 ` Daniel P. Berrangé
2024-11-20 16:12 ` Steven Sistare
2024-11-20 16:26 ` Daniel P. Berrangé
2024-11-01 13:47 ` [PATCH V3 12/16] tests/migration-test: memory_backend Steve Sistare
2024-11-13 22:19 ` Fabiano Rosas
2024-11-01 13:47 ` [PATCH V3 13/16] tests/qtest: defer connection Steve Sistare
2024-11-13 22:36 ` Fabiano Rosas
2024-11-14 18:45 ` Steven Sistare
2024-11-13 22:53 ` Peter Xu
2024-11-14 18:31 ` Steven Sistare
2024-11-01 13:47 ` [PATCH V3 14/16] tests/migration-test: " Steve Sistare
2024-11-14 12:46 ` Fabiano Rosas
2024-11-01 13:47 ` [PATCH V3 15/16] migration-test: cpr-transfer Steve Sistare
2024-11-01 13:47 ` [PATCH V3 16/16] migration: cpr-transfer documentation Steve Sistare
2024-11-13 22:02 ` Peter Xu
2024-11-14 18:31 ` Steven Sistare
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=ZzUWAnYARa_G2-J1@x1n \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=david@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.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;
as well as URLs for NNTP newsgroup(s).