perf trace: Correct cpumask formatting and add --bitmask-list
Status from this message: Applied to perf-tools-next, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest2 patches 5 repliesApplied
- v32 patches 2 repliesSuperseded
- v21 patch 3 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 1 patch | 1 reply | Superseded |
Changes in v4 from the cover letter
- Added a blank line in the code block for bitmap_byte() to improve readability (Namhyung Kim)
- Refactored the bit iteration loop to use an early break, reducing indentation (Namhyung Kim)
- Linked to v3: https://lore.kernel.org/lkml/[email protected]/
Patches in v4 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | perf trace: Correct default cpumask formatting to hexadecimaltools/ tools/ tools/ | +159 | 0 replies | |
| 2/2 | perf trace: Add --bitmask-list command-line optiontools/ tools/ | +9 | 4 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [PATCH v4 0/2] perf trace: Correct cpumask formatting and add --bitmask-list
This series corrects cpumask formatting inside 'perf trace' and introduces a new command-line option to display these masks as human-readable CPU lists.
Currently, when parsing tracepoints containing 'cpumask_t' fields (which are represented as dynamic non-array fields in libtraceevent), 'perf trace' incorrectly interprets and prints the raw length and offset descriptor as a decimal integer (i.e., "cpumask: 524320") rather than formatting the actual mask data.
The first patch addresses this anomaly by introducing helper functions to correctly parse and extract raw bits from dynamic fields that do not have the TEP_FIELD_IS_ARRAY flag set. Once the raw bytes are resolved, 'perf trace' displays them as a zero-padded hexadecimal string by default.
The second patch introduces a '--bitmask-list' option. When specified, formatting is delegated to bitmap_scnprintf(), allowing the resolved cpumask to be rendered as a condensed, human-readable list of CPUs (e.g., "0,2-5,7").
Changes since v3:
- Added a blank line in the code block for bitmap_byte() to improve readability (Namhyung Kim)
- Refactored the bit iteration loop to use an early break, reducing indentation (Namhyung Kim)
- Linked to v3: https://lore.kernel.org/lkml/[email protected]/
Changes since v2:
- Provided an example output of the newly introduced '--bitmask-list' option (Namhyung Kim)
- Updated the documentation to include the new option (Namhyung Kim)
- Linked to v2: https://lore.kernel.org/lkml/[email protected]/
Changes since v1:
- Refactored cpumask parsing by moving the dynamic bitmask reconstruction logic into a new helper function, format_field__get_cpumask()
- Made bitmask parsing cross-platform, word-size, and endianness-safe
- Added a new helper function, bitmap_byte() to extract bytes from the host-native bitmask in a host-endianness-independent manner, simplifying hexadecimal cpumask formatting
- Cleaned up trace__fprintf_tp_fields() to remove complex inline parsing logic
- Linked to v1: https://lore.kernel.org/lkml/[email protected]/
Aaron Tomlin (2):
perf trace: Correct default cpumask formatting to hexadecimal perf trace: Add --bitmask-list command-line option
tools/perf/Documentation/perf-trace.txt | 4 ++ tools/perf/builtin-trace.c | 76 ++++++++++++++++++--- tools/perf/util/evsel.c | 91 +++++++++++++++++++++++++ tools/perf/util/evsel.h | 6 ++ 4 files changed, 168 insertions(+), 9 deletions(-)
Signature · 1 line
2.54.0