lkml.org 
[lkml]   [2018]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 11/14] ftrace/selftest: Have the reset_trigger code be a bit more careful
On Mon, 14 May 2018 16:58:56 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> 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.

Ah, right!

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

I think this should go into stable tree too.

Thank you!

>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
> .../testing/selftests/ftrace/test.d/functions | 21 ++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
> index 2a4f16fc9819..8393b1c06027 100644
> --- a/tools/testing/selftests/ftrace/test.d/functions
> +++ b/tools/testing/selftests/ftrace/test.d/functions
> @@ -15,14 +15,29 @@ reset_tracer() { # reset the current tracer
> echo nop > current_tracer
> }
>
> -reset_trigger() { # reset all current setting triggers
> - grep -v ^# events/*/*/trigger |
> +reset_trigger_file() {
> + # 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
> 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
> }
>
> +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
> grep -v ^none events/*/*/filter |
> while read line; do
> --
> 2.17.0
>
>


--
Masami Hiramatsu <mhiramat@kernel.org>

\
 
 \ /
  Last update: 2018-05-16 14:54    [W:0.076 / U:15.612 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site