Re: [PATCH] arm_pmu: Validate single/group leader events

From: Mark Rutland
Date: Tue Apr 12 2022 - 07:33:50 EST


On Mon, Apr 11, 2022 at 09:14:03AM -0500, Rob Herring wrote:
> On Mon, Apr 11, 2022 at 11:04:26AM +0100, Mark Rutland wrote:
> > Hi Rob,
> >
> > On Fri, Apr 08, 2022 at 03:33:30PM -0500, Rob Herring wrote:
> > > In the case where there is only a cycle counter available (i.e.
> > > PMCR_EL0.N is 0) and an event other than CPU cycles is opened, the open
> > > should fail as the event can never possibly be scheduled. However, the
> > > event validation when an event is opened is skipped when the group
> > > leader is opened. Fix this by always validating the group leader events.
> > >
> > > Reported-by: Al Grant <al.grant@xxxxxxx>
> > > Cc: Will Deacon <will@xxxxxxxxxx>
> > > Cc: Mark Rutland <mark.rutland@xxxxxxx>
> > > Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> >
> > This looks obviously correct to me, so FWIW:
> >
> > Acked-by: Mark Rutland <mark.rutland@xxxxxxx>
>
> Thanks.
>
> > Just to check, have you tested this (e.g. by running on a platform with
> > PMCR_EL0.N == 0, or hacking the PMU probing to report just the cycle counter)
>
> Yes, tested on FVP with 0 counters running the libperf evsel userspace
> access tests as that tries both the cycle counter and instruction
> counts.

Perfect, thanks!

Will, I assume that you'll pick this up.

Mark.