Files
linux/tools/perf/util
Namhyung Kim 2b70702917 perf tools: Remove evsel__handle_error_quirks()
The evsel__handle_error_quirks() is to fixup invalid event attributes on
some architecture based on the error code.  Currently it's only used for
AMD to disable precise_ip not to use IBS which has more restrictions.

But the commit c33aea446b changed call evsel__precise_ip_fallback
for any errors so there's no difference with the above function.  To
make matter worse, it caused a problem with branch stack on Zen3.

The IBS doesn't support branch stack so it should use a regular core
PMU event.  The default event is set precise_max and it starts with 3.
And evsel__precise_ip_fallback() tries with it and reduces the level one
by one.  At last it tries with 0 but it also failed on Zen3 since the
branch stack is not supported for the cycles event.

At this point, evsel__precise_ip_fallback() restores the original
precise_ip value (3) in the hope that it can succeed with other modifier
(like exclude_kernel).  Then evsel__handle_error_quirks() see it has
precise_ip != 0 and make it retry with 0.  This created an infinite
loop.

Before:

  $ perf record -b -vv |& grep removing
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  removing precise_ip on AMD
  ...

After:

  $ perf record -b true
  Error:
  Failure to open event 'cycles:P' on PMU 'cpu' which will be removed.
  Invalid event (cycles:P) in per-thread mode, enable system wide with '-a'.
  Error:
  Failure to open any events for recording.

Fixes: c33aea446b ("perf tools: Fix precise_ip fallback logic")
Tested-by: Chun-Tse Shao <ctshao@google.com>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Link: https://lore.kernel.org/r/20250410010252.402221-1-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2025-04-11 09:22:49 -07:00
..
2024-12-18 16:24:32 -03:00
2022-06-28 12:05:25 -03:00
2025-03-24 09:38:20 -07:00
2023-03-14 08:29:46 -03:00
2025-01-31 14:45:19 -08:00
2021-04-29 10:30:58 -03:00
2024-03-21 10:41:28 -03:00
2021-08-11 09:35:44 -03:00
2024-08-19 14:52:13 -03:00
2024-08-19 14:52:13 -03:00
2025-02-18 14:04:32 -08:00
2023-01-23 10:00:47 -03:00
2024-08-12 18:05:14 -03:00
2024-08-19 14:51:46 -03:00
2025-02-17 22:00:50 -08:00
2024-02-12 12:35:41 -08:00
2025-02-10 11:46:02 -08:00
2023-04-06 21:40:28 -03:00
2023-09-12 17:47:00 -03:00
2025-01-14 14:57:19 -03:00
2025-03-10 11:31:24 -07:00
2025-03-10 11:31:24 -07:00
2025-03-24 09:38:20 -07:00
2025-02-18 14:04:32 -08:00
2024-12-12 15:53:36 -03:00
2025-02-18 14:04:32 -08:00
2023-04-10 19:20:53 -03:00
2024-09-27 15:38:52 -03:00