All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Chun-Tse Shao <ctshao@google.com>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	irogers@google.com, adrian.hunter@intel.com,
	kan.liang@linux.intel.com, dvyukov@google.com,
	ben.gainey@arm.com, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1] perf report: Skip unsupported new event types
Date: Fri, 28 Mar 2025 17:39:45 -0700	[thread overview]
Message-ID: <Z-dBUbCqjGtMg2RS@google.com> (raw)
In-Reply-To: <20250328230219.826726-1-ctshao@google.com>

Hello,

On Fri, Mar 28, 2025 at 04:01:57PM -0700, Chun-Tse Shao 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.
> 
> 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 | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index 60fb9997ea0d..d58fc1ed2fdf 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -1639,8 +1639,13 @@ 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) {
> +		/* 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 the supported event by returning its size. */
> +		return event->header.size;

Please make sure if the size is 8-byte aligned.

Thanks,
Namhyung


> +	}
>  
>  	events_stats__inc(&evlist->stats, event->header.type);
>  
> -- 
> 2.49.0.472.ge94155a9ec-goog
> 

      reply	other threads:[~2025-03-29  0:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 23:01 [PATCH v1] perf report: Skip unsupported new event types Chun-Tse Shao
2025-03-29  0:39 ` Namhyung Kim [this message]

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=Z-dBUbCqjGtMg2RS@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ben.gainey@arm.com \
    --cc=ctshao@google.com \
    --cc=dvyukov@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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.