From 5ecb1622d000dffb9245df8d264d9c1e7492874f Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Tue, 27 Jan 2026 10:44:40 -0800 Subject: [PATCH] perf jevents: Add uncore l3 metric group for AMD Metrics use the amd_l3 PMU for access/miss/hit information. Reviewed-by: Sandipan Das Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Benjamin Gray Cc: Caleb Biggers Cc: Edward Baker Cc: Ingo Molnar Cc: James Clark Cc: Jing Zhang Cc: Jiri Olsa Cc: John Garry Cc: Leo Yan Cc: Namhyung Kim Cc: Perry Taylor Cc: Peter Zijlstra Cc: Thomas Falcon Cc: Weilin Wang Cc: Xu Yang Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/pmu-events/amd_metrics.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/perf/pmu-events/amd_metrics.py b/tools/perf/pmu-events/amd_metrics.py index a4ff88de08b5..d71997177239 100755 --- a/tools/perf/pmu-events/amd_metrics.py +++ b/tools/perf/pmu-events/amd_metrics.py @@ -317,6 +317,24 @@ def Rapl() -> MetricGroup: description="Processor socket power consumption estimates") +def UncoreL3(): + acc = Event("l3_lookup_state.all_coherent_accesses_to_l3", + "l3_lookup_state.all_l3_req_typs") + miss = Event("l3_lookup_state.l3_miss", + "l3_comb_clstr_state.request_miss") + acc = max(acc, miss) + hits = acc - miss + + return MetricGroup("lpm_l3", [ + Metric("lpm_l3_accesses", "L3 victim cache accesses", + d_ratio(acc, interval_sec), "accesses/sec"), + Metric("lpm_l3_hits", "L3 victim cache hit rate", + d_ratio(hits, acc), "100%"), + Metric("lpm_l3_miss", "L3 victim cache miss rate", d_ratio(miss, acc), + "100%"), + ], description="L3 cache breakdown per CCX") + + def main() -> None: global _args global _zen_model @@ -351,6 +369,7 @@ def main() -> None: AmdUpc(), Idle(), Rapl(), + UncoreL3(), ]) if _args.metricgroups: -- 2.30.2