Skip to content

Commit

Permalink
ftrace/selftest: Test combination of function_graph tracer and functi…
Browse files Browse the repository at this point in the history
…on profiler

Masami reported a bug when running function graph tracing then the
function profiler. The following commands would cause a kernel crash:

  # cd /sys/kernel/tracing/
  # echo function_graph > current_tracer
  # echo 1 > function_profile_enabled

In that order. Create a test to test this two to make sure this does not
come back as a regression.

Link: https://lore.kernel.org/172398528350.293426.8347220120333730248.stgit@devnote2

Link: https://lore.kernel.org/all/[email protected]/
Acked-by: Masami Hiramatsu (Google) <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
  • Loading branch information
rostedt authored and shuahkh committed Oct 11, 2024
1 parent a0cc649 commit 4ee5ca9
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tools/testing/selftests/ftrace/test.d/ftrace/fgraph-profiler.tc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: ftrace - function profiler with function graph tracing
# requires: function_profile_enabled set_ftrace_filter function_graph:tracer

# The function graph tracer can now be run along side of the function
# profiler. But there was a bug that caused the combination of the two
# to crash. It also required the function graph tracer to be started
# first.
#
# This test triggers that bug
#
# We need both function_graph and profiling to run this test

fail() { # mesg
echo $1
exit_fail
}

echo "Enabling function graph tracer:"
echo function_graph > current_tracer
echo "enable profiler"

# Older kernels do not allow function_profile to be enabled with
# function graph tracer. If the below fails, mark it as unsupported
echo 1 > function_profile_enabled || exit_unsupported

# Let it run for a bit to make sure nothing explodes
sleep 1

exit 0

0 comments on commit 4ee5ca9

Please sign in to comment.