[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3] x86: do not enable global pages when virtualized on AMD hardware



On Wed, Dec 04, 2019 at 05:11:42PM +0100, Jan Beulich wrote:
> On 04.12.2019 16:12, Roger Pau Monne wrote:
> > --- a/xen/arch/x86/pv/domain.c
> > +++ b/xen/arch/x86/pv/domain.c
> > @@ -118,6 +118,19 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v, 
> > unsigned long cr4)
> >              (mmu_cr4_features & PV_CR4_GUEST_VISIBLE_MASK));
> >  }
> >  
> > +static int8_t __read_mostly opt_global_pages = -1;
> > +boolean_runtime_param("global-pages", opt_global_pages);
> > +
> > +static int __init pge_init(void)
> > +{
> > +    if ( opt_global_pages == -1 )
> > +        opt_global_pages = !cpu_has_hypervisor ||
> > +                           boot_cpu_data.x86_vendor != X86_VENDOR_AMD;
> > +
> > +    return 0;
> > +}
> > +__initcall(pge_init);
> > +
> >  unsigned long pv_make_cr4(const struct vcpu *v)
> >  {
> >      const struct domain *d = v->domain;
> > @@ -130,7 +143,7 @@ unsigned long pv_make_cr4(const struct vcpu *v)
> >       */
> >      if ( d->arch.pv.pcid )
> >          cr4 |= X86_CR4_PCIDE;
> > -    else if ( !d->arch.pv.xpti )
> > +    else if ( !d->arch.pv.xpti && opt_global_pages )
> >          cr4 |= X86_CR4_PGE;
> 
> I'm sorry for noticing this only now, but what about XEN_MINIMAL_CR4,
> which includes X86_CR4_PGE?

I've tried removing PGE from XEN_MINIMAL_CR4 but it made no noticeable
performance difference, so I left it as-is.

> 
> I also have to admit I'm still feeling uneasy about the runtime
> adjustment you permit. I can't point at anything that's wrong in this
> regard, but anyway.

Feel free to change boolean_runtime_param into boolean_param. I think
allowing runtime changes is fine because the flush takes into account
the current CR4, but maybe there are corner cases I'm not aware of.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.