From: Will Deacon <will.deacon@arm.com>
To: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Russell King <linux@arm.linux.org.uk>,
Catalin Marinas <Catalin.Marinas@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
"patches@linaro.org" <patches@linaro.org>,
"linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
John Stultz <john.stultz@linaro.org>,
Sumit Semwal <sumit.semwal@linaro.org>
Subject: Re: [PATCH v2 1/2] arm: perf: Prevent wraparound during overflow
Date: Tue, 6 Jan 2015 19:46:46 +0000 [thread overview]
Message-ID: <20150106194646.GG32449@arm.com> (raw)
In-Reply-To: <20150105193120.GA9167@sundance.lan>
On Mon, Jan 05, 2015 at 07:31:20PM +0000, Daniel Thompson wrote:
> On Mon, Jan 05, 2015 at 03:57:39PM +0100, Peter Zijlstra wrote:
> > On Fri, Nov 21, 2014 at 04:24:26PM +0000, Daniel Thompson wrote:
> > > diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
> > > index 266cba46db3e..ab68833c1e31 100644
> > > --- a/arch/arm/kernel/perf_event.c
> > > +++ b/arch/arm/kernel/perf_event.c
> > > @@ -115,8 +115,14 @@ int armpmu_event_set_period(struct perf_event *event)
> > > ret = 1;
> > > }
> > >
> > > - if (left > (s64)armpmu->max_period)
> > > - left = armpmu->max_period;
> > > + /*
> > > + * Limit the maximum period to prevent the counter value
> > > + * from overtaking the one we are about to program. In
> > > + * effect we are reducing max_period to account for
> > > + * interrupt latency (and we are being very conservative).
> > > + */
> > > + if (left > (armpmu->max_period >> 1))
> > > + left = armpmu->max_period >> 1;
> >
> > On x86 we simply half max_period, why did you choose to do differently?
>
> In truth because I didn't look at the x86 code... there is an existing
> halving of max_period in the arm code and that was enough to satisfy me
> that halving max_period was reasonable.
>
> Predividing max_period looks to me like it would work for ARM too although I
> don't think we could blame hardware insanity for doing so ;-).
>
> Will: Do you want me to update this?
Whichever you prefer. The ARM perf code used to be used by some drivers
and so we tried to keep the implementation details hidden from them, but
that didn't work out so well and it's now only used by the CPU PMUs.
Will
next prev parent reply other threads:[~2015-01-06 19:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-19 15:52 [PATCH] arm: perf: Prevent wraparound during overflow Daniel Thompson
2014-11-19 18:11 ` Will Deacon
2014-11-20 12:14 ` Daniel Thompson
2014-11-21 16:24 ` [PATCH v2 0/2] arm+arm64: " Daniel Thompson
2014-11-21 16:24 ` [PATCH v2 1/2] arm: " Daniel Thompson
2014-12-04 10:26 ` Will Deacon
2014-12-04 13:58 ` Daniel Thompson
2015-01-05 14:57 ` Peter Zijlstra
2015-01-05 19:31 ` Daniel Thompson
2015-01-06 19:46 ` Will Deacon [this message]
2014-11-21 16:24 ` [PATCH v2 2/2] arm64: " Daniel Thompson
2014-12-04 10:27 ` Will Deacon
2014-12-22 9:39 ` [PATCH 3.19-rc1 v3] arm: " Daniel Thompson
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=20150106194646.GG32449@arm.com \
--to=will.deacon@arm.com \
--cc=Catalin.Marinas@arm.com \
--cc=acme@kernel.org \
--cc=daniel.thompson@linaro.org \
--cc=john.stultz@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mingo@redhat.com \
--cc=patches@linaro.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=sumit.semwal@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox