[PATCH 2/2] perf jevents: add amd specific device table entry metrics
From: Jacob Lefkowitz via B4 Relay
Date: Thu Oct 29 2026 - 15:08:59 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" : "100.0"}
Signed-off-by: Jacob Lefkowitz <jlefkowi@xxxxxxxxxx>
---
tools/perf/pmu-events/amd_metrics.py | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tools/perf/pmu-events/amd_metrics.py b/tools/perf/pmu-events/amd_metrics.py
index dcffd6e268fa..912bceb57d67 100755
--- a/tools/perf/pmu-events/amd_metrics.py
+++ b/tools/perf/pmu-events/amd_metrics.py
@@ -318,6 +318,37 @@ def AmdIotlb() -> Optional[MetricGroup]:
)
+def AmdIommudte() -> Optional[MetricGroup]:
+ global _zen_model
+
+ 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",
+ min(d_ratio(dte_mis, lookups), 1),
+ "100%"
+ ),
+ Metric(
+ "lpm_iommu_dte_lookups",
+ "IOMMU device table cache miss rate",
+ d_ratio(lookups, interval_sec),
+ "lookups/s"
+ )
+ ],
+ description="IOMMU Device Table Cache Metrics"
+ )
+
+
+
def AmdIommuptw() -> Optional[MetricGroup]:
global _zen_model
@@ -572,6 +603,7 @@ def main() -> None:
AmdCtxSw(),
AmdDtlb(),
AmdIotlb(),
+ AmdIommudte(),
AmdIommuptw(),
AmdItlb(),
AmdLdSt(),
--
2.53.0