[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180516215612.e86701c1da81e9b9982a3c9f@kernel.org>
Date: Wed, 16 May 2018 21:56:12 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Tom Zanussi <tom.zanussi@...ux.intel.com>,
Clark Williams <williams@...hat.com>,
Karim Yaghmour <karim.yaghmour@...rsys.com>,
Brendan Gregg <bgregg@...flix.com>,
Joel Fernandes <joel@...lfernandes.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Yann Ylavic <ylavic.dev@...il.com>,
linux-rt-users@...r.kernel.org
Subject: Re: [PATCH v2 12/14] ftrace/selftest: Fix reset_trigger() to handle
triggers with filters
On Mon, 14 May 2018 16:58:57 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> From: "Steven Rostedt (VMware)" <rostedt@...dmis.org>
>
> The reset_trigger() function breaks up the command by a space ' '. This is
> useful to ignore the '[active]' word for triggers when removing them. But if
> the trigger has a filter (ie. "if prio < 10") then the filter needs to be
> attached to the line that is written into the trigger file to remove it. But
> the truncation removes the filter and the triggers are not cleared properly.
>
> Before, reset_trigger() did this:
>
> # echo 'hist:keys=common_pid if prev_prio < 10' > events/sched/sched_switch/trigger
> # echo 'hist:keys=common_pid if next_prio < 10' >> events/sched/sched_switch/trigger
> # cat events/sched/sched_switch/trigger
> hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if prev_prio < 10 [active]
> hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if next_prio < 10 [active]
>
> reset_trigger() {
> echo '!hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048' >> events/sched/sched_switch/trigger
> }
>
> # cat events/sched/sched_switch/trigger
> hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if prev_prio < 10 [active]
> hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if next_prio < 10 [active]
>
> After, where it includes the filter:
>
> reset_trigger() {
> echo '!hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if prev_prio < 10' >> events/sched/sched_switch/trigger
> }
>
> # cat events/sched/sched_switch/trigger
> hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if next_prio < 10 [active]
>
This also looks good to me and needs to go into stable.
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Thank you,
> Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
> ---
> tools/testing/selftests/ftrace/test.d/functions | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
> index 8393b1c06027..e4645d5e3126 100644
> --- a/tools/testing/selftests/ftrace/test.d/functions
> +++ b/tools/testing/selftests/ftrace/test.d/functions
> @@ -19,13 +19,13 @@ reset_trigger_file() {
> # remove action triggers first
> grep -H ':on[^:]*(' $@ |
> while read line; do
> - cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "`
> + 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" "`
> + cmd=`echo $line | cut -f2- -d: | cut -f1 -d"["`
> file=`echo $line | cut -f1 -d:`
> echo "!$cmd" > $file
> done
> --
> 2.17.0
>
>
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists