From: Wei-Lin Chang <weilin.chang@arm.com>
To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org
Cc: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
Fuad Tabba <tabba@google.com>, Joey Gouly <joey.gouly@arm.com>,
Steffen Eiden <seiden@linux.ibm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Itaru Kitayama <itaru.kitayama@fujitsu.com>,
Sebastian Ene <sebastianene@google.com>,
Wei-Lin Chang <weilin.chang@arm.com>
Subject: [PATCH v4 3/6] KVM: arm64: nv: Add nested revmap broken tracepoint
Date: Tue, 14 Jul 2026 12:59:22 +0100 [thread overview]
Message-ID: <20260714115926.2044757-4-weilin.chang@arm.com> (raw)
In-Reply-To: <20260714115926.2044757-1-weilin.chang@arm.com>
Add a tracepoint to track when a nested reverse map becomes broken. This
makes it easier to detect NV performance degradation caused by full
shadow stage-2 unmaps.
Signed-off-by: Wei-Lin Chang <weilin.chang@arm.com>
---
arch/arm64/kvm/nested.c | 7 ++++++-
arch/arm64/kvm/trace_arm.h | 27 +++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
index 065823e415ce..22f8a1daca93 100644
--- a/arch/arm64/kvm/nested.c
+++ b/arch/arm64/kvm/nested.c
@@ -17,6 +17,7 @@
#include <asm/sysreg.h>
#include "sys_regs.h"
+#include "trace.h"
struct vncr_tlb {
/* The guest's VNCR_EL2 */
@@ -916,8 +917,12 @@ void kvm_record_nested_revmap(gpa_t canonical_ipa, struct kvm_s2_mmu *mmu,
mas_set_range(&mas_rmap, canonical_ipa, canonical_ipa_end);
if (mas_store_gfp(&mas_rmap, xa_mk_value(new_entry),
- GFP_NOWAIT | __GFP_ACCOUNT))
+ GFP_NOWAIT | __GFP_ACCOUNT)) {
+ trace_kvm_nested_revmap_broken(mmu - mmu->arch->nested_mmus,
+ canonical_ipa, canonical_ipa_end,
+ nested_ipa, new_entry);
mmu->nested_revmap_broken = true;
+ }
unlock:
mtree_unlock(revmap_mt);
}
diff --git a/arch/arm64/kvm/trace_arm.h b/arch/arm64/kvm/trace_arm.h
index 9c60f6465c78..0db90068ff63 100644
--- a/arch/arm64/kvm/trace_arm.h
+++ b/arch/arm64/kvm/trace_arm.h
@@ -415,6 +415,33 @@ TRACE_EVENT(kvm_forward_sysreg_trap,
sys_reg_Op2(__entry->sysreg))
);
+TRACE_EVENT(kvm_nested_revmap_broken,
+ TP_PROTO(int mmu_idx, unsigned long canonical_ipa,
+ unsigned long canonical_ipa_end, unsigned long nested_ipa,
+ unsigned long revmap_entry),
+ TP_ARGS(mmu_idx, canonical_ipa, canonical_ipa_end, nested_ipa, revmap_entry),
+
+ TP_STRUCT__entry(
+ __field(int, mmu_idx)
+ __field(unsigned long, canonical_ipa)
+ __field(unsigned long, nested_ipa)
+ __field(size_t, size)
+ __field(unsigned long, revmap_entry)
+ ),
+
+ TP_fast_assign(
+ __entry->mmu_idx = mmu_idx;
+ __entry->canonical_ipa = canonical_ipa;
+ __entry->nested_ipa = nested_ipa;
+ __entry->size = canonical_ipa_end - canonical_ipa + 1;
+ __entry->revmap_entry = revmap_entry;
+ ),
+
+ TP_printk("mmu idx: %d, cipa: 0x%016lx, nipa: 0x%016lx, size: 0x%016lx, entry: %016lx",
+ __entry->mmu_idx, __entry->canonical_ipa, __entry->nested_ipa,
+ __entry->size, __entry->revmap_entry)
+);
+
#endif /* _TRACE_ARM_ARM64_KVM_H */
#undef TRACE_INCLUDE_PATH
--
2.43.0
next prev parent reply other threads:[~2026-07-14 12:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 11:59 [PATCH v4 0/6] KVM: arm64: nv: Implement nested stage-2 reverse map Wei-Lin Chang
2026-07-14 11:59 ` [PATCH v4 1/6] KVM: arm64: Use a variable for the canonical GPA in kvm_s2_fault_map() Wei-Lin Chang
2026-07-14 11:59 ` [PATCH v4 2/6] KVM: arm64: nv: Avoid full shadow s2 unmap Wei-Lin Chang
2026-07-16 7:05 ` Oliver Upton
2026-07-14 11:59 ` Wei-Lin Chang [this message]
2026-07-16 6:45 ` [PATCH v4 3/6] KVM: arm64: nv: Add nested revmap broken tracepoint Oliver Upton
2026-07-16 8:56 ` Marc Zyngier
2026-07-14 11:59 ` [PATCH v4 4/6] KVM: arm64: Refactor kvm_unmap_gfn_range() with common variables Wei-Lin Chang
2026-07-14 11:59 ` [PATCH v4 5/6] KVM: arm64: nv: Remove reverse map entries during TLBI handling Wei-Lin Chang
2026-07-14 11:59 ` [PATCH v4 6/6] KVM: arm64: nv: Create nested IPA direct map to speed up reverse map removal Wei-Lin Chang
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=20260714115926.2044757-4-weilin.chang@arm.com \
--to=weilin.chang@arm.com \
--cc=catalin.marinas@arm.com \
--cc=itaru.kitayama@fujitsu.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sebastianene@google.com \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=tabba@google.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox