Skip to contentSkip to conversation

selftests/ftrace: Stop tracing before searching non-exist event entry

PATCH In review Masami Hiramatsu 2 participants 2 messages Sep 28, 2021 – Oct 13, 2021

Subsystems (2)
lore
Share & tools
lore

Masami Hiramatsu

author maintainer
#0 lore raw

PATCH 1/1 selftests/ftrace: Stop tracing before searching non-exist event entry

Stop tracing before searching the pattern which is expected to not exist on the trace buffer. In some case, it will take too long and may not come back eternally because while searching the tracing data will be increased by the searching activity.

I found this with enabling kernel debug options, like kmemleak, lockdep etc. and run it on qemu with 2 CPUs. It did not come back in 20 minutes and finally I need to interrupt it to stop.

---
 .../ftrace/test.d/ftrace/func_profiler.tc          |    3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc +3 -0
index 1dbd766c0cd2..440f4d87aa4b 100644
@@ -56,6 +56,9 @@ clear_trace
 sleep 1
 
 echo "make sure something other than scheduler is being traced"
+
+echo 0 > tracing_on
+
 if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then
 	cat trace
 	fail "no other functions besides schedule was found"
maintainer
#1 lore raw

On Tue, 28 Sep 2021 09:11:06 +0900
Masami Hiramatsu <[email protected]> wrote:

I'm finally getting through my queue to see this.

Quoted 8 lines

Stop tracing before searching the pattern which is expected to not exist on the trace buffer. In some case, it will take too long and may not come back eternally because while searching the tracing data will be increased by the searching activity.

I found this with enabling kernel debug options, like kmemleak, lockdep etc. and run it on qemu with 2 CPUs. It did not come back in 20 minutes and finally I need to interrupt it to stop.

One other option is to bring back the old behavior:

echo 1 > options/pause-on-trace

Which will stop tracing as the trace file is read.

But either way works for me.

-- Steve

Quoted 20 lines
---
 .../ftrace/test.d/ftrace/func_profiler.tc          |    3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc +3 -0
index 1dbd766c0cd2..440f4d87aa4b 100644
@@ -56,6 +56,9 @@ clear_trace
 sleep 1
 
 echo "make sure something other than scheduler is being traced"
+
+echo 0 > tracing_on
+
 if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then
 	cat trace
 	fail "no other functions besides schedule was found"