[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150106194646.GG32449@arm.com>
Date: Tue, 6 Jan 2015 19:46:46 +0000
From: Will Deacon <will.deacon@....com>
To: Daniel Thompson <daniel.thompson@...aro.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Russell King <linux@....linux.org.uk>,
Catalin Marinas <Catalin.Marinas@....com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
"patches@...aro.org" <patches@...aro.org>,
"linaro-kernel@...ts.linaro.org" <linaro-kernel@...ts.linaro.org>,
John Stultz <john.stultz@...aro.org>,
Sumit Semwal <sumit.semwal@...aro.org>
Subject: Re: [PATCH v2 1/2] arm: perf: Prevent wraparound during overflow
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists