linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/test: fix perf ftrace test on s390
@ 2024-11-07 12:33 Thomas Richter
  2024-11-07 19:41 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Richter @ 2024-11-07 12:33 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, sumanthk, namhyung
  Cc: agordeev, gor, hca, Thomas Richter, Sven Schnelle

On s390 the perf test case ftrace sometimes fails as follows:

  # ./perf test ftrace
  79: perf ftrace tests    : FAILED!
  #

The failure depends on the kernel .config file. Some configurarions
always work fine, some do not.
To achieve success for all our tested kernel configurations, enlarge
the buffer to store the traces complete without wrapping.
The default buffer size is too small  for all kernel configurations.
Set the buffer size of /sys/kernel/tracing/buffer_size_kb to 16 MB

Output after:
  # ./perf test ftrace
  79: perf ftrace tests     : Ok
  #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Suggested-by: Sven Schnelle <svens@linux.ibm.com>
---
 tools/perf/tests/shell/ftrace.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/perf/tests/shell/ftrace.sh b/tools/perf/tests/shell/ftrace.sh
index a6ee740f0d7e..742d6b8f34d3 100755
--- a/tools/perf/tests/shell/ftrace.sh
+++ b/tools/perf/tests/shell/ftrace.sh
@@ -80,10 +80,21 @@ test_ftrace_profile() {
     echo "perf ftrace profile test  [Success]"
 }
 
+if [ "$(uname -m)" = "s390x" ]
+then
+	ftrace_size=$(cat /sys/kernel/tracing/buffer_size_kb)
+	echo 16384 > /sys/kernel/tracing/buffer_size_kb
+fi
+
 test_ftrace_list
 test_ftrace_trace
 test_ftrace_latency
 test_ftrace_profile
 
+if [ "$(uname -m)" = "s390x" ]
+then
+	echo $ftrace_size > /sys/kernel/tracing/buffer_size_kb
+fi
+
 cleanup
 exit 0
-- 
2.47.0


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

* Re: [PATCH] perf/test: fix perf ftrace test on s390
  2024-11-07 12:33 [PATCH] perf/test: fix perf ftrace test on s390 Thomas Richter
@ 2024-11-07 19:41 ` Namhyung Kim
  2024-11-08  6:28   ` Sven Schnelle
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2024-11-07 19:41 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-perf-users, acme, sumanthk, agordeev, gor,
	hca, Sven Schnelle

On Thu, Nov 07, 2024 at 01:33:43PM +0100, Thomas Richter wrote:
> On s390 the perf test case ftrace sometimes fails as follows:
> 
>   # ./perf test ftrace
>   79: perf ftrace tests    : FAILED!
>   #
> 
> The failure depends on the kernel .config file. Some configurarions
> always work fine, some do not.

Which test do you fail?  ftrace trace or profile?  I don't think it's
gonna be a problem for ftrace latency.


> To achieve success for all our tested kernel configurations, enlarge
> the buffer to store the traces complete without wrapping.
> The default buffer size is too small  for all kernel configurations.
> Set the buffer size of /sys/kernel/tracing/buffer_size_kb to 16 MB

Actually you can use -m 16M option for perf ftrace trace and perf ftrace
profile.  Then you don't need to care about restoring the original size.

Thanks,
Namhyung

> 
> Output after:
>   # ./perf test ftrace
>   79: perf ftrace tests     : Ok
>   #
> 
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> Suggested-by: Sven Schnelle <svens@linux.ibm.com>
> ---
>  tools/perf/tests/shell/ftrace.sh | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/tools/perf/tests/shell/ftrace.sh b/tools/perf/tests/shell/ftrace.sh
> index a6ee740f0d7e..742d6b8f34d3 100755
> --- a/tools/perf/tests/shell/ftrace.sh
> +++ b/tools/perf/tests/shell/ftrace.sh
> @@ -80,10 +80,21 @@ test_ftrace_profile() {
>      echo "perf ftrace profile test  [Success]"
>  }
>  
> +if [ "$(uname -m)" = "s390x" ]
> +then
> +	ftrace_size=$(cat /sys/kernel/tracing/buffer_size_kb)
> +	echo 16384 > /sys/kernel/tracing/buffer_size_kb
> +fi
> +
>  test_ftrace_list
>  test_ftrace_trace
>  test_ftrace_latency
>  test_ftrace_profile
>  
> +if [ "$(uname -m)" = "s390x" ]
> +then
> +	echo $ftrace_size > /sys/kernel/tracing/buffer_size_kb
> +fi
> +
>  cleanup
>  exit 0
> -- 
> 2.47.0
> 

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

* Re: [PATCH] perf/test: fix perf ftrace test on s390
  2024-11-07 19:41 ` Namhyung Kim
@ 2024-11-08  6:28   ` Sven Schnelle
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Schnelle @ 2024-11-08  6:28 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Thomas Richter, linux-kernel, linux-perf-users, acme, sumanthk,
	agordeev, gor, hca

Namhyung Kim <namhyung@kernel.org> writes:

> On Thu, Nov 07, 2024 at 01:33:43PM +0100, Thomas Richter wrote:
>> On s390 the perf test case ftrace sometimes fails as follows:
>> 
>>   # ./perf test ftrace
>>   79: perf ftrace tests    : FAILED!
>>   #
>> 
>> The failure depends on the kernel .config file. Some configurarions
>> always work fine, some do not.
>
> Which test do you fail?  ftrace trace or profile?  I don't think it's
> gonna be a problem for ftrace latency.


The ftrace profile test failed, because the ring buffer was not large
enough, and some lines (especially the interesting ones with nanosleep
in it) where dropped.

>
>> To achieve success for all our tested kernel configurations, enlarge
>> the buffer to store the traces complete without wrapping.
>> The default buffer size is too small  for all kernel configurations.
>> Set the buffer size of /sys/kernel/tracing/buffer_size_kb to 16 MB
>
> Actually you can use -m 16M option for perf ftrace trace and perf ftrace
> profile.  Then you don't need to care about restoring the original size.

Ok, thanks. I leave it to Thomas to decide whether he wants to add this
option to the CI run.

Thanks!

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

end of thread, other threads:[~2024-11-08  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 12:33 [PATCH] perf/test: fix perf ftrace test on s390 Thomas Richter
2024-11-07 19:41 ` Namhyung Kim
2024-11-08  6:28   ` Sven Schnelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).