Skip to content

perf test attr: Report the failures again and cope with more than one core PMU

Arnaldo Carvalho de Melo linux-perf-users lkml stable 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest21 patches 1 replyIn review
  2. v319 patches 0 repliesSuperseded
  3. v219 patches 0 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21perf test attr: Fix record dwarf sample_type expectationtools/perf/tests/shell/attr/test-record-graph-dwarf+1 -10 replies
2/21perf python: Free the parse error entries when parsing failstools/perf/util/python.c+2 -00 replies
3/21perf test attr: Allow tests to require a core PMUtools/perf/tests/shell/attr/test-record-group-sampling tools/perf/tests/shell/attr/test-record-group-sampling1 tools/perf/tests/shell/attr/test-record-group-sampling2 +12 more+77 -00 replies
4/21perf test attr: Fix legacy event encodings in group teststools/perf/tests/shell/attr/README tools/perf/tests/shell/attr/test-record-group-sampling tools/perf/tests/shell/attr/test-record-group-sampling1 +5 more+15 -150 replies
5/21perf test attr: Fix default stat metrics expectationstools/perf/tests/shell/attr/base-stat-group tools/perf/tests/shell/attr/test-stat-default tools/perf/tests/shell/attr/test-stat-detailed-1 +2 more+307 -1500 replies
6/21perf test attr: Relax group checking for ungrouped expectationstools/perf/tests/shell/lib/attr.py+7 -40 replies
7/21perf evsel: Mark the event as supported when retrying an opentools/perf/util/evsel.c+6 -00 replies
8/21perf test attr: Ignore the core PMU type perf puts in 'config'tools/perf/tests/shell/lib/attr.py+51 -20 replies
9/21perf evsel: Don't dump probe events to PERF_TEST_ATTRtools/perf/util/evsel.c tools/perf/util/evsel.h tools/perf/util/pfm.c +1 more+8 -10 replies
10/21perf evsel: Close the fds opened so far when disabling missing featurestools/perf/util/evsel.c+21 -90 replies
11/21perf test attr: Introduce mask_bits(), generalizing hide_core_pmu_type()tools/perf/tests/shell/lib/attr.py+17 -100 replies
12/21perf test attr: Accept either sample id bit perf asks fortools/perf/tests/shell/lib/attr.py+83 -50 replies
13/21perf test attr: Ignore the dummy tracking event and the terms it carriestools/perf/tests/shell/lib/attr.py+61 -00 replies
14/21perf test attr: Leave out the events of the other core PMUstools/perf/tests/shell/lib/attr.py+39 -00 replies
15/21perf test attr: Ignore the group read_format bit the PMU count can removetools/perf/tests/shell/lib/attr.py+63 -120 replies
16/21perf test attr: State, spelled out in a line, why a test is skippedtools/perf/tests/shell/lib/attr.py+70 -360 replies
17/21perf tests: Introduce a 'needs_mlock' suite flagtools/perf/Documentation/perf-test.txt tools/perf/tests/builtin-test.c tools/perf/tests/tests-scripts.c +1 more+168 -140 replies
18/21perf tests: Mark the C tests mapping perf ring bufferstools/perf/tests/backward-ring-buffer.c tools/perf/tests/code-reading.c tools/perf/tests/keep-tracking.c +6 more+9 -40 replies
19/21perf tests: Mark the shell tests not mapping perf ring bufferstools/perf/tests/shell/drm_pmu.sh tools/perf/tests/shell/ftrace.sh tools/perf/tests/shell/kallsyms.sh +22 more+28 -250 replies
20/21perf mutex: Add a robust, process-shared mutex initializertools/build/Makefile.feature tools/build/feature/Makefile tools/build/feature/test-all.c +4 more+125 -140 replies
21/21perf test: Take turns using the perf mlock budget in the mmaping teststools/perf/Documentation/perf-test.txt tools/perf/tests/builtin-test.c+131 -30 replies

Reviews trailers per patch

None of the 21 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchIan Rogers
SeriesT-b R-b
1/21
2/21
3/21
4/21
5/21
6/21
7/21
8/21
9/21
10/21
11/21
12/21
13/21
14/21
15/21
16/21
17/21
18/21
19/21
20/21
21/21

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 00/21] perf test attr: Report the failures again and cope with more than one core PMU

From: Arnaldo Carvalho de Melo <[email protected]>

Hello all,

perf test 82 stopped reporting failures when it got its shell wrapper (8519e4f44c2af722), so expectations that no longer match perf went unverified. The prerequisite fixes are upstream now, so they are not repeated here.

This series updates those expectations and makes the test cope with machines with no core PMU, or with more than one. Asking for one event on the latter gives one event per core PMU. The expectations ignore what that adds; the commit messages say what and why.

The tests that map ring buffers take turns on the per user mlock budget (kernel.perf_event_mlock_kb) through a robust, process-shared mutex. The sysctl is left alone. A test killed while holding the budget does not leave the next one waiting.

Tested: 'perf test -vv attribute' Ok on an Amlogic A311D (aarch64, as root), an Intel i7-14700K (hybrid, two core PMUs), x86_64 (AMD Ryzen 9 9950X3D, kernel 7.2.10-200.fc44) and riscv64 (Orange Pi RV). On riscv64 the stat tests run and the record tests report unsupp, as sampling is not available there (no Sscofpmf).

Best regards,

- Arnaldo

What changed from v3:

- sashiko-bot's v3 review: the python binding no longer leaks the parse error entries it prints when parsing fails.
- sashiko-bot's v3 review: attr.py no longer compares an event against itself unrecorded, and masks both sides with both events' types.
- sashiko-bot's v3 review: evsel__open_cpu() no longer leaks the fds of an attempt abandoned to disable missing features.
- sashiko-bot's v3 review: <stdio.h> included where FILE and snprintf() are used, in builtin-test.c and tests-scripts.c.

What changed from v2:

- sashiko-bot's v2 review: a one-component kernel_since or kernel_until (f.i. kernel_until = 6) no longer crashes attr.py.
- sashiko-bot's v2 review: mutex_trylock() and cond_wait() now take over a robust mutex left behind by a dead owner, as mutex_lock().

What changed from v1:

- Namhyung's python fix and Michael Petlan's two fixes are upstream now, so they are dropped from the series.
- Namhyung's v1 report (test-record-branch-filter-any_call): probe events are no longer dumped, and the core PMU fallout is masked.
- New, not from review: the 'requires = core-pmu' skip, the skip reasons and the mlock budget part.
- New, not from review: the events of the other core PMUs are left out, when the expectations name a core PMU.

 tools/build/Makefile.feature                  |   1 +
 tools/build/feature/Makefile                  |   4 +
 tools/build/feature/test-all.c                |   5 +
 .../build/feature/test-pthread-mutex-robust.c |  18 +
 tools/perf/Documentation/perf-test.txt        |  36 +-
 tools/perf/Makefile.config                    |   4 +
 tools/perf/tests/backward-ring-buffer.c       |   2 +-
 tools/perf/tests/builtin-test.c               | 174 ++++++-
 tools/perf/tests/code-reading.c               |   2 +-
 tools/perf/tests/keep-tracking.c              |   2 +-
 tools/perf/tests/mmap-basic.c                 |   1 +
 tools/perf/tests/openat-syscall-tp-fields.c   |   1 +
 tools/perf/tests/perf-record.c                |   1 +
 tools/perf/tests/perf-time-to-tsc.c           |   1 +
 tools/perf/tests/shell/attr/README            |  10 +-
 tools/perf/tests/shell/attr/base-stat-group   |  45 ++
 .../tests/shell/attr/test-record-graph-dwarf  |   2 +-
 .../shell/attr/test-record-group-sampling     |   5 +-
 .../shell/attr/test-record-group-sampling1    |   5 +-
 .../shell/attr/test-record-group-sampling2    |   5 +-
 .../perf/tests/shell/attr/test-record-group1  |   3 +-
 .../perf/tests/shell/attr/test-record-group2  |   3 +-
 .../perf/tests/shell/attr/test-record-group3  |   3 +-
 tools/perf/tests/shell/attr/test-stat-C0      |   1 +
 tools/perf/tests/shell/attr/test-stat-basic   |   1 +
 tools/perf/tests/shell/attr/test-stat-default |  91 ++--
 .../tests/shell/attr/test-stat-detailed-1     |  99 ++--
 .../tests/shell/attr/test-stat-detailed-2     | 111 +++--
 .../tests/shell/attr/test-stat-detailed-3     | 115 +++--
 tools/perf/tests/shell/attr/test-stat-group1  |   3 +-
 .../tests/shell/attr/test-stat-no-inherit     |   1 +
 tools/perf/tests/shell/drm_pmu.sh             |   2 +-
 tools/perf/tests/shell/ftrace.sh              |   2 +-
 tools/perf/tests/shell/kallsyms.sh            |   2 +-
 tools/perf/tests/shell/lib/attr.py            | 461 ++++++++++++++++--
 tools/perf/tests/shell/list.sh                |   2 +-
 tools/perf/tests/shell/perf_sched_stats.sh    |   2 +-
 tools/perf/tests/shell/probe_vfs_getname.sh   |   2 +-
 tools/perf/tests/shell/python-use.sh          |   2 +-
 tools/perf/tests/shell/schedstat_snapshots.sh |   2 +-
 tools/perf/tests/shell/stat+csv_output.sh     |   2 +-
 tools/perf/tests/shell/stat+csv_summary.sh    |   2 +-
 .../tests/shell/stat+event_uniquifying.sh     |   2 +-
 tools/perf/tests/shell/stat+json_output.sh    |   2 +-
 tools/perf/tests/shell/stat+shadow_stat.sh    |   2 +-
 tools/perf/tests/shell/stat+std_output.sh     |   2 +-
 tools/perf/tests/shell/stat.sh                |   2 +-
 .../perf/tests/shell/stat_all_metricgroups.sh |   2 +-
 tools/perf/tests/shell/stat_all_metrics.sh    |   2 +-
 tools/perf/tests/shell/stat_all_pfm.sh        |   2 +-
 .../tests/shell/stat_bpf_counters_cgrp.sh     |   2 +-
 tools/perf/tests/shell/stat_metrics_cgrp.sh   |   2 +-
 tools/perf/tests/shell/stat_metrics_values.sh |   2 +-
 tools/perf/tests/shell/test_ilist_python.sh   |   2 +-
 .../perf/tests/shell/test_stat_cpi_python.sh  |   2 +-
 .../tests/shell/test_test_junit_output.sh     |   5 +-
 .../shell/test_uprobe_from_different_cu.sh    |   2 +-
 tools/perf/tests/sw-clock.c                   |   2 +-
 tools/perf/tests/task-exit.c                  |   1 +
 tools/perf/tests/tests-scripts.c              |  85 +++-
 tools/perf/tests/tests.h                      |  17 +
 tools/perf/util/evsel.c                       |  42 +-
 tools/perf/util/evsel.h                       |   1 +
 tools/perf/util/mutex.c                       | 101 +++-
 tools/perf/util/mutex.h                       |   6 +
 tools/perf/util/pfm.c                         |   1 +
 tools/perf/util/print-events.c                |   1 +
 tools/perf/util/python.c                      |   2 +
 68 files changed, 1256 insertions(+), 272 deletions(-)

base-commit: cb9dba6f4764fc68ab75c36e332887332339f9c3
v1-head: b1300831ecc4503d
v2-head: da166ef7a002
v3-head: c5f0897aceb01743