linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] perf tools: About encodings of legacy event names
@ 2025-02-20  0:38 Namhyung Kim
  2025-02-20  6:37 ` Ian Rogers
  0 siblings, 1 reply; 12+ messages in thread
From: Namhyung Kim @ 2025-02-20  0:38 UTC (permalink / raw)
  To: linux-perf-users, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo
  Cc: linux-kernel, Ian Rogers, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Adrian Hunter, Kan Liang, Andi Kleen

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-03-07 22:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20  0:38 [RFC] perf tools: About encodings of legacy event names Namhyung Kim
2025-02-20  6:37 ` 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

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).