* [PATCH] perf test 6: Fix missing kvm module load for s390
@ 2019-06-04 5:35 Thomas Richter
2019-06-07 19:50 ` Arnaldo Carvalho de Melo
2019-06-17 19:51 ` [tip:perf/core] " tip-bot for Thomas Richter
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Richter @ 2019-06-04 5:35 UTC (permalink / raw)
To: linux-kernel, linux-perf-users, acme
Cc: brueckner, heiko.carstens, Thomas Richter
Command
# perf test -Fv 6
fails with error
running test 100 'kvm-s390:kvm_s390_create_vm' failed to parse
event 'kvm-s390:kvm_s390_create_vm', err -1, str 'unknown tracepoint'
event syntax error: 'kvm-s390:kvm_s390_create_vm'
\___ unknown tracepoint
when the kvm module is not loaded or not built in.
Fix this by adding a valid function which tests if the module
is loaded. Loaded modules (or builtin KVM support) have a
directory named
/sys/kernel/debug/tracing/events/kvm-s390
for this tracepoint.
Check for existence of this directory.
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
tools/perf/tests/parse-events.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 4a69c07f4101..8f3c80e13584 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -18,6 +18,32 @@
#define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
+#if defined(__s390x__)
+/* Return true if kvm module is available and loaded. Test this
+ * and retun success when trace point kvm_s390_create_vm
+ * exists. Otherwise this test always fails.
+ */
+static bool kvm_s390_create_vm_valid(void)
+{
+ char *eventfile;
+ bool rc = false;
+
+ eventfile = get_events_file("kvm-s390");
+
+ if (eventfile) {
+ DIR *mydir = opendir(eventfile);
+
+ if (mydir) {
+ rc = true;
+ closedir(mydir);
+ }
+ put_events_file(eventfile);
+ }
+
+ return rc;
+}
+#endif
+
static int test__checkevent_tracepoint(struct perf_evlist *evlist)
{
struct perf_evsel *evsel = perf_evlist__first(evlist);
@@ -1642,6 +1668,7 @@ static struct evlist_test test__events[] = {
{
.name = "kvm-s390:kvm_s390_create_vm",
.check = test__checkevent_tracepoint,
+ .valid = kvm_s390_create_vm_valid,
.id = 100,
},
#endif
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf test 6: Fix missing kvm module load for s390
2019-06-04 5:35 [PATCH] perf test 6: Fix missing kvm module load for s390 Thomas Richter
@ 2019-06-07 19:50 ` Arnaldo Carvalho de Melo
2019-06-17 19:51 ` [tip:perf/core] " tip-bot for Thomas Richter
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-06-07 19:50 UTC (permalink / raw)
To: Thomas Richter; +Cc: linux-kernel, linux-perf-users, brueckner, heiko.carstens
Em Tue, Jun 04, 2019 at 07:35:04AM +0200, Thomas Richter escreveu:
> Command
>
> # perf test -Fv 6
>
> fails with error
>
> running test 100 'kvm-s390:kvm_s390_create_vm' failed to parse
> event 'kvm-s390:kvm_s390_create_vm', err -1, str 'unknown tracepoint'
> event syntax error: 'kvm-s390:kvm_s390_create_vm'
> \___ unknown tracepoint
Thanks, applied,
- Arnaldo
> when the kvm module is not loaded or not built in.
>
> Fix this by adding a valid function which tests if the module
> is loaded. Loaded modules (or builtin KVM support) have a
> directory named
> /sys/kernel/debug/tracing/events/kvm-s390
> for this tracepoint.
>
> Check for existence of this directory.
>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> tools/perf/tests/parse-events.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
> index 4a69c07f4101..8f3c80e13584 100644
> --- a/tools/perf/tests/parse-events.c
> +++ b/tools/perf/tests/parse-events.c
> @@ -18,6 +18,32 @@
> #define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
> PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
>
> +#if defined(__s390x__)
> +/* Return true if kvm module is available and loaded. Test this
> + * and retun success when trace point kvm_s390_create_vm
> + * exists. Otherwise this test always fails.
> + */
> +static bool kvm_s390_create_vm_valid(void)
> +{
> + char *eventfile;
> + bool rc = false;
> +
> + eventfile = get_events_file("kvm-s390");
> +
> + if (eventfile) {
> + DIR *mydir = opendir(eventfile);
> +
> + if (mydir) {
> + rc = true;
> + closedir(mydir);
> + }
> + put_events_file(eventfile);
> + }
> +
> + return rc;
> +}
> +#endif
> +
> static int test__checkevent_tracepoint(struct perf_evlist *evlist)
> {
> struct perf_evsel *evsel = perf_evlist__first(evlist);
> @@ -1642,6 +1668,7 @@ static struct evlist_test test__events[] = {
> {
> .name = "kvm-s390:kvm_s390_create_vm",
> .check = test__checkevent_tracepoint,
> + .valid = kvm_s390_create_vm_valid,
> .id = 100,
> },
> #endif
> --
> 2.21.0
--
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/core] perf test 6: Fix missing kvm module load for s390
2019-06-04 5:35 [PATCH] perf test 6: Fix missing kvm module load for s390 Thomas Richter
2019-06-07 19:50 ` Arnaldo Carvalho de Melo
@ 2019-06-17 19:51 ` tip-bot for Thomas Richter
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Thomas Richter @ 2019-06-17 19:51 UTC (permalink / raw)
To: linux-tip-commits
Cc: tmricht, linux-kernel, brueckner, heiko.carstens, mingo,
borntraeger, acme, hpa, tglx
Commit-ID: 53fe307dfd309e425b171f6272d64296a54f4dff
Gitweb: https://git.kernel.org/tip/53fe307dfd309e425b171f6272d64296a54f4dff
Author: Thomas Richter <tmricht@linux.ibm.com>
AuthorDate: Tue, 4 Jun 2019 07:35:04 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 10 Jun 2019 16:20:13 -0300
perf test 6: Fix missing kvm module load for s390
Command
# perf test -Fv 6
fails with error
running test 100 'kvm-s390:kvm_s390_create_vm' failed to parse
event 'kvm-s390:kvm_s390_create_vm', err -1, str 'unknown tracepoint'
event syntax error: 'kvm-s390:kvm_s390_create_vm'
\___ unknown tracepoint
when the kvm module is not loaded or not built in.
Fix this by adding a valid function which tests if the module
is loaded. Loaded modules (or builtin KVM support) have a
directory named
/sys/kernel/debug/tracing/events/kvm-s390
for this tracepoint.
Check for existence of this directory.
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20190604053504.43073-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/parse-events.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 4a69c07f4101..8f3c80e13584 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -18,6 +18,32 @@
#define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
+#if defined(__s390x__)
+/* Return true if kvm module is available and loaded. Test this
+ * and retun success when trace point kvm_s390_create_vm
+ * exists. Otherwise this test always fails.
+ */
+static bool kvm_s390_create_vm_valid(void)
+{
+ char *eventfile;
+ bool rc = false;
+
+ eventfile = get_events_file("kvm-s390");
+
+ if (eventfile) {
+ DIR *mydir = opendir(eventfile);
+
+ if (mydir) {
+ rc = true;
+ closedir(mydir);
+ }
+ put_events_file(eventfile);
+ }
+
+ return rc;
+}
+#endif
+
static int test__checkevent_tracepoint(struct perf_evlist *evlist)
{
struct perf_evsel *evsel = perf_evlist__first(evlist);
@@ -1642,6 +1668,7 @@ static struct evlist_test test__events[] = {
{
.name = "kvm-s390:kvm_s390_create_vm",
.check = test__checkevent_tracepoint,
+ .valid = kvm_s390_create_vm_valid,
.id = 100,
},
#endif
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-17 19:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-04 5:35 [PATCH] perf test 6: Fix missing kvm module load for s390 Thomas Richter
2019-06-07 19:50 ` Arnaldo Carvalho de Melo
2019-06-17 19:51 ` [tip:perf/core] " 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.