Skip to contentSkip to conversation

x86/EPT: squash meaningless TLB flush

PATCH In review Jan Beulich 4 participants 6 messages Nov 30, 2021 – Dec 24, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/EPT: squash meaningless TLB flush

ept_free_entry() gets called after a flush - if one is necessary in the first place - was already issued. That behavior is similar to NPT, which also doesn't have any further flush in p2m_free_entry(). (Furthermore, the function being recursive, in case of recursiveness way too many flushes would have been issued.)

xen/arch/x86/mm/p2m-ept.c +1 -2
@@ -246,8 +246,7 @@ static void ept_free_entry(struct p2m_do
             ept_free_entry(p2m, epte + i, level - 1);
         unmap_domain_page(epte);
     }
-    
-    p2m_tlb_flush_sync(p2m);
+
     p2m_free_ptp(p2m, mfn_to_page(_mfn(ept_entry->mfn)));
 }
 
#1 lore raw
Quoted 7 lines · Jan Beulich

ept_free_entry() gets called after a flush - if one is necessary in the first place - was already issued. That behavior is similar to NPT, which also doesn't have any further flush in p2m_free_entry(). (Furthermore, the function being recursive, in case of recursiveness way too many flushes would have been issued.)

ept_free_entry() is called either recursively, or after an ept_split_super_page(), and I agree that it does not want to queue multiple flushes.

However, I don't see where a suitable flush is in the superpage path. Am I overlooking something?

~Andrew

#2 lore raw
Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich

ept_free_entry() gets called after a flush - if one is necessary in the first place - was already issued. That behavior is similar to NPT, which also doesn't have any further flush in p2m_free_entry(). (Furthermore, the function being recursive, in case of recursiveness way too many flushes would have been issued.)

Quoted 8 lines
Quoted 1 line

ept_free_entry() is called either recursively, or after an ept_split_super_page(), and I agree that it does not want to queue multiple flushes.

However, I don't see where a suitable flush is in the superpage path. Am I overlooking something?

When it gets called after ept_split_super_page(), that's in case the function failed (and hence no update to live page tables was made).

Jan

#3 lore raw

Ping: [PATCH] x86/EPT: squash meaningless TLB flush

In reply to Jan Beulich
Quoted 7 lines · Jan Beulich

ept_free_entry() gets called after a flush - if one is necessary in the first place - was already issued. That behavior is similar to NPT, which also doesn't have any further flush in p2m_free_entry(). (Furthermore, the function being recursive, in case of recursiveness way too many flushes would have been issued.)

May I ask for an ack or otherwise here? From all I can tell I have addressed Andrew's comment.

Jan

Quoted 12 lines
xen/arch/x86/mm/p2m-ept.c +1 -2
@@ -246,8 +246,7 @@ static void ept_free_entry(struct p2m_do
             ept_free_entry(p2m, epte + i, level - 1);
         unmap_domain_page(epte);
     }
-    
-    p2m_tlb_flush_sync(p2m);
+
     p2m_free_ptp(p2m, mfn_to_page(_mfn(ept_entry->mfn)));
 }
 
Reviewed-by on v1 1/1
#4 lore raw
In reply to Jan Beulich
Quoted 7 lines · Jan Beulich

ept_free_entry() gets called after a flush - if one is necessary in the first place - was already issued. That behavior is similar to NPT, which also doesn't have any further flush in p2m_free_entry(). (Furthermore, the function being recursive, in case of recursiveness way too many flushes would have been issued.)

It's also worth noting that ept_free_entry doesn't modify the p2m itself - it gets handed an EPT entry to free, which should have been unhooked from the p2m previously by the caller, so it should be the responsibility of the caller to perform any flushes.

Thanks, Roger.

Reviewed-by on v1 1/1
#5 lore raw
In reply to Jan Beulich
Quoted 10 lines

From: Jan Beulich <[email protected]>
Sent: Wednesday, December 1, 2021 12:11 AM

ept_free_entry() gets called after a flush - if one is necessary in the first place - was already issued. That behavior is similar to NPT, which also doesn't have any further flush in p2m_free_entry(). (Furthermore, the function being recursive, in case of recursiveness way too many flushes would have been issued.)

Quoted 13 lines
xen/arch/x86/mm/p2m-ept.c +1 -2
@@ -246,8 +246,7 @@ static void ept_free_entry(struct p2m_do
             ept_free_entry(p2m, epte + i, level - 1);
         unmap_domain_page(epte);
     }
-
-    p2m_tlb_flush_sync(p2m);
+
     p2m_free_ptp(p2m, mfn_to_page(_mfn(ept_entry->mfn)));
 }