From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8yYr-0007LN-H8 for qemu-devel@nongnu.org; Mon, 21 Nov 2016 19:03:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c8yYo-000852-BG for qemu-devel@nongnu.org; Mon, 21 Nov 2016 19:03:45 -0500 Date: Tue, 22 Nov 2016 10:11:05 +1100 From: David Gibson Message-ID: <20161121231105.GD8681@umbus.fritz.box> References: <1479706302-2251-1-git-send-email-david@gibson.dropbear.id.au> <1479706302-2251-4-git-send-email-david@gibson.dropbear.id.au> <20161121162610.577472c2@bahia> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="P+33d92oIH25kiaB" Content-Disposition: inline In-Reply-To: <20161121162610.577472c2@bahia> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCHv2 3/5] target-ppc: Allow eventual removal of old migration mistakes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: mdroth@linux.vnet.ibm.com, dgilbert@redhat.com, lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org --P+33d92oIH25kiaB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 21, 2016 at 04:26:10PM +0100, Greg Kurz wrote: > On Mon, 21 Nov 2016 16:31:40 +1100 > David Gibson wrote: >=20 > > 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. > >=20 > > dThis patch adds a new cpu property allowing these fields to be > ^ > typo Oops, fixed. > > 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. > >=20 >=20 > It is a bit confusing (at least for me) that "property is enabled" means = it is > actually set to off. No big deal though. Uh, yes, I've reworded this a bit. >=20 > > The migration hack remains in place for pseries-2.7 and earlier > > machine types, allowing backwards and forwards migration with the > > older machine types. > >=20 > > This restricts the migration compatibility cruft to older machine > > types, and at least opens the possibility of eventually deprecating > > and removing it entirely. > >=20 > > Signed-off-by: David Gibson > > --- >=20 > Reviewed-by: Greg Kurz >=20 > > 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(-) > >=20 > > 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 =3D TYPE_SPAPR_PCI_HOST_BRIDGE, \ > > .property =3D "mem64_win_size", \ > > .value =3D "0", \ > > + }, \ > > + { \ > > + .driver =3D TYPE_POWERPC_CPU, \ > > + .property =3D "pre-2.8-migration", \ > > + .value =3D "on", \ > > }, > > =20 > > 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; > > =20 > > - /* 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 =3D { > > #define VMSTATE_AVR_ARRAY(_f, _s, _n) \ > > VMSTATE_AVR_ARRAY_V(_f, _s, _n, 0) > > =20 > > +static bool cpu_pre_2_8_migration(void *opaque, int version_id) > > +{ > > + PowerPCCPU *cpu =3D opaque; > > + > > + return cpu->pre_2_8_migration; > > +} > > + > > static void cpu_pre_save(void *opaque) > > { > > PowerPCCPU *cpu =3D opaque; > > @@ -178,10 +185,12 @@ static void cpu_pre_save(void *opaque) > > } > > =20 > > /* Hacks for migration compatibility between 2.6, 2.7 & 2.8 */ > > - cpu->mig_msr_mask =3D env->msr_mask; > > - cpu->mig_insns_flags =3D env->insns_flags & insns_compat_mask; > > - cpu->mig_insns_flags2 =3D env->insns_flags2 & insns_compat_mask2; > > - cpu->mig_nb_BATs =3D env->nb_BATs; > > + if (cpu->pre_2_8_migration) { > > + cpu->mig_msr_mask =3D env->msr_mask; > > + cpu->mig_insns_flags =3D env->insns_flags & insns_compat_mask; > > + cpu->mig_insns_flags2 =3D env->insns_flags2 & insns_compat_mas= k2; > > + cpu->mig_nb_BATs =3D env->nb_BATs; > > + } > > } > > =20 > > static int cpu_post_load(void *opaque, int version_id) > > @@ -582,10 +591,11 @@ const VMStateDescription vmstate_ppc_cpu =3D { > > /* FIXME: access_type? */ > > =20 > > /* 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_migr= ation), > > + VMSTATE_UINT64_TEST(mig_insns_flags, PowerPCCPU, cpu_pre_2_8_m= igration), > > + VMSTATE_UINT64_TEST(mig_insns_flags2, PowerPCCPU, > > + cpu_pre_2_8_migration), > > + VMSTATE_UINT32_TEST(mig_nb_BATs, PowerPCCPU, cpu_pre_2_8_migra= tion), > > VMSTATE_END_OF_LIST() > > }, > > .subsections =3D (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 > > } > > =20 > > +static Property ppc_cpu_properties[] =3D { > > + DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU, pre_2_8_migratio= n, false), > > + DEFINE_PROP_END_OF_LIST(), > > +}; > > + > > static void ppc_cpu_class_init(ObjectClass *oc, void *data) > > { > > PowerPCCPUClass *pcc =3D POWERPC_CPU_CLASS(oc); > > @@ -10532,6 +10537,7 @@ static void ppc_cpu_class_init(ObjectClass *oc,= void *data) > > pcc->interrupts_big_endian =3D ppc_cpu_interrupts_big_endian_alway= s; > > dc->realize =3D ppc_cpu_realizefn; > > dc->unrealize =3D ppc_cpu_unrealizefn; > > + dc->props =3D ppc_cpu_properties; > > =20 > > pcc->parent_reset =3D cc->reset; > > cc->reset =3D ppc_cpu_reset; >=20 --=20 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 --P+33d92oIH25kiaB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYM38JAAoJEGw4ysog2bOS9/UP+wV1Lp4Yk5TDvHP9qPMas8a7 N6uTaKwyBWHhTbQRAFPl1Gr3DhnkMqmVt59z+coZEx7HBu/ebcb2W2MY8I7wHhKS K98oQTh/WGn2z9G6vuxvG/nig3aAfrXYmEYL1XKMs0W5nx5jFrE0JW0BMW9mz2NQ qYRM7MTWFxrsRiG9zUr/sGsfNEwgMw1dOVJ1/OY4mKBO4EWX4yJwI44lrXzDF/4n X5ZeyaWFJTzL3KiR50qHhcau9Qo+WH9kGX9W6ptFnAMEv0XLBoGyNymUe0hO//Gt VHEKW/itm0+O6EYAFFxW1b4R0VXaf4sHG/M2uEuNEjdJIz1ooONI56yiUjtSOp8m 2YDs/9YNf2XSyuJOm8Gf2YH3juRp69e6QBZ5Nb3cD0O23YrkVyGe5riHkgedjD1O AmrXOOdI+TtqATOO46AY5L3WMpGG5RucV1pGnWYM2nszenXOhhhYrLOtZFXSuOl7 aDJVBVX5bMqWA6Pir7apAvz02jYitPdliyhoT3W3HuyLYfH420oemX3B6s6kdrkv xfKiyaCv21tuobA83MGF3tW0PTpNaOCWqZ9NMTFkAQ2QW5ZuOFshZsWdvvGw3bFa 0IhwTOI0OFCljp0fkFe9RCN5hx5UzV5pKxmB0fDQUxcKfvBu17P6l3YNfDYUtDs2 ylPMhJ+G4hmcEq6UnktM =aqQF -----END PGP SIGNATURE----- --P+33d92oIH25kiaB--