2 # SPDX-License-Identifier: GPL-2.0
3 # description: ftrace - function profiler with function tracing
5 # There was a bug after a rewrite of the ftrace infrastructure that
6 # caused the function_profiler not to be able to run with the function
7 # tracer, because the function_profiler used the function_graph tracer
8 # and it was assumed the two could not run simultaneously.
10 # There was another related bug where the solution to the first bug
11 # broke the way filtering of the function tracer worked.
13 # This test triggers those bugs on those kernels.
15 # We need function_graph and profiling to to run this test
16 if ! grep -q function_graph available_tracers; then
17 echo "no function graph tracer configured"
21 if [ ! -f set_ftrace_filter ]; then
22 echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
26 if [ ! -f function_profile_enabled ]; then
27 echo "function_profile_enabled not found, function profiling enabled?"
33 echo > set_ftrace_filter
38 echo "Testing function tracer with profiler:"
39 echo "enable function tracer"
40 echo function > current_tracer
41 echo "enable profiler"
42 echo 1 > function_profile_enabled
46 echo "Now filter on just schedule"
47 echo '*schedule' > set_ftrace_filter
50 echo "Now disable function profiler"
51 echo 0 > function_profile_enabled
55 # make sure only schedule functions exist
57 echo "testing if only schedule is being traced"
58 if grep -v -e '^#' -e 'schedule' trace; then
59 fail "more than schedule was found"
62 echo "Make sure schedule was traced"
63 if ! grep -e 'schedule' trace > /dev/null; then
65 fail "can not find schedule in trace"
68 echo > set_ftrace_filter
73 echo "make sure something other than scheduler is being traced"
74 if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then
76 fail "no other functions besides schedule was found"