linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@arm.com>
To: German Gomez <german.gomez@arm.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Cc: Chase Conklin <chase.conklin@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>, Ian Rogers <irogers@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Stephane Eranian <eranian@google.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	"acme@kernel.org" <acme@kernel.org>
Subject: Re: [PATCH] perf record/arm-spe: Override attr->sample_period for non-libpfm4 events
Date: Mon, 17 Jan 2022 09:59:12 +0000	[thread overview]
Message-ID: <c2b960eb-a25e-7ce7-ee4b-2be557d8a213@arm.com> (raw)
In-Reply-To: <20220114212102.179209-1-german.gomez@arm.com>



On 14/01/2022 21:21, German Gomez wrote:
> A previous commit preventing attr->sample_period values from being
> overridden in pfm events changed a related behaviour in arm_spe.
> 
> Before this patch:
> perf record -c 10000 -e arm_spe_0// -- sleep 1
> 
> Would not yield an SPE event with period=10000, because the arm-spe code

Just to clarify, this seems like it should say "Would yield", not "Would not yield",
as in it was previously working?

> initializes sample_period to a non-0 value, so the "-c 10000" is ignored.
> 
> This patch restores the previous behaviour for non-libpfm4 events.
> 
> Reported-by: Chase Conklin <chase.conklin@arm.com>
> Fixes: ae5dcc8abe31 (“perf record: Prevent override of attr->sample_period for libpfm4 events”)
> Signed-off-by: German Gomez <german.gomez@arm.com>
> ---
>  tools/perf/util/evsel.c | 25 +++++++++++++++++--------
>  1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index a59fb2ecb84e..86ab038f020f 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -1065,6 +1065,17 @@ void __weak arch_evsel__fixup_new_cycles(struct perf_event_attr *attr __maybe_un
>  {
>  }
>  
> +static void evsel__set_default_freq_period(struct record_opts *opts,
> +					   struct perf_event_attr *attr)
> +{
> +	if (opts->freq) {
> +		attr->freq = 1;
> +		attr->sample_freq = opts->freq;
> +	} else {
> +		attr->sample_period = opts->default_interval;
> +	}
> +}
> +
>  /*
>   * The enable_on_exec/disabled value strategy:
>   *
> @@ -1131,14 +1142,12 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts,
>  	 * We default some events to have a default interval. But keep
>  	 * it a weak assumption overridable by the user.
>  	 */
> -	if (!attr->sample_period) {
> -		if (opts->freq) {
> -			attr->freq		= 1;
> -			attr->sample_freq	= opts->freq;
> -		} else {
> -			attr->sample_period = opts->default_interval;
> -		}
> -	}
> +	if ((evsel->is_libpfm_event && !attr->sample_period) ||
> +	    (!evsel->is_libpfm_event && (!attr->sample_period ||
> +					 opts->user_freq != UINT_MAX ||
> +					 opts->user_interval != ULLONG_MAX)))
> +		evsel__set_default_freq_period(opts, attr);
> +
>  	/*
>  	 * If attr->freq was set (here or earlier), ask for period
>  	 * to be sampled.
> 

  reply	other threads:[~2022-01-17  9:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14 21:21 [PATCH] perf record/arm-spe: Override attr->sample_period for non-libpfm4 events German Gomez
2022-01-17  9:59 ` James Clark [this message]
2022-01-17 10:27   ` German Gomez
2022-01-17 16:28     ` Ian Rogers
2022-01-17 21:32       ` German Gomez
2022-01-18 12:32         ` Arnaldo Carvalho de Melo
2022-01-22 20:15           ` Arnaldo Carvalho de Melo
2022-01-22 20:17       ` Arnaldo Carvalho de Melo

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=c2b960eb-a25e-7ce7-ee4b-2be557d8a213@arm.com \
    --to=james.clark@arm.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=chase.conklin@arm.com \
    --cc=eranian@google.com \
    --cc=german.gomez@arm.com \
    --cc=irogers@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.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 NNTP newsgroup(s).