Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
70 lines
1.5 KiB
Bash
70 lines
1.5 KiB
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# description: Test ftrace direct functions against tracers
|
|
|
|
rmmod ftrace-direct ||:
|
|
if ! modprobe ftrace-direct ; then
|
|
echo "No ftrace-direct sample module - please make CONFIG_SAMPLE_FTRACE_DIRECT=m"
|
|
exit_unresolved;
|
|
fi
|
|
|
|
echo "Let the module run a little"
|
|
sleep 1
|
|
|
|
grep -q "my_direct_func: waking up" trace
|
|
|
|
rmmod ftrace-direct
|
|
|
|
test_tracer() {
|
|
tracer=$1
|
|
|
|
# tracer -> direct -> no direct > no tracer
|
|
echo $tracer > current_tracer
|
|
modprobe ftrace-direct
|
|
rmmod ftrace-direct
|
|
echo nop > current_tracer
|
|
|
|
# tracer -> direct -> no tracer > no direct
|
|
echo $tracer > current_tracer
|
|
modprobe ftrace-direct
|
|
echo nop > current_tracer
|
|
rmmod ftrace-direct
|
|
|
|
# direct -> tracer -> no tracer > no direct
|
|
modprobe ftrace-direct
|
|
echo $tracer > current_tracer
|
|
echo nop > current_tracer
|
|
rmmod ftrace-direct
|
|
|
|
# direct -> tracer -> no direct > no notracer
|
|
modprobe ftrace-direct
|
|
echo $tracer > current_tracer
|
|
rmmod ftrace-direct
|
|
echo nop > current_tracer
|
|
}
|
|
|
|
for t in `cat available_tracers`; do
|
|
if [ "$t" != "nop" ]; then
|
|
test_tracer $t
|
|
fi
|
|
done
|
|
|
|
echo nop > current_tracer
|
|
rmmod ftrace-direct ||:
|
|
|
|
# Now do the same thing with another direct function registered
|
|
echo "Running with another ftrace direct function"
|
|
|
|
rmmod ftrace-direct-too ||:
|
|
modprobe ftrace-direct-too
|
|
|
|
for t in `cat available_tracers`; do
|
|
if [ "$t" != "nop" ]; then
|
|
test_tracer $t
|
|
fi
|
|
done
|
|
|
|
echo nop > current_tracer
|
|
rmmod ftrace-direct ||:
|
|
rmmod ftrace-direct-too ||:
|