ftrace/selftest: Have the reset_trigger code be a bit more careful

The trigger code is picky in how it can be disabled as there may be
dependencies between different events and synthetic events. Change the order
on how triggers are reset.

 1) Reset triggers of all synthetic events first
 2) Remove triggers with actions attached to them
 3) Remove all other triggers

If this order isn't followed, then some triggers will not be reset, and an
error may happen because a trigger is busy.

Cc: stable@vger.kernel.org
Fixes: cfa0963d ("kselftests/ftrace : Add event trigger testcases")
Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent d3439f9d
...@@ -15,14 +15,29 @@ reset_tracer() { # reset the current tracer ...@@ -15,14 +15,29 @@ reset_tracer() { # reset the current tracer
echo nop > current_tracer echo nop > current_tracer
} }
reset_trigger() { # reset all current setting triggers reset_trigger_file() {
grep -v ^# events/*/*/trigger | # remove action triggers first
grep -H ':on[^:]*(' $@ |
while read line; do
cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "`
file=`echo $line | cut -f1 -d:`
echo "!$cmd" >> $file
done
grep -Hv ^# $@ |
while read line; do while read line; do
cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "` cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "`
echo "!$cmd" > `echo $line | cut -f1 -d:` file=`echo $line | cut -f1 -d:`
echo "!$cmd" > $file
done done
} }
reset_trigger() { # reset all current setting triggers
if [ -d events/synthetic ]; then
reset_trigger_file events/synthetic/*/trigger
fi
reset_trigger_file events/*/*/trigger
}
reset_events_filter() { # reset all current setting filters reset_events_filter() { # reset all current setting filters
grep -v ^none events/*/*/filter | grep -v ^none events/*/*/filter |
while read line; do while read line; do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment