All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2] arm: perf: Add event descriptions
Date: Mon, 12 Oct 2015 15:30:25 +0100	[thread overview]
Message-ID: <20151012143025.GG16124@arm.com> (raw)
In-Reply-To: <20151009165330.GA22415@dreric01-gentoo.localdomain>

On Fri, Oct 09, 2015 at 09:53:32AM -0700, Drew Richardson wrote:
> On Fri, Oct 09, 2015 at 11:13:38AM +0100, Will Deacon wrote:
> > On Wed, Oct 07, 2015 at 11:28:18AM -0700, Drew Richardson wrote:
> > > diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
> > > index 126dc679b230..6623bd0d8a1d 100644
> > > --- a/arch/arm/kernel/perf_event_v7.c
> > > +++ b/arch/arm/kernel/perf_event_v7.c
> > > @@ -547,6 +547,95 @@ static const unsigned scorpion_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
> > >  	[C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
> > >  };
> > >  
> > > +static ssize_t armv7_event_sysfs_show(struct device *dev,
> > > +				      struct device_attribute *attr, char *page)
> > > +{
> > > +	struct perf_pmu_events_attr *pmu_attr;
> > > +
> > > +	pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
> > > +
> > > +	return sprintf(page, "event=0x%02llx\n", pmu_attr->id);
> > > +}
> > 
> > Can we not do this with a couple of macros, stringification of the event
> > code and PMU_EVENT_ATTR_STRING, therefore avoiding this function entirely?
> 
> I assumed that doing it this way would be smaller, but using
> PMU_EVENT_ATTR_STRING is a few hundred bytes smaller, see
> below. (Please let me know if you'd prefer I send it out in a separate
> email or even a new thread)

I think this looks much better, thanks. The only thing left to do is
re-use some of the existing event descriptions from the enum
armv7_perf_types that we have at the top of the file, rather than
duplicate the event -> ID mapping. Feel free to extend the enumeration
if you need to (it's intended to cover all of the architected events).

Thanks,

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Drew Richardson <drew.richardson@arm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Russell King <linux@arm.linux.org.uk>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Wade Cherry <Wade.Cherry@arm.com>,
	Pawel Moll <Pawel.Moll@arm.com>
Subject: Re: [PATCHv2] arm: perf: Add event descriptions
Date: Mon, 12 Oct 2015 15:30:25 +0100	[thread overview]
Message-ID: <20151012143025.GG16124@arm.com> (raw)
In-Reply-To: <20151009165330.GA22415@dreric01-gentoo.localdomain>

On Fri, Oct 09, 2015 at 09:53:32AM -0700, Drew Richardson wrote:
> On Fri, Oct 09, 2015 at 11:13:38AM +0100, Will Deacon wrote:
> > On Wed, Oct 07, 2015 at 11:28:18AM -0700, Drew Richardson wrote:
> > > diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
> > > index 126dc679b230..6623bd0d8a1d 100644
> > > --- a/arch/arm/kernel/perf_event_v7.c
> > > +++ b/arch/arm/kernel/perf_event_v7.c
> > > @@ -547,6 +547,95 @@ static const unsigned scorpion_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
> > >  	[C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
> > >  };
> > >  
> > > +static ssize_t armv7_event_sysfs_show(struct device *dev,
> > > +				      struct device_attribute *attr, char *page)
> > > +{
> > > +	struct perf_pmu_events_attr *pmu_attr;
> > > +
> > > +	pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
> > > +
> > > +	return sprintf(page, "event=0x%02llx\n", pmu_attr->id);
> > > +}
> > 
> > Can we not do this with a couple of macros, stringification of the event
> > code and PMU_EVENT_ATTR_STRING, therefore avoiding this function entirely?
> 
> I assumed that doing it this way would be smaller, but using
> PMU_EVENT_ATTR_STRING is a few hundred bytes smaller, see
> below. (Please let me know if you'd prefer I send it out in a separate
> email or even a new thread)

I think this looks much better, thanks. The only thing left to do is
re-use some of the existing event descriptions from the enum
armv7_perf_types that we have at the top of the file, rather than
duplicate the event -> ID mapping. Feel free to extend the enumeration
if you need to (it's intended to cover all of the architected events).

Thanks,

Will

  reply	other threads:[~2015-10-12 14:30 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-07 18:28 [PATCHv2] arm: perf: Add event descriptions Drew Richardson
2015-10-07 18:28 ` Drew Richardson
2015-10-09 10:13 ` Will Deacon
2015-10-09 10:13   ` Will Deacon
2015-10-09 16:53   ` Drew Richardson
2015-10-09 16:53     ` Drew Richardson
2015-10-12 14:30     ` Will Deacon [this message]
2015-10-12 14:30       ` Will Deacon
2015-10-12 18:10       ` Drew Richardson
2015-10-12 18:10         ` Drew Richardson
2015-10-13 14:15         ` Will Deacon
2015-10-13 14:15           ` Will Deacon
2015-10-13 15:34         ` [PATCH v5 0/2] " Drew Richardson
2015-10-13 15:34           ` Drew Richardson
2015-10-13 15:35         ` [PATCH v5 1/2] arm: perf: Convert event enums to #defines Drew Richardson
2015-10-13 15:35           ` Drew Richardson
2015-10-13 15:36         ` [PATCH v5 2/2] arm: perf: Add event descriptions Drew Richardson
2015-10-13 15:36           ` Drew Richardson
2015-10-15 13:21           ` Will Deacon
2015-10-15 13:21             ` Will Deacon
2015-10-15 15:15             ` Drew Richardson
2015-10-15 15:15               ` Drew Richardson
2015-10-15 15:20               ` Pawel Moll
2015-10-15 15:20                 ` Pawel Moll
2015-10-15 15:42                 ` Mark Rutland
2015-10-15 15:42                   ` Mark Rutland
2015-10-15 15:49                   ` Pawel Moll
2015-10-15 15:49                     ` Pawel Moll
2015-10-15 15:29               ` Will Deacon
2015-10-15 15:29                 ` Will Deacon
2015-10-15 15:41                 ` Mark Rutland
2015-10-15 15:41                   ` Mark Rutland
2015-10-15 16:31                   ` Drew Richardson
2015-10-15 16:31                     ` Drew Richardson
2015-10-15 16:44                     ` Mark Rutland
2015-10-15 16:44                       ` Mark Rutland
2015-10-22 14:05   ` [PATCHv2] " Drew Richardson
2015-10-22 14:05     ` Drew Richardson
2015-10-22 14:07     ` [PATCH 1/2] arm64: perf: Convert event enums to #defines Drew Richardson
2015-10-22 14:07       ` Drew Richardson
2015-10-22 14:07     ` [PATCH 2/2] arm64: perf: Add event descriptions Drew Richardson
2015-10-22 14:07       ` Drew Richardson
2015-10-27 17:32     ` [PATCHv2] arm: " Will Deacon
2015-10-27 17:32       ` Will Deacon
2015-10-28 12:33       ` Mark Rutland
2015-10-28 12:33         ` Mark Rutland

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=20151012143025.GG16124@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.