linux/tools/perf
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
..
arch tools headers: Update the syscall table with the kernel sources 2025-04-10 09:28:24 -07:00
bench perf bench sched pipe: fix enforced blocking reads in worker_thread 2025-03-23 23:20:37 -07:00
check-header_ignore_hunks/lib perf tools: update expected diff for lib/list_sort.c 2024-11-05 17:12:33 -08:00
dlfilters perf tools: Simplify evsel__add_modifier() 2024-10-22 09:52:11 -07:00
Documentation perf script: Update brstack syntax documentation 2025-03-14 10:41:08 -07:00
include/perf
jvmti
pmu-events perf build: Add pylint build tests 2025-03-24 09:38:20 -07:00
python perf python tracepoint.py: Change the COMM using setproctitle if available 2025-03-18 16:08:22 -07:00
scripts perf build: Add pylint build tests 2025-03-24 09:38:20 -07:00
tests tracing/timers: Rename the hrtimer_init event to hrtimer_setup 2025-04-05 10:30:17 +02:00
trace tools headers: Update the linux/unaligned.h copy with the kernel sources 2025-04-10 09:28:25 -07:00
ui perf hist stdio: Do bounds check when printing callchains to avoid UB with new gcc versions 2025-03-13 00:30:14 -07:00
util perf tools: Remove evsel__handle_error_quirks() 2025-04-11 09:22:49 -07:00
.gitignore perf tools: Add the empty-pmu-events build to .gitignore 2024-11-07 10:51:56 -08:00
Build perf build: Add pylint build tests 2025-03-24 09:38:20 -07:00
builtin-annotate.c perf annotate: Add --code-with-type option. 2025-03-13 00:19:51 -07:00
builtin-bench.c
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-c2c.c perf mem: Don't leak mem event names 2025-03-10 14:26:45 -07:00
builtin-check.c perf tools: Remove dependency on libaudit 2025-01-10 10:59:42 -03:00
builtin-config.c perf config: Add a function to set one variable in .perfconfig 2025-01-14 15:05:56 -03:00
builtin-daemon.c perf daemon: Fix the build on more 32-bit architectures 2024-08-19 21:44:30 -03:00
builtin-data.c
builtin-diff.c perf stream: Use evsel rather than evsel->idx 2024-12-23 13:53:08 -03:00
builtin-evlist.c perf evlist: Print hint for group 2024-09-11 13:08:45 -03:00
builtin-ftrace.c perf ftrace latency: allow to hide empty buckets 2025-02-26 13:48:02 -08:00
builtin-help.c perf tools: Remove dependency on libaudit 2025-01-10 10:59:42 -03:00
builtin-inject.c perf inject: Fix use without initialization of local variables 2025-01-14 14:57:19 -03:00
builtin-kallsyms.c
builtin-kmem.c perf evsel: Add/use accessor for tp_format 2024-12-09 17:52:42 -03:00
builtin-kvm.c perf kvm: Move functions used in util out of builtin 2024-12-18 16:24:32 -03:00
builtin-kwork.c perf kwork: Make perf_kwork_add_work a callback 2024-12-18 16:24:33 -03:00
builtin-list.c perf list: Document -v option deduplication feature 2025-02-26 16:23:47 -08:00
builtin-lock.c perf lock: Report owner stack in usermode 2025-02-28 10:09:02 -08:00
builtin-mem.c perf mem: Don't leak mem event names 2025-03-10 14:26:45 -07:00
builtin-probe.c perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT 2024-10-18 10:17:40 -07:00
builtin-record.c perf tools: Skip BPF sideband event for userspace profiling 2025-03-02 09:47:24 -08:00
builtin-report.c perf report: Disable children column for data type profiling 2025-03-20 09:17:56 -07:00
builtin-sched.c perf cpumap: Reduce transitive dependencies on libperf MAX_NR_CPUS 2024-12-09 17:52:41 -03:00
builtin-script.c perf script: Fix output type for dynamically allocated core PMU's 2025-03-05 11:46:00 -08:00
builtin-stat.c perf tools: Fix up some comments and code to properly use the event_source bus 2025-02-19 13:23:43 -08:00
builtin-timechart.c perf timechart: Remove redundant variable assignment 2024-11-13 16:27:35 -03:00
builtin-top.c perf annotate: Pass hist_entry to annotate functions 2025-03-13 00:19:51 -07:00
builtin-trace.c perf trace: Fix wrong size to bpf_map__update_elem call 2025-03-24 13:55:26 -07:00
builtin-version.c perf version: Update --build-options to use 'supported_features' array 2024-09-04 16:19:29 -03:00
builtin.h perf script: Move find_scripts to browser/scripts.c 2024-12-18 16:24:32 -03:00
check-headers.sh tools headers: Update the arch/x86/lib/memset_64.S copy with the kernel sources 2025-04-10 09:28:25 -07:00
command-list.txt
CREDITS
design.txt
Makefile
Makefile.config perf build: filter all combinations of -flto for libperl 2025-03-23 23:12:10 -07:00
Makefile.perf perf tools changes for v6.15 2025-03-31 08:52:33 -07:00
MANIFEST perf MANIFEST: Add license files 2025-01-14 14:57:19 -03:00
perf-archive.sh
perf-completion.sh
perf-iostat.sh
perf-read-vdso.c
perf-sys.h
perf.c perf tools: Remove dependency on libaudit 2025-01-10 10:59:42 -03:00
perf.h perf: Increase MAX_NR_CPUS to 4096 2024-12-09 17:52:41 -03:00