From: Laurent Vivier <lvivier@redhat.com>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>,
Juan Quintela <quintela@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 2/2] migration: allow machine to enforce configuration section migration
Date: Thu, 18 Feb 2016 20:57:57 +0100 [thread overview]
Message-ID: <56C62245.5000703@redhat.com> (raw)
In-Reply-To: <20160218113224.9760.37802.stgit@bahia.huguette.org>
On 18/02/2016 12:32, Greg Kurz wrote:
> Migration of pseries-2.3 doesn't have configuration section. Unfortunately,
> QEMU 2.4/2.4.1/2.5 are buggy and always stream and expect the configuration
> section, and break migration both ways.
>
> This patch introduces a property which allows to enforce a configuration
> section for machines who don't have one.
>
> It can be set at startup:
>
> -machine enforce-config-section=on
>
> or later from the QEMU monitor:
>
> qom-set /machine enforce-config-section on
>
> It is up to the tooling to set or unset this property according to the
> version of the QEMU at the other end of the pipe.
>
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> ---
> hw/core/machine.c | 21 +++++++++++++++++++++
> include/hw/boards.h | 1 +
> migration/savevm.c | 10 ++++++++--
> qemu-options.hx | 3 ++-
> 4 files changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 6d1a0d8eebc4..a8c4680b0c47 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -312,6 +312,21 @@ static bool machine_get_suppress_vmdesc(Object *obj, Error **errp)
> return ms->suppress_vmdesc;
> }
>
> +static void machine_set_enforce_config_section(Object *obj, bool value,
> + Error **errp)
> +{
> + MachineState *ms = MACHINE(obj);
> +
> + ms->enforce_config_section = value;
> +}
> +
> +static bool machine_get_enforce_config_section(Object *obj, Error **errp)
> +{
> + MachineState *ms = MACHINE(obj);
> +
> + return ms->enforce_config_section;
> +}
> +
> static int error_on_sysbus_device(SysBusDevice *sbdev, void *opaque)
> {
> error_report("Option '-device %s' cannot be handled by this machine",
> @@ -467,6 +482,12 @@ static void machine_initfn(Object *obj)
> object_property_set_description(obj, "suppress-vmdesc",
> "Set on to disable self-describing migration",
> NULL);
> + object_property_add_bool(obj, "enforce-config-section",
> + machine_get_enforce_config_section,
> + machine_set_enforce_config_section, NULL);
> + object_property_set_description(obj, "enforce-config-section",
> + "Set on to enforce configuration section migration",
> + NULL);
>
> /* Register notifier when init is done for sysbus sanity checks */
> ms->sysbus_notifier.notify = machine_init_notify;
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 0f30959e2e3b..cfdf8d10cfcd 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -128,6 +128,7 @@ struct MachineState {
> char *firmware;
> bool iommu;
> bool suppress_vmdesc;
> + bool enforce_config_section;
>
> ram_addr_t ram_size;
> ram_addr_t maxram_size;
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 94f2894243ce..2fc57363674f 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -878,13 +878,19 @@ bool qemu_savevm_state_blocked(Error **errp)
> return false;
> }
>
> +static bool enforce_config_section(void)
> +{
> + MachineState *machine = MACHINE(qdev_get_machine());
> + return machine->enforce_config_section;
> +}
> +
> void qemu_savevm_state_header(QEMUFile *f)
> {
> trace_savevm_state_header();
> qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
> qemu_put_be32(f, QEMU_VM_FILE_VERSION);
>
> - if (!savevm_state.skip_configuration) {
> + if (!savevm_state.skip_configuration || enforce_config_section()) {
> qemu_put_byte(f, QEMU_VM_CONFIGURATION);
> vmstate_save_state(f, &vmstate_configuration, &savevm_state, 0);
> }
> @@ -1875,7 +1881,7 @@ int qemu_loadvm_state(QEMUFile *f)
> return -ENOTSUP;
> }
>
> - if (!savevm_state.skip_configuration) {
> + if (!savevm_state.skip_configuration || enforce_config_section()) {
> if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
> error_report("Configuration section missing");
> return -EINVAL;
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 2f0465eeb1d1..8d81e310f2bf 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -43,7 +43,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
> " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n"
> " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n"
> " suppress-vmdesc=on|off disables self-describing migration (default=off)\n"
> - " nvdimm=on|off controls NVDIMM support (default=off)\n",
> + " nvdimm=on|off controls NVDIMM support (default=off)\n"
> + " enforce-config-section=on|off enforce configuration section migration (default=off)\n",
> QEMU_ARCH_ALL)
> STEXI
> @item -machine [type=]@var{name}[,prop=@var{value}[,...]]
>
next prev parent reply other threads:[~2016-02-18 19:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 11:32 [Qemu-devel] [PATCH v3 0/2] Fix migration of old pseries Greg Kurz
2016-02-18 11:32 ` [Qemu-devel] [PATCH v3 1/2] spapr: skip configuration section during migration of older machines Greg Kurz
2016-02-18 19:57 ` Laurent Vivier
2016-02-23 8:23 ` Juan Quintela
2016-02-18 11:32 ` [Qemu-devel] [PATCH v3 2/2] migration: allow machine to enforce configuration section migration Greg Kurz
2016-02-18 19:57 ` Laurent Vivier [this message]
2016-02-23 8:24 ` Juan Quintela
2016-02-18 20:00 ` [Qemu-devel] [PATCH v3 0/2] Fix migration of old pseries Laurent Vivier
2016-02-19 6:42 ` Greg Kurz
2016-02-19 0:11 ` David Gibson
2016-02-19 7:59 ` Greg Kurz
2016-02-22 1:09 ` David Gibson
2016-02-26 10:49 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-02-26 11:03 ` David Gibson
2016-02-23 8:31 ` [Qemu-devel] " Juan Quintela
2016-02-23 10:01 ` Greg Kurz
2016-02-23 12:27 ` Greg Kurz
2016-02-19 14:41 ` Laurent Vivier
2016-02-19 16:27 ` Greg Kurz
2016-02-23 15:04 ` Greg Kurz
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=56C62245.5000703@redhat.com \
--to=lvivier@redhat.com \
--cc=amit.shah@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=dgilbert@redhat.com \
--cc=gkurz@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=quintela@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.