Skip to content

perf tests: Add uncore and x86 topdown event sorting tests

Ian Rogers linux-perf-users lkml 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest2 patches 2 repliesIn review
  2. v72 patches 0 repliesSuperseded
  3. v62 patches 0 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v52 patches0 repliesSuperseded
v42 patches0 repliesSuperseded
v32 patches2 repliesSuperseded
v22 patches0 repliesSuperseded
v12 patches4 repliesSuperseded

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2perf tests: Add test for uncore event sortingtools/perf/tests/Build tools/perf/tests/builtin-test.c tools/perf/tests/tests.h +1 more+179 -00 replies
2/2perf arch x86 tests: Add test for topdown event sortingtools/perf/arch/x86/tests/topdown.c+165 -10 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchZide ChenNamhyung Kim
SeriesT-b
1/2T-b
2/2T-b

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

Read the v8 thread

Cover letter [PATCH v8 0/2] perf tests: Add uncore and x86 topdown event sorting tests

A patch thread changing event sorting highlighted a lack of testing for the more complicated uncore and x86 perf metric event sorting:
https://lore.kernel.org/linux-perf-users/CAP-5=fWRgDo7UnJAD4C--d=mVPRhOEWZVyU7nVM1YEp3jncAgg@mail.gmail.com/

v8: Simplify event_cb in the uncore event sorting test by removing the
unreachable dead-code else block (reported by Sashiko).

v7: - Prevent double-free of m.event1 and dangling pointer access upon
PMU scanning loop termination or early continue in the uncore event sorting test by utilizing standard perf zfree() helpers (reported by Sashiko).
- Document Intel Hybrid CPU architectural invariants in the x86 topdown test to clarify why instructions correctly leads a group of 2 on E-cores (cpu_atom) where slots is unsupported and filtered out (reported by Sashiko).

v6: - Ensure robust error initialization and resource cleanup in both
uncore and topdown tests by initializing evlist to NULL and parse_events_error at function entry, preventing uninitialized stack access or resource leaks on early return paths (reported by Sashiko).
- Prevent double evaluation and duplicate debug logging upon test assertion failure in the x86 topdown test by caching test_sort() return values into local variables (reported by Sashiko).

v5: - Strengthen uncore event sorting test assertions to require at
least 4 total events (>= 2 groups of 2 events) instead of > 0 events, guaranteeing that multi-PMU wildcard expansion is genuinely exercised across multiple sibling PMUs (reported by Sashiko).
- Fix memory leaks on assertion failure across both uncore and topdown test suites by replacing standard TEST_ASSERT macros with local CHECK macros that correctly branch to out_err cleanup handlers (reported by Sashiko).
- Fix test_sort() in the x86 topdown test to correctly return TEST_FAIL (-1) instead of parse_events() internal error codes (e.g., -EINVAL) when event parsing fails (reported by Namhyung).

v4: Fix malformed event group string formatting in the uncore event
sorting test when running on AMD systems (where sysfs event aliases lack JSON descriptions - reported by Namhyung). Added a helper to strip redundant PMU prefixes and trailing slashes to ensure parse_events() receives valid syntax across all architectures.

v3: Address sashiko nits on using evsel__name and ensuring slots is injected.
https://lore.kernel.org/linux-perf-users/[email protected]/

v2: Address indentation and other nits from Namhyung. Add Zide Chen's
tested-by tags.
https://lore.kernel.org/lkml/[email protected]/

v1: https://lore.kernel.org/lkml/[email protected]/

Ian Rogers (2):
perf tests: Add test for uncore event sorting perf arch x86 tests: Add test for topdown event sorting

 tools/perf/arch/x86/tests/topdown.c     | 166 +++++++++++++++++++++-
 tools/perf/tests/Build                  |   1 +
 tools/perf/tests/builtin-test.c         |   1 +
 tools/perf/tests/tests.h                |   1 +
 tools/perf/tests/uncore-event-sorting.c | 176 ++++++++++++++++++++++++
 5 files changed, 344 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/tests/uncore-event-sorting.c
Signature · 1 line
2.54.0.563.g4f69b47b94-goog