mirror-linux/tools/perf/tests
Ravi Bangoria 3c723f4497 perf test: Fix lock contention test
Couple of independent fixes:

1. Wire in SIGSEGV handler that terminates the test with a failure code.

2. Use "--lock-cgroup" instead of "-g"; "-g" was proposed but never
   merged. See commit 4d1792d0a2 ("perf lock contention: Add
   --lock-cgroup option")

3. Call cleanup() on every normal exit so trap_cleanup() doesn't mistake
   it for an unexpected signal and emit a false-negative "Unexpected
   signal in main" message.

Before patch:

  # ./perf test -vv "lock contention"
   85: kernel lock contention analysis test:
  --- start ---
  test child forked, pid 610711
  Testing perf lock record and perf lock contention
  Testing perf lock contention --use-bpf
  Testing perf lock record and perf lock contention at the same time
  Testing perf lock contention --threads
  Testing perf lock contention --lock-addr
  Testing perf lock contention --lock-cgroup
  Unexpected signal in test_aggr_cgroup
  ---- end(0) ----
   85: kernel lock contention analysis test                            : Ok

After patch:

  # ./perf test -vv "lock contention"
   85: kernel lock contention analysis test:
  --- start ---
  test child forked, pid 602637
  Testing perf lock record and perf lock contention
  Testing perf lock contention --use-bpf
  Testing perf lock record and perf lock contention at the same time
  Testing perf lock contention --threads
  Testing perf lock contention --lock-addr
  Testing perf lock contention --lock-cgroup
  Testing perf lock contention --type-filter (w/ spinlock)
  Testing perf lock contention --lock-filter (w/ tasklist_lock)
  Testing perf lock contention --callstack-filter (w/ unix_stream)
  [Skip] Could not find 'unix_stream'
  Testing perf lock contention --callstack-filter with task aggregation
  [Skip] Could not find 'unix_stream'
  Testing perf lock contention --cgroup-filter
  Testing perf lock contention CSV output
  ---- end(0) ----
   85: kernel lock contention analysis test                            : Ok

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
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: Ananth Narayan <ananth.narayan@amd.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Santosh Shukla <santosh.shukla@amd.com>
Cc: Tycho Andersen <tycho@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2025-11-13 17:29:00 -03:00
..
config-fragments perf tools: Enable configs required for test_uprobe_from_different_cu.sh 2024-04-17 12:21:39 -03:00
shell perf test: Fix lock contention test 2025-11-13 17:29:00 -03:00
workloads perf test: Extend branch stack sampling test for Arm64 BRBE 2025-10-01 15:31:49 -03:00
Build perf test: Remove C python_use test 2025-10-01 16:59:11 -03:00
api-io.c
backward-ring-buffer.c perf target: Remove uid from target 2025-06-09 11:18:18 -07:00
bitmap.c
bp_account.c perf tests bp_account: Fix leaked file descriptor 2025-07-11 12:05:02 -07:00
bp_signal.c perf parse-events: Add default_breakpoint_len helper 2024-09-04 09:49:09 -03:00
bp_signal_overflow.c perf parse-events: Add default_breakpoint_len helper 2024-09-04 09:49:09 -03:00
builtin-test.c perf test: Remove C python_use test 2025-10-01 16:59:11 -03:00
code-reading.c perf tests: Don't retest sections in "Object code reading" 2025-10-06 16:59:11 -03:00
cpumap.c perf test cpumap: Avoid use-after-free following merge 2025-01-08 17:40:05 -03:00
demangle-java-test.c perf test demangle-java: Don't segv if demangling fails 2025-05-28 10:12:47 -03:00
demangle-ocaml-test.c perf test demangle-ocaml: Switch to using dso__demangle_sym() 2025-05-09 17:03:09 -03:00
demangle-rust-v0-test.c perf test demangle-rust: Add Rust demangling test 2025-05-09 17:01:57 -03:00
dlfilter-test.c perf machine: Explicitly pass in host perf_env 2025-07-25 10:37:57 -07:00
dso-data.c perf test dso-data: Correctly free test file in read test 2025-03-17 22:07:18 -07:00
dwarf-unwind.c perf machine: Explicitly pass in host perf_env 2025-07-25 10:37:57 -07:00
event-times.c perf thread_map: Remove uid options 2025-06-09 11:18:18 -07:00
event_groups.c perf test: Update event_groups test to use instructions 2025-01-18 10:32:57 -08:00
event_update.c libperf evsel: Rename own_cpus to pmu_cpus 2025-07-24 13:41:35 -07:00
evsel-roundtrip-name.c perf evsel: Use evsel__name_is() helper 2024-04-03 11:48:56 -03:00
evsel-tp-sched.c perf build: Include libtraceevent headers directly indicated by pkg-config 2024-11-08 22:42:57 -08:00
expand-cgroup.c perf stat: Move metric list from config to evlist 2025-07-11 12:36:40 -07:00
expr.c perf test expr: Fix system_tsc_freq for only x86 2024-12-11 09:19:44 -08:00
fdarray.c
genelf.c
hists_common.c perf dso: Add reference count checking and accessor functions 2024-05-06 15:28:49 -03:00
hists_common.h
hists_cumulate.c perf sort: Use perf_env to set arch sort keys and header 2025-07-25 10:37:58 -07:00
hists_filter.c perf sort: Use perf_env to set arch sort keys and header 2025-07-25 10:37:58 -07:00
hists_link.c perf sort: Use perf_env to set arch sort keys and header 2025-07-25 10:37:58 -07:00
hists_output.c perf sort: Use perf_env to set arch sort keys and header 2025-07-25 10:37:58 -07:00
hwmon_pmu.c perf hwmon_pmu: Hold path rather than fd 2025-07-02 19:05:26 -07:00
is_printable_array.c
keep-tracking.c perf thread_map: Remove uid options 2025-06-09 11:18:18 -07:00
kmod-path.c
make tools build: Make libperl opt-in rather than opt-out, deprecate 2025-09-19 16:07:21 -03:00
maps.c perf dso: Add reference count checking and accessor functions 2024-05-06 15:28:49 -03:00
mem.c perf mem-info: Add reference count checking 2024-05-07 18:06:44 -03:00
mem2node.c
mmap-basic.c perf test: Expand user space event reading (rdpmc) tests 2025-06-20 13:14:07 -07:00
mmap-thread-lookup.c perf machine: Explicitly pass in host perf_env 2025-07-25 10:37:57 -07:00
openat-syscall-all-cpus.c perf thread_map: Remove uid options 2025-06-09 11:18:18 -07:00
openat-syscall-tp-fields.c perf target: Remove uid from target 2025-06-09 11:18:18 -07:00
openat-syscall.c perf thread_map: Remove uid options 2025-06-09 11:18:18 -07:00
parse-events.c perf record: Add auto counter reload parse and regression tests 2025-10-03 16:49:51 -03:00
parse-metric.c perf stat: Move metric list from config to evlist 2025-07-11 12:36:40 -07:00
parse-no-sample-id-all.c perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
pe-file-parsing.c perf tests: Fix "PE file support" test build 2025-09-03 10:50:55 -07:00
pe-file.c
pe-file.exe
pe-file.exe.debug
perf-hooks.c
perf-record.c perf test: Don't leak workload gopipe in PERF_RECORD_* 2025-09-19 16:39:20 -03:00
perf-targz-src-pkg perf test: Change all remaining #!/bin/sh to #!/bin/bash 2025-06-26 10:31:05 -07:00
perf-time-to-tsc.c perf thread_map: Remove uid options 2025-06-09 11:18:18 -07:00
pfm.c
pmu-events.c perf jevents: If the long_desc and desc are identical then drop the long_desc 2025-07-11 12:36:40 -07:00
pmu.c perf pmu: Rename name matching for no suffix or wildcard variants 2025-02-04 21:28:46 -08:00
sample-parsing.c perf test: Move PERF_SAMPLE_WEIGHT_STRUCT parsing to common test 2025-07-25 10:37:58 -07:00
sdt.c perf symbol: Add blocking argument to filename__read_build_id 2025-08-25 15:07:18 -07:00
sigtrap.c perf btf: Make the sigtrap test helper to find a member by name widely available 2024-12-09 17:52:41 -03:00
stat.c perf stat: Move stat_config into config.c 2024-12-18 16:24:32 -03:00
subcmd-help.c perf test: Add libsubcmd help tests 2025-07-01 15:51:55 -07:00
sw-clock.c perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
switch-tracking.c perf thread_map: Remove uid options 2025-06-09 11:18:18 -07:00
symbols.c perf machine: Explicitly pass in host perf_env 2025-07-25 10:37:57 -07:00
task-exit.c perf target: Remove uid from target 2025-06-09 11:18:18 -07:00
tests-scripts.c perf test: Change all remaining #!/bin/sh to #!/bin/bash 2025-06-26 10:31:05 -07:00
tests-scripts.h
tests.h perf test: Remove C python_use test 2025-10-01 16:59:11 -03:00
thread-map.c perf thread_map: Remove uid options 2025-06-09 11:18:18 -07:00
thread-maps-share.c
time-utils-test.c
tool_pmu.c perf tests: Fix Tool PMU test segfault 2025-02-12 19:34:56 -08:00
topology.c perf evlist: Change env variable to session 2025-07-25 10:37:56 -07:00
unit_number__scnprintf.c
util.c perf util: add a basic SHA-1 implementation 2025-06-26 10:51:40 -07:00
vmlinux-kallsyms.c perf map: API clean up 2024-08-19 14:49:53 -03:00
wp.c perf test: Make watchpoint data 32-bits on i386 2024-09-03 11:26:53 -03:00