All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Perf uncore PMU event alias support for Hisi hip08 ARM64 platform
@ 2019-06-28 14:35 ` John Garry
  0 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: linux-kernel, linuxarm, linux-arm-kernel, zhangshaokun, ak, John Garry

This patchset adds support for uncore PMU event aliasing for HiSilicon
hip08 ARM64 platform.

We can now get proper event description for uncore events for the
perf tool.

For HHA, DDRC, and L3C JSONs, we don't have all the event info yet, so
I will seek it out to update the JSONs later.

Changes to v3:
- Omit "perf pmu: Fix uncore PMU alias list for ARM64", as it has already
  been picked up
- Add comment for pmu_uncore_alias_match()

Changes to v2:
- Use strtok_r() in pmu_uncore_alias_match()
- from "sccl" from uncore aliases

John Garry (4):
  perf pmu: Support more complex PMU event aliasing
  perf jevents: Add support for Hisi hip08 DDRC PMU aliasing
  perf jevents: Add support for Hisi hip08 HHA PMU aliasing
  perf jevents: Add support for Hisi hip08 L3C PMU aliasing

 .../arm64/hisilicon/hip08/uncore-ddrc.json    | 44 ++++++++++++++++
 .../arm64/hisilicon/hip08/uncore-hha.json     | 51 +++++++++++++++++++
 .../arm64/hisilicon/hip08/uncore-l3c.json     | 37 ++++++++++++++
 tools/perf/pmu-events/jevents.c               |  3 ++
 tools/perf/util/pmu.c                         | 46 +++++++++++++++--
 5 files changed, 176 insertions(+), 5 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json

-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v3 0/4] Perf uncore PMU event alias support for Hisi hip08 ARM64 platform
@ 2019-06-28 14:35 ` John Garry
  0 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: ak, John Garry, linux-kernel, linuxarm, zhangshaokun, linux-arm-kernel

This patchset adds support for uncore PMU event aliasing for HiSilicon
hip08 ARM64 platform.

We can now get proper event description for uncore events for the
perf tool.

For HHA, DDRC, and L3C JSONs, we don't have all the event info yet, so
I will seek it out to update the JSONs later.

Changes to v3:
- Omit "perf pmu: Fix uncore PMU alias list for ARM64", as it has already
  been picked up
- Add comment for pmu_uncore_alias_match()

Changes to v2:
- Use strtok_r() in pmu_uncore_alias_match()
- from "sccl" from uncore aliases

John Garry (4):
  perf pmu: Support more complex PMU event aliasing
  perf jevents: Add support for Hisi hip08 DDRC PMU aliasing
  perf jevents: Add support for Hisi hip08 HHA PMU aliasing
  perf jevents: Add support for Hisi hip08 L3C PMU aliasing

 .../arm64/hisilicon/hip08/uncore-ddrc.json    | 44 ++++++++++++++++
 .../arm64/hisilicon/hip08/uncore-hha.json     | 51 +++++++++++++++++++
 .../arm64/hisilicon/hip08/uncore-l3c.json     | 37 ++++++++++++++
 tools/perf/pmu-events/jevents.c               |  3 ++
 tools/perf/util/pmu.c                         | 46 +++++++++++++++--
 5 files changed, 176 insertions(+), 5 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
  2019-06-28 14:35 ` John Garry
@ 2019-06-28 14:35   ` John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: linux-kernel, linuxarm, linux-arm-kernel, zhangshaokun, ak, John Garry

The jevent "Unit" field is used for uncore PMU alias definition.

The form uncore_pmu_example_X is supported, where "X" is a wildcard,
to support multiple instances of the same PMU in a system.

Unfortunately this format not suitable for all uncore PMUs; take the Hisi
DDRC uncore PMU for example, where the name is in the form
hisi_scclX_ddrcY.

For for current jevent parsing, we would be required to hardcode an uncore
alias translation for each possible value of X. This is not scalable.

Instead, add support for "Unit" field in the form "hisi_sccl,ddrc", where
we can match by hisi_scclX and ddrcY. Tokens  in Unit field
are delimited by ','.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 tools/perf/util/pmu.c | 46 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 7e7299fee550..cfc916819c59 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -700,6 +700,46 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
 	return map;
 }
 
+static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
+{
+	char *tmp, *tok, *str;
+	bool res;
+
+	str = strdup(pmu_name);
+	if (!str)
+		return false;
+
+	/*
+	 * uncore alias may be from different PMU with common prefix
+	 */
+	tok = strtok_r(str, ",", &tmp);
+	if (strncmp(pmu_name, tok, strlen(tok))) {
+		res = false;
+		goto out;
+	}
+
+	/*
+	 * Match more complex aliases where the alias name is a comma-delimited
+	 * list of tokens, orderly contained in the matching PMU name.
+	 *
+	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
+	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
+	 *	    "pmunameY".
+	 */
+	for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) {
+		name = strstr(name, tok);
+		if (!name) {
+			res = false;
+			goto out;
+		}
+	}
+
+	res = true;
+out:
+	free(str);
+	return res;
+}
+
 /*
  * From the pmu_events_map, find the table of PMU events that corresponds
  * to the current running CPU. Then, add all PMU events from that table
@@ -730,12 +770,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
 			break;
 		}
 
-		/*
-		 * uncore alias may be from different PMU
-		 * with common prefix
-		 */
 		if (pmu_is_uncore(name) &&
-		    !strncmp(pname, name, strlen(pname)))
+		    pmu_uncore_alias_match(pname, name))
 			goto new_alias;
 
 		if (strcmp(pname, name))
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
@ 2019-06-28 14:35   ` John Garry
  0 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: ak, John Garry, linux-kernel, linuxarm, zhangshaokun, linux-arm-kernel

The jevent "Unit" field is used for uncore PMU alias definition.

The form uncore_pmu_example_X is supported, where "X" is a wildcard,
to support multiple instances of the same PMU in a system.

Unfortunately this format not suitable for all uncore PMUs; take the Hisi
DDRC uncore PMU for example, where the name is in the form
hisi_scclX_ddrcY.

For for current jevent parsing, we would be required to hardcode an uncore
alias translation for each possible value of X. This is not scalable.

Instead, add support for "Unit" field in the form "hisi_sccl,ddrc", where
we can match by hisi_scclX and ddrcY. Tokens  in Unit field
are delimited by ','.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 tools/perf/util/pmu.c | 46 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 7e7299fee550..cfc916819c59 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -700,6 +700,46 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
 	return map;
 }
 
+static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
+{
+	char *tmp, *tok, *str;
+	bool res;
+
+	str = strdup(pmu_name);
+	if (!str)
+		return false;
+
+	/*
+	 * uncore alias may be from different PMU with common prefix
+	 */
+	tok = strtok_r(str, ",", &tmp);
+	if (strncmp(pmu_name, tok, strlen(tok))) {
+		res = false;
+		goto out;
+	}
+
+	/*
+	 * Match more complex aliases where the alias name is a comma-delimited
+	 * list of tokens, orderly contained in the matching PMU name.
+	 *
+	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
+	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
+	 *	    "pmunameY".
+	 */
+	for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) {
+		name = strstr(name, tok);
+		if (!name) {
+			res = false;
+			goto out;
+		}
+	}
+
+	res = true;
+out:
+	free(str);
+	return res;
+}
+
 /*
  * From the pmu_events_map, find the table of PMU events that corresponds
  * to the current running CPU. Then, add all PMU events from that table
@@ -730,12 +770,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
 			break;
 		}
 
-		/*
-		 * uncore alias may be from different PMU
-		 * with common prefix
-		 */
 		if (pmu_is_uncore(name) &&
-		    !strncmp(pname, name, strlen(pname)))
+		    pmu_uncore_alias_match(pname, name))
 			goto new_alias;
 
 		if (strcmp(pname, name))
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 2/4] perf jevents: Add support for Hisi hip08 DDRC PMU aliasing
  2019-06-28 14:35 ` John Garry
@ 2019-06-28 14:35   ` John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: linux-kernel, linuxarm, linux-arm-kernel, zhangshaokun, ak, John Garry

Add support for Hisi hip08 DDRC PMU aliasing. We can now do something like
this:

$perf list

[snip]

uncore ddrc:
  uncore_hisi_ddrc.act_cmd
       [DDRC active commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.flux_rcmd
       [DDRC read commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.flux_wcmd
       [DDRC write commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.flux_wr
       [DDRC precharge commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.rnk_chg
       [DDRC rank commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.rw_chg
       [DDRC read and write changes. Unit: hisi_sccl,ddrc]

Performance counter stats for 'system wide':

                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc0]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc3]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc0]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc3]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc3]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc0]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc0]
            20,421      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc3]

       1.001559011 seconds time elapsed


The kernel driver is in drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c

Signed-off-by: John Garry <john.garry@huawei.com>
---
 .../arm64/hisilicon/hip08/uncore-ddrc.json    | 44 +++++++++++++++++++
 tools/perf/pmu-events/jevents.c               |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
new file mode 100644
index 000000000000..0d1556fcdffe
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
@@ -0,0 +1,44 @@
+[
+   {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_ddrc.flux_wcmd",
+	    "BriefDescription": "DDRC write commands",
+	    "PublicDescription": "DDRC write commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x03",
+	    "EventName": "uncore_hisi_ddrc.flux_rcmd",
+	    "BriefDescription": "DDRC read commands",
+	    "PublicDescription": "DDRC read commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x04",
+	    "EventName": "uncore_hisi_ddrc.flux_wr",
+	    "BriefDescription": "DDRC precharge commands",
+	    "PublicDescription": "DDRC precharge commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x05",
+	    "EventName": "uncore_hisi_ddrc.act_cmd",
+	    "BriefDescription": "DDRC active commands",
+	    "PublicDescription": "DDRC active commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x06",
+	    "EventName": "uncore_hisi_ddrc.rnk_chg",
+	    "BriefDescription": "DDRC rank commands",
+	    "PublicDescription": "DDRC rank commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x07",
+	    "EventName": "uncore_hisi_ddrc.rw_chg",
+	    "BriefDescription": "DDRC read and write changes",
+	    "PublicDescription": "DDRC read and write changes",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+]
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 58f77fd0f59f..cf9a60333554 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -236,6 +236,7 @@ static struct map {
 	{ "CPU-M-CF", "cpum_cf" },
 	{ "CPU-M-SF", "cpum_sf" },
 	{ "UPI LL", "uncore_upi" },
+	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
 	{}
 };
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 2/4] perf jevents: Add support for Hisi hip08 DDRC PMU aliasing
@ 2019-06-28 14:35   ` John Garry
  0 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: ak, John Garry, linux-kernel, linuxarm, zhangshaokun, linux-arm-kernel

Add support for Hisi hip08 DDRC PMU aliasing. We can now do something like
this:

$perf list

[snip]

uncore ddrc:
  uncore_hisi_ddrc.act_cmd
       [DDRC active commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.flux_rcmd
       [DDRC read commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.flux_wcmd
       [DDRC write commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.flux_wr
       [DDRC precharge commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.rnk_chg
       [DDRC rank commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.rw_chg
       [DDRC read and write changes. Unit: hisi_sccl,ddrc]

Performance counter stats for 'system wide':

                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc0]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc3]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc0]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc3]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc3]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc0]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc0]
            20,421      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc3]

       1.001559011 seconds time elapsed


The kernel driver is in drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c

Signed-off-by: John Garry <john.garry@huawei.com>
---
 .../arm64/hisilicon/hip08/uncore-ddrc.json    | 44 +++++++++++++++++++
 tools/perf/pmu-events/jevents.c               |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
new file mode 100644
index 000000000000..0d1556fcdffe
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
@@ -0,0 +1,44 @@
+[
+   {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_ddrc.flux_wcmd",
+	    "BriefDescription": "DDRC write commands",
+	    "PublicDescription": "DDRC write commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x03",
+	    "EventName": "uncore_hisi_ddrc.flux_rcmd",
+	    "BriefDescription": "DDRC read commands",
+	    "PublicDescription": "DDRC read commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x04",
+	    "EventName": "uncore_hisi_ddrc.flux_wr",
+	    "BriefDescription": "DDRC precharge commands",
+	    "PublicDescription": "DDRC precharge commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x05",
+	    "EventName": "uncore_hisi_ddrc.act_cmd",
+	    "BriefDescription": "DDRC active commands",
+	    "PublicDescription": "DDRC active commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x06",
+	    "EventName": "uncore_hisi_ddrc.rnk_chg",
+	    "BriefDescription": "DDRC rank commands",
+	    "PublicDescription": "DDRC rank commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x07",
+	    "EventName": "uncore_hisi_ddrc.rw_chg",
+	    "BriefDescription": "DDRC read and write changes",
+	    "PublicDescription": "DDRC read and write changes",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+]
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 58f77fd0f59f..cf9a60333554 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -236,6 +236,7 @@ static struct map {
 	{ "CPU-M-CF", "cpum_cf" },
 	{ "CPU-M-SF", "cpum_sf" },
 	{ "UPI LL", "uncore_upi" },
+	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
 	{}
 };
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 3/4] perf jevents: Add support for Hisi hip08 HHA PMU aliasing
  2019-06-28 14:35 ` John Garry
@ 2019-06-28 14:35   ` John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: linux-kernel, linuxarm, linux-arm-kernel, zhangshaokun, ak, John Garry

Add support for Hisi hip08 HHA PMU aliasing.

The kernel driver is in drivers/perf/hisilicon/hisi_uncore_hha_pmu.c

Signed-off-by: John Garry <john.garry@huawei.com>
---
 .../arm64/hisilicon/hip08/uncore-hha.json     | 51 +++++++++++++++++++
 tools/perf/pmu-events/jevents.c               |  1 +
 2 files changed, 52 insertions(+)
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
new file mode 100644
index 000000000000..447d3064de90
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
@@ -0,0 +1,51 @@
+[
+   {
+	    "EventCode": "0x00",
+	    "EventName": "uncore_hisi_hha.rx_ops_num",
+	    "BriefDescription": "The number of all operations received by the HHA",
+	    "PublicDescription": "The number of all operations received by the HHA",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x01",
+	    "EventName": "uncore_hisi_hha.rx_outer",
+	    "BriefDescription": "The number of all operations received by the HHA from another socket",
+	    "PublicDescription": "The number of all operations received by the HHA from another socket",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_hha.rx_sccl",
+	    "BriefDescription": "The number of all operations received by the HHA from another SCCL in this socket",
+	    "PublicDescription": "The number of all operations received by the HHA from another SCCL in this socket",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1c",
+	    "EventName": "uncore_hisi_hha.rd_ddr_64b",
+	    "BriefDescription": "The number of read operations sent by HHA to DDRC which size is 64 bytes",
+	    "PublicDescription": "The number of read operations sent by HHA to DDRC which size is 64bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1d",
+	    "EventName": "uncore_hisi_hha.wr_dr_64b",
+	    "BriefDescription": "The number of write operations sent by HHA to DDRC which size is 64 bytes",
+	    "PublicDescription": "The number of write operations sent by HHA to DDRC which size is 64 bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1e",
+	    "EventName": "uncore_hisi_hha.rd_ddr_128b",
+	    "BriefDescription": "The number of read operations sent by HHA to DDRC which size is 128 bytes",
+	    "PublicDescription": "The number of read operations sent by HHA to DDRC which size is 128 bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1f",
+	    "EventName": "uncore_hisi_hha.wr_ddr_128b",
+	    "BriefDescription": "The number of write operations sent by HHA to DDRC which size is 128 bytes",
+	    "PublicDescription": "The number of write operations sent by HHA to DDRC which size is 128 bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+]
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index cf9a60333554..909e53e3b5bd 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -237,6 +237,7 @@ static struct map {
 	{ "CPU-M-SF", "cpum_sf" },
 	{ "UPI LL", "uncore_upi" },
 	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
+	{ "hisi_sccl,hha", "hisi_sccl,hha" },
 	{}
 };
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 3/4] perf jevents: Add support for Hisi hip08 HHA PMU aliasing
@ 2019-06-28 14:35   ` John Garry
  0 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: ak, John Garry, linux-kernel, linuxarm, zhangshaokun, linux-arm-kernel

Add support for Hisi hip08 HHA PMU aliasing.

The kernel driver is in drivers/perf/hisilicon/hisi_uncore_hha_pmu.c

Signed-off-by: John Garry <john.garry@huawei.com>
---
 .../arm64/hisilicon/hip08/uncore-hha.json     | 51 +++++++++++++++++++
 tools/perf/pmu-events/jevents.c               |  1 +
 2 files changed, 52 insertions(+)
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
new file mode 100644
index 000000000000..447d3064de90
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
@@ -0,0 +1,51 @@
+[
+   {
+	    "EventCode": "0x00",
+	    "EventName": "uncore_hisi_hha.rx_ops_num",
+	    "BriefDescription": "The number of all operations received by the HHA",
+	    "PublicDescription": "The number of all operations received by the HHA",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x01",
+	    "EventName": "uncore_hisi_hha.rx_outer",
+	    "BriefDescription": "The number of all operations received by the HHA from another socket",
+	    "PublicDescription": "The number of all operations received by the HHA from another socket",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_hha.rx_sccl",
+	    "BriefDescription": "The number of all operations received by the HHA from another SCCL in this socket",
+	    "PublicDescription": "The number of all operations received by the HHA from another SCCL in this socket",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1c",
+	    "EventName": "uncore_hisi_hha.rd_ddr_64b",
+	    "BriefDescription": "The number of read operations sent by HHA to DDRC which size is 64 bytes",
+	    "PublicDescription": "The number of read operations sent by HHA to DDRC which size is 64bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1d",
+	    "EventName": "uncore_hisi_hha.wr_dr_64b",
+	    "BriefDescription": "The number of write operations sent by HHA to DDRC which size is 64 bytes",
+	    "PublicDescription": "The number of write operations sent by HHA to DDRC which size is 64 bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1e",
+	    "EventName": "uncore_hisi_hha.rd_ddr_128b",
+	    "BriefDescription": "The number of read operations sent by HHA to DDRC which size is 128 bytes",
+	    "PublicDescription": "The number of read operations sent by HHA to DDRC which size is 128 bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1f",
+	    "EventName": "uncore_hisi_hha.wr_ddr_128b",
+	    "BriefDescription": "The number of write operations sent by HHA to DDRC which size is 128 bytes",
+	    "PublicDescription": "The number of write operations sent by HHA to DDRC which size is 128 bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+]
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index cf9a60333554..909e53e3b5bd 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -237,6 +237,7 @@ static struct map {
 	{ "CPU-M-SF", "cpum_sf" },
 	{ "UPI LL", "uncore_upi" },
 	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
+	{ "hisi_sccl,hha", "hisi_sccl,hha" },
 	{}
 };
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 4/4] perf jevents: Add support for Hisi hip08 L3C PMU aliasing
  2019-06-28 14:35 ` John Garry
@ 2019-06-28 14:35   ` John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: linux-kernel, linuxarm, linux-arm-kernel, zhangshaokun, ak, John Garry

Add support for Hisi hip08 L3C PMU aliasing.

The kernel driver is in drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c

Signed-off-by: John Garry <john.garry@huawei.com>
---
 .../arm64/hisilicon/hip08/uncore-l3c.json     | 37 +++++++++++++++++++
 tools/perf/pmu-events/jevents.c               |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json
new file mode 100644
index 000000000000..ca48747642e1
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json
@@ -0,0 +1,37 @@
+[
+   {
+	    "EventCode": "0x00",
+	    "EventName": "uncore_hisi_l3c.rd_cpipe",
+	    "BriefDescription": "Total read accesses",
+	    "PublicDescription": "Total read accesses",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x01",
+	    "EventName": "uncore_hisi_l3c.wr_cpipe",
+	    "BriefDescription": "Total write accesses",
+	    "PublicDescription": "Total write accesses",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_l3c.rd_hit_cpipe",
+	    "BriefDescription": "Total read hits",
+	    "PublicDescription": "Total read hits",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x03",
+	    "EventName": "uncore_hisi_l3c.wr_hit_cpipe",
+	    "BriefDescription": "Total write hits",
+	    "PublicDescription": "Total write hits",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x04",
+	    "EventName": "uncore_hisi_l3c.victim_num",
+	    "BriefDescription": "l3c precharge commands",
+	    "PublicDescription": "l3c precharge commands",
+	    "Unit": "hisi_sccl,l3c",
+   },
+]
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 909e53e3b5bd..7d241efd03de 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -238,6 +238,7 @@ static struct map {
 	{ "UPI LL", "uncore_upi" },
 	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
 	{ "hisi_sccl,hha", "hisi_sccl,hha" },
+	{ "hisi_sccl,l3c", "hisi_sccl,l3c" },
 	{}
 };
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v3 4/4] perf jevents: Add support for Hisi hip08 L3C PMU aliasing
@ 2019-06-28 14:35   ` John Garry
  0 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 14:35 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon
  Cc: ak, John Garry, linux-kernel, linuxarm, zhangshaokun, linux-arm-kernel

Add support for Hisi hip08 L3C PMU aliasing.

The kernel driver is in drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c

Signed-off-by: John Garry <john.garry@huawei.com>
---
 .../arm64/hisilicon/hip08/uncore-l3c.json     | 37 +++++++++++++++++++
 tools/perf/pmu-events/jevents.c               |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json
new file mode 100644
index 000000000000..ca48747642e1
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json
@@ -0,0 +1,37 @@
+[
+   {
+	    "EventCode": "0x00",
+	    "EventName": "uncore_hisi_l3c.rd_cpipe",
+	    "BriefDescription": "Total read accesses",
+	    "PublicDescription": "Total read accesses",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x01",
+	    "EventName": "uncore_hisi_l3c.wr_cpipe",
+	    "BriefDescription": "Total write accesses",
+	    "PublicDescription": "Total write accesses",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_l3c.rd_hit_cpipe",
+	    "BriefDescription": "Total read hits",
+	    "PublicDescription": "Total read hits",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x03",
+	    "EventName": "uncore_hisi_l3c.wr_hit_cpipe",
+	    "BriefDescription": "Total write hits",
+	    "PublicDescription": "Total write hits",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x04",
+	    "EventName": "uncore_hisi_l3c.victim_num",
+	    "BriefDescription": "l3c precharge commands",
+	    "PublicDescription": "l3c precharge commands",
+	    "Unit": "hisi_sccl,l3c",
+   },
+]
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 909e53e3b5bd..7d241efd03de 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -238,6 +238,7 @@ static struct map {
 	{ "UPI LL", "uncore_upi" },
 	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
 	{ "hisi_sccl,hha", "hisi_sccl,hha" },
+	{ "hisi_sccl,l3c", "hisi_sccl,l3c" },
 	{}
 };
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 0/4] Perf uncore PMU event alias support for Hisi hip08 ARM64 platform
  2019-06-28 14:35 ` John Garry
@ 2019-06-28 14:54   ` Jiri Olsa
  -1 siblings, 0 replies; 26+ messages in thread
From: Jiri Olsa @ 2019-06-28 14:54 UTC (permalink / raw)
  To: John Garry
  Cc: peterz, mingo, acme, alexander.shishkin, namhyung, tmricht,
	brueckner, kan.liang, ben, mathieu.poirier, mark.rutland,
	will.deacon, linux-kernel, linuxarm, linux-arm-kernel,
	zhangshaokun, ak

On Fri, Jun 28, 2019 at 10:35:48PM +0800, John Garry wrote:
> This patchset adds support for uncore PMU event aliasing for HiSilicon
> hip08 ARM64 platform.
> 
> We can now get proper event description for uncore events for the
> perf tool.
> 
> For HHA, DDRC, and L3C JSONs, we don't have all the event info yet, so
> I will seek it out to update the JSONs later.
> 
> Changes to v3:
> - Omit "perf pmu: Fix uncore PMU alias list for ARM64", as it has already
>   been picked up
> - Add comment for pmu_uncore_alias_match()

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> 
> Changes to v2:
> - Use strtok_r() in pmu_uncore_alias_match()
> - from "sccl" from uncore aliases
> 
> John Garry (4):
>   perf pmu: Support more complex PMU event aliasing
>   perf jevents: Add support for Hisi hip08 DDRC PMU aliasing
>   perf jevents: Add support for Hisi hip08 HHA PMU aliasing
>   perf jevents: Add support for Hisi hip08 L3C PMU aliasing
> 
>  .../arm64/hisilicon/hip08/uncore-ddrc.json    | 44 ++++++++++++++++
>  .../arm64/hisilicon/hip08/uncore-hha.json     | 51 +++++++++++++++++++
>  .../arm64/hisilicon/hip08/uncore-l3c.json     | 37 ++++++++++++++
>  tools/perf/pmu-events/jevents.c               |  3 ++
>  tools/perf/util/pmu.c                         | 46 +++++++++++++++--
>  5 files changed, 176 insertions(+), 5 deletions(-)
>  create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
>  create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
>  create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json
> 
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 0/4] Perf uncore PMU event alias support for Hisi hip08 ARM64 platform
@ 2019-06-28 14:54   ` Jiri Olsa
  0 siblings, 0 replies; 26+ messages in thread
From: Jiri Olsa @ 2019-06-28 14:54 UTC (permalink / raw)
  To: John Garry
  Cc: mark.rutland, brueckner, ak, mathieu.poirier, peterz, tmricht,
	will.deacon, linux-kernel, acme, linuxarm, zhangshaokun,
	alexander.shishkin, mingo, namhyung, ben, linux-arm-kernel,
	kan.liang

On Fri, Jun 28, 2019 at 10:35:48PM +0800, John Garry wrote:
> This patchset adds support for uncore PMU event aliasing for HiSilicon
> hip08 ARM64 platform.
> 
> We can now get proper event description for uncore events for the
> perf tool.
> 
> For HHA, DDRC, and L3C JSONs, we don't have all the event info yet, so
> I will seek it out to update the JSONs later.
> 
> Changes to v3:
> - Omit "perf pmu: Fix uncore PMU alias list for ARM64", as it has already
>   been picked up
> - Add comment for pmu_uncore_alias_match()

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> 
> Changes to v2:
> - Use strtok_r() in pmu_uncore_alias_match()
> - from "sccl" from uncore aliases
> 
> John Garry (4):
>   perf pmu: Support more complex PMU event aliasing
>   perf jevents: Add support for Hisi hip08 DDRC PMU aliasing
>   perf jevents: Add support for Hisi hip08 HHA PMU aliasing
>   perf jevents: Add support for Hisi hip08 L3C PMU aliasing
> 
>  .../arm64/hisilicon/hip08/uncore-ddrc.json    | 44 ++++++++++++++++
>  .../arm64/hisilicon/hip08/uncore-hha.json     | 51 +++++++++++++++++++
>  .../arm64/hisilicon/hip08/uncore-l3c.json     | 37 ++++++++++++++
>  tools/perf/pmu-events/jevents.c               |  3 ++
>  tools/perf/util/pmu.c                         | 46 +++++++++++++++--
>  5 files changed, 176 insertions(+), 5 deletions(-)
>  create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
>  create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
>  create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json
> 
> -- 
> 2.17.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
  2019-06-28 14:35   ` John Garry
@ 2019-06-28 15:33     ` Andi Kleen
  -1 siblings, 0 replies; 26+ messages in thread
From: Andi Kleen @ 2019-06-28 15:33 UTC (permalink / raw)
  To: John Garry
  Cc: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon, linux-kernel, linuxarm,
	linux-arm-kernel, zhangshaokun

> +	/*
> +	 * Match more complex aliases where the alias name is a comma-delimited
> +	 * list of tokens, orderly contained in the matching PMU name.
> +	 *
> +	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
> +	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
> +	 *	    "pmunameY".

This needs to be documented in some manpage.

-Andi


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
@ 2019-06-28 15:33     ` Andi Kleen
  0 siblings, 0 replies; 26+ messages in thread
From: Andi Kleen @ 2019-06-28 15:33 UTC (permalink / raw)
  To: John Garry
  Cc: mark.rutland, brueckner, mathieu.poirier, peterz, ben, tmricht,
	will.deacon, linux-kernel, acme, linuxarm, zhangshaokun,
	alexander.shishkin, mingo, namhyung, jolsa, linux-arm-kernel,
	kan.liang

> +	/*
> +	 * Match more complex aliases where the alias name is a comma-delimited
> +	 * list of tokens, orderly contained in the matching PMU name.
> +	 *
> +	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
> +	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
> +	 *	    "pmunameY".

This needs to be documented in some manpage.

-Andi


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
  2019-06-28 15:33     ` Andi Kleen
@ 2019-06-28 17:05       ` John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 17:05 UTC (permalink / raw)
  To: Andi Kleen
  Cc: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	tmricht, brueckner, kan.liang, ben, mathieu.poirier,
	mark.rutland, will.deacon, linux-kernel, linuxarm,
	linux-arm-kernel, zhangshaokun

On 28/06/2019 16:33, Andi Kleen wrote:
>> +	/*
>> +	 * Match more complex aliases where the alias name is a comma-delimited
>> +	 * list of tokens, orderly contained in the matching PMU name.
>> +	 *
>> +	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
>> +	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
>> +	 *	    "pmunameY".
>
> This needs to be documented in some manpage.

Hi Andi,

As I see, today the man page does not mention the matching from the 
alias events declared in the jsons.

The perf list command shows these aliases, so I am not sure how useful 
that info is adding to the man page.

What the man page does mention is the glob matching on the PMU device 
name - like how "imc" can match PMU device "uncore_imc_0", but I'm not 
changing around this.

Thanks,
John

>
> -Andi
>
>
> .
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
@ 2019-06-28 17:05       ` John Garry
  0 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-06-28 17:05 UTC (permalink / raw)
  To: Andi Kleen
  Cc: mark.rutland, brueckner, mathieu.poirier, peterz, ben, tmricht,
	will.deacon, linux-kernel, acme, linuxarm, zhangshaokun,
	alexander.shishkin, mingo, namhyung, jolsa, linux-arm-kernel,
	kan.liang

On 28/06/2019 16:33, Andi Kleen wrote:
>> +	/*
>> +	 * Match more complex aliases where the alias name is a comma-delimited
>> +	 * list of tokens, orderly contained in the matching PMU name.
>> +	 *
>> +	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
>> +	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
>> +	 *	    "pmunameY".
>
> This needs to be documented in some manpage.

Hi Andi,

As I see, today the man page does not mention the matching from the 
alias events declared in the jsons.

The perf list command shows these aliases, so I am not sure how useful 
that info is adding to the man page.

What the man page does mention is the glob matching on the PMU device 
name - like how "imc" can match PMU device "uncore_imc_0", but I'm not 
changing around this.

Thanks,
John

>
> -Andi
>
>
> .
>



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 0/4] Perf uncore PMU event alias support for Hisi hip08 ARM64 platform
  2019-06-28 14:54   ` Jiri Olsa
@ 2019-07-02 15:53     ` Arnaldo Carvalho de Melo
  -1 siblings, 0 replies; 26+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-02 15:53 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: John Garry, peterz, mingo, alexander.shishkin, namhyung, tmricht,
	brueckner, kan.liang, ben, mathieu.poirier, mark.rutland,
	will.deacon, linux-kernel, linuxarm, linux-arm-kernel,
	zhangshaokun, ak

Em Fri, Jun 28, 2019 at 04:54:06PM +0200, Jiri Olsa escreveu:
> On Fri, Jun 28, 2019 at 10:35:48PM +0800, John Garry wrote:
> > This patchset adds support for uncore PMU event aliasing for HiSilicon
> > hip08 ARM64 platform.
> > 
> > We can now get proper event description for uncore events for the
> > perf tool.
> > 
> > For HHA, DDRC, and L3C JSONs, we don't have all the event info yet, so
> > I will seek it out to update the JSONs later.
> > 
> > Changes to v3:
> > - Omit "perf pmu: Fix uncore PMU alias list for ARM64", as it has already
> >   been picked up
> > - Add comment for pmu_uncore_alias_match()
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Thanks, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 0/4] Perf uncore PMU event alias support for Hisi hip08 ARM64 platform
@ 2019-07-02 15:53     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 26+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-02 15:53 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: mark.rutland, tmricht, ak, mathieu.poirier, peterz, John Garry,
	will.deacon, linux-kernel, linuxarm, zhangshaokun,
	alexander.shishkin, mingo, brueckner, namhyung, ben,
	linux-arm-kernel, kan.liang

Em Fri, Jun 28, 2019 at 04:54:06PM +0200, Jiri Olsa escreveu:
> On Fri, Jun 28, 2019 at 10:35:48PM +0800, John Garry wrote:
> > This patchset adds support for uncore PMU event aliasing for HiSilicon
> > hip08 ARM64 platform.
> > 
> > We can now get proper event description for uncore events for the
> > perf tool.
> > 
> > For HHA, DDRC, and L3C JSONs, we don't have all the event info yet, so
> > I will seek it out to update the JSONs later.
> > 
> > Changes to v3:
> > - Omit "perf pmu: Fix uncore PMU alias list for ARM64", as it has already
> >   been picked up
> > - Add comment for pmu_uncore_alias_match()
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Thanks, applied.

- Arnaldo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
  2019-06-28 14:35   ` John Garry
@ 2019-07-02 19:07     ` Arnaldo Carvalho de Melo
  -1 siblings, 0 replies; 26+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-02 19:07 UTC (permalink / raw)
  To: John Garry
  Cc: peterz, mingo, alexander.shishkin, jolsa, namhyung, tmricht,
	brueckner, kan.liang, ben, mathieu.poirier, mark.rutland,
	will.deacon, linux-kernel, linuxarm, linux-arm-kernel,
	zhangshaokun, ak

Em Fri, Jun 28, 2019 at 10:35:49PM +0800, John Garry escreveu:
> The jevent "Unit" field is used for uncore PMU alias definition.
> 
> The form uncore_pmu_example_X is supported, where "X" is a wildcard,
> to support multiple instances of the same PMU in a system.
> 
> Unfortunately this format not suitable for all uncore PMUs; take the Hisi
> DDRC uncore PMU for example, where the name is in the form
> hisi_scclX_ddrcY.
> 
> For for current jevent parsing, we would be required to hardcode an uncore
> alias translation for each possible value of X. This is not scalable.
> 
> Instead, add support for "Unit" field in the form "hisi_sccl,ddrc", where
> we can match by hisi_scclX and ddrcY. Tokens  in Unit field
> are delimited by ','.
> 
> Signed-off-by: John Garry <john.garry@huawei.com>
> ---
>  tools/perf/util/pmu.c | 46 ++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 41 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 7e7299fee550..cfc916819c59 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -700,6 +700,46 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
>  	return map;
>  }
>  
> +static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
> +{
> +	char *tmp, *tok, *str;
> +	bool res;
> +
> +	str = strdup(pmu_name);
> +	if (!str)
> +		return false;
> +
> +	/*
> +	 * uncore alias may be from different PMU with common prefix
> +	 */
> +	tok = strtok_r(str, ",", &tmp);

In some places, e.g. gcc version 4.1.2:

  CC       /tmp/build/perf/util/pmu.o
cc1: warnings being treated as errors
util/pmu.c: In function ‘pmu_lookup’:
util/pmu.c:706: warning: ‘tmp’ may be used uninitialized in this function
mv: cannot stat `/tmp/build/perf/util/.pmu.o.tmp': No such file or directory

This silences it, adding.

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 913633ae0bf8..55f4de6442e3 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -703,7 +703,7 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
 
 static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
 {
-	char *tmp, *tok, *str;
+	char *tmp = NULL, *tok, *str;
 	bool res;
 
 	str = strdup(pmu_name);


> +	if (strncmp(pmu_name, tok, strlen(tok))) {
> +		res = false;
> +		goto out;
> +	}
> +
> +	/*
> +	 * Match more complex aliases where the alias name is a comma-delimited
> +	 * list of tokens, orderly contained in the matching PMU name.
> +	 *
> +	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
> +	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
> +	 *	    "pmunameY".
> +	 */
> +	for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) {
> +		name = strstr(name, tok);
> +		if (!name) {
> +			res = false;
> +			goto out;
> +		}
> +	}
> +
> +	res = true;
> +out:
> +	free(str);
> +	return res;
> +}
> +
>  /*
>   * From the pmu_events_map, find the table of PMU events that corresponds
>   * to the current running CPU. Then, add all PMU events from that table
> @@ -730,12 +770,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
>  			break;
>  		}
>  
> -		/*
> -		 * uncore alias may be from different PMU
> -		 * with common prefix
> -		 */
>  		if (pmu_is_uncore(name) &&
> -		    !strncmp(pname, name, strlen(pname)))
> +		    pmu_uncore_alias_match(pname, name))
>  			goto new_alias;
>  
>  		if (strcmp(pname, name))
> -- 
> 2.17.1

-- 

- Arnaldo

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
@ 2019-07-02 19:07     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 26+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-02 19:07 UTC (permalink / raw)
  To: John Garry
  Cc: mark.rutland, brueckner, ak, mathieu.poirier, peterz, ben,
	tmricht, will.deacon, linux-kernel, linuxarm, zhangshaokun,
	alexander.shishkin, mingo, namhyung, jolsa, linux-arm-kernel,
	kan.liang

Em Fri, Jun 28, 2019 at 10:35:49PM +0800, John Garry escreveu:
> The jevent "Unit" field is used for uncore PMU alias definition.
> 
> The form uncore_pmu_example_X is supported, where "X" is a wildcard,
> to support multiple instances of the same PMU in a system.
> 
> Unfortunately this format not suitable for all uncore PMUs; take the Hisi
> DDRC uncore PMU for example, where the name is in the form
> hisi_scclX_ddrcY.
> 
> For for current jevent parsing, we would be required to hardcode an uncore
> alias translation for each possible value of X. This is not scalable.
> 
> Instead, add support for "Unit" field in the form "hisi_sccl,ddrc", where
> we can match by hisi_scclX and ddrcY. Tokens  in Unit field
> are delimited by ','.
> 
> Signed-off-by: John Garry <john.garry@huawei.com>
> ---
>  tools/perf/util/pmu.c | 46 ++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 41 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 7e7299fee550..cfc916819c59 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -700,6 +700,46 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
>  	return map;
>  }
>  
> +static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
> +{
> +	char *tmp, *tok, *str;
> +	bool res;
> +
> +	str = strdup(pmu_name);
> +	if (!str)
> +		return false;
> +
> +	/*
> +	 * uncore alias may be from different PMU with common prefix
> +	 */
> +	tok = strtok_r(str, ",", &tmp);

In some places, e.g. gcc version 4.1.2:

  CC       /tmp/build/perf/util/pmu.o
cc1: warnings being treated as errors
util/pmu.c: In function ‘pmu_lookup’:
util/pmu.c:706: warning: ‘tmp’ may be used uninitialized in this function
mv: cannot stat `/tmp/build/perf/util/.pmu.o.tmp': No such file or directory

This silences it, adding.

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 913633ae0bf8..55f4de6442e3 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -703,7 +703,7 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
 
 static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
 {
-	char *tmp, *tok, *str;
+	char *tmp = NULL, *tok, *str;
 	bool res;
 
 	str = strdup(pmu_name);


> +	if (strncmp(pmu_name, tok, strlen(tok))) {
> +		res = false;
> +		goto out;
> +	}
> +
> +	/*
> +	 * Match more complex aliases where the alias name is a comma-delimited
> +	 * list of tokens, orderly contained in the matching PMU name.
> +	 *
> +	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
> +	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
> +	 *	    "pmunameY".
> +	 */
> +	for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) {
> +		name = strstr(name, tok);
> +		if (!name) {
> +			res = false;
> +			goto out;
> +		}
> +	}
> +
> +	res = true;
> +out:
> +	free(str);
> +	return res;
> +}
> +
>  /*
>   * From the pmu_events_map, find the table of PMU events that corresponds
>   * to the current running CPU. Then, add all PMU events from that table
> @@ -730,12 +770,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
>  			break;
>  		}
>  
> -		/*
> -		 * uncore alias may be from different PMU
> -		 * with common prefix
> -		 */
>  		if (pmu_is_uncore(name) &&
> -		    !strncmp(pname, name, strlen(pname)))
> +		    pmu_uncore_alias_match(pname, name))
>  			goto new_alias;
>  
>  		if (strcmp(pname, name))
> -- 
> 2.17.1

-- 

- Arnaldo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [tip:perf/core] perf pmu: Support more complex PMU event aliasing
  2019-06-28 14:35   ` John Garry
                     ` (2 preceding siblings ...)
  (?)
@ 2019-07-03 14:38   ` tip-bot for John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: tip-bot for John Garry @ 2019-07-03 14:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, peterz, mingo, tglx, namhyung, kan.liang, linux-kernel,
	will.deacon, hpa, ak, john.garry, jolsa, zhangshaokun,
	mathieu.poirier, tmricht, ben, brueckner, mark.rutland,
	alexander.shishkin

Commit-ID:  730670b1d108c4a8aa1924762738ca38593ee44c
Gitweb:     https://git.kernel.org/tip/730670b1d108c4a8aa1924762738ca38593ee44c
Author:     John Garry <john.garry@huawei.com>
AuthorDate: Fri, 28 Jun 2019 22:35:49 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 2 Jul 2019 16:07:36 -0300

perf pmu: Support more complex PMU event aliasing

The jevent "Unit" field is used for uncore PMU alias definition.

The form uncore_pmu_example_X is supported, where "X" is a wildcard, to
support multiple instances of the same PMU in a system.

Unfortunately this format not suitable for all uncore PMUs; take the
Hisi DDRC uncore PMU for example, where the name is in the form
hisi_scclX_ddrcY.

For for current jevent parsing, we would be required to hardcode an
uncore alias translation for each possible value of X. This is not
scalable.

Instead, add support for "Unit" field in the form "hisi_sccl,ddrc",
where we can match by hisi_scclX and ddrcY. Tokens  in Unit field are
delimited by ','.

Signed-off-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxarm@huawei.com
Link: http://lkml.kernel.org/r/1561732552-143038-2-git-send-email-john.garry@huawei.com
[ Shut up older gcc complianing about the last arg to strtok_r() being uninitialized, set that tmp to NULL ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/pmu.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 8139a1f3ed39..55f4de6442e3 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -701,6 +701,46 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
 	return map;
 }
 
+static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
+{
+	char *tmp = NULL, *tok, *str;
+	bool res;
+
+	str = strdup(pmu_name);
+	if (!str)
+		return false;
+
+	/*
+	 * uncore alias may be from different PMU with common prefix
+	 */
+	tok = strtok_r(str, ",", &tmp);
+	if (strncmp(pmu_name, tok, strlen(tok))) {
+		res = false;
+		goto out;
+	}
+
+	/*
+	 * Match more complex aliases where the alias name is a comma-delimited
+	 * list of tokens, orderly contained in the matching PMU name.
+	 *
+	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
+	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
+	 *	    "pmunameY".
+	 */
+	for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) {
+		name = strstr(name, tok);
+		if (!name) {
+			res = false;
+			goto out;
+		}
+	}
+
+	res = true;
+out:
+	free(str);
+	return res;
+}
+
 /*
  * From the pmu_events_map, find the table of PMU events that corresponds
  * to the current running CPU. Then, add all PMU events from that table
@@ -731,12 +771,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
 			break;
 		}
 
-		/*
-		 * uncore alias may be from different PMU
-		 * with common prefix
-		 */
 		if (pmu_is_uncore(name) &&
-		    !strncmp(pname, name, strlen(pname)))
+		    pmu_uncore_alias_match(pname, name))
 			goto new_alias;
 
 		if (strcmp(pname, name))

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [tip:perf/core] perf jevents: Add support for Hisi hip08 DDRC PMU aliasing
  2019-06-28 14:35   ` John Garry
  (?)
@ 2019-07-03 14:38   ` tip-bot for John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: tip-bot for John Garry @ 2019-07-03 14:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: zhangshaokun, tglx, acme, will.deacon, alexander.shishkin,
	john.garry, mathieu.poirier, mark.rutland, ben, kan.liang, mingo,
	brueckner, ak, namhyung, peterz, hpa, jolsa, linux-kernel,
	tmricht

Commit-ID:  57cc732479bac2a3cbd759fb07188657c871d5c1
Gitweb:     https://git.kernel.org/tip/57cc732479bac2a3cbd759fb07188657c871d5c1
Author:     John Garry <john.garry@huawei.com>
AuthorDate: Fri, 28 Jun 2019 22:35:50 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 2 Jul 2019 16:08:15 -0300

perf jevents: Add support for Hisi hip08 DDRC PMU aliasing

Add support for Hisi hip08 DDRC PMU aliasing. We can now do something like
this:

$perf list

[snip]

uncore ddrc:
  uncore_hisi_ddrc.act_cmd
       [DDRC active commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.flux_rcmd
       [DDRC read commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.flux_wcmd
       [DDRC write commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.flux_wr
       [DDRC precharge commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.rnk_chg
       [DDRC rank commands. Unit: hisi_sccl,ddrc]
  uncore_hisi_ddrc.rw_chg
       [DDRC read and write changes. Unit: hisi_sccl,ddrc]

Performance counter stats for 'system wide':

                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc0]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc3]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc0]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc3]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc3]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc0]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl5_ddrc1]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl7_ddrc0]
            20,421      uncore_hisi_ddrc.flux_rcmd [hisi_sccl1_ddrc2]
                 0      uncore_hisi_ddrc.flux_rcmd [hisi_sccl3_ddrc3]

       1.001559011 seconds time elapsed

The kernel driver is in drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c

Signed-off-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxarm@huawei.com
Link: http://lkml.kernel.org/r/1561732552-143038-3-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../arch/arm64/hisilicon/hip08/uncore-ddrc.json    | 44 ++++++++++++++++++++++
 tools/perf/pmu-events/jevents.c                    |  1 +
 2 files changed, 45 insertions(+)

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
new file mode 100644
index 000000000000..0d1556fcdffe
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json
@@ -0,0 +1,44 @@
+[
+   {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_ddrc.flux_wcmd",
+	    "BriefDescription": "DDRC write commands",
+	    "PublicDescription": "DDRC write commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x03",
+	    "EventName": "uncore_hisi_ddrc.flux_rcmd",
+	    "BriefDescription": "DDRC read commands",
+	    "PublicDescription": "DDRC read commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x04",
+	    "EventName": "uncore_hisi_ddrc.flux_wr",
+	    "BriefDescription": "DDRC precharge commands",
+	    "PublicDescription": "DDRC precharge commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x05",
+	    "EventName": "uncore_hisi_ddrc.act_cmd",
+	    "BriefDescription": "DDRC active commands",
+	    "PublicDescription": "DDRC active commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x06",
+	    "EventName": "uncore_hisi_ddrc.rnk_chg",
+	    "BriefDescription": "DDRC rank commands",
+	    "PublicDescription": "DDRC rank commands",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+   {
+	    "EventCode": "0x07",
+	    "EventName": "uncore_hisi_ddrc.rw_chg",
+	    "BriefDescription": "DDRC read and write changes",
+	    "PublicDescription": "DDRC read and write changes",
+	    "Unit": "hisi_sccl,ddrc",
+   },
+]
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index a1184ea64cc6..d5997741f1d8 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -236,6 +236,7 @@ static struct map {
 	{ "CPU-M-CF", "cpum_cf" },
 	{ "CPU-M-SF", "cpum_sf" },
 	{ "UPI LL", "uncore_upi" },
+	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
 	{}
 };
 

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [tip:perf/core] perf jevents: Add support for Hisi hip08 HHA PMU aliasing
  2019-06-28 14:35   ` John Garry
  (?)
@ 2019-07-03 14:39   ` tip-bot for John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: tip-bot for John Garry @ 2019-07-03 14:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tmricht, linux-kernel, peterz, ben, hpa, mathieu.poirier,
	zhangshaokun, kan.liang, alexander.shishkin, jolsa, mingo,
	will.deacon, namhyung, tglx, john.garry, ak, acme, mark.rutland,
	brueckner

Commit-ID:  8f5b703add99473b59b4a38a6b66afbafc29d92e
Gitweb:     https://git.kernel.org/tip/8f5b703add99473b59b4a38a6b66afbafc29d92e
Author:     John Garry <john.garry@huawei.com>
AuthorDate: Fri, 28 Jun 2019 22:35:51 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 2 Jul 2019 16:08:15 -0300

perf jevents: Add support for Hisi hip08 HHA PMU aliasing

Add support for Hisi hip08 HHA PMU aliasing.

The kernel driver is in drivers/perf/hisilicon/hisi_uncore_hha_pmu.c

Signed-off-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxarm@huawei.com
Link: http://lkml.kernel.org/r/1561732552-143038-4-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../arch/arm64/hisilicon/hip08/uncore-hha.json     | 51 ++++++++++++++++++++++
 tools/perf/pmu-events/jevents.c                    |  1 +
 2 files changed, 52 insertions(+)

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
new file mode 100644
index 000000000000..447d3064de90
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json
@@ -0,0 +1,51 @@
+[
+   {
+	    "EventCode": "0x00",
+	    "EventName": "uncore_hisi_hha.rx_ops_num",
+	    "BriefDescription": "The number of all operations received by the HHA",
+	    "PublicDescription": "The number of all operations received by the HHA",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x01",
+	    "EventName": "uncore_hisi_hha.rx_outer",
+	    "BriefDescription": "The number of all operations received by the HHA from another socket",
+	    "PublicDescription": "The number of all operations received by the HHA from another socket",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_hha.rx_sccl",
+	    "BriefDescription": "The number of all operations received by the HHA from another SCCL in this socket",
+	    "PublicDescription": "The number of all operations received by the HHA from another SCCL in this socket",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1c",
+	    "EventName": "uncore_hisi_hha.rd_ddr_64b",
+	    "BriefDescription": "The number of read operations sent by HHA to DDRC which size is 64 bytes",
+	    "PublicDescription": "The number of read operations sent by HHA to DDRC which size is 64bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1d",
+	    "EventName": "uncore_hisi_hha.wr_dr_64b",
+	    "BriefDescription": "The number of write operations sent by HHA to DDRC which size is 64 bytes",
+	    "PublicDescription": "The number of write operations sent by HHA to DDRC which size is 64 bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1e",
+	    "EventName": "uncore_hisi_hha.rd_ddr_128b",
+	    "BriefDescription": "The number of read operations sent by HHA to DDRC which size is 128 bytes",
+	    "PublicDescription": "The number of read operations sent by HHA to DDRC which size is 128 bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+   {
+	    "EventCode": "0x1f",
+	    "EventName": "uncore_hisi_hha.wr_ddr_128b",
+	    "BriefDescription": "The number of write operations sent by HHA to DDRC which size is 128 bytes",
+	    "PublicDescription": "The number of write operations sent by HHA to DDRC which size is 128 bytes",
+	    "Unit": "hisi_sccl,hha",
+   },
+]
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index d5997741f1d8..3c95affd85a4 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -237,6 +237,7 @@ static struct map {
 	{ "CPU-M-SF", "cpum_sf" },
 	{ "UPI LL", "uncore_upi" },
 	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
+	{ "hisi_sccl,hha", "hisi_sccl,hha" },
 	{}
 };
 

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [tip:perf/core] perf jevents: Add support for Hisi hip08 L3C PMU aliasing
  2019-06-28 14:35   ` John Garry
  (?)
@ 2019-07-03 14:40   ` tip-bot for John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: tip-bot for John Garry @ 2019-07-03 14:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, alexander.shishkin, mingo, namhyung, kan.liang, john.garry,
	brueckner, mark.rutland, zhangshaokun, peterz, ben, ak, jolsa,
	tglx, linux-kernel, tmricht, mathieu.poirier, will.deacon, acme

Commit-ID:  edd93a4076cf18ede423c167de6d6fb8e4211e7b
Gitweb:     https://git.kernel.org/tip/edd93a4076cf18ede423c167de6d6fb8e4211e7b
Author:     John Garry <john.garry@huawei.com>
AuthorDate: Fri, 28 Jun 2019 22:35:52 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 2 Jul 2019 16:08:16 -0300

perf jevents: Add support for Hisi hip08 L3C PMU aliasing

Add support for Hisi hip08 L3C PMU aliasing.

The kernel driver is in drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c

Signed-off-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxarm@huawei.com
Link: http://lkml.kernel.org/r/1561732552-143038-5-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../arch/arm64/hisilicon/hip08/uncore-l3c.json     | 37 ++++++++++++++++++++++
 tools/perf/pmu-events/jevents.c                    |  1 +
 2 files changed, 38 insertions(+)

diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json
new file mode 100644
index 000000000000..ca48747642e1
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json
@@ -0,0 +1,37 @@
+[
+   {
+	    "EventCode": "0x00",
+	    "EventName": "uncore_hisi_l3c.rd_cpipe",
+	    "BriefDescription": "Total read accesses",
+	    "PublicDescription": "Total read accesses",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x01",
+	    "EventName": "uncore_hisi_l3c.wr_cpipe",
+	    "BriefDescription": "Total write accesses",
+	    "PublicDescription": "Total write accesses",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_l3c.rd_hit_cpipe",
+	    "BriefDescription": "Total read hits",
+	    "PublicDescription": "Total read hits",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x03",
+	    "EventName": "uncore_hisi_l3c.wr_hit_cpipe",
+	    "BriefDescription": "Total write hits",
+	    "PublicDescription": "Total write hits",
+	    "Unit": "hisi_sccl,l3c",
+   },
+   {
+	    "EventCode": "0x04",
+	    "EventName": "uncore_hisi_l3c.victim_num",
+	    "BriefDescription": "l3c precharge commands",
+	    "PublicDescription": "l3c precharge commands",
+	    "Unit": "hisi_sccl,l3c",
+   },
+]
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index 3c95affd85a4..287a6f10ca48 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -238,6 +238,7 @@ static struct map {
 	{ "UPI LL", "uncore_upi" },
 	{ "hisi_sccl,ddrc", "hisi_sccl,ddrc" },
 	{ "hisi_sccl,hha", "hisi_sccl,hha" },
+	{ "hisi_sccl,l3c", "hisi_sccl,l3c" },
 	{}
 };
 

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
  2019-07-02 19:07     ` Arnaldo Carvalho de Melo
@ 2019-07-11  2:23       ` John Garry
  -1 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-07-11  2:23 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: peterz, mingo, alexander.shishkin, jolsa, namhyung, tmricht,
	brueckner, kan.liang, ben, mathieu.poirier, mark.rutland,
	will.deacon, linux-kernel, linuxarm, linux-arm-kernel,
	zhangshaokun, ak

On 02/07/2019 20:07, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jun 28, 2019 at 10:35:49PM +0800, John Garry escreveu:
>> The jevent "Unit" field is used for uncore PMU alias definition.
>>
>> The form uncore_pmu_example_X is supported, where "X" is a wildcard,
>> to support multiple instances of the same PMU in a system.
>>
>> Unfortunately this format not suitable for all uncore PMUs; take the Hisi
>> DDRC uncore PMU for example, where the name is in the form
>> hisi_scclX_ddrcY.
>>
>> For for current jevent parsing, we would be required to hardcode an uncore
>> alias translation for each possible value of X. This is not scalable.
>>
>> Instead, add support for "Unit" field in the form "hisi_sccl,ddrc", where
>> we can match by hisi_scclX and ddrcY. Tokens  in Unit field
>> are delimited by ','.
>>
>> Signed-off-by: John Garry <john.garry@huawei.com>
>> ---
>>  tools/perf/util/pmu.c | 46 ++++++++++++++++++++++++++++++++++++++-----
>>  1 file changed, 41 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
>> index 7e7299fee550..cfc916819c59 100644
>> --- a/tools/perf/util/pmu.c
>> +++ b/tools/perf/util/pmu.c
>> @@ -700,6 +700,46 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
>>  	return map;
>>  }
>>
>> +static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
>> +{
>> +	char *tmp, *tok, *str;
>> +	bool res;
>> +
>> +	str = strdup(pmu_name);
>> +	if (!str)
>> +		return false;
>> +
>> +	/*
>> +	 * uncore alias may be from different PMU with common prefix
>> +	 */
>> +	tok = strtok_r(str, ",", &tmp);
>
> In some places, e.g. gcc version 4.1.2:
>
>   CC       /tmp/build/perf/util/pmu.o
> cc1: warnings being treated as errors
> util/pmu.c: In function ‘pmu_lookup’:
> util/pmu.c:706: warning: ‘tmp’ may be used uninitialized in this function
> mv: cannot stat `/tmp/build/perf/util/.pmu.o.tmp': No such file or directory
>

Hi Arnaldo,

Sorry for the delayed resposne. Your fix, below, looks ok.

Regards,
John

> This silences it, adding.
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 913633ae0bf8..55f4de6442e3 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -703,7 +703,7 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
>
>  static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
>  {
> -	char *tmp, *tok, *str;
> +	char *tmp = NULL, *tok, *str;
>  	bool res;
>
>  	str = strdup(pmu_name);
>
>
>> +	if (strncmp(pmu_name, tok, strlen(tok))) {
>> +		res = false;
>> +		goto out;
>> +	}
>> +
>> +	/*
>> +	 * Match more complex aliases where the alias name is a comma-delimited
>> +	 * list of tokens, orderly contained in the matching PMU name.
>> +	 *
>> +	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
>> +	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
>> +	 *	    "pmunameY".
>> +	 */
>> +	for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) {
>> +		name = strstr(name, tok);
>> +		if (!name) {
>> +			res = false;
>> +			goto out;
>> +		}
>> +	}
>> +
>> +	res = true;
>> +out:
>> +	free(str);
>> +	return res;
>> +}
>> +
>>  /*
>>   * From the pmu_events_map, find the table of PMU events that corresponds
>>   * to the current running CPU. Then, add all PMU events from that table
>> @@ -730,12 +770,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
>>  			break;
>>  		}
>>
>> -		/*
>> -		 * uncore alias may be from different PMU
>> -		 * with common prefix
>> -		 */
>>  		if (pmu_is_uncore(name) &&
>> -		    !strncmp(pname, name, strlen(pname)))
>> +		    pmu_uncore_alias_match(pname, name))
>>  			goto new_alias;
>>
>>  		if (strcmp(pname, name))
>> --
>> 2.17.1
>



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
@ 2019-07-11  2:23       ` John Garry
  0 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2019-07-11  2:23 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: mark.rutland, brueckner, ak, mathieu.poirier, peterz, ben,
	tmricht, will.deacon, linux-kernel, linuxarm, zhangshaokun,
	alexander.shishkin, mingo, namhyung, jolsa, linux-arm-kernel,
	kan.liang

On 02/07/2019 20:07, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jun 28, 2019 at 10:35:49PM +0800, John Garry escreveu:
>> The jevent "Unit" field is used for uncore PMU alias definition.
>>
>> The form uncore_pmu_example_X is supported, where "X" is a wildcard,
>> to support multiple instances of the same PMU in a system.
>>
>> Unfortunately this format not suitable for all uncore PMUs; take the Hisi
>> DDRC uncore PMU for example, where the name is in the form
>> hisi_scclX_ddrcY.
>>
>> For for current jevent parsing, we would be required to hardcode an uncore
>> alias translation for each possible value of X. This is not scalable.
>>
>> Instead, add support for "Unit" field in the form "hisi_sccl,ddrc", where
>> we can match by hisi_scclX and ddrcY. Tokens  in Unit field
>> are delimited by ','.
>>
>> Signed-off-by: John Garry <john.garry@huawei.com>
>> ---
>>  tools/perf/util/pmu.c | 46 ++++++++++++++++++++++++++++++++++++++-----
>>  1 file changed, 41 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
>> index 7e7299fee550..cfc916819c59 100644
>> --- a/tools/perf/util/pmu.c
>> +++ b/tools/perf/util/pmu.c
>> @@ -700,6 +700,46 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
>>  	return map;
>>  }
>>
>> +static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
>> +{
>> +	char *tmp, *tok, *str;
>> +	bool res;
>> +
>> +	str = strdup(pmu_name);
>> +	if (!str)
>> +		return false;
>> +
>> +	/*
>> +	 * uncore alias may be from different PMU with common prefix
>> +	 */
>> +	tok = strtok_r(str, ",", &tmp);
>
> In some places, e.g. gcc version 4.1.2:
>
>   CC       /tmp/build/perf/util/pmu.o
> cc1: warnings being treated as errors
> util/pmu.c: In function ‘pmu_lookup’:
> util/pmu.c:706: warning: ‘tmp’ may be used uninitialized in this function
> mv: cannot stat `/tmp/build/perf/util/.pmu.o.tmp': No such file or directory
>

Hi Arnaldo,

Sorry for the delayed resposne. Your fix, below, looks ok.

Regards,
John

> This silences it, adding.
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 913633ae0bf8..55f4de6442e3 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -703,7 +703,7 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
>
>  static bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
>  {
> -	char *tmp, *tok, *str;
> +	char *tmp = NULL, *tok, *str;
>  	bool res;
>
>  	str = strdup(pmu_name);
>
>
>> +	if (strncmp(pmu_name, tok, strlen(tok))) {
>> +		res = false;
>> +		goto out;
>> +	}
>> +
>> +	/*
>> +	 * Match more complex aliases where the alias name is a comma-delimited
>> +	 * list of tokens, orderly contained in the matching PMU name.
>> +	 *
>> +	 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we
>> +	 *	    match "socket" in "socketX_pmunameY" and then "pmuname" in
>> +	 *	    "pmunameY".
>> +	 */
>> +	for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) {
>> +		name = strstr(name, tok);
>> +		if (!name) {
>> +			res = false;
>> +			goto out;
>> +		}
>> +	}
>> +
>> +	res = true;
>> +out:
>> +	free(str);
>> +	return res;
>> +}
>> +
>>  /*
>>   * From the pmu_events_map, find the table of PMU events that corresponds
>>   * to the current running CPU. Then, add all PMU events from that table
>> @@ -730,12 +770,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
>>  			break;
>>  		}
>>
>> -		/*
>> -		 * uncore alias may be from different PMU
>> -		 * with common prefix
>> -		 */
>>  		if (pmu_is_uncore(name) &&
>> -		    !strncmp(pname, name, strlen(pname)))
>> +		    pmu_uncore_alias_match(pname, name))
>>  			goto new_alias;
>>
>>  		if (strcmp(pname, name))
>> --
>> 2.17.1
>



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2019-07-11  2:23 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-28 14:35 [PATCH v3 0/4] Perf uncore PMU event alias support for Hisi hip08 ARM64 platform John Garry
2019-06-28 14:35 ` John Garry
2019-06-28 14:35 ` [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing John Garry
2019-06-28 14:35   ` John Garry
2019-06-28 15:33   ` Andi Kleen
2019-06-28 15:33     ` Andi Kleen
2019-06-28 17:05     ` John Garry
2019-06-28 17:05       ` John Garry
2019-07-02 19:07   ` Arnaldo Carvalho de Melo
2019-07-02 19:07     ` Arnaldo Carvalho de Melo
2019-07-11  2:23     ` John Garry
2019-07-11  2:23       ` John Garry
2019-07-03 14:38   ` [tip:perf/core] " tip-bot for John Garry
2019-06-28 14:35 ` [PATCH v3 2/4] perf jevents: Add support for Hisi hip08 DDRC PMU aliasing John Garry
2019-06-28 14:35   ` John Garry
2019-07-03 14:38   ` [tip:perf/core] " tip-bot for John Garry
2019-06-28 14:35 ` [PATCH v3 3/4] perf jevents: Add support for Hisi hip08 HHA " John Garry
2019-06-28 14:35   ` John Garry
2019-07-03 14:39   ` [tip:perf/core] " tip-bot for John Garry
2019-06-28 14:35 ` [PATCH v3 4/4] perf jevents: Add support for Hisi hip08 L3C " John Garry
2019-06-28 14:35   ` John Garry
2019-07-03 14:40   ` [tip:perf/core] " tip-bot for John Garry
2019-06-28 14:54 ` [PATCH v3 0/4] Perf uncore PMU event alias support for Hisi hip08 ARM64 platform Jiri Olsa
2019-06-28 14:54   ` Jiri Olsa
2019-07-02 15:53   ` Arnaldo Carvalho de Melo
2019-07-02 15:53     ` Arnaldo Carvalho de Melo

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.