lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z7Z5kv75BMML2A1q@google.com>
Date: Wed, 19 Feb 2025 16:38:42 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: linux-perf-users@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: linux-kernel@...r.kernel.org, Ian Rogers <irogers@...gle.com>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Kan Liang <kan.liang@...ux.intel.com>,
	Andi Kleen <ak@...ux.intel.com>
Subject: [RFC] perf tools: About encodings of legacy event names

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ