Skip to contentSkip to conversation

Perf uncore PMU event alias support for Hisi hip08 ARM64 platform

PATCH Applied John Garry 5 participants 15 messages Jun 28, 2019 – Jul 11, 2019

Subsystems (3)
lore
Share & tools
lore

John Garry

author
#0 lore raw

v3 cover Perf uncore PMU event alias support for Hisi hip08 ARM64 platform

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
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v3 1/4 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 ','.

---
 tools/perf/util/pmu.c | 46 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)
tools/perf/util/pmu.c +41 -5
index 7e7299fee550..cfc916819c59 100644
@@ -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))
Signature · 7 lines
2.17.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing

tools/perf/util/pmu.c struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu) · line 727

Quoted 7 lines
tools/perf/util/pmu.c +7 -0
+	/*
+	 * 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

author
#3 lore raw

Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing

Quoted 9 lines · Andi Kleen

tools/perf/util/pmu.c struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu) · line 727

Quoted 7 lines
tools/perf/util/pmu.c +7 -0
+	/*
+	 * 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

Quoted 6 lines

-Andi

.

#4 lore raw

Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing

In reply to John Garry

Em Fri, Jun 28, 2019 at 10:35:49PM +0800, John Garry escreveu:

Quoted 32 lines

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 ','.

---
 tools/perf/util/pmu.c | 46 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)
tools/perf/util/pmu.c +3 -0
index 7e7299fee550..cfc916819c59 100644
@@ -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;

tools/perf/util/pmu.c struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu) · line 715

Quoted 10 lines
tools/perf/util/pmu.c +10 -0
+	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.

tools/perf/util/pmu.c +1 -1
index 913633ae0bf8..55f4de6442e3 100644
@@ -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);
Quoted 46 lines
tools/perf/util/pmu.c +28 -5
+	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))
Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
author
#5 lore raw

Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing

Quoted 46 lines · Arnaldo Carvalho de Melo

Em Fri, Jun 28, 2019 at 10:35:49PM +0800, John Garry escreveu:

Quoted 32 lines

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 ','.

---
 tools/perf/util/pmu.c | 46 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)
tools/perf/util/pmu.c +3 -0
index 7e7299fee550..cfc916819c59 100644
@@ -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;

tools/perf/util/pmu.c struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu) · line 715

Quoted 10 lines
tools/perf/util/pmu.c +10 -0
+	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:

Quoted 6 lines

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

Quoted 64 lines

This silences it, adding.

tools/perf/util/pmu.c +1 -1
index 913633ae0bf8..55f4de6442e3 100644
@@ -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);
Quoted 48 lines
tools/perf/util/pmu.c +28 -6
+	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

#6 lore raw

[tip:perf/core] perf pmu: Support more complex PMU event aliasing

In reply to John Garry
perf pmu: Support more complex PMU event aliasing
Commit-ID:  730670b1d108c4a8aa1924762738ca38593ee44c
Gitweb:     https://git.kernel.org/tip/730670b1d108c4a8aa1924762738ca38593ee44c
Author:     John Garry <[email protected]>
AuthorDate: Fri, 28 Jun 2019 22:35:49 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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 ','.

Cc Alexander Shishkin <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Ben Hutchings <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Kan Liang <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Shaokun Zhang <[email protected]>
Cc Thomas Richter <[email protected]>
Cc Will Deacon <[email protected]>
[ Shut up older gcc complianing about the last arg to strtok_r() being uninitialized, set that tmp to NULL ]
---
 tools/perf/util/pmu.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)
tools/perf/util/pmu.c +41 -5
index 8139a1f3ed39..55f4de6442e3 100644
@@ -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))
author
#7 lore raw

PATCH v3 2/4 perf jevents: Add support for Hisi hip08 DDRC PMU aliasing

In reply to 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

---
 .../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
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json new file +44 -0
new file mode 100644
index 000000000000..0d1556fcdffe
@@ -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",
+   },
+]
tools/perf/pmu-events/jevents.c +1 -0
index 58f77fd0f59f..cf9a60333554 100644
@@ -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" },
 	{}
 };
 
Signature · 1 line
2.17.1
#8 lore raw

[tip:perf/core] perf jevents: Add support for Hisi hip08 DDRC PMU aliasing

perf jevents: Add support for Hisi hip08 DDRC PMU aliasing
Commit-ID:  57cc732479bac2a3cbd759fb07188657c871d5c1
Gitweb:     https://git.kernel.org/tip/57cc732479bac2a3cbd759fb07188657c871d5c1
Author:     John Garry <[email protected]>
AuthorDate: Fri, 28 Jun 2019 22:35:50 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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

Cc Alexander Shishkin <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Ben Hutchings <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Kan Liang <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Shaokun Zhang <[email protected]>
Cc Thomas Richter <[email protected]>
Cc Will Deacon <[email protected]>
---
 .../arch/arm64/hisilicon/hip08/uncore-ddrc.json    | 44 ++++++++++++++++++++++
 tools/perf/pmu-events/jevents.c                    |  1 +
 2 files changed, 45 insertions(+)
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json new file +44 -0
new file mode 100644
index 000000000000..0d1556fcdffe
@@ -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",
+   },
+]
tools/perf/pmu-events/jevents.c +1 -0
index a1184ea64cc6..d5997741f1d8 100644
@@ -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" },
 	{}
 };
 
author
#9 lore raw

PATCH v3 3/4 perf jevents: Add support for Hisi hip08 HHA PMU aliasing

In reply to John Garry

Add support for Hisi hip08 HHA PMU aliasing.

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

---
 .../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
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json new file +51 -0
new file mode 100644
index 000000000000..447d3064de90
@@ -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",
+   },
+]
tools/perf/pmu-events/jevents.c +1 -0
index cf9a60333554..909e53e3b5bd 100644
@@ -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" },
 	{}
 };
 
Signature · 1 line
2.17.1
#10 lore raw

[tip:perf/core] perf jevents: Add support for Hisi hip08 HHA PMU aliasing

perf jevents: Add support for Hisi hip08 HHA PMU aliasing
Commit-ID:  8f5b703add99473b59b4a38a6b66afbafc29d92e
Gitweb:     https://git.kernel.org/tip/8f5b703add99473b59b4a38a6b66afbafc29d92e
Author:     John Garry <[email protected]>
AuthorDate: Fri, 28 Jun 2019 22:35:51 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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

Cc Alexander Shishkin <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Ben Hutchings <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Kan Liang <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Shaokun Zhang <[email protected]>
Cc Thomas Richter <[email protected]>
Cc Will Deacon <[email protected]>
---
 .../arch/arm64/hisilicon/hip08/uncore-hha.json     | 51 ++++++++++++++++++++++
 tools/perf/pmu-events/jevents.c                    |  1 +
 2 files changed, 52 insertions(+)
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-hha.json new file +51 -0
new file mode 100644
index 000000000000..447d3064de90
@@ -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",
+   },
+]
tools/perf/pmu-events/jevents.c +1 -0
index d5997741f1d8..3c95affd85a4 100644
@@ -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" },
 	{}
 };
 
author
#11 lore raw

PATCH v3 4/4 perf jevents: Add support for Hisi hip08 L3C PMU aliasing

In reply to John Garry

Add support for Hisi hip08 L3C PMU aliasing.

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

---
 .../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
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json new file +37 -0
new file mode 100644
index 000000000000..ca48747642e1
@@ -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",
+   },
+]
tools/perf/pmu-events/jevents.c +1 -0
index 909e53e3b5bd..7d241efd03de 100644
@@ -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" },
 	{}
 };
 
Signature · 1 line
2.17.1
#12 lore raw

[tip:perf/core] perf jevents: Add support for Hisi hip08 L3C PMU aliasing

perf jevents: Add support for Hisi hip08 L3C PMU aliasing
Commit-ID:  edd93a4076cf18ede423c167de6d6fb8e4211e7b
Gitweb:     https://git.kernel.org/tip/edd93a4076cf18ede423c167de6d6fb8e4211e7b
Author:     John Garry <[email protected]>
AuthorDate: Fri, 28 Jun 2019 22:35:52 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
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

Cc Alexander Shishkin <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Ben Hutchings <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Kan Liang <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Shaokun Zhang <[email protected]>
Cc Thomas Richter <[email protected]>
Cc Will Deacon <[email protected]>
---
 .../arch/arm64/hisilicon/hip08/uncore-l3c.json     | 37 ++++++++++++++++++++++
 tools/perf/pmu-events/jevents.c                    |  1 +
 2 files changed, 38 insertions(+)
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-l3c.json new file +37 -0
new file mode 100644
index 000000000000..ca48747642e1
@@ -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",
+   },
+]
tools/perf/pmu-events/jevents.c +1 -0
index 3c95affd85a4..287a6f10ca48 100644
@@ -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" },
 	{}
 };
 
Acked-by on the v3 series
#13 lore raw
In reply to John Garry
Quoted 6 lines · 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.

Quoted 7 lines

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()

thanks,
jirka

Quoted 24 lines

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
Signature · 1 line
2.17.1
#14 lore raw

Em Fri, Jun 28, 2019 at 04:54:06PM +0200, Jiri Olsa escreveu:

Quoted 10 lines · John Garry
Quoted 9 lines

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.

Quoted 6 lines
Quoted 4 lines

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()

Thanks, applied.

- Arnaldo