From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: aarcange@redhat.com, yamahata@private.email.ne.jp,
quintela@redhat.com, qemu-devel@nongnu.org, amit.shah@redhat.com,
pbonzini@redhat.com, yanghy@cn.fujitsu.com
Subject: Re: [Qemu-devel] [PATCH v5 23/45] migrate_start_postcopy: Command to trigger transition to postcopy
Date: Fri, 13 Mar 2015 11:19:06 +0000 [thread overview]
Message-ID: <20150313111905.GC2486@work-vm> (raw)
In-Reply-To: <20150313012652.GB11973@voom.redhat.com>
* David Gibson (david@gibson.dropbear.id.au) wrote:
> On Wed, Feb 25, 2015 at 04:51:46PM +0000, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Once postcopy is enabled (with migrate_set_capability), the migration
> > will still start on precopy mode. To cause a transition into postcopy
> > the:
> >
> > migrate_start_postcopy
> >
> > command must be issued. Postcopy will start sometime after this
> > (when it's next checked in the migration loop).
> >
> > Issuing the command before migration has started will error,
> > and issuing after it has finished is ignored.
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > Reviewed-by: Eric Blake <eblake@redhat.com>
> > ---
> > hmp-commands.hx | 15 +++++++++++++++
> > hmp.c | 7 +++++++
> > hmp.h | 1 +
> > include/migration/migration.h | 3 +++
> > migration/migration.c | 22 ++++++++++++++++++++++
> > qapi-schema.json | 8 ++++++++
> > qmp-commands.hx | 19 +++++++++++++++++++
> > 7 files changed, 75 insertions(+)
> >
> > diff --git a/hmp-commands.hx b/hmp-commands.hx
> > index e37bc8b..03b8b78 100644
> > --- a/hmp-commands.hx
> > +++ b/hmp-commands.hx
> > @@ -985,6 +985,21 @@ Enable/Disable the usage of a capability @var{capability} for migration.
> > ETEXI
> >
> > {
> > + .name = "migrate_start_postcopy",
> > + .args_type = "",
> > + .params = "",
> > + .help = "Switch migration to postcopy mode",
> > + .mhandler.cmd = hmp_migrate_start_postcopy,
> > + },
> > +
> > +STEXI
> > +@item migrate_start_postcopy
> > +@findex migrate_start_postcopy
> > +Switch in-progress migration to postcopy mode. Ignored after the end of
> > +migration (or once already in postcopy).
> > +ETEXI
> > +
> > + {
> > .name = "client_migrate_info",
> > .args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
> > .params = "protocol hostname port tls-port cert-subject",
> > diff --git a/hmp.c b/hmp.c
> > index b47f331..df9736c 100644
> > --- a/hmp.c
> > +++ b/hmp.c
> > @@ -1140,6 +1140,13 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
> > }
> > }
> >
> > +void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict)
> > +{
> > + Error *err = NULL;
> > + qmp_migrate_start_postcopy(&err);
> > + hmp_handle_error(mon, &err);
> > +}
> > +
> > void hmp_set_password(Monitor *mon, const QDict *qdict)
> > {
> > const char *protocol = qdict_get_str(qdict, "protocol");
> > diff --git a/hmp.h b/hmp.h
> > index 4bb5dca..da1334f 100644
> > --- a/hmp.h
> > +++ b/hmp.h
> > @@ -64,6 +64,7 @@ void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict);
> > void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict);
> > void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict);
> > void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict);
> > +void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict);
> > void hmp_set_password(Monitor *mon, const QDict *qdict);
> > void hmp_expire_password(Monitor *mon, const QDict *qdict);
> > void hmp_eject(Monitor *mon, const QDict *qdict);
> > diff --git a/include/migration/migration.h b/include/migration/migration.h
> > index e6a814a..293c83e 100644
> > --- a/include/migration/migration.h
> > +++ b/include/migration/migration.h
> > @@ -104,6 +104,9 @@ struct MigrationState
> > int64_t xbzrle_cache_size;
> > int64_t setup_time;
> > int64_t dirty_sync_count;
> > +
> > + /* Flag set once the migration has been asked to enter postcopy */
> > + bool start_postcopy;
> > };
> >
> > void process_incoming_migration(QEMUFile *f);
> > diff --git a/migration/migration.c b/migration/migration.c
> > index a4fc7d7..43ca656 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -372,6 +372,28 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
> > }
> > }
> >
> > +void qmp_migrate_start_postcopy(Error **errp)
> > +{
> > + MigrationState *s = migrate_get_current();
> > +
> > + if (!migrate_postcopy_ram()) {
> > + error_setg(errp, "Enable postcopy with migration_set_capability before"
> > + " the start of migration");
> > + return;
> > + }
> > +
> > + if (s->state == MIG_STATE_NONE) {
> > + error_setg(errp, "Postcopy must be started after migration has been"
> > + " started");
> > + return;
> > + }
> > + /*
> > + * we don't error if migration has finished since that would be racy
> > + * with issuing this command.
> > + */
> > + atomic_set(&s->start_postcopy, true);
>
> Why atomic_set?
It's being read by the migration thread, this is happening in the main thread.
There's no strict ordering requirement or anything.
Dave
>
> > +}
> > +
> > /* shared migration helpers */
> >
> > static void migrate_set_state(MigrationState *s, int old_state, int new_state)
> > diff --git a/qapi-schema.json b/qapi-schema.json
> > index a8af1cb..7ff61e9 100644
> > --- a/qapi-schema.json
> > +++ b/qapi-schema.json
> > @@ -542,6 +542,14 @@
> > { 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabilityStatus']}
> >
> > ##
> > +# @migrate-start-postcopy
> > +#
> > +# Switch migration to postcopy mode
> > +#
> > +# Since: 2.3
> > +{ 'command': 'migrate-start-postcopy' }
> > +
> > +##
> > # @MouseInfo:
> > #
> > # Information about a mouse device.
> > diff --git a/qmp-commands.hx b/qmp-commands.hx
> > index a85d847..25d2208 100644
> > --- a/qmp-commands.hx
> > +++ b/qmp-commands.hx
> > @@ -685,6 +685,25 @@ Example:
> >
> > EQMP
> > {
> > + .name = "migrate-start-postcopy",
> > + .args_type = "",
> > + .mhandler.cmd_new = qmp_marshal_input_migrate_start_postcopy,
> > + },
> > +
> > +SQMP
> > +migrate-start-postcopy
> > +----------------------
> > +
> > +Switch an in-progress migration to postcopy mode. Ignored after the end of
> > +migration (or once already in postcopy).
> > +
> > +Example:
> > +-> { "execute": "migrate-start-postcopy" }
> > +<- { "return": {} }
> > +
> > +EQMP
> > +
> > + {
> > .name = "query-migrate-cache-size",
> > .args_type = "",
> > .mhandler.cmd_new = qmp_marshal_input_query_migrate_cache_size,
>
> --
> David Gibson | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
> | _way_ _around_!
> http://www.ozlabs.org/~dgibson
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2015-03-13 11:19 UTC|newest]
Thread overview: 181+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 16:51 [Qemu-devel] [PATCH v5 00/45] Postcopy implementation Dr. David Alan Gilbert (git)
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 01/45] Start documenting how postcopy works Dr. David Alan Gilbert (git)
2015-03-05 3:21 ` David Gibson
2015-03-05 9:21 ` Dr. David Alan Gilbert
2015-03-10 1:04 ` David Gibson
2015-03-13 13:07 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 02/45] Split header writing out of qemu_save_state_begin Dr. David Alan Gilbert (git)
2015-03-10 1:05 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 03/45] qemu_ram_foreach_block: pass up error value, and down the ramblock name Dr. David Alan Gilbert (git)
2015-03-10 15:30 ` Eric Blake
2015-03-10 16:21 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 04/45] Add qemu_get_counted_string to read a string prefixed by a count byte Dr. David Alan Gilbert (git)
2015-03-10 1:12 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 05/45] Create MigrationIncomingState Dr. David Alan Gilbert (git)
2015-03-10 2:37 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 06/45] Provide runtime Target page information Dr. David Alan Gilbert (git)
2015-03-10 2:38 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 07/45] Return path: Open a return path on QEMUFile for sockets Dr. David Alan Gilbert (git)
2015-03-10 2:49 ` David Gibson
2015-03-13 13:14 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 08/45] Return path: socket_writev_buffer: Block even on non-blocking fd's Dr. David Alan Gilbert (git)
2015-03-10 2:56 ` David Gibson
2015-03-10 13:35 ` Dr. David Alan Gilbert
2015-03-11 1:51 ` David Gibson
2015-03-28 15:30 ` Paolo Bonzini
2015-03-29 4:07 ` David Gibson
2015-03-29 9:03 ` Paolo Bonzini
2015-03-30 16:50 ` Dr. David Alan Gilbert
2015-03-30 18:22 ` Markus Armbruster
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 09/45] Migration commands Dr. David Alan Gilbert (git)
2015-03-10 4:58 ` David Gibson
2015-03-10 11:04 ` Dr. David Alan Gilbert
2015-03-10 11:06 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 10/45] Return path: Control commands Dr. David Alan Gilbert (git)
2015-03-10 5:40 ` David Gibson
2015-03-28 15:32 ` Paolo Bonzini
2015-03-30 17:34 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 11/45] Return path: Send responses from destination to source Dr. David Alan Gilbert (git)
2015-03-10 5:47 ` David Gibson
2015-03-10 14:34 ` Dr. David Alan Gilbert
2015-03-11 1:54 ` David Gibson
2015-03-25 18:47 ` Dr. David Alan Gilbert
2015-03-28 15:34 ` Paolo Bonzini
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 12/45] Return path: Source handling of return path Dr. David Alan Gilbert (git)
2015-03-10 6:08 ` David Gibson
2015-03-20 18:17 ` Dr. David Alan Gilbert
2015-03-23 2:37 ` David Gibson
2015-04-01 15:14 ` Dr. David Alan Gilbert
2015-04-07 3:07 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 13/45] ram_debug_dump_bitmap: Dump a migration bitmap as text Dr. David Alan Gilbert (git)
2015-03-10 6:11 ` David Gibson
2015-03-20 18:48 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 14/45] Move loadvm_handlers into MigrationIncomingState Dr. David Alan Gilbert (git)
2015-03-10 6:19 ` David Gibson
2015-03-10 10:12 ` Dr. David Alan Gilbert
2015-03-10 11:03 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 15/45] Rework loadvm path for subloops Dr. David Alan Gilbert (git)
2015-03-12 6:11 ` David Gibson
2015-04-14 12:04 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 16/45] Add migration-capability boolean for postcopy-ram Dr. David Alan Gilbert (git)
2015-03-12 6:14 ` David Gibson
2015-03-13 12:58 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 17/45] Add wrappers and handlers for sending/receiving the postcopy-ram migration messages Dr. David Alan Gilbert (git)
2015-03-12 9:30 ` David Gibson
2015-03-26 16:33 ` Dr. David Alan Gilbert
2015-03-27 4:13 ` David Gibson
2015-03-27 10:48 ` Dr. David Alan Gilbert
2015-03-28 16:00 ` Paolo Bonzini
2015-03-30 4:03 ` David Gibson
2015-03-28 15:58 ` Paolo Bonzini
2015-03-28 15:43 ` Paolo Bonzini
2015-03-30 17:46 ` Dr. David Alan Gilbert
2015-03-30 19:23 ` Paolo Bonzini
2015-03-31 11:05 ` Dr. David Alan Gilbert
2015-03-31 11:10 ` Paolo Bonzini
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 18/45] MIG_CMD_PACKAGED: Send a packaged chunk of migration stream Dr. David Alan Gilbert (git)
2015-03-13 0:55 ` David Gibson
2015-03-13 11:51 ` Dr. David Alan Gilbert
2015-03-16 6:16 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 19/45] migrate_init: Call from savevm Dr. David Alan Gilbert (git)
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 20/45] Modify savevm handlers for postcopy Dr. David Alan Gilbert (git)
2015-03-13 1:00 ` David Gibson
2015-03-13 10:19 ` Dr. David Alan Gilbert
2015-03-16 6:18 ` David Gibson
2015-03-20 12:37 ` Dr. David Alan Gilbert
2015-03-23 2:25 ` David Gibson
2015-03-24 20:04 ` Dr. David Alan Gilbert
2015-03-24 22:32 ` David Gibson
2015-03-25 15:00 ` Dr. David Alan Gilbert
2015-03-25 16:40 ` Dr. David Alan Gilbert
2015-03-26 1:35 ` David Gibson
2015-03-26 11:44 ` Dr. David Alan Gilbert
2015-03-27 3:56 ` David Gibson
2015-03-26 1:35 ` David Gibson
2015-03-30 8:10 ` Paolo Bonzini
2015-03-31 0:10 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 21/45] Add Linux userfaultfd header Dr. David Alan Gilbert (git)
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 22/45] postcopy: OS support test Dr. David Alan Gilbert (git)
2015-03-13 1:23 ` David Gibson
2015-03-13 10:41 ` Dr. David Alan Gilbert
2015-03-16 6:22 ` David Gibson
2015-03-30 8:14 ` Paolo Bonzini
2015-03-30 14:07 ` Dr. David Alan Gilbert
2015-03-30 14:09 ` Paolo Bonzini
2015-06-16 10:49 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 23/45] migrate_start_postcopy: Command to trigger transition to postcopy Dr. David Alan Gilbert (git)
2015-03-13 1:26 ` David Gibson
2015-03-13 11:19 ` Dr. David Alan Gilbert [this message]
2015-03-16 6:23 ` David Gibson
2015-03-18 17:59 ` Dr. David Alan Gilbert
2015-03-19 4:18 ` David Gibson
2015-03-19 9:33 ` Dr. David Alan Gilbert
2015-03-23 2:20 ` David Gibson
2015-03-30 8:19 ` Paolo Bonzini
2015-03-30 17:04 ` Dr. David Alan Gilbert
2015-03-30 19:22 ` Paolo Bonzini
2015-03-31 11:21 ` Dr. David Alan Gilbert
2015-03-30 8:17 ` Paolo Bonzini
2015-03-31 2:23 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 24/45] MIG_STATE_POSTCOPY_ACTIVE: Add new migration state Dr. David Alan Gilbert (git)
2015-03-13 4:45 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 25/45] qemu_savevm_state_complete: Postcopy changes Dr. David Alan Gilbert (git)
2015-03-13 4:58 ` David Gibson
2015-03-13 12:25 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 26/45] Postcopy page-map-incoming (PMI) structure Dr. David Alan Gilbert (git)
2015-03-13 5:19 ` David Gibson
2015-03-13 13:47 ` Dr. David Alan Gilbert
2015-03-16 6:30 ` David Gibson
2015-03-18 17:58 ` Dr. David Alan Gilbert
2015-03-23 2:48 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 27/45] Postcopy: Maintain sentmap and calculate discard Dr. David Alan Gilbert (git)
2015-03-23 3:30 ` David Gibson
2015-03-23 14:36 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 28/45] postcopy: Incoming initialisation Dr. David Alan Gilbert (git)
2015-03-23 3:41 ` David Gibson
2015-03-23 13:46 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 29/45] postcopy: ram_enable_notify to switch on userfault Dr. David Alan Gilbert (git)
2015-03-23 3:45 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 30/45] Postcopy: Postcopy startup in migration thread Dr. David Alan Gilbert (git)
2015-03-23 4:20 ` David Gibson
2015-03-26 11:05 ` Dr. David Alan Gilbert
2015-03-30 8:31 ` Paolo Bonzini
2015-04-13 11:35 ` Dr. David Alan Gilbert
2015-04-13 13:26 ` Paolo Bonzini
2015-04-13 14:58 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 31/45] Postcopy end in migration_thread Dr. David Alan Gilbert (git)
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 32/45] Page request: Add MIG_RP_CMD_REQ_PAGES reverse command Dr. David Alan Gilbert (git)
2015-03-23 5:00 ` David Gibson
2015-03-25 18:16 ` Dr. David Alan Gilbert
2015-03-26 1:28 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 33/45] Page request: Process incoming page request Dr. David Alan Gilbert (git)
2015-03-24 1:53 ` David Gibson
2015-03-25 17:37 ` Dr. David Alan Gilbert
2015-03-26 1:31 ` David Gibson
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 34/45] Page request: Consume pages off the post-copy queue Dr. David Alan Gilbert (git)
2015-03-24 2:15 ` David Gibson
2015-06-16 10:48 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 35/45] postcopy_ram.c: place_page and helpers Dr. David Alan Gilbert (git)
2015-03-24 2:33 ` David Gibson
2015-03-25 17:46 ` Dr. David Alan Gilbert
2015-02-25 16:51 ` [Qemu-devel] [PATCH v5 36/45] Postcopy: Use helpers to map pages during migration Dr. David Alan Gilbert (git)
2015-03-24 4:51 ` David Gibson
2015-02-25 16:52 ` [Qemu-devel] [PATCH v5 37/45] qemu_ram_block_from_host Dr. David Alan Gilbert (git)
2015-03-24 4:55 ` David Gibson
2015-02-25 16:52 ` [Qemu-devel] [PATCH v5 38/45] Don't sync dirty bitmaps in postcopy Dr. David Alan Gilbert (git)
2015-03-24 4:58 ` David Gibson
2015-03-24 9:05 ` Dr. David Alan Gilbert
2015-02-25 16:52 ` [Qemu-devel] [PATCH v5 39/45] Host page!=target page: Cleanup bitmaps Dr. David Alan Gilbert (git)
2015-03-24 5:23 ` David Gibson
2015-02-25 16:52 ` [Qemu-devel] [PATCH v5 40/45] Postcopy; Handle userfault requests Dr. David Alan Gilbert (git)
2015-03-24 5:38 ` David Gibson
2015-03-26 11:59 ` Dr. David Alan Gilbert
2015-02-25 16:52 ` [Qemu-devel] [PATCH v5 41/45] Start up a postcopy/listener thread ready for incoming page data Dr. David Alan Gilbert (git)
2015-02-25 16:52 ` [Qemu-devel] [PATCH v5 42/45] postcopy: Wire up loadvm_postcopy_handle_{run, end} commands Dr. David Alan Gilbert (git)
2015-02-25 16:52 ` [Qemu-devel] [PATCH v5 43/45] End of migration for postcopy Dr. David Alan Gilbert (git)
2015-02-25 16:52 ` [Qemu-devel] [PATCH v5 44/45] Disable mlock around incoming postcopy Dr. David Alan Gilbert (git)
2015-03-23 4:33 ` David Gibson
2015-02-25 16:52 ` [Qemu-devel] [PATCH v5 45/45] Inhibit ballooning during postcopy Dr. David Alan Gilbert (git)
2015-03-23 4:32 ` David Gibson
2015-03-23 12:21 ` Dr. David Alan Gilbert
2015-03-24 1:25 ` David Gibson
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=20150313111905.GC2486@work-vm \
--to=dgilbert@redhat.com \
--cc=aarcange@redhat.com \
--cc=amit.shah@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=yamahata@private.email.ne.jp \
--cc=yanghy@cn.fujitsu.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).