Skip to contentSkip to conversation

Only flush EPT TLB if the previous entry was valid

PATCH New Tim Deegan 1 participant 1 message May 25, 2010

lore
Share & tools
lore

Tim Deegan

author
#0 lore raw

PATCH 1/1 Only flush EPT TLB if the previous entry was valid

Original patch from George Dunlap <[email protected]>

# HG changeset patch
# User Tim Deegan <[email protected]> # Date 1274798978 -3600
# Node ID 8878c25bd0ba45c16d505623be1292e3dcb680b5 # Parent e823c66bf4310c874a7a7158c42586f4d535687c Only flush EPT TLB if the previous entry was valid

Original patch from George Dunlap <[email protected]>

xen/arch/x86/mm/hap/p2m-ept.c +8 -1
diff -r e823c66bf431 -r 8878c25bd0ba xen/arch/x86/mm/hap/p2m-ept.c
@@ -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 )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel