linux/tools/perf
Anne Macedo 2a5049b75d perf lock contention: Trim backtrace by skipping traceiter functions
The 'perf lock contention' program currently shows the caller of the locks
as __traceiter_contention_begin+0x??. This caller can be ignored, as it is
from the traceiter itself. Instead, it should show the real callers for
the locks.

When fiddling with the --stack-skip parameter, the actual callers for
the locks start to show up. However, just ignore the
__traceiter_contention_begin and the __traceiter_contention_end symbols
so the actual callers will show up.

Before this patch is applied:

sudo perf lock con -a -b -- sleep 3
 contended   total wait     max wait     avg wait         type   caller

         8      2.33 s       2.28 s     291.18 ms     rwlock:W   __traceiter_contention_begin+0x44
         4      2.33 s       2.28 s     582.35 ms     rwlock:W   __traceiter_contention_begin+0x44
         7    140.30 ms     46.77 ms     20.04 ms     rwlock:W   __traceiter_contention_begin+0x44
         2     63.35 ms     33.76 ms     31.68 ms        mutex   trace_contention_begin+0x84
         2     46.74 ms     46.73 ms     23.37 ms     rwlock:W   __traceiter_contention_begin+0x44
         1     13.54 us     13.54 us     13.54 us        mutex   trace_contention_begin+0x84
         1      3.67 us      3.67 us      3.67 us      rwsem:R   __traceiter_contention_begin+0x44

Before this patch is applied - using --stack-skip 5

sudo perf lock con --stack-skip 5 -a -b -- sleep 3
 contended   total wait     max wait     avg wait         type   caller

         2      2.24 s       2.24 s       1.12 s      rwlock:W   do_epoll_wait+0x5a0
         4      1.65 s     824.21 ms    412.08 ms     rwlock:W   do_exit+0x338
         2    824.35 ms    824.29 ms    412.17 ms     spinlock   get_signal+0x108
         2    824.14 ms    824.14 ms    412.07 ms     rwlock:W   release_task+0x68
         1     25.22 ms     25.22 ms     25.22 ms        mutex   cgroup_kn_lock_live+0x58
         1     24.71 us     24.71 us     24.71 us     spinlock   do_exit+0x44
         1     22.04 us     22.04 us     22.04 us      rwsem:R   lock_mm_and_find_vma+0xb0

After this patch is applied:

sudo ./perf lock con -a -b -- sleep 3
 contended   total wait     max wait     avg wait         type   caller

         4      4.13 s       2.07 s       1.03 s      rwlock:W   release_task+0x68
         2      2.07 s       2.07 s       1.03 s      rwlock:R   mm_update_next_owner+0x50
         2      2.07 s       2.07 s       1.03 s      rwlock:W   do_exit+0x338
         1     41.56 ms     41.56 ms     41.56 ms        mutex   cgroup_kn_lock_live+0x58
         2     36.12 us     18.83 us     18.06 us     rwlock:W   do_exit+0x338

Signed-off-by: Anne Macedo <retpolanne@posteo.net>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240319143629.3422590-1-retpolanne@posteo.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2024-03-21 20:44:35 -03:00
..
arch perf cpumap: Use perf_cpu_map__for_each_cpu when possible 2024-03-21 10:41:28 -03:00
bench
dlfilters
Documentation perf docs arm_spe: Clarify more SPE requirements related to KPTI 2024-03-21 10:41:27 -03:00
include/perf
jvmti
pmu-events perf vendor events intel: Remove info metrics erroneously in TopdownL1 2024-03-21 13:54:40 -03:00
python
scripts
tests perf tests: Run tests in parallel by default 2024-03-21 13:54:40 -03:00
trace perf beauty: Introduce faccessat2 flags scnprintf routine 2024-03-21 13:54:40 -03:00
ui perf annotate: Calculate instruction overhead using hashmap 2024-03-06 20:25:20 -08:00
util perf lock contention: Trim backtrace by skipping traceiter functions 2024-03-21 20:44:35 -03:00
.gitignore
Build
builtin-annotate.c perf annotate-data: Implement instruction tracking 2024-03-21 10:41:29 -03:00
builtin-bench.c
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-c2c.c perf cpumap: Clean up use of perf_cpu_map__has_any_cpu_or_is_empty 2024-03-21 10:41:28 -03:00
builtin-config.c
builtin-daemon.c
builtin-data.c
builtin-diff.c
builtin-evlist.c
builtin-ftrace.c
builtin-help.c
builtin-inject.c
builtin-kallsyms.c
builtin-kmem.c
builtin-kvm.c
builtin-kwork.c
builtin-list.c perf list: Allow wordwrap to wrap on commas 2024-03-21 10:41:29 -03:00
builtin-lock.c
builtin-mem.c
builtin-probe.c
builtin-record.c perf record: Delete session after stopping sideband thread 2024-03-21 13:54:39 -03:00
builtin-report.c perf report: Sort child tasks by tid 2024-03-03 22:50:55 -08:00
builtin-sched.c
builtin-script.c perf script: Show also errors for --insn-trace option 2024-03-21 10:41:27 -03:00
builtin-stat.c perf stat: Remove duplicate cpus_map_matched function 2024-03-21 10:41:28 -03:00
builtin-timechart.c
builtin-top.c
builtin-trace.c perf trace: Fix 'newfstatat'/'fstatat' argument pretty printing 2024-03-21 13:54:40 -03:00
builtin-version.c perf version: Display availability of OpenCSD support 2024-03-03 22:48:40 -08:00
builtin.h perf tools: Suggest inbuilt commands for unknown command 2024-03-21 13:54:40 -03:00
check-headers.sh perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument 2024-03-21 13:54:40 -03:00
command-list.txt
CREDITS
design.txt
Makefile
Makefile.config treewide: remove meaningless assignments in Makefiles 2024-02-23 14:19:07 -08:00
Makefile.perf perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument 2024-03-21 13:54:40 -03:00
MANIFEST
perf-archive.sh
perf-completion.sh
perf-iostat.sh
perf-read-vdso.c
perf-sys.h
perf.c perf tools: Suggest inbuilt commands for unknown command 2024-03-21 13:54:40 -03:00
perf.h