|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN][PATCH v5 5/8] xen/arm: do not flush the TLBs when resolving a translation fault
From: Haseeb Ashraf <haseeb.ashraf@xxxxxxxxxxx>
After p2m_flush_vm() invalidates the root of the p2m, the first
access to every table of the p2m faults. Then
p2m_resolve_translation_fault() sets the valid bit of the entry and
clears the valid bits of the table below it with
p2m_invalidate_table(). That function asks for a TLB flush, so
p2m_write_unlock() flushes all the TLBs of the domain, once for
every table that is walked for the first time.
The flush is not needed. The entry has had its valid bit unset since
the TLBs were flushed after the invalidation, so no walk went through
it and nothing from the table below can be cached. This does not
depend on what Xen runs on. Under nested virtualization, a global
broadcast can be especially expensive and hold the p2m lock while the
fault is being resolved. No separate measurement is available for this
patch.
Keep the flush that was already pending, if any.
Signed-off-by: Haseeb Ashraf <haseeb.ashraf@xxxxxxxxxxx>
---
New in v5.
xen/arch/arm/mmu/p2m.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c
index 3b1b9b394c..8cbd504fdc 100644
--- a/xen/arch/arm/mmu/p2m.c
+++ b/xen/arch/arm/mmu/p2m.c
@@ -1450,7 +1450,20 @@ bool p2m_resolve_translation_fault(struct domain *d,
gfn_t gfn)
* If an entry is pointing to a block/page, no work to do for now.
*/
if ( lpae_is_table(entry, level) )
+ {
+ /*
+ * The table below an entry whose valid bit is unset cannot be in the
+ * TLBs: no walk went through that entry since the TLBs were flushed
+ * after the entry was invalidated. So clearing the valid bits of the
+ * table does not need a flush, and p2m_invalidate_table() must not
+ * ask for one. It would be a flush of all the TLBs of the domain at
+ * p2m_write_unlock(), for the first access to every table.
+ */
+ bool need_flush = p2m->need_flush;
+
p2m_invalidate_table(p2m, lpae_get_mfn(entry));
+ p2m->need_flush = need_flush;
+ }
/*
* Now that the work on the entry is done, set the valid bit to prevent
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |