* [PATCH] perf evlist: Fix the warning logic about warn_user_request_cpu
@ 2024-03-18 12:11 Chunxin Zang
2024-12-09 14:42 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 4+ messages in thread
From: Chunxin Zang @ 2024-03-18 12:11 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter
Cc: yangchen11, zhouchunhua, linux-perf-users, linux-kernel,
zangchunxin, Chunxin Zang
The old logic in evlist__warn_user_requested_cpus incorrectly output
the warning message when I run 'perf record -C xxx' command on my
context(the cpu has 8 performance-cores and 8 efficient-cores.).
The old warning like this:
# perf record -C 17
WARNING: A requested CPU in '17' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
# perf record -C 14
WARNING: A requested CPU in '14' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
# perf record -C 14-17
WARNING: A requested CPU in '15-16' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
WARNING: A requested CPU in '15-16' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
After patching, the warning is as follows
# perf record -C 17
WARNING: A requested CPU '17' in '17' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
# perf record -C 14
WARNING: A requested CPU '14' in '14' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
# perf record -C 15-18
WARNING: A requested CPU '16-18' in '15-18' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
WARNING: A requested CPU '15' in '15-18' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
Signed-off-by: Chunxin Zang <spring.cxz@gmail.com>
Reviewed-by: Chen Yang <yangchen11@lixiang.com>
---
tools/perf/util/evlist.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 55a300a0977b..82fee2e29966 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -2514,12 +2514,16 @@ void evlist__warn_user_requested_cpus(struct evlist *evlist, const char *cpu_lis
to_test = pmu && pmu->is_core ? pmu->cpus : cpu_map__online();
intersect = perf_cpu_map__intersect(to_test, user_requested_cpus);
- if (!perf_cpu_map__equal(intersect, user_requested_cpus)) {
- char buf[128];
- cpu_map__snprint(to_test, buf, sizeof(buf));
- pr_warning("WARNING: A requested CPU in '%s' is not supported by PMU '%s' (CPUs %s) for event '%s'\n",
- cpu_list, pmu ? pmu->name : "cpu", buf, evsel__name(pos));
+ if (intersect && perf_cpu_map__is_subset(user_requested_cpus, intersect)) {
+ char buf_test[128];
+ char buf_intersect[128];
+
+ cpu_map__snprint(to_test, buf_test, sizeof(buf_test));
+ cpu_map__snprint(intersect, buf_intersect, sizeof(buf_intersect));
+ pr_warning("WARNING: A requested CPU '%s' in '%s' is not supported by "
+ "PMU '%s' (CPUs %s) for event '%s'\n", buf_intersect, cpu_list,
+ pmu ? pmu->name : "cpu", buf_test, evsel__name(pos));
}
perf_cpu_map__put(intersect);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf evlist: Fix the warning logic about warn_user_request_cpu
2024-03-18 12:11 [PATCH] perf evlist: Fix the warning logic about warn_user_request_cpu Chunxin Zang
@ 2024-12-09 14:42 ` Arnaldo Carvalho de Melo
2024-12-10 9:28 ` James Clark
0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-12-09 14:42 UTC (permalink / raw)
To: Chunxin Zang
Cc: peterz, mingo, namhyung, mark.rutland, alexander.shishkin, jolsa,
irogers, adrian.hunter, yangchen11, zhouchunhua, linux-perf-users,
linux-kernel, zangchunxin
On Mon, Mar 18, 2024 at 08:11:50PM +0800, Chunxin Zang wrote:
> The old logic in evlist__warn_user_requested_cpus incorrectly output
> the warning message when I run 'perf record -C xxx' command on my
> context(the cpu has 8 performance-cores and 8 efficient-cores.).
>
> The old warning like this:
> # perf record -C 17
> WARNING: A requested CPU in '17' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
> # perf record -C 14
> WARNING: A requested CPU in '14' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
> # perf record -C 14-17
> WARNING: A requested CPU in '15-16' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
> WARNING: A requested CPU in '15-16' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
>
> After patching, the warning is as follows
> # perf record -C 17
> WARNING: A requested CPU '17' in '17' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
Looks wrong, i.e. I ask for CPU 17 and it says it is not in the range
16-23?
Ditto for the rest, no?
- Arnaldo
> # perf record -C 14
> WARNING: A requested CPU '14' in '14' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
> # perf record -C 15-18
> WARNING: A requested CPU '16-18' in '15-18' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
> WARNING: A requested CPU '15' in '15-18' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
>
> Signed-off-by: Chunxin Zang <spring.cxz@gmail.com>
> Reviewed-by: Chen Yang <yangchen11@lixiang.com>
> ---
> tools/perf/util/evlist.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 55a300a0977b..82fee2e29966 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -2514,12 +2514,16 @@ void evlist__warn_user_requested_cpus(struct evlist *evlist, const char *cpu_lis
>
> to_test = pmu && pmu->is_core ? pmu->cpus : cpu_map__online();
> intersect = perf_cpu_map__intersect(to_test, user_requested_cpus);
> - if (!perf_cpu_map__equal(intersect, user_requested_cpus)) {
> - char buf[128];
>
> - cpu_map__snprint(to_test, buf, sizeof(buf));
> - pr_warning("WARNING: A requested CPU in '%s' is not supported by PMU '%s' (CPUs %s) for event '%s'\n",
> - cpu_list, pmu ? pmu->name : "cpu", buf, evsel__name(pos));
> + if (intersect && perf_cpu_map__is_subset(user_requested_cpus, intersect)) {
> + char buf_test[128];
> + char buf_intersect[128];
> +
> + cpu_map__snprint(to_test, buf_test, sizeof(buf_test));
> + cpu_map__snprint(intersect, buf_intersect, sizeof(buf_intersect));
> + pr_warning("WARNING: A requested CPU '%s' in '%s' is not supported by "
> + "PMU '%s' (CPUs %s) for event '%s'\n", buf_intersect, cpu_list,
> + pmu ? pmu->name : "cpu", buf_test, evsel__name(pos));
> }
> perf_cpu_map__put(intersect);
> }
> --
> 2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf evlist: Fix the warning logic about warn_user_request_cpu
2024-12-09 14:42 ` Arnaldo Carvalho de Melo
@ 2024-12-10 9:28 ` James Clark
2024-12-10 10:13 ` Chunxin Zang
0 siblings, 1 reply; 4+ messages in thread
From: James Clark @ 2024-12-10 9:28 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Chunxin Zang, Ian Rogers, yangchen11
Cc: peterz, mingo, namhyung, mark.rutland, alexander.shishkin, jolsa,
adrian.hunter, zhouchunhua, linux-perf-users, linux-kernel,
zangchunxin
On 09/12/2024 2:42 pm, Arnaldo Carvalho de Melo wrote:
> On Mon, Mar 18, 2024 at 08:11:50PM +0800, Chunxin Zang wrote:
>> The old logic in evlist__warn_user_requested_cpus incorrectly output
>> the warning message when I run 'perf record -C xxx' command on my
>> context(the cpu has 8 performance-cores and 8 efficient-cores.).
>>
>> The old warning like this:
>> # perf record -C 17
>> WARNING: A requested CPU in '17' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
>> # perf record -C 14
>> WARNING: A requested CPU in '14' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
>> # perf record -C 14-17
>> WARNING: A requested CPU in '15-16' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
>> WARNING: A requested CPU in '15-16' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
>>
>> After patching, the warning is as follows
>> # perf record -C 17
>> WARNING: A requested CPU '17' in '17' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
>
> Looks wrong, i.e. I ask for CPU 17 and it says it is not in the range
> 16-23?
>
> Ditto for the rest, no?
>
> - Arnaldo
>
Is this fix needed if we have
https://lore.kernel.org/linux-perf-users/20241114160450.295844-1-james.clark@linaro.org/T/#t
?
I think some of these warnings might not be shown in that case due to
fixing the other issue.
>> # perf record -C 14
>> WARNING: A requested CPU '14' in '14' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
>> # perf record -C 15-18
>> WARNING: A requested CPU '16-18' in '15-18' is not supported by PMU 'cpu_atom' (CPUs 16-23) for event 'cycles:P'
>> WARNING: A requested CPU '15' in '15-18' is not supported by PMU 'cpu_core' (CPUs 0-15) for event 'cycles:P'
>>
>> Signed-off-by: Chunxin Zang <spring.cxz@gmail.com>
>> Reviewed-by: Chen Yang <yangchen11@lixiang.com>
>> ---
>> tools/perf/util/evlist.c | 14 +++++++++-----
>> 1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
>> index 55a300a0977b..82fee2e29966 100644
>> --- a/tools/perf/util/evlist.c
>> +++ b/tools/perf/util/evlist.c
>> @@ -2514,12 +2514,16 @@ void evlist__warn_user_requested_cpus(struct evlist *evlist, const char *cpu_lis
>>
>> to_test = pmu && pmu->is_core ? pmu->cpus : cpu_map__online();
>> intersect = perf_cpu_map__intersect(to_test, user_requested_cpus);
>> - if (!perf_cpu_map__equal(intersect, user_requested_cpus)) {
>> - char buf[128];
>>
>> - cpu_map__snprint(to_test, buf, sizeof(buf));
>> - pr_warning("WARNING: A requested CPU in '%s' is not supported by PMU '%s' (CPUs %s) for event '%s'\n",
>> - cpu_list, pmu ? pmu->name : "cpu", buf, evsel__name(pos));
>> + if (intersect && perf_cpu_map__is_subset(user_requested_cpus, intersect)) {
>> + char buf_test[128];
>> + char buf_intersect[128];
>> +
>> + cpu_map__snprint(to_test, buf_test, sizeof(buf_test));
>> + cpu_map__snprint(intersect, buf_intersect, sizeof(buf_intersect));
>> + pr_warning("WARNING: A requested CPU '%s' in '%s' is not supported by "
>> + "PMU '%s' (CPUs %s) for event '%s'\n", buf_intersect, cpu_list,
>> + pmu ? pmu->name : "cpu", buf_test, evsel__name(pos));
>> }
>> perf_cpu_map__put(intersect);
>> }
>> --
>> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf evlist: Fix the warning logic about warn_user_request_cpu
2024-12-10 9:28 ` James Clark
@ 2024-12-10 10:13 ` Chunxin Zang
0 siblings, 0 replies; 4+ messages in thread
From: Chunxin Zang @ 2024-12-10 10:13 UTC (permalink / raw)
To: James Clark
Cc: Arnaldo Carvalho de Melo, Ian Rogers, Chen Yang, Peter Zijlstra,
mingo, namhyung, mark.rutland, alexander.shishkin, jolsa,
adrian.hunter, zhouchunhua, linux-perf-users, linux-kernel,
zangchunxin
> On Dec 10, 2024, at 17:28, James Clark <james.clark@linaro.org> wrote:
>
> .
Hi James, Arnaldo
At that time, I also released a v2 version, and Ian Rogers provided some suggestions
for modifications. However, I'm very sorry that later, because I was busy with other
things, I forgot about this issue.
Now I'm very glad to hear that this problem has been fixed. I'll verify it in my environment
when I have time this weekend.
https://lore.kernel.org/lkml/20240319091429.2056555-1-spring.cxz@gmail.com/
Best wishes
Chunxin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-10 10:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-18 12:11 [PATCH] perf evlist: Fix the warning logic about warn_user_request_cpu Chunxin Zang
2024-12-09 14:42 ` Arnaldo Carvalho de Melo
2024-12-10 9:28 ` James Clark
2024-12-10 10:13 ` Chunxin Zang
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).