From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754049AbcKROaz (ORCPT ); Fri, 18 Nov 2016 09:30:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55774 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751905AbcKROaw (ORCPT ); Fri, 18 Nov 2016 09:30:52 -0500 Date: Fri, 18 Nov 2016 15:30:48 +0100 From: Jiri Olsa To: Peter Zijlstra Cc: "Liang, Kan" , Andi Kleen , Vince Weaver , lkml , Ingo Molnar , Thomas Gleixner Subject: Re: [PATCH] perf/x86/uncore: Allow single pmu/box within events group Message-ID: <20161118143048.GC15416@krava> References: <20161118001528.GA28231@krava> <20161118112850.GO3117@twins.programming.kicks-ass.net> <20161118123325.GA15416@krava> <20161118125354.GQ3117@twins.programming.kicks-ass.net> <20161118134859.GB15416@krava> <20161118140605.GR3117@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161118140605.GR3117@twins.programming.kicks-ass.net> User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 18 Nov 2016 14:30:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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