mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] perf/test: fix perf ftrace test on s390
@ 2024-11-15  6:57 Thomas Richter
  2024-11-19  0:54 ` Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2024-11-15  6:57 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, namhyung, james.clark
  Cc: agordeev, gor, sumanthk, 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.  The ftrace profile test mostly fails,
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

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>
Reviewed-by: James Clark <james.clark@linaro.org>
---
 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..6161a8bdc251 100755
--- a/tools/perf/tests/shell/ftrace.sh
+++ b/tools/perf/tests/shell/ftrace.sh
@@ -14,6 +14,11 @@ output=$(mktemp /tmp/__perf_test.ftrace.XXXXXX)
 
 cleanup() {
   rm -f "${output}"
+  if [ "$(uname -m)" = "s390x" ]
+  then
+	echo $ftrace_size > /sys/kernel/tracing/buffer_size_kb
+  fi
+
 
   trap - EXIT TERM INT
 }
@@ -80,6 +85,12 @@ 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
-- 
2.47.0


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

* Re: [PATCH v2] perf/test: fix perf ftrace test on s390
  2024-11-15  6:57 [PATCH v2] perf/test: fix perf ftrace test on s390 Thomas Richter
@ 2024-11-19  0:54 ` Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2024-11-19  0:54 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-perf-users, acme, james.clark, agordeev, gor,
	sumanthk, hca, Sven Schnelle

On Fri, Nov 15, 2024 at 07:57:35AM +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.  The ftrace profile test mostly fails,
> 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
> 
> 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>
> Reviewed-by: James Clark <james.clark@linaro.org>
> ---
>  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..6161a8bdc251 100755
> --- a/tools/perf/tests/shell/ftrace.sh
> +++ b/tools/perf/tests/shell/ftrace.sh
> @@ -14,6 +14,11 @@ output=$(mktemp /tmp/__perf_test.ftrace.XXXXXX)
>  
>  cleanup() {
>    rm -f "${output}"
> +  if [ "$(uname -m)" = "s390x" ]
> +  then
> +	echo $ftrace_size > /sys/kernel/tracing/buffer_size_kb
> +  fi
> +
>  
>    trap - EXIT TERM INT
>  }
> @@ -80,6 +85,12 @@ test_ftrace_profile() {
>      echo "perf ftrace profile test  [Success]"
>  }

Could you please use `perf ftrace profile -m 16M ...` instead?

Thanks,
Namhyung

>  
> +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
> -- 
> 2.47.0
> 

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

end of thread, other threads:[~2024-11-19  0:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-15  6:57 [PATCH v2] perf/test: fix perf ftrace test on s390 Thomas Richter
2024-11-19  0:54 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®