From: Roger Pau Monne <roger@xenproject.org>
To: xen-devel@lists.xenproject.org
Cc: Roger Pau Monne <roger@xenproject.org>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Anthony PERARD <anthony.perard@vates.tech>,
Michal Orzel <michal.orzel@amd.com>,
Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH v2] x86/mm: limit deferred TLB flushing to PV domain support
Date: Wed, 9 Sep 2026 16:05:00 +0200 [thread overview]
Message-ID: <20260909140500.73483-1-roger@xenproject.org> (raw)
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>
---
Changes since v1:
- Only avoid the flush if there's no PV domain support.
- Fix comment.
---
xen/common/page_alloc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 62ac89b824de..cbb2af7f64ce 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1538,8 +1538,11 @@ 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 will need no
+ * safety TLB flush, there can be no stale TLB entries.
+ */
+ pg->u.free.need_tlbflush = IS_ENABLED(CONFIG_PV) && page_get_owner(pg);
if ( pg->u.free.need_tlbflush )
page_set_tlbflush_timestamp(pg);
--
2.55.0
next reply other threads:[~2026-09-09 14:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 14:05 Roger Pau Monne [this message]
2026-09-09 14:46 ` [PATCH v2] x86/mm: limit deferred TLB flushing to PV domain support Jan Beulich
2026-09-09 16:28 ` Roger Pau Monné
2026-09-09 20:07 ` Jason Andryuk
2026-09-10 6:33 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260909140500.73483-1-roger@xenproject.org \
--to=roger@xenproject.org \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.