[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] x86/mm: limit deferred TLB flushing to PV domain support



commit d7bf1b8ea2756b6160d41bf377a85365dbd6f8f6
Author:     Roger Pau Monne <roger@xxxxxxxxxxxxxx>
AuthorDate: Mon Jul 27 16:36:15 2026 +0200
Commit:     Roger Pau Monne <roger@xxxxxxxxxxxxxx>
CommitDate: Thu Sep 10 11:54:12 2026 +0200

    x86/mm: limit deferred TLB flushing to PV domain support
    
    The current logic on x86 will mark all domain owned pages as needing a TLB
    flush before being re-used.  However such TLB flushing is only strictly
    needed when the pages might have been mapped by a PV domain, as those can
    keep a reference to the page in the TLB after it has been freed.
    
    Limit the flushing to builds with PV domain support, as tracking whether a
    page might have been mapped by a PV domain is not trivial (and possibly not
    worth the extra logic).
    
    Signed-off-by: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/common/page_alloc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 62ac89b824..fe150eccd7 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1538,8 +1538,13 @@ static bool mark_page_free(struct page_info *pg, mfn_t 
mfn)
         BUG();
     }
 
-    /* If a page has no owner it will need no safety TLB flush. */
-    pg->u.free.need_tlbflush = (page_get_owner(pg) != NULL);
+    /*
+     * If a page has no owner and there's no PV domain support it does not need
+     * a safety TLB flush.  PV domains are the only domain types that can keep
+     * stale entries on the TLB, as they have (limited) control over the host
+     * MMU and when flushes are performed.
+     */
+    pg->u.free.need_tlbflush = IS_ENABLED(CONFIG_PV) && page_get_owner(pg);
     if ( pg->u.free.need_tlbflush )
         page_set_tlbflush_timestamp(pg);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.