All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@atomlin.com>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	namhyung@kernel.org
Cc: mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
	jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
	james.clark@linaro.org, howardchu95@gmail.com,
	atomlin@atomlin.com, neelx@suse.com, chjohnst@mail.com,
	sean@ashe.io, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 0/2] perf trace: Correct cpumask formatting and add --bitmask-list
Date: Sat, 18 Jul 2026 20:15:08 -0400	[thread overview]
Message-ID: <20260719001510.398616-1-atomlin@atomlin.com> (raw)

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


             reply	other threads:[~2026-07-19  0:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-19  0:15 Aaron Tomlin [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260719001510.398616-1-atomlin@atomlin.com \
    --to=atomlin@atomlin.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=chjohnst@mail.com \
    --cc=howardchu95@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=neelx@suse.com \
    --cc=peterz@infradead.org \
    --cc=sean@ashe.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.