Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757560Ab3HGWgI (ORCPT ); Wed, 7 Aug 2013 18:36:08 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:49290 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757452Ab3HGWgF (ORCPT ); Wed, 7 Aug 2013 18:36:05 -0400 Date: Wed, 7 Aug 2013 23:35:50 +0100 From: Will Deacon To: Vince Weaver Cc: Mark Rutland , "linux-kernel@vger.kernel.org" , Peter Zijlstra , Ingo Molnar , Paul Mackerras , Arnaldo Carvalho de Melo , "trinity@vger.kernel.org" Subject: Re: perf,arm -- oops in validate_event Message-ID: <20130807223550.GB17118@mudshark.cambridge.arm.com> References: <20130806111932.GA25383@e106331-lin.cambridge.arm.com> <20130806115921.GA14798@mudshark.cambridge.arm.com> <20130806130815.GC25383@e106331-lin.cambridge.arm.com> <20130807130027.GA16474@mudshark.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2086 Lines: 48 On Wed, Aug 07, 2013 at 04:30:33PM +0100, Vince Weaver wrote: > On Wed, 7 Aug 2013, Vince Weaver wrote: > > On Wed, 7 Aug 2013, Will Deacon wrote: > > > diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c > > > index d9f5cd4..0500f10b 100644 > > > --- a/arch/arm/kernel/perf_event.c > > > +++ b/arch/arm/kernel/perf_event.c > > > @@ -253,6 +253,9 @@ validate_event(struct pmu_hw_events *hw_events, > > > struct arm_pmu *armpmu = to_arm_pmu(event->pmu); > > > struct pmu *leader_pmu = event->group_leader->pmu; > > > > > > + if (is_software_event(event)) > > > + return 1; > > > + > > > if (event->pmu != leader_pmu || event->state < PERF_EVENT_STATE_OFF) > > > return 1; > > > > this isn't enough. You can also trigger the oops by using > > tracepoint or breakpoint events as group leaders in addition to software > > events. > > I take that back, it turns out tracepoint and breakpoint both > have task_ctx_nr set to perf_sw_context (althouth breakpoint has > a comment saying this may change in the future). > > Let me compile and verify the fix. It may take some time for the compile > to finish as it's not a very fast machine. Ok, thanks for testing, I'll send the fix to rmk with a CC for stable. As for future work, we want to support multiple HW PMUs on ARM yet restrict event groups to accept events targetting the same HW PMU. If we allow groups to have a software event as a leader, yet still accept HW events, then this check becomes a real pain because we essentially have to stash the PMU for the first HW event added to the group. I think I'd rather fail validation when adding a HW event to a group with a SW event as a group leader. PeterZ: any thoughts? This sort of stuff feels like it should really belong in core code... Will -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/