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

Re: [Xen-devel] [PATCH] support 1gb pages in guest page table walker



Hi, 

Thanks for this.  Do you have a matching patch that enables 1GB mappings
in the appropriate guests?

At 11:46 +0200 on 25 Jul (1311594401), Christoph Egger wrote:
> +#if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */
> +    pse1G = (guest_supports_1G_superpages(v) && 
> +           (guest_l3e_get_flags(gw->l3e) & _PAGE_PSE)); 
> +
> +    if ( pse1G )
> +    {
> +        /* Special case: this guest VA is in a PSE superpage, so there's
> +         * no guest l1e.  We make one up so that the propagation code
> +         * can generate a shadow l1 table.  Start with the gfn of the 
> +         * first 4k-page of the superpage. */

Shadow pagetables don't support 1GB mappings, so this comment needs to
be updated to say why you're making the fake l1e (basically as a vehicle
for the GFN of the target frame).

> +        gfn_t start = guest_l2e_get_gfn(gw->l2e);
> +        /* Grant full access in the l1e, since all the guest entry's 
> +         * access controls are enforced in the shadow l2e. */
> +        int flags = (_PAGE_PRESENT|_PAGE_USER|_PAGE_RW|
> +                     _PAGE_ACCESSED|_PAGE_DIRTY);
> +        /* Import cache-control bits. Note that _PAGE_PAT is actually
> +         * _PAGE_PSE, and it is always set. We will clear it in case
> +         * _PAGE_PSE_PAT (bit 12, i.e. first bit of gfn) is clear. */
> +        flags |= (guest_l2e_get_flags(gw->l2e)
> +                  & (_PAGE_PAT|_PAGE_PWT|_PAGE_PCD));

You should be taking these from the l3e, not the l2e.  Also, you should
probably do it before the code that maps the l2 table. :)

> diff -r 4f2c59fb28e6 xen/include/asm-x86/guest_pt.h
> --- a/xen/include/asm-x86/guest_pt.h  Mon Jul 18 11:43:45 2011 +0200
> +++ b/xen/include/asm-x86/guest_pt.h  Mon Jul 25 11:43:36 2011 +0200
> @@ -194,6 +194,17 @@ guest_supports_superpages(struct vcpu *v
>  }
>  
>  static inline int
> +guest_supports_1G_superpages(struct vcpu *v)
> +{
> +    if (!guest_supports_superpages(v))
> +        return 0;
> +
> +    return (GUEST_PAGING_LEVELS >= 4
> +           && cpu_has_page1gb
> +           && hvm_long_mode_enabled(v));

There needs to be some interlock to make sure this returns false for
all guests except HVM HAP ones.  

Also this function should be called from the CPUID trap handler to make
sure we never advertise PSE1GB when we're not going to support it.  
(I think that involves moving it out of this header file -- it should
probably go into hvm.h and be renamed to match the hvm_*_enabled macros
already there.)

Cheers,

Tim.

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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