* [PATCH v4] perf report: Skip unsupported new event types @ 2025-04-14 17:38 Chun-Tse Shao 2025-04-14 17:43 ` Ian Rogers 0 siblings, 1 reply; 5+ messages in thread From: Chun-Tse Shao @ 2025-04-14 17:38 UTC (permalink / raw) To: linux-kernel Cc: Chun-Tse Shao, Arnaldo Carvalho de Melo, Namhyung Kim, peterz, mingo, mark.rutland, alexander.shishkin, jolsa, irogers, adrian.hunter, kan.liang, dvyukov, ben.gainey, linux-perf-users `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. Signed-off-by: Chun-Tse Shao <ctshao@google.com> Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org> Suggested-by: Namhyung Kim <namhyung@kernel.org> --- tools/perf/util/session.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 60fb9997ea0d..ba32f8461a4b 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -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 type %u, please considering update perf.\n", + event->header.type); + /* Skip unsupported event by returning its size. */ + return event->header.size; + } events_stats__inc(&evlist->stats, event->header.type); -- 2.49.0.604.gff1f9ca942-goog ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4] perf report: Skip unsupported new event types 2025-04-14 17:38 [PATCH v4] perf report: Skip unsupported new event types Chun-Tse Shao @ 2025-04-14 17:43 ` Ian Rogers 2025-04-23 22:46 ` Chun-Tse Shao 0 siblings, 1 reply; 5+ messages in thread From: Ian Rogers @ 2025-04-14 17:43 UTC (permalink / raw) To: Chun-Tse Shao Cc: linux-kernel, Arnaldo Carvalho de Melo, Namhyung Kim, peterz, mingo, mark.rutland, alexander.shishkin, jolsa, adrian.hunter, kan.liang, dvyukov, ben.gainey, linux-perf-users On Mon, Apr 14, 2025 at 10:39 AM Chun-Tse Shao <ctshao@google.com> wrote: > > `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. > > Signed-off-by: Chun-Tse Shao <ctshao@google.com> > Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org> > Suggested-by: Namhyung Kim <namhyung@kernel.org> Reviewed-by: Ian Rogers <irogers@google.com> Thanks, Ian > --- > tools/perf/util/session.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > index 60fb9997ea0d..ba32f8461a4b 100644 > --- a/tools/perf/util/session.c > +++ b/tools/perf/util/session.c > @@ -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 type %u, please considering update perf.\n", > + event->header.type); > + /* Skip unsupported event by returning its size. */ > + return event->header.size; > + } > > events_stats__inc(&evlist->stats, event->header.type); > > -- > 2.49.0.604.gff1f9ca942-goog > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] perf report: Skip unsupported new event types 2025-04-14 17:43 ` Ian Rogers @ 2025-04-23 22:46 ` Chun-Tse Shao 2025-04-24 12:52 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 5+ messages in thread From: Chun-Tse Shao @ 2025-04-23 22:46 UTC (permalink / raw) To: Ian Rogers Cc: linux-kernel, Arnaldo Carvalho de Melo, Namhyung Kim, peterz, mingo, mark.rutland, alexander.shishkin, jolsa, adrian.hunter, kan.liang, dvyukov, ben.gainey, linux-perf-users Ping. Thanks, CT On Mon, Apr 14, 2025 at 10:43 AM Ian Rogers <irogers@google.com> wrote: > > On Mon, Apr 14, 2025 at 10:39 AM Chun-Tse Shao <ctshao@google.com> wrote: > > > > `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. > > > > Signed-off-by: Chun-Tse Shao <ctshao@google.com> > > Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org> > > Suggested-by: Namhyung Kim <namhyung@kernel.org> > > Reviewed-by: Ian Rogers <irogers@google.com> > > Thanks, > Ian > > > --- > > tools/perf/util/session.c | 13 +++++++++++-- > > 1 file changed, 11 insertions(+), 2 deletions(-) > > > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > > index 60fb9997ea0d..ba32f8461a4b 100644 > > --- a/tools/perf/util/session.c > > +++ b/tools/perf/util/session.c > > @@ -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 type %u, please considering update perf.\n", > > + event->header.type); > > + /* Skip unsupported event by returning its size. */ > > + return event->header.size; > > + } > > > > events_stats__inc(&evlist->stats, event->header.type); > > > > -- > > 2.49.0.604.gff1f9ca942-goog > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] perf report: Skip unsupported new event types 2025-04-23 22:46 ` Chun-Tse Shao @ 2025-04-24 12:52 ` Arnaldo Carvalho de Melo 2025-04-24 22:38 ` Chun-Tse Shao 0 siblings, 1 reply; 5+ messages in thread From: Arnaldo Carvalho de Melo @ 2025-04-24 12:52 UTC (permalink / raw) To: Chun-Tse Shao Cc: Ian Rogers, linux-kernel, Namhyung Kim, peterz, mingo, mark.rutland, alexander.shishkin, jolsa, adrian.hunter, kan.liang, dvyukov, ben.gainey, linux-perf-users On Wed, Apr 23, 2025 at 03:46:21PM -0700, Chun-Tse Shao wrote: > Ping. Thanks for the ping, I just applied it with these changes, please check, Thanks, - Arnaldo ⬢ [acme@toolbox perf-tools-next]$ git diff diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index ba32f8461a4b6438..81cc56503a2d0f51 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1645,7 +1645,7 @@ static s64 perf_session__process_event(struct perf_session *session, return -EINVAL; /* This perf is outdated and does not support the latest event type. */ - ui__warning("Unsupported type %u, please considering update perf.\n", + 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; ⬢ [acme@toolbox perf-tools-next]$ > Thanks, > CT > > > On Mon, Apr 14, 2025 at 10:43 AM Ian Rogers <irogers@google.com> wrote: > > > > On Mon, Apr 14, 2025 at 10:39 AM Chun-Tse Shao <ctshao@google.com> wrote: > > > > > > `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. > > > > > > Signed-off-by: Chun-Tse Shao <ctshao@google.com> > > > Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org> > > > Suggested-by: Namhyung Kim <namhyung@kernel.org> > > > > Reviewed-by: Ian Rogers <irogers@google.com> > > > > Thanks, > > Ian > > > > > --- > > > tools/perf/util/session.c | 13 +++++++++++-- > > > 1 file changed, 11 insertions(+), 2 deletions(-) > > > > > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > > > index 60fb9997ea0d..ba32f8461a4b 100644 > > > --- a/tools/perf/util/session.c > > > +++ b/tools/perf/util/session.c > > > @@ -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 type %u, please considering update perf.\n", > > > + event->header.type); > > > + /* Skip unsupported event by returning its size. */ > > > + return event->header.size; > > > + } > > > > > > events_stats__inc(&evlist->stats, event->header.type); > > > > > > -- > > > 2.49.0.604.gff1f9ca942-goog > > > ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4] perf report: Skip unsupported new event types 2025-04-24 12:52 ` Arnaldo Carvalho de Melo @ 2025-04-24 22:38 ` Chun-Tse Shao 0 siblings, 0 replies; 5+ messages in thread From: Chun-Tse Shao @ 2025-04-24 22:38 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Ian Rogers, linux-kernel, Namhyung Kim, peterz, mingo, mark.rutland, alexander.shishkin, jolsa, adrian.hunter, kan.liang, dvyukov, ben.gainey, linux-perf-users Thank you Arnaldo! -CT On Thu, Apr 24, 2025 at 5:52 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > > On Wed, Apr 23, 2025 at 03:46:21PM -0700, Chun-Tse Shao wrote: > > Ping. > > Thanks for the ping, I just applied it with these changes, please check, > > Thanks, > > - Arnaldo > > ⬢ [acme@toolbox perf-tools-next]$ git diff > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > index ba32f8461a4b6438..81cc56503a2d0f51 100644 > --- a/tools/perf/util/session.c > +++ b/tools/perf/util/session.c > @@ -1645,7 +1645,7 @@ static s64 perf_session__process_event(struct perf_session *session, > return -EINVAL; > > /* This perf is outdated and does not support the latest event type. */ > - ui__warning("Unsupported type %u, please considering update perf.\n", > + 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; > ⬢ [acme@toolbox perf-tools-next]$ > > > Thanks, > > CT > > > > > > On Mon, Apr 14, 2025 at 10:43 AM Ian Rogers <irogers@google.com> wrote: > > > > > > On Mon, Apr 14, 2025 at 10:39 AM Chun-Tse Shao <ctshao@google.com> wrote: > > > > > > > > `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. > > > > > > > > Signed-off-by: Chun-Tse Shao <ctshao@google.com> > > > > Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org> > > > > Suggested-by: Namhyung Kim <namhyung@kernel.org> > > > > > > Reviewed-by: Ian Rogers <irogers@google.com> > > > > > > Thanks, > > > Ian > > > > > > > --- > > > > tools/perf/util/session.c | 13 +++++++++++-- > > > > 1 file changed, 11 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > > > > index 60fb9997ea0d..ba32f8461a4b 100644 > > > > --- a/tools/perf/util/session.c > > > > +++ b/tools/perf/util/session.c > > > > @@ -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 type %u, please considering update perf.\n", > > > > + event->header.type); > > > > + /* Skip unsupported event by returning its size. */ > > > > + return event->header.size; > > > > + } > > > > > > > > events_stats__inc(&evlist->stats, event->header.type); > > > > > > > > -- > > > > 2.49.0.604.gff1f9ca942-goog > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-24 22:38 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-14 17:38 [PATCH v4] perf report: Skip unsupported new event types Chun-Tse Shao 2025-04-14 17:43 ` Ian Rogers 2025-04-23 22:46 ` Chun-Tse Shao 2025-04-24 12:52 ` Arnaldo Carvalho de Melo 2025-04-24 22:38 ` Chun-Tse Shao
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).