linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, acme@kernel.org,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	mingo@redhat.com, peterz@infradead.org
Subject: Re: [RFCv4 1/7] drivers/perf: arm_pmu: add common attr group fields
Date: Fri, 9 Sep 2016 11:25:54 +0100	[thread overview]
Message-ID: <20160909102554.GF20192@arm.com> (raw)
In-Reply-To: <1473330112-28528-2-git-send-email-mark.rutland@arm.com>

On Thu, Sep 08, 2016 at 11:21:46AM +0100, Mark Rutland wrote:
> In preparation for adding common attribute groups, add an array of
> attribute group pointers to arm_pmu, which will be used if the
> backend hasn't already set pmu::attr_groups.
> 
> Subsequent patches will move backends over to using these, before adding
> common fields.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> ---
>  drivers/perf/arm_pmu.c       | 3 +++
>  include/linux/perf/arm_pmu.h | 9 ++++++++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index f5e1008..145caf4 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -1039,6 +1039,9 @@ int arm_pmu_device_probe(struct platform_device *pdev,
>  		goto out_free;
>  	}
>  
> +	if (!pmu->pmu.attr_groups)
> +		pmu->pmu.attr_groups = pmu->attr_groups;
> +
>  	ret = cpu_pmu_init(pmu);
>  	if (ret)
>  		goto out_free;
> diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
> index e188438..8030814 100644
> --- a/include/linux/perf/arm_pmu.h
> +++ b/include/linux/perf/arm_pmu.h
> @@ -14,7 +14,7 @@
>  
>  #include <linux/interrupt.h>
>  #include <linux/perf_event.h>
> -
> +#include <linux/sysfs.h>
>  #include <asm/cputype.h>
>  
>  /*
> @@ -77,6 +77,12 @@ struct pmu_hw_events {
>  	struct arm_pmu		*percpu_pmu;
>  };
>  
> +enum armpmu_attr_groups {
> +	ARMPMU_ATTR_GROUP_EVENTS,
> +	ARMPMU_ATTR_GROUP_FORMATS,
> +	ARMPMU_NR_ATTR_GROUPS
> +};
> +
>  struct arm_pmu {
>  	struct pmu	pmu;
>  	cpumask_t	active_irqs;
> @@ -111,6 +117,7 @@ struct arm_pmu {
>  	struct pmu_hw_events	__percpu *hw_events;
>  	struct list_head	entry;
>  	struct notifier_block	cpu_pm_nb;
> +	const struct attribute_group *attr_groups[ARMPMU_NR_ATTR_GROUPS + 1];

Is the '+ 1' because the array has to be NULL terminated? Probably worth
a comment to disuade people from sending "obvious" fixes.

Will

  reply	other threads:[~2016-09-09 10:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 10:21 [RFCv4 0/7] arm_pmu/perf tools: play nicely with CPU PMU cpumasks Mark Rutland
2016-09-08 10:21 ` [RFCv4 1/7] drivers/perf: arm_pmu: add common attr group fields Mark Rutland
2016-09-09 10:25   ` Will Deacon [this message]
2016-09-09 11:05     ` Mark Rutland
2016-09-08 10:21 ` [RFCv4 2/7] arm64: perf: move to common attr_group fields Mark Rutland
2016-09-08 10:21 ` [RFCv4 3/7] arm: " Mark Rutland
2016-09-08 10:21 ` [RFCv4 4/7] drivers/perf: arm_pmu: only use common attr_groups Mark Rutland
2016-09-08 10:21 ` [RFCv4 5/7] drivers/perf: arm_pmu: expose a cpumask in sysfs Mark Rutland
2016-09-09 10:24   ` Will Deacon
2016-09-09 11:04     ` Mark Rutland
2016-09-08 10:21 ` [RFCv4 6/7] perf: util: only open events on CPUs an evsel permits Mark Rutland
2016-09-09  5:53   ` [tip:perf/core] perf evlist: Only " tip-bot for Mark Rutland
2016-09-08 10:21 ` [RFCv4 7/7] perf: util: support alternative sysfs cpumask Mark Rutland
2016-09-09  5:54   ` [tip:perf/core] perf pmu: Support " tip-bot for Mark Rutland
2016-09-08 10:38 ` [RFCv4 0/7] arm_pmu/perf tools: play nicely with CPU PMU cpumasks Will Deacon
2016-09-08 11:29   ` Mark Rutland
2016-09-08 16:25 ` Arnaldo Carvalho de Melo
2016-09-08 18:16   ` Peter Zijlstra
2016-09-09  9:31     ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160909102554.GF20192@arm.com \
    --to=will.deacon@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).