From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
"Laurent Vivier" <lvivier@redhat.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Suraj Jitindar Singh" <sjitindarsingh@gmail.com>,
"Bharata B Rao" <bharata@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] target/ppc: always set PPC_MEM_TLBIE in pre 2.8 migration hack
Date: Fri, 4 May 2018 16:01:01 +1000 [thread overview]
Message-ID: <20180504060101.GY13229@umbus.fritz.box> (raw)
In-Reply-To: <20180504075419.4eb70618@bahia.lan>
[-- Attachment #1: Type: text/plain, Size: 3315 bytes --]
On Fri, May 04, 2018 at 07:54:19AM +0200, Greg Kurz wrote:
> On Fri, 4 May 2018 10:12:23 +1000
> David Gibson <david@gibson.dropbear.id.au> wrote:
>
> > On Thu, May 03, 2018 at 11:16:29PM +0200, Greg Kurz wrote:
> > > The pseries-2.7 and older machine types require CPUPPCState::insns_flags
> > > to be strictly equal between source and destination. This checking is
> > > abusive and breaks migration of KVM guests when the host CPU models
> > > are different, even if they are compatible enough to allow the guest
> > > to run transparently. This buggy behaviour was fixed for pseries-2.8
> > > and we added some hacks to allow backward migration of older machine
> > > types. These hacks assume that the CPU belongs to the POWER8 family,
> > > which was true for most KVM based setup we cared about at the time.
> > > But now POWER9 systems are coming, and backward migration of pre 2.8
> > > guests running in POWER8 architected mode from a POWER9 host to a
> > > POWER8 host is broken:
> > >
> > > qemu-system-ppc64: error while loading state for instance 0x0 of device
> > > 'cpu'
> > > qemu-system-ppc64: load of migration failed: Invalid argument
> > >
> > > This happens because POWER9 doesn't set PPC_MEM_TLBIE in insns_flags,
> > > while POWER8 does. Let's force PPC_MEM_TLBIE in the migration hack to
> > > fix the issue. This is an acceptable hack because these old machine
> > > types only support CPU models that do set PPC_MEM_TLBIE.
> > >
> > > Signed-off-by: Greg Kurz <groug@kaod.org>
> > > ---
> > > target/ppc/machine.c | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > >
> > > diff --git a/target/ppc/machine.c b/target/ppc/machine.c
> > > index 3d6434a006fa..ba1b9e531f97 100644
> > > --- a/target/ppc/machine.c
> > > +++ b/target/ppc/machine.c
> > > @@ -212,6 +212,11 @@ static int cpu_pre_save(void *opaque)
> > > ;
> > > cpu->mig_msr_mask = env->msr_mask & ~metamask;
> > > cpu->mig_insns_flags = env->insns_flags & insns_compat_mask;
> > > + /* CPU models supported by old machines all have PPC_MEM_TLBIE,
> > > + * so we set it unconditionally to allow backward migration from
> > > + * a POWER9 host to a POWER8 host.
> >
> > So.. the comment's slightly misleading. This code is common to all
> > cpus, not just those used on pseries, so across that set it's not
> > really accurate. But pseries is the only machine we support migration
> > to/from old versions with so it doesn't really matter.
>
> Oh... I was assuming that we only supported migration for pseries
> machine, irrespective of the versions.
Actually, that's probably true. Although there are a couple where it
might just about work. pseries is *definitely* the only one that we
properly check and care about cross-version compatibility though.
>
> > > + */
> > > + cpu->mig_insns_flags |= PPC_MEM_TLBIE;
> > > cpu->mig_insns_flags2 = env->insns_flags2 & insns_compat_mask2;
> > > cpu->mig_nb_BATs = env->nb_BATs;
> > > }
> > >
> >
>
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-05-04 6:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 21:16 [Qemu-devel] [PATCH 0/3] spapr: fix backward migration from POWER9 to POWER8 hosts Greg Kurz
2018-05-03 21:16 ` [Qemu-devel] [PATCH 1/3] target/ppc: always set PPC_MEM_TLBIE in pre 2.8 migration hack Greg Kurz
2018-05-04 0:12 ` David Gibson
2018-05-04 5:54 ` Greg Kurz
2018-05-04 6:01 ` David Gibson [this message]
2018-05-03 21:16 ` [Qemu-devel] [PATCH 2/3] spapr: don't migrate "spapr_option_vector_ov5_cas" to pre 2.8 machines Greg Kurz
2018-05-03 21:16 ` [Qemu-devel] [PATCH 3/3] spapr: don't advertise radix GTSE if max-compat-cpu < power9 Greg Kurz
2018-05-04 0:11 ` [Qemu-devel] [PATCH 0/3] spapr: fix backward migration from POWER9 to POWER8 hosts David Gibson
2018-05-04 5:58 ` Greg Kurz
2018-05-04 6:37 ` David Gibson
2018-05-04 7:01 ` 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=20180504060101.GY13229@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=bharata@linux.vnet.ibm.com \
--cc=clg@kaod.org \
--cc=groug@kaod.org \
--cc=lvivier@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sjitindarsingh@gmail.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).