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-next>] [day] [month] [year] [list]
Message-ID: <20250402183806.3947021-1-irogers@google.com>
Date: Wed,  2 Apr 2025 11:38:06 -0700
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>, 
	Mark Rutland <mark.rutland@....com>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, 
	Kan Liang <kan.liang@...ux.intel.com>, James Clark <james.clark@...aro.org>, 
	John Garry <john.g.garry@...cle.com>, Xu Yang <xu.yang_2@....com>, 
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Thomas Falcon <thomas.falcon@...el.com>, Weilin Wang <weilin.wang@...el.com>
Subject: [PATCH v1] perf jevents: Allow duplicate metrics with different PMUs

On hybrid machines the same metric may appear for cpu_atom and
cpu_core as well as being referenced from other metrics. The same
named metrics are required but on differing PMUs are required. Update
the jevents.py to handle this.

On (hybrid) Alderlake before:
```
$ perf stat -M tma_fp_divider -a sleep 1
event syntax error: '.._ACTIVE!3/,tma_core_bound/metric-id=tma_core_bound/,tma_backend_bound/metric-id=tma_..'
                                  \___ Bad event or PMU
```

After:
```
$ perf stat -M tma_fp_divider -a sleep 1

 Performance counter stats for 'system wide':

     1,257,833,472      cpu_core/TOPDOWN.SLOTS/          #      0.0 %  tma_fp_divider
            45,870      cpu_core/ARITH.FPDIV_ACTIVE/
       187,096,541      cpu_core/topdown-retiring/
       199,533,380      cpu_core/topdown-mem-bound/
       107,164,806      cpu_core/topdown-bad-spec/
       214,281,782      cpu_core/CPU_CLK_UNHALTED.THREAD/
         1,588,539      cpu_core/ARITH.DIV_ACTIVE/
       538,842,818      cpu_core/topdown-fe-bound/
       431,005,264      cpu_core/topdown-be-bound/
```

Signed-off-by: Ian Rogers <irogers@...gle.com>
---
 tools/perf/pmu-events/jevents.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py
index 36a5e5fa2a54..89f1ace2a697 100755
--- a/tools/perf/pmu-events/jevents.py
+++ b/tools/perf/pmu-events/jevents.py
@@ -481,7 +481,8 @@ def add_events_table_entries(item: os.DirEntry, topic: str) -> None:
   for e in read_json_events(item.path, topic):
     if e.name:
       _pending_events.append(e)
-    if e.metric_name and not any(e.metric_name == x.metric_name for x in _pending_metrics):
+    if e.metric_name and not any(e.metric_name == x.metric_name and
+                                 e.pmu == x.pmu for x in _pending_metrics):
       _pending_metrics.append(e)
 
 
-- 
2.49.0.504.g3bcea36a83-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ