linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>,
	robert.richter@amd.com, Anton Blanchard <anton@au1.ibm.com>,
	linux-kernel@vger.kernel.org,
	Stephane Eranian <eranian@google.com>,
	linuxppc-dev@ozlabs.org,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 5/6][v3] perf: Create a sysfs entry for Power event format
Date: Wed, 9 Jan 2013 17:06:34 -0800	[thread overview]
Message-ID: <20130110010633.GE32590@us.ibm.com> (raw)
In-Reply-To: <20130110010347.GA32590@us.ibm.com>

[PATCH 5/6][v3] perf: Create a sysfs entry for Power event format

Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
which describes the format of a POWER cpu.

The format of the event is the same for all POWER cpus at least in
(Power6, Power7), so bulk of this change is common in the code common
to POWER cpus.

This code is based on corresponding code in x86.

Changelog[v2]: [Jiri Olsa] Use PMU_FORMAT_ATTR() rather than duplicating it.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/perf_event_server.h |    6 ++++++
 arch/powerpc/perf/core-book3s.c              |   12 ++++++++++++
 arch/powerpc/perf/power7-pmu.c               |    1 +
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index b29fcc6..ee63205 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -135,3 +135,9 @@ extern ssize_t power_events_sysfs_show(struct device *dev,
 
 #define	POWER_EVENT_ATTR(_name, _id)	EVENT_ATTR(PM_##_name, _id, _p)
 #define	POWER_EVENT_PTR(_id)		EVENT_PTR(_id, _p)
+
+/*
+ * Format of a perf event is the same on all POWER cpus. Declare a
+ * common sysfs attribute group that individual POWER cpus can share.
+ */
+extern struct attribute_group power_pmu_format_group;
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index fa476d5..4ae044b 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1315,6 +1315,18 @@ ssize_t power_events_sysfs_show(struct device *dev,
 	return sprintf(page, "event=0x%02llx\n", pmu_attr->id);
 }
 
+PMU_FORMAT_ATTR(event, "config:0-20");
+
+static struct attribute *power_pmu_format_attr[] = {
+	&format_attr_event.attr,
+	NULL,
+};
+
+struct attribute_group power_pmu_format_group = {
+	.name = "format",
+	.attrs = power_pmu_format_attr,
+};
+
 struct pmu power_pmu = {
 	.pmu_enable	= power_pmu_enable,
 	.pmu_disable	= power_pmu_disable,
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c
index 5627940..5fb3c9b 100644
--- a/arch/powerpc/perf/power7-pmu.c
+++ b/arch/powerpc/perf/power7-pmu.c
@@ -410,6 +410,7 @@ static struct attribute_group power7_pmu_events_group = {
 };
 
 static const struct attribute_group *power7_pmu_attr_groups[] = {
+	&power_pmu_format_group,
 	&power7_pmu_events_group,
 	NULL,
 };
-- 
1.7.1

  parent reply	other threads:[~2013-01-10  1:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10  1:03 [PATCH 1/6][v3] perf/Power7: Use macros to identify perf events Sukadev Bhattiprolu
2013-01-10  1:04 ` [PATCH 2/6][v3] perf: Make EVENT_ATTR global Sukadev Bhattiprolu
2013-01-10  1:05 ` [PATCH 3/6][v3] perf/POWER7: Make generic event translations available in sysfs Sukadev Bhattiprolu
2013-01-10  1:06 ` [PATCH 4/6][v3] perf/POWER7: Make some POWER7 events " Sukadev Bhattiprolu
2013-01-10  1:06 ` Sukadev Bhattiprolu [this message]
2013-01-10  1:07 ` [PATCH 6/6][v3] perf: Document the ABI of perf sysfs entries Sukadev Bhattiprolu
2013-01-15 18:57   ` Arnaldo Carvalho de Melo
2013-01-15 22:47     ` Greg KH
2013-01-16 11:30     ` Jiri Olsa
2013-01-16 18:58       ` Sukadev Bhattiprolu
2013-01-17 14:11         ` Jiri Olsa
2013-01-18 17:46           ` Sukadev Bhattiprolu
2013-01-18 19:20             ` Arnaldo Carvalho de Melo
2013-01-22 17:10             ` Jiri Olsa
2013-01-23  3:50 ` [PATCH 1/6][v3] perf/Power7: Use macros to identify perf events Michael Ellerman
  -- strict thread matches above, loose matches on Subject: below --
2013-01-10  0:20 sukadev
2013-01-10  0:20 ` [PATCH 5/6][v3] perf: Create a sysfs entry for Power event format sukadev
2013-01-10  0:06 [PATCH 1/6][v3] perf/Power7: Use macros to identify perf events sukadev
2013-01-10  0:06 ` [PATCH 5/6][v3] perf: Create a sysfs entry for Power event format sukadev

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=20130110010633.GE32590@us.ibm.com \
    --to=sukadev@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=ak@linux.intel.com \
    --cc=anton@au1.ibm.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=robert.richter@amd.com \
    /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).