From: Namhyung Kim <namhyung@kernel.org>
To: linux-perf-users@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, Ian Rogers <irogers@google.com>,
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>,
Andi Kleen <ak@linux.intel.com>
Subject: [RFC] perf tools: About encodings of legacy event names
Date: Wed, 19 Feb 2025 16:38:42 -0800 [thread overview]
Message-ID: <Z7Z5kv75BMML2A1q@google.com> (raw)
Hello,
Ian and I have been discussing the behaviors of event encodings and it's
hard to find a point so far that we can agree on. So I'd like to hear
your opinion to resolve this. If you happen to have some time, you can
follow the thread here:
https://lore.kernel.org/linux-perf-users/20250109222109.567031-5-irogers@google.com/#r
Basically there are some events that were defined in the perf ABI.
PERF_COUNT_HW_CPU_CYCLES, PERF_COUNT_HW_INSTRUCTIONS, ...
So perf tools use those (legacy) encodings with the matching names like
"cycles" (or "cpu-cycles"), "instructions", etc.
On the another hand, it has wildcard matching for event names in PMUs so
that users can conveniently use events without specifying PMU names.
For example, "event1" would expand to "pmuX/event1/", "pmuY/event1/", etc
as long as the PMUs have the event in sysfs or JSON.
And there are platforms where "cycles" event is defined in a (core) PMU
(like "blah/cycles") and the event has a different behavior than the
legacy encoding. Then it has to choose which encoding is better for the
given name. But it's a general issue for the legacy event names.
Q. what should it do with "cycles"?
-----------------------------------
1. just use the legacy encoding (PERF_COUNT_HW_CPU_CYCLES).
2. expand to (possibly multiple) PMU events (like "cpu/cycles/") and
use the encoding defined there.
I think the #1 is the current behavior. The upside is it's simple and
intuitive. But it's different than other names and can make confusion.
Users should use the full name ("cpu/cycles/") if they need sysfs one.
The #2 can make the parsing code simpler and the behavior consistent.
Also it can override the (possibly broken) behavior of the legacy event
on some platforms. No way (and reason?) to use the legacy encodings.
Also Ian says `perf list` shows "cpu-cycles" and "cpu/cpu-cycles/"
together which assumes they are the same. But using #1 can result in a
different behavior respectively. Probably better to make it consistent.
I tried to summarize the issues concisely but may miss some issues. I
hope Ian can fill it up in case I missed something important.
Can you please share your opinion about what would be the best behavior?
Thanks,
Namhyung
next reply other threads:[~2025-02-20 0:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 0:38 Namhyung Kim [this message]
2025-02-20 6:37 ` [RFC] perf tools: About encodings of legacy event names Ian Rogers
2025-02-24 15:01 ` Arnaldo Carvalho de Melo
2025-02-24 17:36 ` Ian Rogers
2025-02-24 20:25 ` Arnaldo Carvalho de Melo
2025-02-24 21:34 ` Ian Rogers
2025-02-24 23:28 ` Ian Rogers
2025-03-07 5:24 ` Ian Rogers
2025-03-07 14:17 ` James Clark
2025-03-07 15:10 ` Arnaldo Carvalho de Melo
2025-03-07 18:48 ` Ian Rogers
2025-03-07 22:10 ` Ian Rogers
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=Z7Z5kv75BMML2A1q@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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).