From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Anthony PERARD <anthony.perard@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu list <qemu-devel@nongnu.org>,
Anthony PERARD <anthony.perard@citrix.com>
Subject: Re: [Qemu-devel] [PULL for-2.4 2/3] migration: Fix global state with Xen.
Date: Mon, 3 Aug 2015 13:50:12 +0100 [thread overview]
Message-ID: <20150803125011.GB2362@work-vm> (raw)
In-Reply-To: <9c7292fe59f31cc3296c15a5b693867fbabe9fad.1438605827.git.amit.shah@redhat.com>
* Amit Shah (amit.shah@redhat.com) wrote:
> From: Anthony PERARD <anthony.perard@gmail.com>
>
> When doing migration via the QMP command xen_save_devices_state, the
> current runstate is not store into the global state section. Also the
> current runstate is not the one we want on the receiver side.
>
> During migration, the Xen toolstack paused QEMU before save the devices
> state. Also, the toolstack expect QEMU to autostart when the migration is
> finished.
> So this patch store "running" as it's current runstate.
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Message-Id: <1438098885-4339-3-git-send-email-anthony.perard@citrix.com>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
> include/migration/migration.h | 1 +
> migration/migration.c | 7 +++++++
> migration/savevm.c | 1 +
> 3 files changed, 9 insertions(+)
>
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index a2f8ed0..8334621 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -203,4 +203,5 @@ void register_global_state(void);
> void global_state_set_optional(void);
> void savevm_skip_configuration(void);
> int global_state_store(void);
> +void global_state_store_running(void);
> #endif
> diff --git a/migration/migration.c b/migration/migration.c
> index fd4f99b..175a397 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -122,6 +122,13 @@ int global_state_store(void)
> return 0;
> }
>
> +void global_state_store_running(void)
> +{
> + const char *state = RunState_lookup[RUN_STATE_RUNNING];
> + memcpy((char *)global_state.runstate,
> + state, sizeof(global_state.runstate));
> +}
As mentioned previously, I think that needs to be a strcpy,
NOT a memcpy; the RuNState_lookup[] array isn't guaranteed to
be long enough to fulfill that memcpy.
Dave
> +
> static bool global_state_received(void)
> {
> return global_state.received;
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 81dbe58..6071215 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1394,6 +1394,7 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp)
>
> saved_vm_running = runstate_is_running();
> vm_stop(RUN_STATE_SAVE_VM);
> + global_state_store_running();
>
> f = qemu_fopen(filename, "wb");
> if (!f) {
> --
> 2.4.3
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2015-08-03 12:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-03 12:44 [Qemu-devel] [PULL for-2.4 0/3] Regression fix for migration on Xen Amit Shah
2015-08-03 12:44 ` [Qemu-devel] [PULL for-2.4 1/3] migration: Fix regretion for xenfv machine Amit Shah
2015-08-03 12:44 ` [Qemu-devel] [PULL for-2.4 2/3] migration: Fix global state with Xen Amit Shah
2015-08-03 12:50 ` Dr. David Alan Gilbert [this message]
2015-08-03 12:45 ` [Qemu-devel] [PULL for-2.4 3/3] migration: Add configuration section to vmstate with xen Amit Shah
2015-08-03 13:09 ` [Qemu-devel] [PULL for-2.4 0/3] Regression fix for migration on Xen Anthony PERARD
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=20150803125011.GB2362@work-vm \
--to=dgilbert@redhat.com \
--cc=amit.shah@redhat.com \
--cc=anthony.perard@citrix.com \
--cc=anthony.perard@gmail.com \
--cc=peter.maydell@linaro.org \
--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 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).