On Fri, 22 Jun 2018 00:01:13 +1000 David Gibson <da...@gibson.dropbear.id.au> wrote:
> On Thu, Jun 21, 2018 at 02:24:19PM +0200, Greg Kurz wrote: > > On Mon, 18 Jun 2018 16:36:05 +1000 > > David Gibson <da...@gibson.dropbear.id.au> wrote: > > > > > KVM HV has some limitations (deriving from the hardware) that mean not all > > > host-cpu supported pagesizes may be usable in the guest. At present this > > > means that KVM guests and TCG guests may see different available page > > > sizes > > > even if they notionally have the same vcpu model. This is confusing and > > > also prevents migration between TCG and KVM. > > > > > > This patch makes the environment consistent by always allowing the same > > > set > > > of pagesizes. Since we can't remove the KVM limitations, we do this by > > > always applying the same limitations it has, even to TCG guests. > > > > > > Signed-off-by: David Gibson <da...@gibson.dropbear.id.au> > > > --- > > > hw/ppc/spapr_caps.c | 33 +++++++++++++++++++++++++++++++++ > > > 1 file changed, 33 insertions(+) > > > > > > diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c > > > index 9fc739b3f5..0584c7c6ab 100644 > > > --- a/hw/ppc/spapr_caps.c > > > +++ b/hw/ppc/spapr_caps.c > > > @@ -334,6 +334,38 @@ static void > > > cap_hpt_maxpagesize_apply(sPAPRMachineState *spapr, > > > spapr_check_pagesize(spapr, qemu_getrampagesize(), errp); > > > } > > > > > > +static bool spapr_pagesize_cb(void *opaque, uint32_t seg_pshift, > > > uint32_t pshift) > > > +{ > > > + unsigned maxshift = *((unsigned *)opaque); > > > + > > > + assert(pshift >= seg_pshift); > > > + > > > + /* Don't allow the guest to use pages bigger than the configured > > > + * maximum size */ > > > + if (pshift > maxshift) { > > > + return false; > > > + } > > > + > > > + /* For whatever reason, KVM doesn't allow multiple pagesizes > > > + * within a segment, *except* for the case of 16M pages in a 4k or > > > + * 64k segment. Always exclude other cases, so that TCG and KVM > > > + * guests see a consistent environment */ > > > > Unless I'm missing something, I don't see how we could get "other cases" > > with TCG, at least with the current content of ppc_hash64_opts_POWER7. > > You're missing something. hash64_opts_POWER7 includes 64k pages in a > segment with base page size of 4k. > /me should read more carefully... :( Reviewed-by: Greg Kurz <gr...@kaod.org>
pgpoWmBAANESC.pgp
Description: OpenPGP digital signature