From patchwork Thu Oct 15 15:41:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 55043 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f72.google.com (mail-lf0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 29C012301F for ; Thu, 15 Oct 2015 15:41:39 +0000 (UTC) Received: by lffv3 with SMTP id v3sf4363174lff.1 for ; Thu, 15 Oct 2015 08:41:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=AV4E9n92NWalhoPImkjq/8JJrpKShT+FS69VnDPjWEw=; b=UZBenjrBG82CnUtpcFxlrlns0f9ZoYaRG42w1jS9Hh0mGhoACShhluxcJIvgQfOnap EaEFnFzRRRuVVddS1CUQcx11xBS0JlXoJWZyjhkFxn/FED6o+Q2GcTDqtx7/t8HXaNYW FoFZpEfp1BoA5z27QBTXp79R+piXcP9OmTvbQTLMtdilrCd0m59ItZfBWD5+YurYuB9D 0+VBwFeA2IluEf5EhXuLY2XKlEzVZsjwU4WW3is9Bw6HievEdYPckK0eH4hQvNpFNfmT 0m635c2F/DL5TaTYKbLP5bzFnMR+blT45aZoWQ5hLO0qFQ1W9acpP7vWK2bIB5TdndQE hl0g== X-Gm-Message-State: ALoCoQnGZStNfxofAQBB7hxl4iZtH/VwhFq/j5K+2j3semv+kVU9FTjdoqeVrQMwGz1nusBwZruU X-Received: by 10.112.16.229 with SMTP id j5mr2345270lbd.6.1444923698091; Thu, 15 Oct 2015 08:41:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.165.212 with SMTP id o203ls143715lfe.39.gmail; Thu, 15 Oct 2015 08:41:37 -0700 (PDT) X-Received: by 10.112.170.165 with SMTP id an5mr4980758lbc.33.1444923697917; Thu, 15 Oct 2015 08:41:37 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id m1si9510994lfg.133.2015.10.15.08.41.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 08:41:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbwb3 with SMTP id wb3so11776701lbb.1 for ; Thu, 15 Oct 2015 08:41:37 -0700 (PDT) X-Received: by 10.112.199.137 with SMTP id jk9mr5032757lbc.86.1444923697690; Thu, 15 Oct 2015 08:41:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp709369lbq; Thu, 15 Oct 2015 08:41:36 -0700 (PDT) X-Received: by 10.66.221.104 with SMTP id qd8mr10911811pac.155.1444923696449; Thu, 15 Oct 2015 08:41:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id co2si22400466pbc.217.2015.10.15.08.41.36; Thu, 15 Oct 2015 08:41:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753760AbbJOPle (ORCPT + 30 others); Thu, 15 Oct 2015 11:41:34 -0400 Received: from foss.arm.com ([217.140.101.70]:36802 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753532AbbJOPlb (ORCPT ); Thu, 15 Oct 2015 11:41:31 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AACD23C; Thu, 15 Oct 2015 08:41:28 -0700 (PDT) Received: from leverpostej (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D600F3F49B; Thu, 15 Oct 2015 08:41:29 -0700 (PDT) Date: Thu, 15 Oct 2015 16:41:26 +0100 From: Mark Rutland To: Will Deacon Cc: Drew Richardson , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Russell King , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Wade Cherry , Pawel Moll Subject: Re: [PATCH v5 2/2] arm: perf: Add event descriptions Message-ID: <20151015154126.GL8825@leverpostej> References: <20151007182735.GA18706@dreric01-gentoo.localdomain> <20151009101338.GH26278@arm.com> <20151009165330.GA22415@dreric01-gentoo.localdomain> <20151012143025.GG16124@arm.com> <20151012181037.GA16013@dreric01-gentoo.localdomain> <20151013153644.GC18121@dreric01-gentoo.localdomain> <20151015132111.GD29301@arm.com> <20151015151506.GC18965@dreric01-gentoo.localdomain> <20151015152915.GH29301@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151015152915.GH29301@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mark.rutland@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Thu, Oct 15, 2015 at 04:29:15PM +0100, Will Deacon wrote: > On Thu, Oct 15, 2015 at 08:15:06AM -0700, Drew Richardson wrote: > > On Thu, Oct 15, 2015 at 02:21:12PM +0100, Will Deacon wrote: > > > On Tue, Oct 13, 2015 at 08:36:45AM -0700, Drew Richardson wrote: > > > > Add additional information about the ARM architected hardware events > > > > to make counters self describing. This makes the hardware PMUs easier > > > > to use as perf list contains possible events instead of users having > > > > to refer to documentation like the ARM TRMs. > > > > > > > > Signed-off-by: Drew Richardson > > > > --- > > > > arch/arm/kernel/perf_event_v7.c | 121 ++++++++++++++++++++++++++++++++++++++++ > > > > drivers/perf/arm_pmu.c | 1 + > > > > 2 files changed, 122 insertions(+) > > > > > > [...] > > > > > > > diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c > > > > index 2365a32a595e..e933d2dd71c0 100644 > > > > --- a/drivers/perf/arm_pmu.c > > > > +++ b/drivers/perf/arm_pmu.c > > > > @@ -548,6 +548,7 @@ static void armpmu_init(struct arm_pmu *armpmu) > > > > .stop = armpmu_stop, > > > > .read = armpmu_read, > > > > .filter_match = armpmu_filter_match, > > > > + .attr_groups = armpmu->pmu.attr_groups, > > > > > > I don't understand this hunk. What's it doing? > > > > I'm not 100% clear either on what it's doing. But without this line > > the attr_groups don't get passed on and I don't see them on my TC2. I > > debugged the issue down to this but it may not be the proper way to > > solve the problem. > > Oh yuck, it's because we call armpmu_init after cpu_pmu_init and the former > uses struct initialisation and ends up zeroing anything set previously. > > We should probably tidy all this up: > > * Remove armpmu_register and call perf_pmu_register directly from > arm_pmu_device_probe instead > > * Call armpmu_init immediately prior to arm_cpu_init Assuming you mean cpu_pmu_init, how about the below? Thanks, Mark. ---->8---- >From f8a99a406f3dd7a272a6dee4a551436fea851f38 Mon Sep 17 00:00:00 2001 From: Mark Rutland Date: Thu, 15 Oct 2015 16:32:17 +0100 Subject: [PATCH] drivers/perf: kill armpmu_register Nothing outside of drivers/perf/arm_pmu.c should call armpmu_register any more, so it no longer needs to be in include/linux/perf/arm_pmu.h. Additionally, by folding it in to arm_pmu_device_probe we can allow drivers to override struct pmu fields without getting blatted by the armpmu code. This patch folds armpmu_register into arm_pmu_device_probe. The logging to the console is moved to after the PMU is successfully registered with the core perf code. Signed-off-by: Mark Rutland Suggested-by: Will Deacon Cc: Drew Richardson Cc: Pawel Moll --- drivers/perf/arm_pmu.c | 14 +++++--------- include/linux/perf/arm_pmu.h | 2 -- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index f346960..15463cb 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -583,14 +583,6 @@ static void armpmu_init(struct arm_pmu *armpmu) }; } -int armpmu_register(struct arm_pmu *armpmu, int type) -{ - armpmu_init(armpmu); - pr_info("enabled with %s PMU driver, %d counters available\n", - armpmu->name, armpmu->num_events); - return perf_pmu_register(&armpmu->pmu, armpmu->name, type); -} - /* Set at runtime when we know what CPU type we are. */ static struct arm_pmu *__oprofile_cpu_pmu; @@ -934,14 +926,18 @@ int arm_pmu_device_probe(struct platform_device *pdev, goto out_free; } + armpmu_init(pmu); ret = cpu_pmu_init(pmu); if (ret) goto out_free; - ret = armpmu_register(pmu, -1); + ret = perf_pmu_register(&pmu->pmu, pmu->name, -1); if (ret) goto out_destroy; + pr_info("enabled with %s PMU driver, %d counters available\n", + pmu->name, pmu->num_events); + return 0; out_destroy: diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index bfa673b..83b5e34 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -111,8 +111,6 @@ struct arm_pmu { #define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu)) -int armpmu_register(struct arm_pmu *armpmu, int type); - u64 armpmu_event_update(struct perf_event *event); int armpmu_event_set_period(struct perf_event *event);