From: Tim Deegan Subject: [PATCH] Track max_mapped_pfn better when using 2MB p2m mappings. Date: Tue, 21 Oct 2008 12:24:52 +0100 Message-ID: <20081021112452.GP3780@york.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="aZoGpuMECXJckB41" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --aZoGpuMECXJckB41 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline 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 --aZoGpuMECXJckB41 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename=ept-max-pfn diff -r ecc40aae2a8a xen/arch/x86/mm/hap/p2m-ept.c --- a/xen/arch/x86/mm/hap/p2m-ept.c Tue Oct 21 11:23:08 2008 +0100 +++ b/xen/arch/x86/mm/hap/p2m-ept.c Tue Oct 21 11:48:31 2008 +0100 @@ -157,9 +157,6 @@ ept_set_entry(struct domain *d, unsigned { if ( mfn_valid(mfn_x(mfn)) || (p2mt == p2m_mmio_direct) ) { - /* Track the highest gfn for which we have ever had a valid mapping */ - if ( gfn > d->arch.p2m->max_mapped_pfn ) - d->arch.p2m->max_mapped_pfn = gfn; ept_entry->emt = epte_get_entry_emt(d, gfn, mfn_x(mfn)); ept_entry->sp_avail = walk_level ? 1 : 0; @@ -233,6 +230,11 @@ ept_set_entry(struct domain *d, unsigned unmap_domain_page(split_table); } + + /* Track the highest gfn for which we have ever had a valid mapping */ + if ( mfn_valid(mfn_x(mfn)) + && (gfn + (1UL << order) - 1 > d->arch.p2m->max_mapped_pfn) ) + d->arch.p2m->max_mapped_pfn = gfn + (1UL << order) - 1; /* Success */ rv = 1; diff -r ecc40aae2a8a xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Tue Oct 21 11:23:08 2008 +0100 +++ b/xen/arch/x86/mm/p2m.c Tue Oct 21 11:30:01 2008 +0100 @@ -322,7 +322,8 @@ p2m_set_entry(struct domain *d, unsigned } /* Track the highest gfn for which we have ever had a valid mapping */ - if ( mfn_valid(mfn) && (gfn > d->arch.p2m->max_mapped_pfn) ) + if ( mfn_valid(mfn) + && (gfn + (1UL << page_order) - 1 > d->arch.p2m->max_mapped_pfn) ) d->arch.p2m->max_mapped_pfn = gfn + (1UL << page_order) - 1; if ( iommu_enabled && (is_hvm_domain(d) || need_iommu(d)) ) --aZoGpuMECXJckB41 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --aZoGpuMECXJckB41--