Skip to contentSkip to conversation

perf/test: fix perf ftrace test on s390

PATCH Superseded Thomas Richter 2 participants 2 messages Nov 15, 2024 – Nov 19, 2024 perf events

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 perf/test: fix perf ftrace test on s390

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
  #
---
 tools/perf/tests/shell/ftrace.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/perf/tests/shell/ftrace.sh +11 -0
index a6ee740f0d7e..6161a8bdc251 100755
@@ -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
Signature · 1 line
2.47.0
maintainer
#1 lore raw
Quoted 45 lines · Thomas Richter

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
  #
---
 tools/perf/tests/shell/ftrace.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/perf/tests/shell/ftrace.sh +5 -0
index a6ee740f0d7e..6161a8bdc251 100755
@@ -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
 }

tools/perf/tests/shell/ftrace.sh test_ftrace_profile() { · line 86

Quoted 2 lines
tools/perf/tests/shell/ftrace.sh +0 -0
@@ -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

Quoted 13 lines
tools/perf/tests/shell/ftrace.sh +6 -0
+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
Signature · 1 line
2.47.0