From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c3z4X-0000Hu-Qh for qemu-devel@nongnu.org; Tue, 08 Nov 2016 00:35:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c3z4W-0002Fr-GC for qemu-devel@nongnu.org; Tue, 08 Nov 2016 00:35:49 -0500 Date: Tue, 8 Nov 2016 16:19:50 +1100 From: David Gibson Message-ID: <20161108051950.GT28688@umbus.fritz.box> References: <1477825928-10803-1-git-send-email-david@gibson.dropbear.id.au> <1477825928-10803-13-git-send-email-david@gibson.dropbear.id.au> <761e90db-fce0-1533-d5db-e97d188bb949@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pnDjx0H/VpusRTEI" Content-Disposition: inline In-Reply-To: <761e90db-fce0-1533-d5db-e97d188bb949@ozlabs.ru> Subject: Re: [Qemu-devel] [RFC 12/17] ppc: Migrate compatibility mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: nikunj@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com, thuth@redhat.com, lvivier@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org --pnDjx0H/VpusRTEI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 04, 2016 at 04:58:47PM +1100, Alexey Kardashevskiy wrote: > On 30/10/16 22:12, David Gibson wrote: > > Server-class POWER CPUs can be put into several compatibility modes. T= hese > > can be specified on the command line, or negotiated by the guest during > > boot. > >=20 > > Currently we don't migrate the compatibility mode, which means after a > > migration the guest will revert to running with whatever compatibility > > mode (or none) specified on the command line. > >=20 > > With the limited range of CPUs currently used, this doesn't usually cau= se > > a problem, but it could. Fix this by adding the compatibility mode (if > > set) to the migration stream. > >=20 > > Signed-off-by: David Gibson > > --- > > target-ppc/machine.c | 34 ++++++++++++++++++++++++++++++++++ > > 1 file changed, 34 insertions(+) > >=20 > > diff --git a/target-ppc/machine.c b/target-ppc/machine.c > > index 4820f22..5d87ff6 100644 > > --- a/target-ppc/machine.c > > +++ b/target-ppc/machine.c > > @@ -9,6 +9,7 @@ > > #include "mmu-hash64.h" > > #include "migration/cpu.h" > > #include "exec/exec-all.h" > > +#include "qapi/error.h" > > =20 > > static int cpu_load_old(QEMUFile *f, void *opaque, int version_id) > > { > > @@ -176,6 +177,20 @@ static int cpu_post_load(void *opaque, int version= _id) > > * software has to take care of running QEMU in a compatible mode. > > */ > > env->spr[SPR_PVR] =3D env->spr_cb[SPR_PVR].default_value; > > + > > +#if defined(TARGET_PPC64) > > + if (cpu->compat_pvr) { > > + Error *local_err =3D NULL; > > + > > + ppc_set_compat(cpu, cpu->compat_pvr, &local_err); > > + if (local_err) { > > + error_report_err(local_err); > > + error_free(local_err); > > + return -1; > > + } > > + } > > +#endif > > + > > env->lr =3D env->spr[SPR_LR]; > > env->ctr =3D env->spr[SPR_CTR]; > > cpu_write_xer(env, env->spr[SPR_XER]); > > @@ -528,6 +543,24 @@ static const VMStateDescription vmstate_tlbmas =3D= { > > } > > }; > > =20 > > +static bool compat_needed(void *opaque) > > +{ > > + PowerPCCPU *cpu =3D opaque; > > + > > + return cpu->compat_pvr !=3D 0; >=20 >=20 > Finally got to trying how this affects migration :) >=20 > This breaks migration to QEMU <=3D2.7, and it should not at least when bo= th > source and destination are running with -cpu host,compat=3Dpower7. IIUC, we don't generally try to maintain backwards migration, even for old machine types. >=20 >=20 > > +} > > + > > +static const VMStateDescription vmstate_compat =3D { > > + .name =3D "cpu/compat", > > + .version_id =3D 1, > > + .minimum_version_id =3D 1, > > + .needed =3D compat_needed, > > + .fields =3D (VMStateField[]) { > > + VMSTATE_UINT32(compat_pvr, PowerPCCPU), > > + VMSTATE_END_OF_LIST() > > + } > > +}; > > + > > const VMStateDescription vmstate_ppc_cpu =3D { > > .name =3D "cpu", > > .version_id =3D 5, > > @@ -580,6 +613,7 @@ const VMStateDescription vmstate_ppc_cpu =3D { > > &vmstate_tlb6xx, > > &vmstate_tlbemb, > > &vmstate_tlbmas, > > + &vmstate_compat, > > NULL > > } > > }; > >=20 >=20 >=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 --pnDjx0H/VpusRTEI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYIWB2AAoJEGw4ysog2bOSXrcQAI8mM8ys8DLC47lbB2TvPVG5 dCo2++kd9B8Pcr0XvMi4tMUknVg8wJp0Up5m4DRet25bjkLl1bmC4F+uHJEkMvIP upBUfvDrVOEUDVTIoYcwJ0tuHhBXnIg0iz9EYj71hxkqpW8h8IVUStd+/3Ctzmmm LWb3bZDNriZFNrxZpFuKZqCo2Z+IxdALcXARA5kJz0wyRKyq0YQCKmt+ygKcr47q DHbgei618kX4ZznLvOTaXEq4WJfTHK8/XVKhLWC6uKHFIIuOrZRPDaVGZQdY1z3S 3OwBDJ8RiGgkgkE1hYTD+8oKSH5jtV28pBdxyULY+ePklaKNAUaRZsJglR5gSEUq 96OEWsst5yUhVegXuI8CNj+1aNIiPGYR+d+rGRC5B7cljFfXe+50sdsNze3pZRkY oE2QE07jgZyXaQIaTAOh2tGJ+ccyhJP6U60Cw5ygCTHOpLQ4Zl9Zqv+8yhHbxaGR WLCSoM4bK37XP/djqiKgDkyrVuDjcPIqL+gBbdZUwz+rocR1DxT2e0OzquVlU35y mJfVlISLbxFVe3ogsswZp4/0FTLTBO0SE/VKTsVq3eUvuPCmCrmNAEy2FbyUInk7 TWZYfIAutZ7FhZnMuDuvhoChKNo/mt7VwS2L2D0J8qYu1jHLFurcBQgAhM6JHP0d 2Jbw/6VADv5l2yj/ZxLJ =ZY2q -----END PGP SIGNATURE----- --pnDjx0H/VpusRTEI--