From: Peter Xu <peterx@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, "Juan Quintela" <quintela@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Avihai Horon" <avihaih@nvidia.com>,
"Leonardo Bras Soares Passos" <lsoaresp@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Thomas Huth" <thuth@redhat.com>
Subject: Re: [PATCH v5 1/2] migration: switchover-hold parameter
Date: Thu, 6 Jul 2023 09:54:31 -0400 [thread overview]
Message-ID: <ZKbHl7uKI/NOAfMQ@x1n> (raw)
In-Reply-To: <87v8exqhx6.fsf@pond.sub.org>
Hi, Markus,
On Thu, Jul 06, 2023 at 03:38:13PM +0200, Markus Armbruster wrote:
> Peter Xu <peterx@redhat.com> writes:
>
> > Add a new migration parameter switchover-hold which can block src qemu
> > migration from switching over to dest from running.
> >
> > One can set this flag to true so src qemu will keep iterating the VM data,
> > not switching over to dest even if it can.
> >
> > It means now live migration works somehow like COLO; we keep syncing data
> > from src to dst without stopping.
>
> Out of curiosity: does it share code with COLO?
Nop, it is still purely the migration path.
>
> > When the user is ready for the switchover, one can set the parameter from
> > true->false. That'll contain a implicit kick to migration thread to be
> > alive and re-evaluate the switchover decision.
> >
> > This can be used in two cases so far in my mind:
> >
> > (1) One can use this parameter to start pre-heating migration (but not
> > really migrating, so a migrate-cancel will cancel the preheat). When
> > the user wants to really migrate, just clear the flag. It'll in most
> > cases migrate immediately because most pages are already synced.
> >
> > (2) Can also be used as a clean way to do qtest, in many of the precopy
> > tests we have requirement to run after 1 iteration without completing
> > the precopy migration. Before that we have either set bandwidth to
> > ridiculous low value, or tricks on detecting guest memory change over
> > some adhoc guest memory position. Now we can simply set this flag
> > then we know precopy won't complete and will just keep going.
> >
> > Here we leveraged a sem to make sure migration thread won't busy spin on a
> > physical cpu, meanwhile provide a timedwait() of 10ms so it can still try
> > its best to sync with dest QEMU from time to time. Note that the sem is
> > prone to outdated counts but it's benign, please refer to the comment above
> > the semaphore definition for more information.
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > qapi/migration.json | 25 ++++++++++--
> > migration/migration.h | 17 +++++++++
> > migration/migration-hmp-cmds.c | 7 ++++
> > migration/migration.c | 69 ++++++++++++++++++++++++++++++++--
> > migration/options.c | 17 +++++++++
> > 5 files changed, 128 insertions(+), 7 deletions(-)
> >
> > diff --git a/qapi/migration.json b/qapi/migration.json
> > index 47dfef0278..c050081555 100644
> > --- a/qapi/migration.json
> > +++ b/qapi/migration.json
> > @@ -789,6 +789,15 @@
> > # Nodes are mapped to their block device name if there is one, and
> > # to their node name otherwise. (Since 5.2)
> > #
> > +# @switchover-hold: Whether we should hold-off precopy switchover from
> > +# src to dest QEMU, even if we can finish migration in the
>
> Spell out "source" and "destination", please.
>
> Recommend to spell it out in the commit message, too.
Will do.
>
> > +# downtime specified. By default off, so precopy migration will
> > +# complete as soon as possible. One can set it to explicitly keep
> > +# iterating during precopy migration until set the flag to false
> > +# again to kick off the final switchover. Note, this does not
>
> "until the flag is set to false again"
>
> or
>
> "until the flag is cleared".
Will do.
>
> > +# affect postcopy switchover, because the user can control that
> > +# using "migrate-start-postcopy" command explicitly. (Since 8.1)
> > +#
> > # Features:
> > #
> > # @unstable: Member @x-checkpoint-delay is experimental.
> > @@ -810,7 +819,7 @@
> > 'xbzrle-cache-size', 'max-postcopy-bandwidth',
> > 'max-cpu-throttle', 'multifd-compression',
> > 'multifd-zlib-level' ,'multifd-zstd-level',
> > - 'block-bitmap-mapping' ] }
> > + 'block-bitmap-mapping', 'switchover-hold' ] }
> >
> > ##
> > # @MigrateSetParameters:
> > @@ -945,6 +954,10 @@
> > # Nodes are mapped to their block device name if there is one, and
> > # to their node name otherwise. (Since 5.2)
> > #
> > +# @switchover-hold: Whether we should hold-off precopy switchover from
> > +# src to dest QEMU. For more details, please refer to
> > +# MigrationParameter entry of the same field. (Since 8.1)
>
> We normally duplicate the documentation. This would be the first
> instance where we reference instead. Do we want that?
Personally I'd hope to try avoid any form of duplication if possible. We
have some structure duplications that I cannot avoid (not until someone,
including myself, can dedup it..), so I tried to not duplicate exactly same
thing in the documents at least, instead to put such a reference.
But I agree only referencing other docs in this flag is special. We may
want to do at least the same across all the parameters. I have no strong
opinion either, so if we want to keep full descriptions in multiple places
I'll do that in the new spin. It's more QAPI stuff IMHO; I'll just follow
your advise.
Thanks for taking a look!
--
Peter Xu
next prev parent reply other threads:[~2023-07-06 13:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 12:43 [PATCH v5 0/2] migration: switchover-hold flag Peter Xu
2023-07-06 12:43 ` [PATCH v5 1/2] migration: switchover-hold parameter Peter Xu
2023-07-06 13:29 ` Avihai Horon
2023-07-06 13:44 ` Peter Xu
2023-07-06 13:48 ` Avihai Horon
2023-07-06 13:38 ` Markus Armbruster
2023-07-06 13:54 ` Peter Xu [this message]
2023-07-06 12:43 ` [PATCH v5 2/2] qtest/migration: Use switchover-hold to speedup Peter Xu
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=ZKbHl7uKI/NOAfMQ@x1n \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=avihaih@nvidia.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=lsoaresp@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thuth@redhat.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.