From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Leo Yan <leo.yan@linux.dev>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
James Clark <james.clark@arm.com>,
Dominique Martinet <asmadeus@codewreck.org>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] perf evlist: Force adding default events only to core PMUs
Date: Tue, 28 May 2024 16:44:23 -0300 [thread overview]
Message-ID: <ZlY0F_lmB37g10OK@x1> (raw)
In-Reply-To: <CAP-5=fXfidyF_e=yMNi26ScgY-VbJPfxN8M7OiK9ELa3qTfXPQ@mail.gmail.com>
On Mon, May 27, 2024 at 10:36:45PM -0700, Ian Rogers wrote:
> On Mon, May 27, 2024 at 3:58 AM Leo Yan <leo.yan@linux.dev> wrote:
> > On Sat, May 25, 2024 at 02:14:26PM -0700, Linus Torvalds wrote:
> > > On Sat, 25 May 2024 at 09:43, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> > > > This makes 'perf record' work for me again.
> > > Oh, wait, no it doesn't.
> > > It makes just the plain "perf record" without any arguments work,
> > > which was what I was testing because I was lazy.
> > > So now
> > > $ perf record sleep 1
> > > works fine. But
> > > $ perf record -e cycles:pp sleep 1
> > > is still completely broken (with or without ":p" and ":pp").
> > Seems to me that this patch fails to check if a PMU is a core-attached
> > PMU that can support common hardware events. Therefore, we should
> > consider adding the following check.
> > +++ b/tools/perf/util/parse-events.c
> > @@ -1594,6 +1594,9 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state,
> > while ((pmu = perf_pmus__scan(pmu)) != NULL) {
> > bool auto_merge_stats;
> >
> > + if (hw_config != PERF_COUNT_HW_MAX && !pmu->is_core)
> > + continue;
> > +
> > if (parse_events__filter_pmu(parse_state, pmu))
> > continue;
> > To be clear, I only compiled this change but I have no chance to test
> > it. @Ian, could you confirm this?
> Hi Leo,
> so the code is working as intended. I believe it also agrees with what
> Arnaldo thinks.
> If you do:
> $ perf stat -e cycles ...
> and you have
> /sys/devices/pmu1/events/cycles
> /sys/devices/pmu2/events/cycles
> The output of perf stat should contain counts for pmu1 and pmu2. Were
> the event 'data_read' or 'inst_retired.any' we wouldn't be having the
Sure, what is being asked is to count events and if those two events in
those two PMUs can count, then do what the user asked.
For 'perf record' we're asking for sampling, if the event has the name
specified and can't be sampled, skip it, warn the user and even so
only if verbose mode is asked, something like:
root@x1:~# perf record -e cycles -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.998 MB perf.data (4472 samples) ]
root@x1:~# perf evlist
cpu_atom/cycles/
cpu_core/cycles/
dummy:u
root@x1:~#
Cool, there are two 'cycles' events, one in a PMU named 'cpu_atom',
another in a 'cpu_core' one, both can be sampled, my workload may
run/use resources on then, I'm interested, sample both.
But if we had some other PMU, to use a name Jiri uses in tests/fake
PMUs, the 'krava' PMU and it has a 'cycles' event, so 'krava/cycles/'
and for some reason it doesn't support sampling, skip it, then the
result should be the same as above.
If the user finds it strange after looking at sysfs that 'krava/cycles/'
isn't being sampled, the usual workflow is to ask perf for more
verbosity, using -v (or multiple 'v' letters to get increasing levels of
verbosity), in which case the user would see:
root@x1:~# perf record -v -e cycles -a sleep 1
WARNING: skipping 'krava/cycles/' event, it doesn't support sampling.
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.998 MB perf.data (4472 samples) ]
root@x1:~# perf evlist
- Arnaldo
next prev parent reply other threads:[~2024-05-28 19:44 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-25 15:29 [PATCH v1] perf evlist: Force adding default events only to core PMUs Ian Rogers
2024-05-25 16:43 ` Linus Torvalds
2024-05-25 21:14 ` Linus Torvalds
2024-05-27 10:58 ` Leo Yan
2024-05-28 5:36 ` Ian Rogers
2024-05-28 17:00 ` Linus Torvalds
2024-05-28 17:39 ` Ian Rogers
2024-05-28 18:12 ` Linus Torvalds
2024-05-28 18:58 ` Ian Rogers
2024-05-28 19:42 ` Linus Torvalds
2024-05-28 20:03 ` Ian Rogers
2024-05-28 20:33 ` Linus Torvalds
2024-05-28 21:37 ` Ian Rogers
2024-05-28 21:42 ` Linus Torvalds
2024-05-28 19:44 ` Arnaldo Carvalho de Melo [this message]
2024-05-28 19:51 ` Ian Rogers
2024-05-29 14:50 ` James Clark
2024-05-29 17:33 ` Ian Rogers
2024-05-30 15:37 ` James Clark
2024-05-30 16:14 ` Ian Rogers
2024-05-29 18:44 ` Arnaldo Carvalho de Melo
2024-05-29 19:25 ` Ian Rogers
2024-05-30 5:35 ` Namhyung Kim
2024-05-30 12:48 ` James Clark
2024-05-30 13:46 ` Ian Rogers
2024-05-30 22:51 ` Namhyung Kim
2024-06-05 20:29 ` Namhyung Kim
2024-06-05 23:02 ` Ian Rogers
2024-06-06 7:09 ` Namhyung Kim
2024-06-06 9:42 ` James Clark
2024-06-06 13:51 ` Arnaldo Carvalho de Melo
2024-06-07 6:10 ` Namhyung Kim
2024-06-06 13:47 ` Arnaldo Carvalho de Melo
2024-05-28 20:00 ` Linus Torvalds
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=ZlY0F_lmB37g10OK@x1 \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=asmadeus@codewreck.org \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).