All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf/test: test case 71 fails on s390
@ 2022-04-20  6:29 Thomas Richter
  2022-04-20 16:52 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2022-04-20  6:29 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, chengdongli, adrian.hunter
  Cc: svens, gor, sumanthk, hca, Thomas Richter

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 <tmricht@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf/test: test case 71 fails on s390
  2022-04-20  6:29 [PATCH] perf/test: test case 71 fails on s390 Thomas Richter
@ 2022-04-20 16:52 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-20 16:52 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-perf-users, chengdongli, adrian.hunter,
	svens, gor, sumanthk, hca

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 <tmricht@linux.ibm.com>
> Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-20 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  6:29 [PATCH] perf/test: test case 71 fails on s390 Thomas Richter
2022-04-20 16:52 ` Arnaldo Carvalho de Melo

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.