# HG changeset patch # User Tim Deegan # Date 1274798978 -3600 # Node ID 8878c25bd0ba45c16d505623be1292e3dcb680b5 # Parent e823c66bf4310c874a7a7158c42586f4d535687c Only flush EPT TLB if the previous entry was valid Original patch from George Dunlap Signed-off-by: Tim Deegan diff -r e823c66bf431 -r 8878c25bd0ba xen/arch/x86/mm/hap/p2m-ept.c --- a/xen/arch/x86/mm/hap/p2m-ept.c Tue May 25 15:43:56 2010 +0100 +++ b/xen/arch/x86/mm/hap/p2m-ept.c Tue May 25 15:49:38 2010 +0100 @@ -242,6 +242,7 @@ int direct_mmio = (p2mt == p2m_mmio_direct); uint8_t ipat = 0; int need_modify_vtd_table = 1; + int needs_sync = 1; struct p2m_domain *p2m = p2m_get_hostp2m(d); if ( order != 0 ) @@ -276,6 +277,11 @@ if ( i == walk_level ) { /* We reached the level we're looking for */ + + /* No need to flush if the old entry wasn't valid */ + if ( !(ept_entry->epte & 7) ) + needs_sync = 0; + if ( mfn_valid(mfn_x(mfn)) || direct_mmio || p2m_is_paged(p2mt) || (p2mt == p2m_ram_paging_in_start) ) { @@ -336,7 +342,8 @@ out: unmap_domain_page(table); - ept_sync_domain(d); + if ( needs_sync ) + ept_sync_domain(d); /* Now the p2m table is not shared with vt-d page table */ if ( rv && iommu_enabled && need_iommu(d) && need_modify_vtd_table )