The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: acme@kernel.org, peterz@infradead.org, irogers@google.com,
	jolsa@kernel.org, adrian.hunter@intel.com,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	sandipan.das@amd.com, ananth.narayan@amd.com,
	santosh.shukla@amd.com, Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH] perf evsel amd: Fix IBS error message
Date: Thu, 22 Jun 2023 10:57:57 +0530	[thread overview]
Message-ID: <27a64673-63f1-e438-ff17-164b008c674b@amd.com> (raw)
In-Reply-To: <CAM9d7chbpiSJ6eSu9_Gs7aLZZb58gtHsvH9tsE-U4eM1eyDvKQ@mail.gmail.com>

Hi Namhyung,

On 22-Jun-23 4:03 AM, Namhyung Kim wrote:
> Hi Ravi,
> 
> On Tue, Jun 20, 2023 at 11:24 PM Ravi Bangoria <ravi.bangoria@amd.com> wrote:
>>
>> AMD IBS can do per-process profiling[1] and is no longer restricted to
>> per-cpu or systemwide only. Remove stale error message.
>>
>> Before:
>>   $ sudo ./perf record -e "{ibs_op//,ibs_op//}" -C 0
>>   Error:
>>   AMD IBS may only be available in system-wide/per-cpu mode.
>>   Try using -a, or -C and workload affinity
> 
> It was strange that the -C option was given already.

Hmm. evsel->core.system_wide is bit confusing for me. A Comment on it's
definition says "irrespective of user requested CPUs or threads":

        /*
         * system_wide is for events that need to be on every CPU, irrespective
         * of user requested CPUs or threads. Map propagation will set cpus to
         * this event's own_cpus, whereby they will contribute to evlist
         * all_cpus.
         */
        bool                     system_wide;

So, I guess evsel->core.system_wide doesn't depend on -a / -C.

> 
>>
>> After:
>>   $ sudo ./perf record -e "{ibs_op//,ibs_op//}" -C 0
>>   Error:
>>   The sys_perf_event_open() syscall returned with 22 (Invalid
>>   argument) for event (ibs_op//).
>>   /bin/dmesg | grep -i perf may provide additional information.
> 
> It can run newer perf tools on an old kernel but the old error
> message seems to be invalid anyway.  So I'm ok with removing it.

Right.

>>
>> [1] https://git.kernel.org/torvalds/c/30093056f7b2
>>
>> Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
>> ---
>>  tools/perf/util/evsel.c | 10 +++-------
>>  1 file changed, 3 insertions(+), 7 deletions(-)
>>
>> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
>> index 356c07f03be6..65b0b70830f0 100644
>> --- a/tools/perf/util/evsel.c
>> +++ b/tools/perf/util/evsel.c
>> @@ -3092,14 +3092,10 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
>>                         return scnprintf(msg, size,
>>         "Invalid event (%s) in per-thread mode, enable system wide with '-a'.",
>>                                         evsel__name(evsel));
>> -               if (is_amd(arch, cpuid)) {
>> -                       if (is_amd_ibs(evsel)) {
>> -                               if (evsel->core.attr.exclude_kernel)
>> -                                       return scnprintf(msg, size,
>> +               if (is_amd(arch, cpuid) && is_amd_ibs(evsel)) {
>> +                       if (evsel->core.attr.exclude_kernel) {
>> +                               return scnprintf(msg, size,
>>         "AMD IBS can't exclude kernel events.  Try running at a higher privilege level.");
> 
> I'm not sure if it's enough.  The IBS PMUs have CAP_NO_EXCLUDE then
> it can't exclude user events too, right?

That's correct. Let me try to fix this whole `if (is_amd())` part properly.

Thanks for your feedback,
Ravi

  reply	other threads:[~2023-06-22  5:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20  9:16 [PATCH] perf/amd: Prevent grouping of IBS events Ravi Bangoria
2023-06-20 16:44 ` Ian Rogers
2023-06-21  3:27   ` Ravi Bangoria
2023-06-21  6:23     ` [PATCH] perf evsel amd: Fix IBS error message Ravi Bangoria
2023-06-21 22:33       ` Namhyung Kim
2023-06-22  5:27         ` Ravi Bangoria [this message]
2023-06-22  5:38           ` Namhyung Kim
2023-06-21 22:50     ` [PATCH] perf/amd: Prevent grouping of IBS events Namhyung Kim
2023-06-22  3:30       ` Ravi Bangoria
2023-06-22  5:09     ` Ian Rogers
2023-06-22  5:39       ` Ravi Bangoria
2023-06-22  5:44         ` Ian Rogers
2023-06-22  5:49           ` Ravi Bangoria
2023-07-10  8:37 ` [tip: perf/core] " tip-bot2 for Ravi Bangoria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27a64673-63f1-e438-ff17-164b008c674b@amd.com \
    --to=ravi.bangoria@amd.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ananth.narayan@amd.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sandipan.das@amd.com \
    --cc=santosh.shukla@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox