[PATCH v2 2/2] perf jevents: add amd specific device table entry metrics
From: Jacob Lefkowitz via B4 Relay
Date: Mon Nov 02 2026 - 17:54:26 EST
From: Jacob Lefkowitz <jlefkowi@xxxxxxxxxx>
Adds AMD specific device table entry metrics to perf jevents.
These metrics are only allowed on Zen 2+ processors and are
implemented using the 'amd_iommu' PMU events.
The list of metrics added are:
- lpm_iommu_dte_miss_rate
- lpm_iommu_dte_lookups
The metrics were tested with the standard 'sleep' workload:
perf stat -M iommudte --per-socket --metric-only -j -a -- sleep 10
{"socket" : "S0", "counters" : 8,
"lookups/s lpm_iommu_dte_lookups" : "4117.3",
"% lpm_iommu_dte_miss_rate" : "0.0"}
{"socket" : "S1", "counters" : 0,
"lookups/s lpm_iommu_dte_lookups" : "none",
"% lpm_iommu_dte_miss_rate" : "none"}
Signed-off-by: Jacob Lefkowitz <jlefkowi@xxxxxxxxxx>
---
tools/perf/pmu-events/amd_metrics.py | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tools/perf/pmu-events/amd_metrics.py b/tools/perf/pmu-events/amd_metrics.py
index 452b88033492..fd0bd9f16529 100755
--- a/tools/perf/pmu-events/amd_metrics.py
+++ b/tools/perf/pmu-events/amd_metrics.py
@@ -318,6 +318,35 @@ def AmdIotlb() -> Optional[MetricGroup]:
)
+def AmdIommudte() -> Optional[MetricGroup]:
+ if _zen_model < 2:
+ return None
+
+ dte_hit = Event("amd_iommu/mem_dte_hit/")
+ dte_mis = Event("amd_iommu/mem_dte_mis/")
+ lookups = dte_hit + dte_mis
+
+ return MetricGroup(
+ "iommudte",
+ [
+ Metric(
+ "lpm_iommu_dte_miss_rate",
+ "IOMMU device table cache miss rate",
+ d_ratio(dte_mis, lookups),
+ "100%"
+ ),
+ Metric(
+ "lpm_iommu_dte_lookups",
+ "IOMMU device table cache lookups",
+ d_ratio(lookups, interval_sec),
+ "lookups/s"
+ )
+ ],
+ description="IOMMU Device Table Cache Metrics"
+ )
+
+
+
def AmdIommuptw() -> Optional[MetricGroup]:
if _zen_model < 2:
return None
@@ -570,6 +599,7 @@ def main() -> None:
AmdCtxSw(),
AmdDtlb(),
AmdIotlb(),
+ AmdIommudte(),
AmdIommuptw(),
AmdItlb(),
AmdLdSt(),
--
2.53.0