* [PATCH v2] perf list: Remove s390 specific strcmp_cpuid_cmp function
@ 2018-04-23 8:17 Thomas Richter
2018-04-23 14:03 ` Arnaldo Carvalho de Melo
2018-04-26 5:52 ` [tip:perf/urgent] " tip-bot for Thomas Richter
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Richter @ 2018-04-23 8:17 UTC (permalink / raw)
To: linux-kernel, linux-perf-users, acme
Cc: brueckner, schwidefsky, heiko.carstens, Thomas Richter
Make the type field in pmu-events/arch/s390/mapfile.cvs
more generic to match the created cpuid string for s390.
The pattern also checks for the counter first version
number and counter second version number ([13]\.[1-5])
and the authorization field which follows. These numbers do
not exist in the cpuid identification string when perf
commands are executed on a z/VM environment (which does
not support CPU counter measurement facility).
CPUID string for LPAR:
cpuid : IBM,3906,704,M03,3.5,002f
CPUID string for z/VM:
cpuid : IBM,2964,702,N96
This allows the removal of s390 specific cpuid compare code
and uses the common compare function with its regular
expression matching algorithm.
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
---
| 18 ------------------
tools/perf/pmu-events/arch/s390/mapfile.csv | 10 +++++-----
tools/perf/util/pmu.c | 2 +-
3 files changed, 6 insertions(+), 24 deletions(-)
--git a/tools/perf/arch/s390/util/header.c b/tools/perf/arch/s390/util/header.c
index a4c30f1c70be..163b92f33998 100644
--- a/tools/perf/arch/s390/util/header.c
+++ b/tools/perf/arch/s390/util/header.c
@@ -146,21 +146,3 @@ char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
zfree(&buf);
return buf;
}
-
-/*
- * Compare the cpuid string returned by get_cpuid() function
- * with the name generated by the jevents file read from
- * pmu-events/arch/s390/mapfile.csv.
- *
- * Parameter mapcpuid is the cpuid as stored in the
- * pmu-events/arch/s390/mapfile.csv. This is just the type number.
- * Parameter cpuid is the cpuid returned by function get_cpuid().
- */
-int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
-{
- char *cp = strchr(cpuid, ',');
-
- if (cp == NULL)
- return -1;
- return strncmp(cp + 1, mapcpuid, strlen(mapcpuid));
-}
diff --git a/tools/perf/pmu-events/arch/s390/mapfile.csv b/tools/perf/pmu-events/arch/s390/mapfile.csv
index ca7682748a4b..af6386ba3df4 100644
--- a/tools/perf/pmu-events/arch/s390/mapfile.csv
+++ b/tools/perf/pmu-events/arch/s390/mapfile.csv
@@ -1,6 +1,6 @@
Family-model,Version,Filename,EventType
-209[78],1,cf_z10,core
-281[78],1,cf_z196,core
-282[78],1,cf_zec12,core
-296[45],1,cf_z13,core
-3906,3,cf_z14,core
+^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
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 8675ddf558c6..08e39197c77d 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -586,7 +586,7 @@ char * __weak get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
* cpuid string generated on this platform.
* Otherwise return non-zero.
*/
-int __weak strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
+int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
{
regex_t re;
regmatch_t pmatch[1];
--
2.14.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] perf list: Remove s390 specific strcmp_cpuid_cmp function
2018-04-23 8:17 [PATCH v2] perf list: Remove s390 specific strcmp_cpuid_cmp function Thomas Richter
@ 2018-04-23 14:03 ` Arnaldo Carvalho de Melo
2018-04-26 5:52 ` [tip:perf/urgent] " tip-bot for Thomas Richter
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-04-23 14:03 UTC (permalink / raw)
To: Thomas Richter
Cc: linux-kernel, linux-perf-users, brueckner, schwidefsky,
heiko.carstens
Em Mon, Apr 23, 2018 at 10:17:45AM +0200, Thomas Richter escreveu:
> Make the type field in pmu-events/arch/s390/mapfile.cvs
> more generic to match the created cpuid string for s390.
> The pattern also checks for the counter first version
> number and counter second version number ([13]\.[1-5])
> and the authorization field which follows. These numbers do
> not exist in the cpuid identification string when perf
> commands are executed on a z/VM environment (which does
> not support CPU counter measurement facility).
> CPUID string for LPAR:
> cpuid : IBM,3906,704,M03,3.5,002f
> CPUID string for z/VM:
> cpuid : IBM,2964,702,N96
>
> This allows the removal of s390 specific cpuid compare code
> and uses the common compare function with its regular
> expression matching algorithm.
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/urgent] perf list: Remove s390 specific strcmp_cpuid_cmp function
2018-04-23 8:17 [PATCH v2] perf list: Remove s390 specific strcmp_cpuid_cmp function Thomas Richter
2018-04-23 14:03 ` Arnaldo Carvalho de Melo
@ 2018-04-26 5:52 ` tip-bot for Thomas Richter
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Thomas Richter @ 2018-04-26 5:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: tmricht, brueckner, linux-kernel, tglx, acme, hpa, mingo,
heiko.carstens, schwidefsky
Commit-ID: ce04abfbd3ea545a8eb38a8b6a48fb6e7d139dcb
Gitweb: https://git.kernel.org/tip/ce04abfbd3ea545a8eb38a8b6a48fb6e7d139dcb
Author: Thomas Richter <tmricht@linux.ibm.com>
AuthorDate: Mon, 23 Apr 2018 10:17:45 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 23 Apr 2018 11:03:13 -0300
perf list: Remove s390 specific strcmp_cpuid_cmp function
Make the type field in pmu-events/arch/s390/mapfile.cvs more generic to
match the created cpuid string for s390.
The pattern also checks for the counter first version number and counter
second version number ([13]\.[1-5]) and the authorization field which
follows.
These numbers do not exist in the cpuid identification string when perf
commands are executed on a z/VM environment (which does not support CPU
counter measurement facility).
CPUID string for LPAR:
cpuid : IBM,3906,704,M03,3.5,002f
CPUID string for z/VM:
cpuid : IBM,2964,702,N96
This allows the removal of s390 specific cpuid compare code and uses the
common compare function with its regular expression matching algorithm.
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Link: http://lkml.kernel.org/r/20180423081745.3672-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
| 18 ------------------
tools/perf/pmu-events/arch/s390/mapfile.csv | 10 +++++-----
tools/perf/util/pmu.c | 2 +-
3 files changed, 6 insertions(+), 24 deletions(-)
--git a/tools/perf/arch/s390/util/header.c b/tools/perf/arch/s390/util/header.c
index a4c30f1c70be..163b92f33998 100644
--- a/tools/perf/arch/s390/util/header.c
+++ b/tools/perf/arch/s390/util/header.c
@@ -146,21 +146,3 @@ char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
zfree(&buf);
return buf;
}
-
-/*
- * Compare the cpuid string returned by get_cpuid() function
- * with the name generated by the jevents file read from
- * pmu-events/arch/s390/mapfile.csv.
- *
- * Parameter mapcpuid is the cpuid as stored in the
- * pmu-events/arch/s390/mapfile.csv. This is just the type number.
- * Parameter cpuid is the cpuid returned by function get_cpuid().
- */
-int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
-{
- char *cp = strchr(cpuid, ',');
-
- if (cp == NULL)
- return -1;
- return strncmp(cp + 1, mapcpuid, strlen(mapcpuid));
-}
diff --git a/tools/perf/pmu-events/arch/s390/mapfile.csv b/tools/perf/pmu-events/arch/s390/mapfile.csv
index ca7682748a4b..78bcf7f8e206 100644
--- a/tools/perf/pmu-events/arch/s390/mapfile.csv
+++ b/tools/perf/pmu-events/arch/s390/mapfile.csv
@@ -1,6 +1,6 @@
Family-model,Version,Filename,EventType
-209[78],1,cf_z10,core
-281[78],1,cf_z196,core
-282[78],1,cf_zec12,core
-296[45],1,cf_z13,core
-3906,3,cf_z14,core
+^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
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 61a5e5027338..af4bedf4cf98 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -586,7 +586,7 @@ char * __weak get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
* cpuid string generated on this platform.
* Otherwise return non-zero.
*/
-int __weak strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
+int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
{
regex_t re;
regmatch_t pmatch[1];
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-26 5:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-23 8:17 [PATCH v2] perf list: Remove s390 specific strcmp_cpuid_cmp function Thomas Richter
2018-04-23 14:03 ` Arnaldo Carvalho de Melo
2018-04-26 5:52 ` [tip:perf/urgent] " tip-bot for Thomas Richter
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.