* [PATCH 1/1 v6.16] perf test event_uniquifying: Skip test on platforms without 'clockticks' events
@ 2025-06-05 19:22 Arnaldo Carvalho de Melo
2025-06-06 17:52 ` Namhyung Kim
0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-06-05 19:22 UTC (permalink / raw)
To: Chun-Tse Shao
Cc: Adrian Hunter, Alexander Shishkin, Andi Kleen,
Dr. David Alan Gilbert, Howard Chu, Ian Rogers, Ingo Molnar,
James Clark, Jiri Olsa, Kan Liang, Levi Yun, Mark Rutland,
Namhyung Kim, Peter Zijlstra, Weilin Wang,
Linux Kernel Mailing List, linux-perf-users
I'll add this to perf-tools for v6.16, please check.
- Arnaldo
---
This test assumes the 'clockticks' event is generally available, which
isn't the case, for instance, on AMD systems such as:
root@number:~# grep -m1 "model name" /proc/cpuinfo
model name : AMD Ryzen 9 9950X3D 16-Core Processor
root@number:~# perf list clockticks
List of pre-defined events (to be used in -e or -M):
root@number:~#
So skip this test when 'clockticks' isn't available.
This should be improved to find other events that are available in
multiple PMUs so that the intent of the test is achieved in more
platforms.
Fixes: cb422594d62066a5 ("perf test: Add stat uniquifying test")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Levi Yun <yeoreum.yun@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Weilin Wang <weilin.wang@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/shell/stat+event_uniquifying.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/perf/tests/shell/stat+event_uniquifying.sh b/tools/perf/tests/shell/stat+event_uniquifying.sh
index 5ec35c52b7d9651e..20498b6eadb57702 100755
--- a/tools/perf/tests/shell/stat+event_uniquifying.sh
+++ b/tools/perf/tests/shell/stat+event_uniquifying.sh
@@ -49,6 +49,12 @@ test_event_uniquifying() {
uniquified_event_array+=("${uniquified_event}")
done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
+ if [ ${#uniquified_event_array[@]} -eq 0 ]; then
+ echo "'clocktick' event not available on this machine"
+ err=2
+ return
+ fi
+
perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
$perf_command
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/1 v6.16] perf test event_uniquifying: Skip test on platforms without 'clockticks' events 2025-06-05 19:22 [PATCH 1/1 v6.16] perf test event_uniquifying: Skip test on platforms without 'clockticks' events Arnaldo Carvalho de Melo @ 2025-06-06 17:52 ` Namhyung Kim 2025-06-06 20:18 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 6+ messages in thread From: Namhyung Kim @ 2025-06-06 17:52 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Chun-Tse Shao, Adrian Hunter, Alexander Shishkin, Andi Kleen, Dr. David Alan Gilbert, Howard Chu, Ian Rogers, Ingo Molnar, James Clark, Jiri Olsa, Kan Liang, Levi Yun, Mark Rutland, Peter Zijlstra, Weilin Wang, Linux Kernel Mailing List, linux-perf-users On Thu, Jun 05, 2025 at 04:22:40PM -0300, Arnaldo Carvalho de Melo wrote: > I'll add this to perf-tools for v6.16, please check. Plesae see https://lore.kernel.org/linux-perf-users/20250521224513.1104129-1-ctshao@google.com/ Thanks, Namhyung > --- > > This test assumes the 'clockticks' event is generally available, which > isn't the case, for instance, on AMD systems such as: > > root@number:~# grep -m1 "model name" /proc/cpuinfo > model name : AMD Ryzen 9 9950X3D 16-Core Processor > root@number:~# perf list clockticks > > List of pre-defined events (to be used in -e or -M): > > root@number:~# > > So skip this test when 'clockticks' isn't available. > > This should be improved to find other events that are available in > multiple PMUs so that the intent of the test is achieved in more > platforms. > > Fixes: cb422594d62066a5 ("perf test: Add stat uniquifying test") > Cc: Adrian Hunter <adrian.hunter@intel.com> > Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> > Cc: Andi Kleen <ak@linux.intel.com> > Cc: Chun-Tse Shao <ctshao@google.com> > Cc: Dr. David Alan Gilbert <linux@treblig.org> > Cc: Howard Chu <howardchu95@gmail.com> > Cc: Ian Rogers <irogers@google.com> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: James Clark <james.clark@linaro.org> > Cc: Jiri Olsa <jolsa@kernel.org> > Cc: Kan Liang <kan.liang@linux.intel.com> > Cc: Levi Yun <yeoreum.yun@arm.com> > Cc: Mark Rutland <mark.rutland@arm.com> > Cc: Namhyung Kim <namhyung@kernel.org> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Weilin Wang <weilin.wang@intel.com> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> > --- > tools/perf/tests/shell/stat+event_uniquifying.sh | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/tools/perf/tests/shell/stat+event_uniquifying.sh b/tools/perf/tests/shell/stat+event_uniquifying.sh > index 5ec35c52b7d9651e..20498b6eadb57702 100755 > --- a/tools/perf/tests/shell/stat+event_uniquifying.sh > +++ b/tools/perf/tests/shell/stat+event_uniquifying.sh > @@ -49,6 +49,12 @@ test_event_uniquifying() { > uniquified_event_array+=("${uniquified_event}") > done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]") > > + if [ ${#uniquified_event_array[@]} -eq 0 ]; then > + echo "'clocktick' event not available on this machine" > + err=2 > + return > + fi > + > perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true" > $perf_command > > -- > 2.49.0 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1 v6.16] perf test event_uniquifying: Skip test on platforms without 'clockticks' events 2025-06-06 17:52 ` Namhyung Kim @ 2025-06-06 20:18 ` Arnaldo Carvalho de Melo 2025-06-06 20:25 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 6+ messages in thread From: Arnaldo Carvalho de Melo @ 2025-06-06 20:18 UTC (permalink / raw) To: Namhyung Kim Cc: Chun-Tse Shao, Adrian Hunter, Alexander Shishkin, Andi Kleen, Dr. David Alan Gilbert, Howard Chu, Ian Rogers, Ingo Molnar, James Clark, Jiri Olsa, Kan Liang, Levi Yun, Mark Rutland, Peter Zijlstra, Weilin Wang, Linux Kernel Mailing List, linux-perf-users On Fri, Jun 06, 2025 at 10:52:02AM -0700, Namhyung Kim wrote: > On Thu, Jun 05, 2025 at 04:22:40PM -0300, Arnaldo Carvalho de Melo wrote: > > I'll add this to perf-tools for v6.16, please check. > > Plesae see > > https://lore.kernel.org/linux-perf-users/20250521224513.1104129-1-ctshao@google.com/ Oh, great, I'll drop my fix and get that one instead. - Arnaldo > Thanks, > Namhyung > > > --- > > > > This test assumes the 'clockticks' event is generally available, which > > isn't the case, for instance, on AMD systems such as: > > > > root@number:~# grep -m1 "model name" /proc/cpuinfo > > model name : AMD Ryzen 9 9950X3D 16-Core Processor > > root@number:~# perf list clockticks > > > > List of pre-defined events (to be used in -e or -M): > > > > root@number:~# > > > > So skip this test when 'clockticks' isn't available. > > > > This should be improved to find other events that are available in > > multiple PMUs so that the intent of the test is achieved in more > > platforms. > > > > Fixes: cb422594d62066a5 ("perf test: Add stat uniquifying test") > > Cc: Adrian Hunter <adrian.hunter@intel.com> > > Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> > > Cc: Andi Kleen <ak@linux.intel.com> > > Cc: Chun-Tse Shao <ctshao@google.com> > > Cc: Dr. David Alan Gilbert <linux@treblig.org> > > Cc: Howard Chu <howardchu95@gmail.com> > > Cc: Ian Rogers <irogers@google.com> > > Cc: Ingo Molnar <mingo@redhat.com> > > Cc: James Clark <james.clark@linaro.org> > > Cc: Jiri Olsa <jolsa@kernel.org> > > Cc: Kan Liang <kan.liang@linux.intel.com> > > Cc: Levi Yun <yeoreum.yun@arm.com> > > Cc: Mark Rutland <mark.rutland@arm.com> > > Cc: Namhyung Kim <namhyung@kernel.org> > > Cc: Peter Zijlstra <peterz@infradead.org> > > Cc: Weilin Wang <weilin.wang@intel.com> > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> > > --- > > tools/perf/tests/shell/stat+event_uniquifying.sh | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/tools/perf/tests/shell/stat+event_uniquifying.sh b/tools/perf/tests/shell/stat+event_uniquifying.sh > > index 5ec35c52b7d9651e..20498b6eadb57702 100755 > > --- a/tools/perf/tests/shell/stat+event_uniquifying.sh > > +++ b/tools/perf/tests/shell/stat+event_uniquifying.sh > > @@ -49,6 +49,12 @@ test_event_uniquifying() { > > uniquified_event_array+=("${uniquified_event}") > > done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]") > > > > + if [ ${#uniquified_event_array[@]} -eq 0 ]; then > > + echo "'clocktick' event not available on this machine" > > + err=2 > > + return > > + fi > > + > > perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true" > > $perf_command > > > > -- > > 2.49.0 > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1 v6.16] perf test event_uniquifying: Skip test on platforms without 'clockticks' events 2025-06-06 20:18 ` Arnaldo Carvalho de Melo @ 2025-06-06 20:25 ` Arnaldo Carvalho de Melo 2025-06-07 2:55 ` Chun-Tse Shao 0 siblings, 1 reply; 6+ messages in thread From: Arnaldo Carvalho de Melo @ 2025-06-06 20:25 UTC (permalink / raw) To: Namhyung Kim Cc: Chun-Tse Shao, Adrian Hunter, Alexander Shishkin, Andi Kleen, Dr. David Alan Gilbert, Howard Chu, Ian Rogers, Ingo Molnar, James Clark, Jiri Olsa, Kan Liang, Levi Yun, Mark Rutland, Peter Zijlstra, Weilin Wang, Linux Kernel Mailing List, linux-perf-users On Fri, Jun 06, 2025 at 05:18:07PM -0300, Arnaldo Carvalho de Melo wrote: > On Fri, Jun 06, 2025 at 10:52:02AM -0700, Namhyung Kim wrote: > > On Thu, Jun 05, 2025 at 04:22:40PM -0300, Arnaldo Carvalho de Melo wrote: > > > I'll add this to perf-tools for v6.16, please check. > > Plesae see > > https://lore.kernel.org/linux-perf-users/20250521224513.1104129-1-ctshao@google.com/ > Oh, great, I'll drop my fix and get that one instead. Nope, that one returns ok if the test can't be performed, it should return 2 so that it is skipped and since we don't have a way to show the reason for skipping a shell test, when using 'perf test -vv' the warning that is there already (the needed PMU not being available) will be shown. So I'm amending this on top, ok? diff --git a/tools/perf/tests/shell/stat+event_uniquifying.sh b/tools/perf/tests/shell/stat+event_uniquifying.sh index 5a51fbaa13bb9b3c..c39d77ab4ad95bfc 100755 --- a/tools/perf/tests/shell/stat+event_uniquifying.sh +++ b/tools/perf/tests/shell/stat+event_uniquifying.sh @@ -47,6 +47,7 @@ test_event_uniquifying() { # Skip if the machine does not have `uncore_imc` device. if ! ${perf_tool} list pmu | grep -q ${pmu}; then echo "Target does not support pmu ${pmu} [Skipped]" + err=2 return fi Then we get: root@number:~# perf test uniqu 93: perf stat events uniquifying : Skip root@number:~# Instead of the misleading: root@number:~# perf test uniqu 93: perf stat events uniquifying : Ok root@number:~# With -vv and the fix: root@number:~# perf test -vv uniqu 93: perf stat events uniquifying: --- start --- test child forked, pid 94671 stat event uniquifying test Target does not support PMU uncore_imc [Skipped] ---- end(-2) ---- 93: perf stat events uniquifying : Skip root@number:~# - Arnaldo ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1 v6.16] perf test event_uniquifying: Skip test on platforms without 'clockticks' events 2025-06-06 20:25 ` Arnaldo Carvalho de Melo @ 2025-06-07 2:55 ` Chun-Tse Shao 2025-06-09 15:18 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 6+ messages in thread From: Chun-Tse Shao @ 2025-06-07 2:55 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Namhyung Kim, Adrian Hunter, Alexander Shishkin, Andi Kleen, Dr. David Alan Gilbert, Howard Chu, Ian Rogers, Ingo Molnar, James Clark, Jiri Olsa, Kan Liang, Levi Yun, Mark Rutland, Peter Zijlstra, Weilin Wang, Linux Kernel Mailing List, linux-perf-users Thank you Arnaldo for finding this problem. Please feel free to amend your fix. -CT On Fri, Jun 6, 2025 at 1:25 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > > On Fri, Jun 06, 2025 at 05:18:07PM -0300, Arnaldo Carvalho de Melo wrote: > > On Fri, Jun 06, 2025 at 10:52:02AM -0700, Namhyung Kim wrote: > > > On Thu, Jun 05, 2025 at 04:22:40PM -0300, Arnaldo Carvalho de Melo wrote: > > > > I'll add this to perf-tools for v6.16, please check. > > > > Plesae see > > > > https://lore.kernel.org/linux-perf-users/20250521224513.1104129-1-ctshao@google.com/ > > > Oh, great, I'll drop my fix and get that one instead. > > Nope, that one returns ok if the test can't be performed, it should > return 2 so that it is skipped and since we don't have a way to show the > reason for skipping a shell test, when using 'perf test -vv' the warning > that is there already (the needed PMU not being available) will be > shown. > > So I'm amending this on top, ok? > > diff --git a/tools/perf/tests/shell/stat+event_uniquifying.sh b/tools/perf/tests/shell/stat+event_uniquifying.sh > index 5a51fbaa13bb9b3c..c39d77ab4ad95bfc 100755 > --- a/tools/perf/tests/shell/stat+event_uniquifying.sh > +++ b/tools/perf/tests/shell/stat+event_uniquifying.sh > @@ -47,6 +47,7 @@ test_event_uniquifying() { > # Skip if the machine does not have `uncore_imc` device. > if ! ${perf_tool} list pmu | grep -q ${pmu}; then > echo "Target does not support pmu ${pmu} [Skipped]" > + err=2 > return > fi > > Then we get: > root@number:~# perf test uniqu > 93: perf stat events uniquifying : Skip > root@number:~# > > Instead of the misleading: > > root@number:~# perf test uniqu > 93: perf stat events uniquifying : Ok > root@number:~# > > With -vv and the fix: > > root@number:~# perf test -vv uniqu > 93: perf stat events uniquifying: > --- start --- > test child forked, pid 94671 > stat event uniquifying test > Target does not support PMU uncore_imc [Skipped] > ---- end(-2) ---- > 93: perf stat events uniquifying : Skip > root@number:~# > > - Arnaldo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1 v6.16] perf test event_uniquifying: Skip test on platforms without 'clockticks' events 2025-06-07 2:55 ` Chun-Tse Shao @ 2025-06-09 15:18 ` Arnaldo Carvalho de Melo 0 siblings, 0 replies; 6+ messages in thread From: Arnaldo Carvalho de Melo @ 2025-06-09 15:18 UTC (permalink / raw) To: Chun-Tse Shao Cc: Namhyung Kim, Adrian Hunter, Alexander Shishkin, Andi Kleen, Dr. David Alan Gilbert, Howard Chu, Ian Rogers, Ingo Molnar, James Clark, Jiri Olsa, Kan Liang, Levi Yun, Mark Rutland, Peter Zijlstra, Weilin Wang, Linux Kernel Mailing List, linux-perf-users On Fri, Jun 06, 2025 at 07:55:54PM -0700, Chun-Tse Shao wrote: > Thank you Arnaldo for finding this problem. Please feel free to amend your fix. Thanks for checking! - Arnaldo ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-06-09 15:18 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-06-05 19:22 [PATCH 1/1 v6.16] perf test event_uniquifying: Skip test on platforms without 'clockticks' events Arnaldo Carvalho de Melo 2025-06-06 17:52 ` Namhyung Kim 2025-06-06 20:18 ` Arnaldo Carvalho de Melo 2025-06-06 20:25 ` Arnaldo Carvalho de Melo 2025-06-07 2:55 ` Chun-Tse Shao 2025-06-09 15:18 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox