perf jevents: Add dir breakdown metrics for Intel

Breakdown directory hit, misses and requests. The implementation uses
the M2M and CHA PMUs present in server models broadwellde, broadwellx
cascadelakex, emeraldrapids, icelakex, sapphirerapids and skylakex.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Falcon <thomas.falcon@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Benjamin Gray <bgray@linux.ibm.com>
Cc: Caleb Biggers <caleb.biggers@intel.com>
Cc: Edward Baker <edward.baker@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Perry Taylor <perry.taylor@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Weilin Wang <weilin.wang@intel.com>
Cc: Xu Yang <xu.yang_2@nxp.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2026-01-27 10:45:00 -08:00 committed by Arnaldo Carvalho de Melo
parent cde9c1a5d9
commit 2166b44be9
1 changed files with 36 additions and 0 deletions

View File

@ -815,6 +815,41 @@ def IntelLdSt() -> Optional[MetricGroup]:
], description="Breakdown of load/store instructions")
def UncoreDir() -> Optional[MetricGroup]:
try:
m2m_upd = Event("UNC_M2M_DIRECTORY_UPDATE.ANY")
m2m_hits = Event("UNC_M2M_DIRECTORY_HIT.DIRTY_I")
# Turn the umask into a ANY rather than DIRTY_I filter.
m2m_hits.name += "/umask=0xFF,name=UNC_M2M_DIRECTORY_HIT.ANY/"
m2m_miss = Event("UNC_M2M_DIRECTORY_MISS.DIRTY_I")
# Turn the umask into a ANY rather than DIRTY_I filter.
m2m_miss.name += "/umask=0xFF,name=UNC_M2M_DIRECTORY_MISS.ANY/"
cha_upd = Event("UNC_CHA_DIR_UPDATE.HA")
# Turn the umask into a ANY rather than HA filter.
cha_upd.name += "/umask=3,name=UNC_CHA_DIR_UPDATE.ANY/"
except:
return None
m2m_total = m2m_hits + m2m_miss
upd = m2m_upd + cha_upd # in cache lines
upd_r = upd / interval_sec
look_r = m2m_total / interval_sec
scale = 64 / 1_000_000 # Cache lines to MB
return MetricGroup("lpm_dir", [
Metric("lpm_dir_lookup_rate", "",
d_ratio(m2m_total, interval_sec), "requests/s"),
Metric("lpm_dir_lookup_hits", "",
d_ratio(m2m_hits, m2m_total), "100%"),
Metric("lpm_dir_lookup_misses", "",
d_ratio(m2m_miss, m2m_total), "100%"),
Metric("lpm_dir_update_requests", "",
d_ratio(m2m_upd + cha_upd, interval_sec), "requests/s"),
Metric("lpm_dir_update_bw", "",
d_ratio(m2m_upd + cha_upd, interval_sec), f"{scale}MB/s"),
])
def UncoreMem() -> Optional[MetricGroup]:
try:
loc_rds = Event("UNC_CHA_REQUESTS.READS_LOCAL",
@ -944,6 +979,7 @@ def main() -> None:
IntelMlp(),
IntelPorts(),
IntelSwpf(),
UncoreDir(),
UncoreMem(),
UncoreMemBw(),
])