Skip to content

Commit 4ee5ca9

Browse files
rostedtshuahkh
authored andcommitted
ftrace/selftest: Test combination of function_graph tracer and function 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]>
1 parent a0cc649 commit 4ee5ca9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
# description: ftrace - function profiler with function graph tracing
4+
# requires: function_profile_enabled set_ftrace_filter function_graph:tracer
5+
6+
# The function graph tracer can now be run along side of the function
7+
# profiler. But there was a bug that caused the combination of the two
8+
# to crash. It also required the function graph tracer to be started
9+
# first.
10+
#
11+
# This test triggers that bug
12+
#
13+
# We need both function_graph and profiling to run this test
14+
15+
fail() { # mesg
16+
echo $1
17+
exit_fail
18+
}
19+
20+
echo "Enabling function graph tracer:"
21+
echo function_graph > current_tracer
22+
echo "enable profiler"
23+
24+
# Older kernels do not allow function_profile to be enabled with
25+
# function graph tracer. If the below fails, mark it as unsupported
26+
echo 1 > function_profile_enabled || exit_unsupported
27+
28+
# Let it run for a bit to make sure nothing explodes
29+
sleep 1
30+
31+
exit 0

0 commit comments

Comments
 (0)