Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752711AbaAPQM2 (ORCPT ); Thu, 16 Jan 2014 11:12:28 -0500 Received: from mail-qe0-f51.google.com ([209.85.128.51]:41632 "EHLO mail-qe0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752661AbaAPQMX (ORCPT ); Thu, 16 Jan 2014 11:12:23 -0500 Date: Thu, 16 Jan 2014 11:13:29 -0500 (EST) From: Vince Weaver To: Will Deacon cc: Vince Weaver , Chad Paradis , Peter Zijlstra , "linux-kernel@vger.kernel.org" , Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo , Stephane Eranian Subject: Re: [patch/rfc] perf on raspberry-pi without overflow interrupt In-Reply-To: <20140115183822.GC28782@mudshark.cambridge.arm.com> Message-ID: References: <20140108225315.GG31570@twins.programming.kicks-ass.net> <20140109101921.GA26435@mudshark.cambridge.arm.com> <20140110100804.GB11045@mudshark.cambridge.arm.com> <20140115183822.GC28782@mudshark.cambridge.arm.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 15 Jan 2014, Will Deacon wrote: > Hi Vince, > > On Tue, Jan 14, 2014 at 04:42:13AM +0000, Vince Weaver wrote: > > On Fri, 10 Jan 2014, Will Deacon wrote: > > > In the absence of a core change, I think I'd rather have something like your > > > second patch, but without the extra no_overflow_irq field (you can check the > > > platform device, as I mentioned previously). > > > > Something like the following? It works on my rasp-pi, still waiting for > > the compile to finish on the pandaboard so I haven't verified that the > > has-working-interrupt case still works. > > [...] > > > diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c > > index bc3f2ef..e2c4aa2 100644 > > --- a/arch/arm/kernel/perf_event.c > > +++ b/arch/arm/kernel/perf_event.c > > @@ -397,7 +397,7 @@ __hw_perf_event_init(struct perf_event *event) > > */ > > hwc->config_base |= (unsigned long)mapping; > > > > - if (!hwc->sample_period) { > > + if (!is_sampling_event(event)) { > > /* > > * For non-sampling runs, limit the sample_period to half > > * of the counter width. That way, the new counter value > > @@ -407,6 +407,14 @@ __hw_perf_event_init(struct perf_event *event) > > hwc->sample_period = armpmu->max_period >> 1; > > hwc->last_period = hwc->sample_period; > > local64_set(&hwc->period_left, hwc->sample_period); > > + } else { > > + > > + /* > > + * If we have no PMU interrupt we cannot sample. > > + */ > > + if (platform_get_irq(armpmu->plat_device, 0) < 0) > > + return -EOPNOTSUPP; > > I think this should be <= 0, but apart from that this looks alright to me in > the absence of a core change. It's a shame platform_get_irq() doesn't have better documentation. I always forget what the result of the "is 0 a valid IRQ" flamewar was. A grep through the kernel shows more or less an even split of using !, using <0, and using <=0. I'll put together a patch with this change and send it off. I'm also investigating the proper core change, but I'm guessing that's going to take a bit longer to get together, and it would be nice to have the rasp-pi counters working sooner rather than later. Vince -- 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/