Re: [PATCH] perf/x86/uncore: Allow single pmu/box within events group

From: Jiri Olsa
Date: Fri Nov 18 2016 - 09:30:58 EST


On Fri, Nov 18, 2016 at 03:06:05PM +0100, Peter Zijlstra wrote:
> On Fri, Nov 18, 2016 at 02:48:59PM +0100, Jiri Olsa wrote:
> > On Fri, Nov 18, 2016 at 01:53:54PM +0100, Peter Zijlstra wrote:
> >
> > SNIP
> >
> > > ---
> > > arch/x86/events/intel/uncore.c | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
> > > index efca2685d876..7b1b34576886 100644
> > > --- a/arch/x86/events/intel/uncore.c
> > > +++ b/arch/x86/events/intel/uncore.c
> > > @@ -319,9 +319,9 @@ static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type,
> > > */
> > > static int uncore_pmu_event_init(struct perf_event *event);
> > >
> > > -static bool is_uncore_event(struct perf_event *event)
> > > +static bool is_box_event(struct intel_uncore_box *box, struct perf_event *event)
> > > {
> > > - return event->pmu->event_init == uncore_pmu_event_init;
> > > + return box->pmu == event->pmu;
> >
> > this one needs to be:
> >
> > + return box->pmu == uncore_event_to_pmu(event);
> >
> > and it works.. ;-)
>
> Will that not explode if we fudge a software event in there?
>
> Wouldn't:
>
> return box->pmu.pmu == event->pmu;
>
> be the safer option?

hum right.. but for some reason I can't crash it nor even fuzzer complains

jirka