Skip to contentSkip to conversation

perf/test: fix perf ftrace test on s390

PATCH In review Thomas Richter 3 participants 3 messages Nov 7, 2024 – Nov 8, 2024 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 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.
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..742d6b8f34d3 100755
@@ -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
Signature · 1 line
2.47.0
maintainer
#1 lore raw
Quoted 8 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.

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

Quoted 4 lines

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

Quoted 41 lines

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..742d6b8f34d3 100755
@@ -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
Signature · 1 line
2.47.0
#2 lore raw
Quoted 7 lines · Namhyung Kim
Quoted 6 lines · Thomas Richter

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

  # ./perf test ftrace
  79: perf ftrace tests    : FAILED!
  #
Quoted 5 lines
Quoted 2 lines

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.

Quoted 8 lines
Quoted 5 lines

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!