All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] perf trace: Correct cpumask formatting and add --bitmask-list
@ 2026-07-19  0:15 Aaron Tomlin
  2026-07-19  0:15 ` [PATCH v3 1/2] perf trace: Correct default cpumask formatting to hexadecimal Aaron Tomlin
  2026-07-19  0:15 ` [PATCH v3 2/2] perf trace: Add --bitmask-list command-line option Aaron Tomlin
  0 siblings, 2 replies; 5+ messages in thread
From: Aaron Tomlin @ 2026-07-19  0:15 UTC (permalink / raw)
  To: peterz, mingo, acme, namhyung
  Cc: mark.rutland, alexander.shishkin, jolsa, irogers, adrian.hunter,
	james.clark, howardchu95, atomlin, neelx, chjohnst, sean,
	linux-perf-users, linux-kernel

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 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/20260717013544.257768-1-atomlin@atomlin.com/

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/20260714162947.214270-1-atomlin@atomlin.com/


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              | 75 ++++++++++++++++++---
 tools/perf/util/evsel.c                 | 90 +++++++++++++++++++++++++
 tools/perf/util/evsel.h                 |  6 ++
 4 files changed, 166 insertions(+), 9 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-20 16:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-19  0:15 [PATCH v3 0/2] perf trace: Correct cpumask formatting and add --bitmask-list Aaron Tomlin
2026-07-19  0:15 ` [PATCH v3 1/2] perf trace: Correct default cpumask formatting to hexadecimal Aaron Tomlin
2026-07-20  5:02   ` Namhyung Kim
2026-07-20 16:35     ` Aaron Tomlin
2026-07-19  0:15 ` [PATCH v3 2/2] perf trace: Add --bitmask-list command-line option Aaron Tomlin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.