lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1ac78000-b41c-47d1-ace1-3bdfc2968e4a@amd.com>
Date: Wed, 26 Nov 2025 15:47:24 +0530
From: Sandipan Das <sandipan.das@....com>
To: Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
 Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
 Arnaldo Carvalho de Melo <acme@...nel.org>,
 Benjamin Gray <bgray@...ux.ibm.com>, Caleb Biggers
 <caleb.biggers@...el.com>, Edward Baker <edward.baker@...el.com>,
 Ingo Molnar <mingo@...hat.com>, James Clark <james.clark@...aro.org>,
 Jing Zhang <renyu.zj@...ux.alibaba.com>, Jiri Olsa <jolsa@...nel.org>,
 John Garry <john.g.garry@...cle.com>, Leo Yan <leo.yan@....com>,
 Namhyung Kim <namhyung@...nel.org>, Perry Taylor <perry.taylor@...el.com>,
 Peter Zijlstra <peterz@...radead.org>, Samantha Alt
 <samantha.alt@...el.com>, Thomas Falcon <thomas.falcon@...el.com>,
 Weilin Wang <weilin.wang@...el.com>, Xu Yang <xu.yang_2@....com>,
 linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v8 20/52] perf jevents: Add hardware prefetch (hwpf)
 metric group for AMD

On 11/13/2025 8:50 AM, Ian Rogers wrote:
> Add metrics that give the utility of hardware prefetches on zen2, zen3
> and zen4.
> 
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
>  tools/perf/pmu-events/amd_metrics.py | 64 ++++++++++++++++++++++++++++
>  1 file changed, 64 insertions(+)
> 
> diff --git a/tools/perf/pmu-events/amd_metrics.py b/tools/perf/pmu-events/amd_metrics.py
> index 06cb56cbd617..be27a4947e45 100755
> --- a/tools/perf/pmu-events/amd_metrics.py
> +++ b/tools/perf/pmu-events/amd_metrics.py
> @@ -121,6 +121,69 @@ def AmdBr():
>                         description="breakdown of retired branch instructions")
>  
>  
> +def AmdHwpf():
> +    """Returns a MetricGroup representing AMD hardware prefetch metrics."""
> +    global _zen_model
> +    if _zen_model <= 1:
> +        return None
> +
> +    hwp_ld = Event("ls_dispatch.ld_dispatch")
> +    hwp_l2 = Event("ls_hw_pf_dc_fills.local_l2",
> +                   "ls_hw_pf_dc_fills.lcl_l2",
> +                   "ls_hw_pf_dc_fill.ls_mabresp_lcl_l2")
> +    hwp_lc = Event("ls_hw_pf_dc_fills.local_ccx",
> +                   "ls_hw_pf_dc_fills.int_cache",
> +                   "ls_hw_pf_dc_fill.ls_mabresp_lcl_cache")
> +    hwp_lm = Event("ls_hw_pf_dc_fills.dram_io_near",
> +                   "ls_hw_pf_dc_fills.mem_io_local",
> +                   "ls_hw_pf_dc_fill.ls_mabresp_lcl_dram")
> +    hwp_rc = Event("ls_hw_pf_dc_fills.far_cache",
> +                   "ls_hw_pf_dc_fills.ext_cache_remote",
> +                   "ls_hw_pf_dc_fill.ls_mabresp_rmt_cache")
> +    hwp_rm = Event("ls_hw_pf_dc_fills.dram_io_far",
> +                   "ls_hw_pf_dc_fills.mem_io_remote",
> +                   "ls_hw_pf_dc_fill.ls_mabresp_rmt_dram")
> +

Same notes from the previous SWPF patch are applicable here.

> +    loc_pf = hwp_l2 + hwp_lc + hwp_lm
> +    rem_pf = hwp_rc + hwp_rm
> +    all_pf = loc_pf + rem_pf
> +
> +    r1 = d_ratio(ins, all_pf)
> +    r2 = d_ratio(hwp_ld, all_pf)
> +    r3 = d_ratio(all_pf, interval_sec)
> +
> +    overview = MetricGroup("lpm_hwpf_overview", [
> +        Metric("lpm_hwpf_ov_insn_bt_hwpf", "Insn between HWPF", r1, "insns"),
> +        Metric("lpm_hwpf_ov_loads_bt_hwpf", "Loads between HWPF", r2, "loads"),
> +        Metric("lpm_hwpf_ov_rate", "HWPF per second", r3, "hwpf/s"),
> +    ])
> +    r1 = d_ratio(hwp_l2, all_pf)
> +    r2 = d_ratio(hwp_lc, all_pf)
> +    r3 = d_ratio(hwp_lm, all_pf)
> +    data_src_local = MetricGroup("lpm_hwpf_data_src_local", [
> +        Metric("lpm_hwpf_data_src_local_l2",
> +               "Data source local l2", r1, "100%"),
> +        Metric("lpm_hwpf_data_src_local_ccx_l3_loc_ccx",
> +               "Data source local ccx l3 loc ccx", r2, "100%"),
> +        Metric("lpm_hwpf_data_src_local_memory_or_io",
> +               "Data source local memory or IO", r3, "100%"),
> +    ])
> +
> +    r1 = d_ratio(hwp_rc, all_pf)
> +    r2 = d_ratio(hwp_rm, all_pf)
> +    data_src_remote = MetricGroup("lpm_hwpf_data_src_remote", [
> +        Metric("lpm_hwpf_data_src_remote_cache", "Data source remote cache", r1,
> +               "100%"),
> +        Metric("lpm_hwpf_data_src_remote_memory_or_io",
> +               "Data source remote memory or IO", r2, "100%"),
> +    ])
> +
> +    data_src = MetricGroup("lpm_hwpf_data_src", [
> +                           data_src_local, data_src_remote])
> +    return MetricGroup("lpm_hwpf", [overview, data_src],
> +                       description="Hardware prefetch breakdown (CCX L3 = L3 of current thread, Loc CCX = CCX cache on some socket)")
> +
> +
>  def AmdSwpf() -> Optional[MetricGroup]:
>      """Returns a MetricGroup representing AMD software prefetch metrics."""
>      global _zen_model
> @@ -287,6 +350,7 @@ def main() -> None:
>  
>      all_metrics = MetricGroup("", [
>          AmdBr(),
> +        AmdHwpf(),
>          AmdSwpf(),
>          AmdUpc(),
>          Idle(),


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ