2022-04-21 15:58:36

by Thomas Richter

[permalink] [raw]
Subject: [PATCH] perf/test: test case 71 fails on s390

Test case 71 'Convert perf time to TSC' is not supported on s390.
Subtest 71.1 is skipped with the correct message, but
subtest 71.2 is not skipped and fails.

The root cause is function evlist__open() called from
test__perf_time_to_tsc(). evlist__open() returns -ENOENT because the
event cycles:u is not supported by the selected PMU, for example
platform s390 on z/VM or an x86_64 virtual machine.
The PMU driver returns -ENOENT in this case. This error is leads to
the failure.
Fix this by returning TEST_SKIP on -ENOENT.

Output before:
71: Convert perf time to TSC:
71.1: TSC support: Skip (This architecture does not support)
71.2: Perf time to TSC: FAILED!

Output after:
71: Convert perf time to TSC:
71.1: TSC support: Skip (This architecture does not support)
71.2: Perf time to TSC: Skip (perf_read_tsc_conversion is not supported)

This also happens on an x86_64 virtual machine:
# uname -m
x86_64
$ ./perf test -F 71
71: Convert perf time to TSC :
71.1: TSC support : Ok
71.2: Perf time to TSC : FAILED!
$

Fixes: 290fa68bdc45 ("perf test tsc: Fix error message when not supported")
Signed-off-by: Thomas Richter <[email protected]>
Acked-by: Sumanth Korikkar <[email protected]>
---
tools/perf/tests/perf-time-to-tsc.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c
index cc6df49a65a1..4ad0dfbc8b21 100644
--- a/tools/perf/tests/perf-time-to-tsc.c
+++ b/tools/perf/tests/perf-time-to-tsc.c
@@ -123,6 +123,10 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su
evsel->core.attr.enable_on_exec = 0;
}

+ if (evlist__open(evlist) == -ENOENT) {
+ err = TEST_SKIP;
+ goto out_err;
+ }
CHECK__(evlist__open(evlist));

CHECK__(evlist__mmap(evlist, UINT_MAX));
--
2.35.1


2022-04-22 20:57:59

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH] perf/test: test case 71 fails on s390

Em Wed, Apr 20, 2022 at 08:29:21AM +0200, Thomas Richter escreveu:
> Test case 71 'Convert perf time to TSC' is not supported on s390.
> Subtest 71.1 is skipped with the correct message, but
> subtest 71.2 is not skipped and fails.
>
> The root cause is function evlist__open() called from
> test__perf_time_to_tsc(). evlist__open() returns -ENOENT because the
> event cycles:u is not supported by the selected PMU, for example
> platform s390 on z/VM or an x86_64 virtual machine.
> The PMU driver returns -ENOENT in this case. This error is leads to
> the failure.
> Fix this by returning TEST_SKIP on -ENOENT.

Thanks, applied and tested it on x86_64, where it continues to work.

- Arnaldo


> Output before:
> 71: Convert perf time to TSC:
> 71.1: TSC support: Skip (This architecture does not support)
> 71.2: Perf time to TSC: FAILED!
>
> Output after:
> 71: Convert perf time to TSC:
> 71.1: TSC support: Skip (This architecture does not support)
> 71.2: Perf time to TSC: Skip (perf_read_tsc_conversion is not supported)
>
> This also happens on an x86_64 virtual machine:
> # uname -m
> x86_64
> $ ./perf test -F 71
> 71: Convert perf time to TSC :
> 71.1: TSC support : Ok
> 71.2: Perf time to TSC : FAILED!
> $
>
> Fixes: 290fa68bdc45 ("perf test tsc: Fix error message when not supported")
> Signed-off-by: Thomas Richter <[email protected]>
> Acked-by: Sumanth Korikkar <[email protected]>
> ---
> tools/perf/tests/perf-time-to-tsc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c
> index cc6df49a65a1..4ad0dfbc8b21 100644
> --- a/tools/perf/tests/perf-time-to-tsc.c
> +++ b/tools/perf/tests/perf-time-to-tsc.c
> @@ -123,6 +123,10 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su
> evsel->core.attr.enable_on_exec = 0;
> }
>
> + if (evlist__open(evlist) == -ENOENT) {
> + err = TEST_SKIP;
> + goto out_err;
> + }
> CHECK__(evlist__open(evlist));
>
> CHECK__(evlist__mmap(evlist, UINT_MAX));
> --
> 2.35.1

--

- Arnaldo