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@xenproject.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Roger Pau Monne committed 2026-09-10 11:54:12 +02:00
1 parent 0ea57a11f5
commit d7bf1b8ea2
1 file changed
+7 -2
+7 -2
View File
@@ -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);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.