* [PATCH 1/2] perf test: Enable system wide for metricgroups test
@ 2021-11-23 2:03 Ian Rogers
2021-11-23 2:03 ` [PATCH 2/2] perf evsel: Improve error message for uncore events Ian Rogers
0 siblings, 1 reply; 6+ messages in thread
From: Ian Rogers @ 2021-11-23 2:03 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Andi Kleen, linux-perf-users, linux-kernel
Cc: eranian, Ian Rogers
Uncore events as group leaders fail in per-thread mode causing exit
errors. Enable system-wide for metricgroup testing. This fixes the HPC
metric group when tested on skylakex.
Fixes: 4a87dea9e60f ("perf test: Workload test of metric and metricgroups")
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/shell/stat_all_metricgroups.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/stat_all_metricgroups.sh b/tools/perf/tests/shell/stat_all_metricgroups.sh
index de24d374ce24..cb35e488809a 100755
--- a/tools/perf/tests/shell/stat_all_metricgroups.sh
+++ b/tools/perf/tests/shell/stat_all_metricgroups.sh
@@ -6,7 +6,7 @@ set -e
for m in $(perf list --raw-dump metricgroups); do
echo "Testing $m"
- perf stat -M "$m" true
+ perf stat -M "$m" -a true
done
exit 0
--
2.34.0.rc2.393.gf8c9666880-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2] perf evsel: Improve error message for uncore events 2021-11-23 2:03 [PATCH 1/2] perf test: Enable system wide for metricgroups test Ian Rogers @ 2021-11-23 2:03 ` Ian Rogers 2021-11-28 16:57 ` Jiri Olsa 0 siblings, 1 reply; 6+ messages in thread From: Ian Rogers @ 2021-11-23 2:03 UTC (permalink / raw) To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim, Andi Kleen, linux-perf-users, linux-kernel Cc: eranian, Ian Rogers When a group has multiple events and the leader fails it can yield errors like: $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_imc/cas_count_read/). /bin/dmesg | grep -i perf may provide additional information. However, when not the group leader <not supported> is given: $ perf stat -e '{instructions,uncore_imc/cas_count_read/}' /bin/true ... 1,619,057 instructions <not supported> MiB uncore_imc/cas_count_read/ This is necessary because get_group_fd will fail if the leader fails and is the direct result of the check on line 750 of builtin-stat.c in stat_handle_error that returns COUNTER_SKIP for the latter case. This patch improves the error message to: $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true Error: Invalid event (uncore_imc/cas_count_read/) in per-thread mode, enable system wide with '-a'. Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/util/evsel.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index a59fb2ecb84e..48696ff4bddb 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -2950,6 +2950,11 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target, return scnprintf(msg, size, "wrong clockid (%d).", clockid); if (perf_missing_features.aux_output) return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel."); + if ((evsel__leader(evsel) == evsel) && + (evsel->core.leader->nr_members > 1)) + return scnprintf(msg, size, + "Invalid event (%s) in per-thread mode, enable system wide with '-a'.", + evsel__name(evsel)); break; case ENODATA: return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. " -- 2.34.0.rc2.393.gf8c9666880-goog ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] perf evsel: Improve error message for uncore events 2021-11-23 2:03 ` [PATCH 2/2] perf evsel: Improve error message for uncore events Ian Rogers @ 2021-11-28 16:57 ` Jiri Olsa 2021-11-29 23:48 ` Ian Rogers 0 siblings, 1 reply; 6+ messages in thread From: Jiri Olsa @ 2021-11-28 16:57 UTC (permalink / raw) To: Ian Rogers Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin, Namhyung Kim, Andi Kleen, linux-perf-users, linux-kernel, eranian On Mon, Nov 22, 2021 at 06:03:41PM -0800, Ian Rogers wrote: > When a group has multiple events and the leader fails it can yield > errors like: > > $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true > Error: > The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_imc/cas_count_read/). > /bin/dmesg | grep -i perf may provide additional information. > > However, when not the group leader <not supported> is given: > > $ perf stat -e '{instructions,uncore_imc/cas_count_read/}' /bin/true > ... > 1,619,057 instructions > <not supported> MiB uncore_imc/cas_count_read/ > > This is necessary because get_group_fd will fail if the leader fails and > is the direct result of the check on line 750 of builtin-stat.c in > stat_handle_error that returns COUNTER_SKIP for the latter case. > > This patch improves the error message to: > > $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true > Error: > Invalid event (uncore_imc/cas_count_read/) in per-thread mode, enable system wide with '-a'. > > Signed-off-by: Ian Rogers <irogers@google.com> > --- > tools/perf/util/evsel.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index a59fb2ecb84e..48696ff4bddb 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -2950,6 +2950,11 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target, > return scnprintf(msg, size, "wrong clockid (%d).", clockid); > if (perf_missing_features.aux_output) > return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel."); > + if ((evsel__leader(evsel) == evsel) && > + (evsel->core.leader->nr_members > 1)) > + return scnprintf(msg, size, > + "Invalid event (%s) in per-thread mode, enable system wide with '-a'.", > + evsel__name(evsel)); should we rather check 'target' pointer for the per-thread mode? I'm not sure that per-thread mode will always be the case for the failure jirka > break; > case ENODATA: > return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. " > -- > 2.34.0.rc2.393.gf8c9666880-goog > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] perf evsel: Improve error message for uncore events 2021-11-28 16:57 ` Jiri Olsa @ 2021-11-29 23:48 ` Ian Rogers 2021-11-30 6:55 ` Namhyung Kim 0 siblings, 1 reply; 6+ messages in thread From: Ian Rogers @ 2021-11-29 23:48 UTC (permalink / raw) To: Jiri Olsa Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin, Namhyung Kim, Andi Kleen, linux-perf-users, linux-kernel, eranian On Sun, Nov 28, 2021 at 8:58 AM Jiri Olsa <jolsa@redhat.com> wrote: > > On Mon, Nov 22, 2021 at 06:03:41PM -0800, Ian Rogers wrote: > > When a group has multiple events and the leader fails it can yield > > errors like: > > > > $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true > > Error: > > The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_imc/cas_count_read/). > > /bin/dmesg | grep -i perf may provide additional information. > > > > However, when not the group leader <not supported> is given: > > > > $ perf stat -e '{instructions,uncore_imc/cas_count_read/}' /bin/true > > ... > > 1,619,057 instructions > > <not supported> MiB uncore_imc/cas_count_read/ > > > > This is necessary because get_group_fd will fail if the leader fails and > > is the direct result of the check on line 750 of builtin-stat.c in > > stat_handle_error that returns COUNTER_SKIP for the latter case. > > > > This patch improves the error message to: > > > > $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true > > Error: > > Invalid event (uncore_imc/cas_count_read/) in per-thread mode, enable system wide with '-a'. > > > > Signed-off-by: Ian Rogers <irogers@google.com> > > --- > > tools/perf/util/evsel.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > > index a59fb2ecb84e..48696ff4bddb 100644 > > --- a/tools/perf/util/evsel.c > > +++ b/tools/perf/util/evsel.c > > @@ -2950,6 +2950,11 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target, > > return scnprintf(msg, size, "wrong clockid (%d).", clockid); > > if (perf_missing_features.aux_output) > > return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel."); > > + if ((evsel__leader(evsel) == evsel) && > > + (evsel->core.leader->nr_members > 1)) > > + return scnprintf(msg, size, > > + "Invalid event (%s) in per-thread mode, enable system wide with '-a'.", > > + evsel__name(evsel)); > > should we rather check 'target' pointer for the per-thread mode? > I'm not sure that per-thread mode will always be the case for the failure Unfortunately the target isn't populated at that point: gdb --args perf stat -e '{uncore_imc/cas_count_write/},instructions' /bin/true (gdb) p *target $2 = {pid = 0x0, tid = 0x0, cpu_list = 0x0, uid_str = 0x0, bpf_str = 0x0, uid = 4294967295, system_wide = false, uses_mmap = false, default_per_cpu = false, per_thread = false, use_bpf = false, hybrid = false, attr_map = 0x0} #0 evsel__open_strerror (evsel=0x616000015680, target=0x5555586aa140 <target>, err=22, msg=0x7fffffff78d0 "]k\264WUU", size=8192) at util/evsel.c:2857 #1 0x00005555561744e8 in stat_handle_error (counter=0x616000015680) at builtin-stat.c:771 #2 0x0000555556174f05 in __run_perf_stat (argc=1, argv=0x7fffffffe450, run_idx=0) at builtin-stat.c:852 #3 0x00005555561763e1 in run_perf_stat (argc=1, argv=0x7fffffffe450, run_idx=0) at builtin-stat.c:1048 #4 0x000055555617df82 in cmd_stat (argc=1, argv=0x7fffffffe450) at builtin-stat.c:2550 #5 0x00005555562f36b8 in run_builtin (p=0x5555586bad00 <commands+288>, argc=4, argv=0x7fffffffe450) at perf.c:313 #6 0x00005555562f3c11 in handle_internal_command (argc=4, argv=0x7fffffffe450) at perf.c:365 #7 0x00005555562f3fce in run_argv (argcp=0x7fffffffe230, argv=0x7fffffffe240) at perf.c:409 #8 0x00005555562f47bd in main (argc=4, argv=0x7fffffffe450) at perf.c:539 Thanks, Ian > jirka > > > break; > > case ENODATA: > > return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. " > > -- > > 2.34.0.rc2.393.gf8c9666880-goog > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] perf evsel: Improve error message for uncore events 2021-11-29 23:48 ` Ian Rogers @ 2021-11-30 6:55 ` Namhyung Kim 2021-11-30 7:57 ` Ian Rogers 0 siblings, 1 reply; 6+ messages in thread From: Namhyung Kim @ 2021-11-30 6:55 UTC (permalink / raw) To: Ian Rogers Cc: Jiri Olsa, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin, Andi Kleen, linux-perf-users, linux-kernel, Stephane Eranian Hi Ian, On Mon, Nov 29, 2021 at 3:48 PM Ian Rogers <irogers@google.com> wrote: > > On Sun, Nov 28, 2021 at 8:58 AM Jiri Olsa <jolsa@redhat.com> wrote: > > > > On Mon, Nov 22, 2021 at 06:03:41PM -0800, Ian Rogers wrote: > > > When a group has multiple events and the leader fails it can yield > > > errors like: > > > > > > $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true > > > Error: > > > The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_imc/cas_count_read/). > > > /bin/dmesg | grep -i perf may provide additional information. > > > > > > However, when not the group leader <not supported> is given: > > > > > > $ perf stat -e '{instructions,uncore_imc/cas_count_read/}' /bin/true > > > ... > > > 1,619,057 instructions > > > <not supported> MiB uncore_imc/cas_count_read/ > > > > > > This is necessary because get_group_fd will fail if the leader fails and > > > is the direct result of the check on line 750 of builtin-stat.c in > > > stat_handle_error that returns COUNTER_SKIP for the latter case. > > > > > > This patch improves the error message to: > > > > > > $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true > > > Error: > > > Invalid event (uncore_imc/cas_count_read/) in per-thread mode, enable system wide with '-a'. > > > > > > Signed-off-by: Ian Rogers <irogers@google.com> > > > --- > > > tools/perf/util/evsel.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > > > index a59fb2ecb84e..48696ff4bddb 100644 > > > --- a/tools/perf/util/evsel.c > > > +++ b/tools/perf/util/evsel.c > > > @@ -2950,6 +2950,11 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target, > > > return scnprintf(msg, size, "wrong clockid (%d).", clockid); > > > if (perf_missing_features.aux_output) > > > return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel."); > > > + if ((evsel__leader(evsel) == evsel) && > > > + (evsel->core.leader->nr_members > 1)) > > > + return scnprintf(msg, size, > > > + "Invalid event (%s) in per-thread mode, enable system wide with '-a'.", > > > + evsel__name(evsel)); > > > > should we rather check 'target' pointer for the per-thread mode? > > I'm not sure that per-thread mode will always be the case for the failure > > Unfortunately the target isn't populated at that point: It might be populated properly, as in this case it should have no target. I think you can use !target__has_cpu(). Thanks, Namhyung > > gdb --args perf stat -e '{uncore_imc/cas_count_write/},instructions' /bin/true > (gdb) p *target > $2 = {pid = 0x0, tid = 0x0, cpu_list = 0x0, uid_str = 0x0, bpf_str = > 0x0, uid = 4294967295, system_wide = false, uses_mmap = false, > default_per_cpu = false, per_thread = false, use_bpf = false, hybrid > = false, attr_map = 0x0} > > #0 evsel__open_strerror (evsel=0x616000015680, target=0x5555586aa140 > <target>, err=22, msg=0x7fffffff78d0 "]k\264WUU", size=8192) > at util/evsel.c:2857 > #1 0x00005555561744e8 in stat_handle_error (counter=0x616000015680) > at builtin-stat.c:771 > #2 0x0000555556174f05 in __run_perf_stat (argc=1, > argv=0x7fffffffe450, run_idx=0) at builtin-stat.c:852 > #3 0x00005555561763e1 in run_perf_stat (argc=1, argv=0x7fffffffe450, > run_idx=0) at builtin-stat.c:1048 > #4 0x000055555617df82 in cmd_stat (argc=1, argv=0x7fffffffe450) at > builtin-stat.c:2550 > #5 0x00005555562f36b8 in run_builtin (p=0x5555586bad00 > <commands+288>, argc=4, argv=0x7fffffffe450) at perf.c:313 > #6 0x00005555562f3c11 in handle_internal_command (argc=4, > argv=0x7fffffffe450) at perf.c:365 > #7 0x00005555562f3fce in run_argv (argcp=0x7fffffffe230, > argv=0x7fffffffe240) at perf.c:409 > #8 0x00005555562f47bd in main (argc=4, argv=0x7fffffffe450) at perf.c:539 > > Thanks, > Ian > > > jirka > > > > > break; > > > case ENODATA: > > > return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. " > > > -- > > > 2.34.0.rc2.393.gf8c9666880-goog > > > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] perf evsel: Improve error message for uncore events 2021-11-30 6:55 ` Namhyung Kim @ 2021-11-30 7:57 ` Ian Rogers 0 siblings, 0 replies; 6+ messages in thread From: Ian Rogers @ 2021-11-30 7:57 UTC (permalink / raw) To: Namhyung Kim Cc: Jiri Olsa, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin, Andi Kleen, linux-perf-users, linux-kernel, Stephane Eranian On Mon, Nov 29, 2021 at 10:55 PM Namhyung Kim <namhyung@kernel.org> wrote: > > Hi Ian, > > On Mon, Nov 29, 2021 at 3:48 PM Ian Rogers <irogers@google.com> wrote: > > > > On Sun, Nov 28, 2021 at 8:58 AM Jiri Olsa <jolsa@redhat.com> wrote: > > > > > > On Mon, Nov 22, 2021 at 06:03:41PM -0800, Ian Rogers wrote: > > > > When a group has multiple events and the leader fails it can yield > > > > errors like: > > > > > > > > $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true > > > > Error: > > > > The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_imc/cas_count_read/). > > > > /bin/dmesg | grep -i perf may provide additional information. > > > > > > > > However, when not the group leader <not supported> is given: > > > > > > > > $ perf stat -e '{instructions,uncore_imc/cas_count_read/}' /bin/true > > > > ... > > > > 1,619,057 instructions > > > > <not supported> MiB uncore_imc/cas_count_read/ > > > > > > > > This is necessary because get_group_fd will fail if the leader fails and > > > > is the direct result of the check on line 750 of builtin-stat.c in > > > > stat_handle_error that returns COUNTER_SKIP for the latter case. > > > > > > > > This patch improves the error message to: > > > > > > > > $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true > > > > Error: > > > > Invalid event (uncore_imc/cas_count_read/) in per-thread mode, enable system wide with '-a'. > > > > > > > > Signed-off-by: Ian Rogers <irogers@google.com> > > > > --- > > > > tools/perf/util/evsel.c | 5 +++++ > > > > 1 file changed, 5 insertions(+) > > > > > > > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > > > > index a59fb2ecb84e..48696ff4bddb 100644 > > > > --- a/tools/perf/util/evsel.c > > > > +++ b/tools/perf/util/evsel.c > > > > @@ -2950,6 +2950,11 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target, > > > > return scnprintf(msg, size, "wrong clockid (%d).", clockid); > > > > if (perf_missing_features.aux_output) > > > > return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel."); > > > > + if ((evsel__leader(evsel) == evsel) && > > > > + (evsel->core.leader->nr_members > 1)) > > > > + return scnprintf(msg, size, > > > > + "Invalid event (%s) in per-thread mode, enable system wide with '-a'.", > > > > + evsel__name(evsel)); > > > > > > should we rather check 'target' pointer for the per-thread mode? > > > I'm not sure that per-thread mode will always be the case for the failure > > > > Unfortunately the target isn't populated at that point: > > It might be populated properly, as in this case > it should have no target. I think you can use > !target__has_cpu(). Thanks :-) I'm not sure having !target__has_cpu is intention revealing. Perhaps changing the error to say that an invalid/unsupported event can't be the group leader, unless it is the only event, and then suggest system wide mode. Thanks, Ian > Thanks, > Namhyung > > > > > > gdb --args perf stat -e '{uncore_imc/cas_count_write/},instructions' /bin/true > > (gdb) p *target > > $2 = {pid = 0x0, tid = 0x0, cpu_list = 0x0, uid_str = 0x0, bpf_str = > > 0x0, uid = 4294967295, system_wide = false, uses_mmap = false, > > default_per_cpu = false, per_thread = false, use_bpf = false, hybrid > > = false, attr_map = 0x0} > > > > #0 evsel__open_strerror (evsel=0x616000015680, target=0x5555586aa140 > > <target>, err=22, msg=0x7fffffff78d0 "]k\264WUU", size=8192) > > at util/evsel.c:2857 > > #1 0x00005555561744e8 in stat_handle_error (counter=0x616000015680) > > at builtin-stat.c:771 > > #2 0x0000555556174f05 in __run_perf_stat (argc=1, > > argv=0x7fffffffe450, run_idx=0) at builtin-stat.c:852 > > #3 0x00005555561763e1 in run_perf_stat (argc=1, argv=0x7fffffffe450, > > run_idx=0) at builtin-stat.c:1048 > > #4 0x000055555617df82 in cmd_stat (argc=1, argv=0x7fffffffe450) at > > builtin-stat.c:2550 > > #5 0x00005555562f36b8 in run_builtin (p=0x5555586bad00 > > <commands+288>, argc=4, argv=0x7fffffffe450) at perf.c:313 > > #6 0x00005555562f3c11 in handle_internal_command (argc=4, > > argv=0x7fffffffe450) at perf.c:365 > > #7 0x00005555562f3fce in run_argv (argcp=0x7fffffffe230, > > argv=0x7fffffffe240) at perf.c:409 > > #8 0x00005555562f47bd in main (argc=4, argv=0x7fffffffe450) at perf.c:539 > > > > Thanks, > > Ian > > > > > jirka > > > > > > > break; > > > > case ENODATA: > > > > return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. " > > > > -- > > > > 2.34.0.rc2.393.gf8c9666880-goog > > > > > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-11-30 7:57 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-11-23 2:03 [PATCH 1/2] perf test: Enable system wide for metricgroups test Ian Rogers 2021-11-23 2:03 ` [PATCH 2/2] perf evsel: Improve error message for uncore events Ian Rogers 2021-11-28 16:57 ` Jiri Olsa 2021-11-29 23:48 ` Ian Rogers 2021-11-30 6:55 ` Namhyung Kim 2021-11-30 7:57 ` Ian Rogers
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).