Linux-perf-users Archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Yabin Cui <yabinc@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH v4 1/3] perf/core: Save raw sample data conditionally based on sample type
Date: Wed, 15 May 2024 10:57:55 +0200	[thread overview]
Message-ID: <20240515085755.GC40213@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20240510191423.2297538-2-yabinc@google.com>

On Fri, May 10, 2024 at 12:14:21PM -0700, Yabin Cui wrote:

> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index d2a15c0c6f8a..9fc55193ff99 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -1240,12 +1240,16 @@ static inline void perf_sample_save_callchain(struct perf_sample_data *data,
>  }
>  
>  static inline void perf_sample_save_raw_data(struct perf_sample_data *data,
> +					     struct perf_event *event,
>  					     struct perf_raw_record *raw)
>  {
>  	struct perf_raw_frag *frag = &raw->frag;
>  	u32 sum = 0;
>  	int size;
>  
> +	if (!(event->attr.sample_type & PERF_SAMPLE_RAW))
> +		return;
> +

Should we add something like:

	if (WARN_ON_ONCE(data->sample_flags & PERF_SAMPLE_RAW))
		return;

? And I suppose the same for all these other patches.

>  	do {
>  		sum += frag->size;
>  		if (perf_raw_frag_last(frag))



  reply	other threads:[~2024-05-15  8:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 19:14 [PATCH v4 0/3] perf/core: Check sample_type in sample data saving helper functions Yabin Cui
2024-05-10 19:14 ` [PATCH v4 1/3] perf/core: Save raw sample data conditionally based on sample type Yabin Cui
2024-05-15  8:57   ` Peter Zijlstra [this message]
2024-05-15 17:39     ` Yabin Cui
2024-05-10 19:14 ` [PATCH v4 2/3] perf/core: Check sample_type in perf_sample_save_callchain Yabin Cui
2024-05-10 19:14 ` [PATCH v4 3/3] perf/core: Check sample_type in perf_sample_save_brstack Yabin Cui
2024-05-10 21:29   ` Namhyung Kim
2024-05-13 18:31     ` Yabin Cui
2024-05-13 20:39       ` Namhyung Kim
2024-05-15  8:58     ` Peter Zijlstra
2024-05-15 17:47       ` Yabin Cui
2024-05-10 19:30 ` [PATCH v4 0/3] perf/core: Check sample_type in sample data saving helper functions Ian Rogers
2024-05-10 21:26 ` Namhyung Kim

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=20240515085755.GC40213@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=irogers@google.com \
    --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=yabinc@google.com \
    /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 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 read-only IMAP folder(s) and NNTP newsgroup(s).