mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tan Xiaojun <tanxiaojun@huawei.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
	<alexander.shishkin@linux.intel.com>, <jolsa@redhat.com>,
	<namhyung@kernel.org>, <ak@linux.intel.com>,
	<adrian.hunter@intel.com>, <yao.jin@linux.intel.com>,
	<tmricht@linux.ibm.com>, <brueckner@linux.ibm.com>,
	<songliubraving@fb.com>, <gregkh@linuxfoundation.org>,
	<kim.phillips@arm.com>, <James.Clark@arm.com>,
	<jeremy.linton@arm.com>
Cc: <gengdongjiu@huawei.com>, <wxf.wang@hisilicon.com>,
	<liwei391@huawei.com>, <tanxiaojun@huawei.com>,
	<huawei.libin@huawei.com>, <linux-kernel@vger.kernel.org>,
	<linux-perf-users@vger.kernel.org>
Subject: [RFC v3 4/5] drivers: perf: add some arm spe events
Date: Sat, 23 Nov 2019 18:11:17 +0800	[thread overview]
Message-ID: <20191123101118.12635-5-tanxiaojun@huawei.com> (raw)
In-Reply-To: <20191123101118.12635-1-tanxiaojun@huawei.com>

Add some definitions of arm spe events, these are precise ip events.
Displayed in the perf list as follows:

---------------------------------------------------------------------
...
arm_spe_0//                                        [Kernel PMU event]
arm_spe_0/branch_miss/                             [Kernel PMU event]
arm_spe_0/llc_miss/                                [Kernel PMU event]
arm_spe_0/remote_access/                           [Kernel PMU event]
arm_spe_0/tlb_miss/                                [Kernel PMU event]
...
---------------------------------------------------------------------

Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com>
---
 drivers/perf/arm_spe_pmu.c | 44 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
index 4e4984a55cd1..4df9abdb2255 100644
--- a/drivers/perf/arm_spe_pmu.c
+++ b/drivers/perf/arm_spe_pmu.c
@@ -161,6 +161,9 @@ static struct attribute_group arm_spe_pmu_cap_group = {
 #define ATTR_CFG_FLD_pct_enable_CFG		config	/* PMSCR_EL1.PCT */
 #define ATTR_CFG_FLD_pct_enable_LO		2
 #define ATTR_CFG_FLD_pct_enable_HI		2
+#define ATTR_CFG_FLD_event_CFG			config	/* ARM SPE EVENTS */
+#define ATTR_CFG_FLD_event_LO			3
+#define ATTR_CFG_FLD_event_HI			6
 #define ATTR_CFG_FLD_jitter_CFG			config	/* PMSIRR_EL1.RND */
 #define ATTR_CFG_FLD_jitter_LO			16
 #define ATTR_CFG_FLD_jitter_HI			16
@@ -174,6 +177,11 @@ static struct attribute_group arm_spe_pmu_cap_group = {
 #define ATTR_CFG_FLD_store_filter_LO		34
 #define ATTR_CFG_FLD_store_filter_HI		34
 
+#define ARM_SPE_EVENT_LLC_MISS			BIT(0)
+#define ARM_SPE_EVENT_BRANCH_MISS		BIT(1)
+#define ARM_SPE_EVENT_TLB_MISS			BIT(2)
+#define ARM_SPE_EVENT_REMOTE_ACCESS		BIT(3)
+
 #define ATTR_CFG_FLD_event_filter_CFG		config1	/* PMSEVFR_EL1 */
 #define ATTR_CFG_FLD_event_filter_LO		0
 #define ATTR_CFG_FLD_event_filter_HI		63
@@ -213,8 +221,43 @@ GEN_PMU_FORMAT_ATTR(load_filter);
 GEN_PMU_FORMAT_ATTR(store_filter);
 GEN_PMU_FORMAT_ATTR(event_filter);
 GEN_PMU_FORMAT_ATTR(min_latency);
+GEN_PMU_FORMAT_ATTR(event);
+
+static ssize_t
+arm_spe_events_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%03llx\n", pmu_attr->id);
+}
+
+#define ARM_SPE_EVENT_ATTR(name, config) \
+	PMU_EVENT_ATTR(name, arm_spe_event_attr_##name, \
+		       config, arm_spe_events_sysfs_show)
+
+ARM_SPE_EVENT_ATTR(llc_miss, ARM_SPE_EVENT_LLC_MISS);
+ARM_SPE_EVENT_ATTR(branch_miss, ARM_SPE_EVENT_BRANCH_MISS);
+ARM_SPE_EVENT_ATTR(tlb_miss, ARM_SPE_EVENT_TLB_MISS);
+ARM_SPE_EVENT_ATTR(remote_access, ARM_SPE_EVENT_REMOTE_ACCESS);
+
+static struct attribute *arm_spe_pmu_event_attrs[] = {
+	&arm_spe_event_attr_llc_miss.attr.attr,
+	&arm_spe_event_attr_branch_miss.attr.attr,
+	&arm_spe_event_attr_tlb_miss.attr.attr,
+	&arm_spe_event_attr_remote_access.attr.attr,
+	NULL,
+};
+
+static struct attribute_group arm_spe_pmu_event_group = {
+	.name = "events",
+	.attrs	= arm_spe_pmu_event_attrs,
+};
 
 static struct attribute *arm_spe_pmu_formats_attr[] = {
+	&format_attr_event.attr,
 	&format_attr_ts_enable.attr,
 	&format_attr_pa_enable.attr,
 	&format_attr_pct_enable.attr,
@@ -252,6 +295,7 @@ static struct attribute_group arm_spe_pmu_group = {
 };
 
 static const struct attribute_group *arm_spe_pmu_attr_groups[] = {
+	&arm_spe_pmu_event_group,
 	&arm_spe_pmu_group,
 	&arm_spe_pmu_cap_group,
 	&arm_spe_pmu_format_group,
-- 
2.17.1


  parent reply	other threads:[~2019-11-23  9:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-23 10:11 [RFC v3 0/5] perf tools: Add support for some spe events and precise ip Tan Xiaojun
2019-11-23 10:11 ` [RFC v3 1/5] perf tools: Move arm-spe-pkt-decoder.h/c to the new dir Tan Xiaojun
2019-11-23 10:11 ` [RFC v3 2/5] perf tools: Add support for "report" for some spe events Tan Xiaojun
2019-11-23 10:11 ` [RFC v3 3/5] perf report: Add --spe options for arm-spe Tan Xiaojun
2019-11-23 10:11 ` Tan Xiaojun [this message]
2019-11-23 10:11 ` [RFC v3 5/5] perf tools: Add support to process multi spe events Tan Xiaojun
2019-11-29 16:32   ` James Clark
2019-11-30  0:42     ` Tan Xiaojun
2019-12-06 15:48       ` James Clark
2019-12-09  0:46         ` Tan Xiaojun
2019-12-12 15:50           ` James Clark
2019-12-16  3:20             ` Tan Xiaojun
2019-12-02  7:07 ` [RFC v3 0/5] perf tools: Add support for some spe events and precise ip Qi Liu

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=20191123101118.12635-5-tanxiaojun@huawei.com \
    --to=tanxiaojun@huawei.com \
    --cc=James.Clark@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=brueckner@linux.ibm.com \
    --cc=gengdongjiu@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=huawei.libin@huawei.com \
    --cc=jeremy.linton@arm.com \
    --cc=jolsa@redhat.com \
    --cc=kim.phillips@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=songliubraving@fb.com \
    --cc=tmricht@linux.ibm.com \
    --cc=wxf.wang@hisilicon.com \
    --cc=yao.jin@linux.intel.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

all inboxes | Powered by JetHome®