mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 07:33:19 +02:00
perf session: Skip unsupported new event types
`perf report` currently halts with an error when encountering unsupported new event types (`event.type >= PERF_RECORD_HEADER_MAX`). This patch modifies the behavior to skip these samples and continue processing the remaining events. Additionally, stops reporting if the new event size is not 8-byte aligned. Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org> Suggested-by: Namhyung Kim <namhyung@kernel.org> Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: Chun-Tse Shao <ctshao@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ben Gainey <ben.gainey@arm.com> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20250414173921.2905822-1-ctshao@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
0ef8091f17
commit
b1b26ce8bb
|
|
@ -1639,8 +1639,17 @@ static s64 perf_session__process_event(struct perf_session *session,
|
|||
if (session->header.needs_swap)
|
||||
event_swap(event, evlist__sample_id_all(evlist));
|
||||
|
||||
if (event->header.type >= PERF_RECORD_HEADER_MAX)
|
||||
return -EINVAL;
|
||||
if (event->header.type >= PERF_RECORD_HEADER_MAX) {
|
||||
/* perf should not support unaligned event, stop here. */
|
||||
if (event->header.size % sizeof(u64))
|
||||
return -EINVAL;
|
||||
|
||||
/* This perf is outdated and does not support the latest event type. */
|
||||
ui__warning("Unsupported header type %u, please consider updating perf.\n",
|
||||
event->header.type);
|
||||
/* Skip unsupported event by returning its size. */
|
||||
return event->header.size;
|
||||
}
|
||||
|
||||
events_stats__inc(&evlist->stats, event->header.type);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user