mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-05 11:53:41 +00:00

Commitcad6967ac1
("fork: introduce kernel_clone()") replaced "_do_fork()" with "kernel_clone()". The ftrace selftests reference the fork function in several of the tests. The rename will make the tests break, but if those names are changed in the tests, they would then break on older kernels. The same set of tests should pass older kernels if they have previously passed. Obviously, a new test may not work on older kernels if the test was added due to a bug or a new feature. The setup of ftracetest will now create a $FUNCTION_FORK bash variable that will contain "_do_fork" for older kernels and "kernel_clone" for newer ones. It figures out the proper name by examining /proc/kallsyms. Note, available_filter_functions could also be used, but because some tests should be able to pass without function tracing enabled, it could not be used. Fixes:eea11285da
("tracing: switch to kernel_clone()") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
46 lines
1.0 KiB
Bash
46 lines
1.0 KiB
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# description: Kprobe dynamic event with function tracer
|
|
# requires: kprobe_events stack_trace_filter function:tracer
|
|
|
|
# prepare
|
|
echo nop > current_tracer
|
|
echo $FUNCTION_FORK > set_ftrace_filter
|
|
echo "p:testprobe $FUNCTION_FORK" > kprobe_events
|
|
|
|
# kprobe on / ftrace off
|
|
echo 1 > events/kprobes/testprobe/enable
|
|
echo > trace
|
|
( echo "forked")
|
|
grep testprobe trace
|
|
! grep "$FUNCTION_FORK <-" trace
|
|
|
|
# kprobe on / ftrace on
|
|
echo function > current_tracer
|
|
echo > trace
|
|
( echo "forked")
|
|
grep testprobe trace
|
|
grep "$FUNCTION_FORK <-" trace
|
|
|
|
# kprobe off / ftrace on
|
|
echo 0 > events/kprobes/testprobe/enable
|
|
echo > trace
|
|
( echo "forked")
|
|
! grep testprobe trace
|
|
grep "$FUNCTION_FORK <-" trace
|
|
|
|
# kprobe on / ftrace on
|
|
echo 1 > events/kprobes/testprobe/enable
|
|
echo function > current_tracer
|
|
echo > trace
|
|
( echo "forked")
|
|
grep testprobe trace
|
|
grep "$FUNCTION_FORK <-" trace
|
|
|
|
# kprobe on / ftrace off
|
|
echo nop > current_tracer
|
|
echo > trace
|
|
( echo "forked")
|
|
grep testprobe trace
|
|
! grep "$FUNCTION_FORK <-" trace
|