Skip to contentSkip to conversation

perf vendor events: Remove 'type' field from mapfiles

PATCH In review John Garry 2 participants 4 messages Feb 26, 2021

Subsystems (2)
lore
Share & tools
lore

John Garry

author
#0 lore raw

PATCH 1/1 perf vendor events: Remove 'type' field from mapfiles

Included for each CPU entry in the per-arch mapfile.csv file is a 'type' field.

However, it is never used in the jevents or any other code, and it has been this way since commit 80eeb67fe577a ("perf jevents: Program to convert JSON file"). Indeed, each entry so far just sets the field to 'core'.

So just remove it, as so far this has just caused confusion.

tools/perf/pmu-events/arch/arm64/mapfile.csv +12 -13
index 0d609149b82a..4e6f934cd93d 100644
@@ -1,5 +1,5 @@
 # Format:
-#	MIDR,Version,JSON/file/pathname,Type
+#	MIDR,Version,JSON/file/pathname
 #
 # where
 #	MIDR	Processor version
@@ -8,17 +8,16 @@
 #		but currently unused.
 #	JSON/file/pathname is the path to JSON file, relative
 #		to tools/perf/pmu-events/arch/arm64/.
-#	Type is core, uncore etc
 #
 #
-#Family-model,Version,Filename,EventType
-0x00000000410fd030,v1,arm/cortex-a53,core
-0x00000000420f1000,v1,arm/cortex-a53,core
-0x00000000410fd070,v1,arm/cortex-a57-a72,core
-0x00000000410fd080,v1,arm/cortex-a57-a72,core
-0x00000000410fd0b0,v1,arm/cortex-a76-n1,core
-0x00000000410fd0c0,v1,arm/cortex-a76-n1,core
-0x00000000420f5160,v1,cavium/thunderx2,core
-0x00000000430f0af0,v1,cavium/thunderx2,core
-0x00000000480fd010,v1,hisilicon/hip08,core
-0x00000000500f0000,v1,ampere/emag,core
+#Family-model,Version,Filename
+0x00000000410fd030,v1,arm/cortex-a53
+0x00000000420f1000,v1,arm/cortex-a53
+0x00000000410fd070,v1,arm/cortex-a57-a72
+0x00000000410fd080,v1,arm/cortex-a57-a72
+0x00000000410fd0b0,v1,arm/cortex-a76-n1
+0x00000000410fd0c0,v1,arm/cortex-a76-n1
+0x00000000420f5160,v1,cavium/thunderx2
+0x00000000430f0af0,v1,cavium/thunderx2
+0x00000000480fd010,v1,hisilicon/hip08
+0x00000000500f0000,v1,ampere/emag
tools/perf/pmu-events/arch/nds32/mapfile.csv +3 -4
index efb395f26883..19937201e2e9 100644
@@ -1,5 +1,5 @@
 # Format:
-#	MIDR,Version,JSON/file/pathname,Type
+#	MIDR,Version,JSON/file/pathname
 #
 # where
 #	MIDR	Processor version
@@ -8,8 +8,7 @@
 #		but currently unused.
 #	JSON/file/pathname is the path to JSON file, relative
 #		to tools/perf/pmu-events/arch/arm64/.
-#	Type is core, uncore etc
 #
 #
-#Family-model,Version,Filename,EventType
-0x0,v3,n13,core
+#Family-model,Version,Filename
+0x0,v3,n13
tools/perf/pmu-events/arch/powerpc/mapfile.csv +3 -4
index 229150e7ab7d..c5f19576a78c 100644
@@ -1,5 +1,5 @@
 # Format:
-# 	PVR,Version,JSON/file/pathname,Type
+# 	PVR,Version,JSON/file/pathname
 #
 # where
 # 	PVR	Processor version
@@ -7,11 +7,10 @@
 # 		but currently unused.
 # 	JSON/file/pathname is the path to JSON file, relative
 # 		to tools/perf/pmu-events/arch/powerpc/.
-# 	Type is core, uncore etc
 #
 # Multiple PVRs could map to a single JSON file.
 #
 
 # Power8 entries
-004[bcd][[:xdigit:]]{4},1,power8,core
-004e[[:xdigit:]]{4},1,power9,core
+004[bcd][[:xdigit:]]{4},1,power8
+004e[[:xdigit:]]{4},1,power9
tools/perf/pmu-events/arch/s390/mapfile.csv +7 -7
index 61641a3480e0..af86c7d6ecd0 100644
@@ -1,7 +1,7 @@
-Family-model,Version,Filename,EventType
-^IBM.209[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z10,core
-^IBM.281[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z196,core
-^IBM.282[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_zec12,core
-^IBM.296[45].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z13,core
-^IBM.390[67].*[13]\.[1-5].[[:xdigit:]]+$,3,cf_z14,core
-^IBM.856[12].*3\.6.[[:xdigit:]]+$,3,cf_z15,core
+Family-model,Version,Filename
+^IBM.209[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z10
+^IBM.281[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z196
+^IBM.282[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_zec12
+^IBM.296[45].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z13
+^IBM.390[67].*[13]\.[1-5].[[:xdigit:]]+$,3,cf_z14
+^IBM.856[12].*3\.6.[[:xdigit:]]+$,3,cf_z15
tools/perf/pmu-events/arch/x86/mapfile.csv +41 -41

82 lines not on this page · raw message

tools/perf/pmu-events/jevents.c +1 -15
index e1f3f5c8c550..0edb5d40a88d 100644
@@ -795,7 +795,6 @@ static void print_mapping_table_suffix(FILE *outfp)
 	fprintf(outfp, "{\n");
 	fprintf(outfp, "\t.cpuid = 0,\n");
 	fprintf(outfp, "\t.version = 0,\n");
-	fprintf(outfp, "\t.type = 0,\n");
 	fprintf(outfp, "\t.table = 0,\n");
 	fprintf(outfp, "},\n");
 
@@ -811,7 +810,6 @@ static void print_mapping_test_table(FILE *outfp)
 	fprintf(outfp, "{\n");
 	fprintf(outfp, "\t.cpuid = \"testcpu\",\n");
 	fprintf(outfp, "\t.version = \"v1\",\n");
-	fprintf(outfp, "\t.type = \"core\",\n");
 	fprintf(outfp, "\t.table = pme_test_cpu,\n");
 	fprintf(outfp, "},\n");
 }
@@ -876,7 +874,7 @@ static int process_mapfile(FILE *outfp, char *fpath)
 
 	line_num = 1;
 	while (1) {
-		char *cpuid, *version, *type, *fname;
+		char *cpuid, *version, *fname;
 
 		line_num++;
 		p = fgets(line, n, mapfp);
@@ -898,23 +896,11 @@ static int process_mapfile(FILE *outfp, char *fpath)
 		cpuid = fixregex(strtok_r(p, ",", &save));
 		version = strtok_r(NULL, ",", &save);
 		fname = strtok_r(NULL, ",", &save);
-		type = strtok_r(NULL, ",", &save);
 
 		tblname = file_name_to_table_name(fname);
 		fprintf(outfp, "{\n");
 		fprintf(outfp, "\t.cpuid = \"%s\",\n", cpuid);
 		fprintf(outfp, "\t.version = \"%s\",\n", version);
-		fprintf(outfp, "\t.type = \"%s\",\n", type);
-
-		/*
-		 * CHECK: We can't use the type (eg "core") field in the
-		 * table name. For us to do that, we need to somehow tweak
-		 * the other caller of file_name_to_table(), process_json()
-		 * to determine the type. process_json() file has no way
-		 * of knowing these are "core" events unless file name has
-		 * core in it. If filename has core in it, we can safely
-		 * ignore the type field here also.
-		 */
 		fprintf(outfp, "\t.table = %s\n", tblname);
 		fprintf(outfp, "},\n");
 	}
tools/perf/pmu-events/pmu-events.h +0 -1
index d1172f6aebf1..82c0e0a18301 100644
@@ -40,7 +40,6 @@ struct pmu_event {
 struct pmu_events_map {
 	const char *cpuid;
 	const char *version;
-	const char *type;		/* core, uncore etc */
 	struct pmu_event *table;
 };
 
tools/perf/tests/expand-cgroup.c +0 -1
index 0e46aeb843ce..a7cc011dd7f8 100644
@@ -196,7 +196,6 @@ static int expand_metric_events(void)
 	struct pmu_events_map ev_map = {
 		.cpuid		= "test",
 		.version	= "1",
-		.type		= "core",
 		.table		= pme_test,
 	};
 
tools/perf/tests/parse-metric.c +0 -1
index 6dc1db1626ad..64516fd92fac 100644
@@ -81,7 +81,6 @@ static struct pmu_event pme_test[] = {
 static struct pmu_events_map map = {
 	.cpuid		= "test",
 	.version	= "1",
-	.type		= "core",
 	.table		= pme_test,
 };
 
tools/perf/tests/pmu-events.c +2 -2
index 0ca6a5a53523..1226b40ba06e 100644
@@ -465,8 +465,8 @@ static void expr_failure(const char *msg,
 			 const struct pmu_events_map *map,
 			 const struct pmu_event *pe)
 {
-	pr_debug("%s for map %s %s %s\n",
-		msg, map->cpuid, map->version, map->type);
+	pr_debug("%s for map %s %s\n",
+		msg, map->cpuid, map->version);
 	pr_debug("On metric %s\n", pe->metric_name);
 	pr_debug("On expression %s\n", pe->metric_expr);
 }
Signature · 1 line
2.26.2
#1 lore raw
Quoted 2 lines · John Garry

Included for each CPU entry in the per-arch mapfile.csv file is a 'type' field.

I don't like it because this will make the mapfile incompatible with what download.01.org uses. We originally derived it from that.

It would be ok if it fixed something serious, but as it seems to be more cosmetic I don't think there's a good reason to devivate.

-Andi

author
#2 lore raw
Quoted 5 lines · Andi Kleen
Quoted 2 lines · John Garry

Included for each CPU entry in the per-arch mapfile.csv file is a 'type' field.

I don't like it because this will make the mapfile incompatible with what download.01.org uses. We originally derived it from that.

I assumed that it was this file:
https://download.01.org/perfmon/mapfile.csv

which already has a different format - extra columns - so figured that some handcrafting was already going on. Indeed 'type' is not always 'core' there.

Quoted 4 lines

It would be ok if it fixed something serious, but as it seems to be more cosmetic I don't think there's a good reason to devivate.

If you're against that, then ok; I suppose jevents handling could still be removed, but I'm not enthused.

Thanks,
John

#3 lore raw
Quoted 2 lines

I assumed that it was this file:
https://download.01.org/perfmon/mapfile.csv

Yep.

Quoted 3 lines

which already has a different format - extra columns - so figured that some handcrafting was already going on. Indeed 'type' is not always 'core' there.

Yes. Could possibly add the extra columns from there just to stay compatible, but being a subset is ok too.

-Andi