ia64/xen-unstable

changeset 18700:96d8b7f40dc7

x86, hap: Track max_mapped_pfn better when using 2MB p2m mappings.

The test for when to increase it was not quite right; also on EPT
the value it was set to didn't count the top 511 frames.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Oct 22 11:58:20 2008 +0100 (2008-10-22)
parents 066c84c7018a
children 007a5df1d45b
files xen/arch/x86/mm/hap/p2m-ept.c xen/arch/x86/mm/p2m.c
line diff
     1.1 --- a/xen/arch/x86/mm/hap/p2m-ept.c	Wed Oct 22 11:56:44 2008 +0100
     1.2 +++ b/xen/arch/x86/mm/hap/p2m-ept.c	Wed Oct 22 11:58:20 2008 +0100
     1.3 @@ -157,9 +157,6 @@ ept_set_entry(struct domain *d, unsigned
     1.4      {
     1.5          if ( mfn_valid(mfn_x(mfn)) || (p2mt == p2m_mmio_direct) )
     1.6          {
     1.7 -            /* Track the highest gfn for which we have ever had a valid mapping */
     1.8 -            if ( gfn > d->arch.p2m->max_mapped_pfn )
     1.9 -                d->arch.p2m->max_mapped_pfn = gfn;
    1.10              ept_entry->emt = epte_get_entry_emt(d, gfn, mfn_x(mfn));
    1.11              ept_entry->sp_avail = walk_level ? 1 : 0;
    1.12  
    1.13 @@ -234,6 +231,11 @@ ept_set_entry(struct domain *d, unsigned
    1.14          unmap_domain_page(split_table);
    1.15      }
    1.16  
    1.17 +    /* Track the highest gfn for which we have ever had a valid mapping */
    1.18 +    if ( mfn_valid(mfn_x(mfn))
    1.19 +         && (gfn + (1UL << order) - 1 > d->arch.p2m->max_mapped_pfn) )
    1.20 +        d->arch.p2m->max_mapped_pfn = gfn + (1UL << order) - 1;
    1.21 +
    1.22      /* Success */
    1.23      rv = 1;
    1.24  
     2.1 --- a/xen/arch/x86/mm/p2m.c	Wed Oct 22 11:56:44 2008 +0100
     2.2 +++ b/xen/arch/x86/mm/p2m.c	Wed Oct 22 11:58:20 2008 +0100
     2.3 @@ -322,7 +322,8 @@ p2m_set_entry(struct domain *d, unsigned
     2.4      }
     2.5  
     2.6      /* Track the highest gfn for which we have ever had a valid mapping */
     2.7 -    if ( mfn_valid(mfn) && (gfn > d->arch.p2m->max_mapped_pfn) )
     2.8 +    if ( mfn_valid(mfn) 
     2.9 +         && (gfn + (1UL << page_order) - 1 > d->arch.p2m->max_mapped_pfn) )
    2.10          d->arch.p2m->max_mapped_pfn = gfn + (1UL << page_order) - 1;
    2.11  
    2.12      if ( iommu_enabled && (is_hvm_domain(d) || need_iommu(d)) )