]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf header: Refactor pipe mode end marker handling
authorIan Rogers <irogers@google.com>
Wed, 1 Apr 2026 16:13:21 +0000 (09:13 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 3 Apr 2026 02:35:16 +0000 (19:35 -0700)
commit8a4aab17c350f7c2ca7c459a9977f8e18f2878f6
treeefdcb748d8b631751c6f55c49fe813452c0c2d74
parentcdaebccc1cb5c0f635f6db7fb1570f11b5c9f985
perf header: Refactor pipe mode end marker handling

In non-pipe/data mode the header has a 256-bit bitmap representing
whether a feature is enabled or not. In pipe mode features are written
out in perf_event__synthesize_features as PERF_RECORD_HEADER_FEATURE
events with a special zero sized marker for the last feature. If a new
feature is added the last feature marker event appears as that feature
from old pipe mode perf data. As the event is zero sized it will fail
to be processed and generally terminate perf.

Add a last_feat variable to the header that in non-pipe/data mode is
just HEADER_LAST_FEATURE. In pipe mode compute the last_feat by
handling zero sized feature events, assuming they are the marker and
updating last_feat accordingly. Potentially a feature event could be
zero sized and so still process the feature event, just ignore the
error if it fails.

As perf_event__process_feature can properly handle pipe mode data,
migrate users to it except for report that still wants to group events
and stop header printing with the last feature marker. Make
perf_event__process_feature non-fatal in the case of a newer feature
than this version of perf's HEADER_LAST_FEATURE, which was the
behavior all users wanted.

Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c
tools/perf/builtin-script.c
tools/perf/util/data-convert-bt.c
tools/perf/util/data-convert-json.c
tools/perf/util/header.c
tools/perf/util/header.h
tools/perf/util/intel-tpebs.c