qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: mdroth@linux.vnet.ibm.com, dgilbert@redhat.com,
	lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org,
	qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCHv2 3/5] target-ppc: Allow eventual removal of old migration mistakes
Date: Mon, 21 Nov 2016 16:26:10 +0100	[thread overview]
Message-ID: <20161121162610.577472c2@bahia> (raw)
In-Reply-To: <1479706302-2251-4-git-send-email-david@gibson.dropbear.id.au>

On Mon, 21 Nov 2016 16:31:40 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> Until very recently, the vmstate for ppc cpus included some poorly
> thought out VMSTATE_EQUAL() components, that can easily break
> migration compatibility, and did so between qemu-2.6 and later
> versions.  A hack was recently added which fixes this migration
> breakage, but it leaves the unhelpful cruft of these fields in the
> migration stream.
> 
> dThis patch adds a new cpu property allowing these fields to be
  ^
typo

> removed from the stream entirely.  This property is enabled by default
> for the pseries-2.8 machine type - which comes after the fix - and for
> all non-pseries machine types - which aren't mature enough to care
> about cross-version migration.
> 

It is a bit confusing (at least for me) that "property is enabled" means it is
actually set to off. No big deal though.

> The migration hack remains in place for pseries-2.7 and earlier
> machine types, allowing backwards and forwards migration with the
> older machine types.
> 
> This restricts the migration compatibility cruft to older machine
> types, and at least opens the possibility of eventually deprecating
> and removing it entirely.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/ppc/spapr.c              |  5 +++++
>  target-ppc/cpu.h            |  3 ++-
>  target-ppc/machine.c        | 26 ++++++++++++++++++--------
>  target-ppc/translate_init.c |  6 ++++++
>  4 files changed, 31 insertions(+), 9 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 54b88d3..775ad2e 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2767,6 +2767,11 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", true);
>          .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,     \
>          .property = "mem64_win_size",               \
>          .value    = "0",                            \
> +    },                                              \
> +    {                                               \
> +        .driver = TYPE_POWERPC_CPU,                 \
> +        .property = "pre-2.8-migration",            \
> +        .value    = "on",                           \
>      },
>  
>  static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index,
> diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
> index 7798b2e..2a50c43 100644
> --- a/target-ppc/cpu.h
> +++ b/target-ppc/cpu.h
> @@ -1167,7 +1167,8 @@ struct PowerPCCPU {
>      uint32_t max_compat;
>      uint32_t cpu_version;
>  
> -    /* fields used only during migration for compatibility hacks */
> +    /* Fields related to migration compatibility hacks */
> +    bool pre_2_8_migration;
>      target_ulong mig_msr_mask;
>      uint64_t mig_insns_flags;
>      uint64_t mig_insns_flags2;
> diff --git a/target-ppc/machine.c b/target-ppc/machine.c
> index fcac263..18c16d2 100644
> --- a/target-ppc/machine.c
> +++ b/target-ppc/machine.c
> @@ -135,6 +135,13 @@ static const VMStateInfo vmstate_info_avr = {
>  #define VMSTATE_AVR_ARRAY(_f, _s, _n)                             \
>      VMSTATE_AVR_ARRAY_V(_f, _s, _n, 0)
>  
> +static bool cpu_pre_2_8_migration(void *opaque, int version_id)
> +{
> +    PowerPCCPU *cpu = opaque;
> +
> +    return cpu->pre_2_8_migration;
> +}
> +
>  static void cpu_pre_save(void *opaque)
>  {
>      PowerPCCPU *cpu = opaque;
> @@ -178,10 +185,12 @@ static void cpu_pre_save(void *opaque)
>      }
>  
>      /* Hacks for migration compatibility between 2.6, 2.7 & 2.8 */
> -    cpu->mig_msr_mask = env->msr_mask;
> -    cpu->mig_insns_flags = env->insns_flags & insns_compat_mask;
> -    cpu->mig_insns_flags2 = env->insns_flags2 & insns_compat_mask2;
> -    cpu->mig_nb_BATs = env->nb_BATs;
> +    if (cpu->pre_2_8_migration) {
> +        cpu->mig_msr_mask = env->msr_mask;
> +        cpu->mig_insns_flags = env->insns_flags & insns_compat_mask;
> +        cpu->mig_insns_flags2 = env->insns_flags2 & insns_compat_mask2;
> +        cpu->mig_nb_BATs = env->nb_BATs;
> +    }
>  }
>  
>  static int cpu_post_load(void *opaque, int version_id)
> @@ -582,10 +591,11 @@ const VMStateDescription vmstate_ppc_cpu = {
>          /* FIXME: access_type? */
>  
>          /* Sanity checking */
> -        VMSTATE_UINTTL(mig_msr_mask, PowerPCCPU),
> -        VMSTATE_UINT64(mig_insns_flags, PowerPCCPU),
> -        VMSTATE_UINT64(mig_insns_flags2, PowerPCCPU),
> -        VMSTATE_UINT32(mig_nb_BATs, PowerPCCPU),
> +        VMSTATE_UINTTL_TEST(mig_msr_mask, PowerPCCPU, cpu_pre_2_8_migration),
> +        VMSTATE_UINT64_TEST(mig_insns_flags, PowerPCCPU, cpu_pre_2_8_migration),
> +        VMSTATE_UINT64_TEST(mig_insns_flags2, PowerPCCPU,
> +                            cpu_pre_2_8_migration),
> +        VMSTATE_UINT32_TEST(mig_nb_BATs, PowerPCCPU, cpu_pre_2_8_migration),
>          VMSTATE_END_OF_LIST()
>      },
>      .subsections = (const VMStateDescription*[]) {
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 208fa1e..626e031 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -10520,6 +10520,11 @@ static gchar *ppc_gdb_arch_name(CPUState *cs)
>  #endif
>  }
>  
> +static Property ppc_cpu_properties[] = {
> +    DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU, pre_2_8_migration, false),
> +    DEFINE_PROP_END_OF_LIST(),
> +};
> +
>  static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>  {
>      PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
> @@ -10532,6 +10537,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>      pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_always;
>      dc->realize = ppc_cpu_realizefn;
>      dc->unrealize = ppc_cpu_unrealizefn;
> +    dc->props = ppc_cpu_properties;
>  
>      pcc->parent_reset = cc->reset;
>      cc->reset = ppc_cpu_reset;

  parent reply	other threads:[~2016-11-21 15:26 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21  5:31 [Qemu-devel] [PATCHv2 0/5] Last minute ppc migration fixes David Gibson
2016-11-21  5:31 ` [Qemu-devel] [PATCHv2 1/5] target-ppc: Fix CPU migration from qemu-2.6 <-> later versions David Gibson
2016-11-21 10:12   ` Dr. David Alan Gilbert
2016-11-21 10:41   ` Thomas Huth
2016-11-21 14:14   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-11-22  8:19   ` [Qemu-devel] " Alexey Kardashevskiy
2016-11-22 23:28     ` David Gibson
2016-11-21  5:31 ` [Qemu-devel] [PATCHv2 2/5] migration: Add VMSTATE_UINTTL_TEST() David Gibson
2016-11-21 10:02   ` Dr. David Alan Gilbert
2016-11-21 10:43   ` Thomas Huth
2016-11-21 14:16   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-11-21  5:31 ` [Qemu-devel] [PATCHv2 3/5] target-ppc: Allow eventual removal of old migration mistakes David Gibson
2016-11-21 10:24   ` Dr. David Alan Gilbert
2016-11-21 10:47   ` Thomas Huth
2016-11-21 15:26   ` Greg Kurz [this message]
2016-11-21 23:11     ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-11-22  8:32   ` [Qemu-devel] " Alexey Kardashevskiy
2016-11-21  5:31 ` [Qemu-devel] [PATCHv2 4/5] Revert "spapr: Fix migration of PCI host bridges from qemu-2.7" David Gibson
2016-11-21 10:51   ` Thomas Huth
2016-11-21 15:27   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-11-22  8:33   ` [Qemu-devel] " Alexey Kardashevskiy
2016-11-21  5:31 ` [Qemu-devel] [PATCHv2 5/5] spapr: Fix 2.7<->2.8 migration of PCI host bridge David Gibson
2016-11-21 10:43   ` Dr. David Alan Gilbert
2016-11-21 12:02   ` Thomas Huth
2016-11-21 16:02     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-11-21 23:15       ` David Gibson
2016-11-22  9:42         ` Greg Kurz
2016-11-22  8:17   ` [Qemu-devel] " Alexey Kardashevskiy
2016-11-23  0:17     ` David Gibson
2016-11-23  2:28       ` Alexey Kardashevskiy

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=20161121162610.577472c2@bahia \
    --to=groug@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --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 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).