[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210820091325.d5eab4b2c24562f67ab1e205@kernel.org>
Date: Fri, 20 Aug 2021 09:13:25 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-devel@...r.kernel.org,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
"Tzvetomir Stoyanov" <tz.stoyanov@...il.com>,
Tom Zanussi <zanussi@...nel.org>,
Shuah Khan <shuah@...nel.org>,
Shuah Khan <skhan@...uxfoundation.org>,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v8 3/5] selftests/ftrace: Add clear_dynamic_events() to
test cases
On Thu, 19 Aug 2021 11:26:07 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> From: "Steven Rostedt (VMware)" <rostedt@...dmis.org>
>
> Add a function to remove all dynamic events from the tracing directory. It
> requires a loop as some of the dynamic events may depend on others being
> removed first. Also add a safety that prevents it from looping infinitely
> due to a bug where an event never gets removed.
>
> Link: https://lkml.kernel.org/r/20210819041842.696873153@goodmis.org
>
Thank you for adding this useful function!
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
> Cc: Shuah Khan <shuah@...nel.org>
> Cc: Shuah Khan <skhan@...uxfoundation.org>
> Cc: linux-kselftest@...r.kernel.org
> Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
> ---
> .../testing/selftests/ftrace/test.d/functions | 22 +++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
> index a6fac927ee82..f68d336b961b 100644
> --- a/tools/testing/selftests/ftrace/test.d/functions
> +++ b/tools/testing/selftests/ftrace/test.d/functions
> @@ -83,6 +83,27 @@ clear_synthetic_events() { # reset all current synthetic events
> done
> }
>
> +clear_dynamic_events() { # reset all current dynamic events
> + again=1
> + stop=1
> + # loop mulitple times as some events require other to be removed first
> + while [ $again -eq 1 ]; do
> + stop=$((stop+1))
> + # Prevent infinite loops
> + if [ $stop -gt 10 ]; then
> + break;
> + fi
> + again=2
> + grep -v '^#' dynamic_events|
> + while read line; do
> + del=`echo $line | sed -e 's/^.\([^ ]*\).*/-\1/'`
> + if ! echo "$del" >> dynamic_events; then
> + again=1
> + fi
> + done
> + done
> +}
> +
> initialize_ftrace() { # Reset ftrace to initial-state
> # As the initial state, ftrace will be set to nop tracer,
> # no events, no triggers, no filters, no function filters,
> @@ -93,6 +114,7 @@ initialize_ftrace() { # Reset ftrace to initial-state
> reset_events_filter
> reset_ftrace_filter
> disable_events
> + clear_dynamic_events
> [ -f set_event_pid ] && echo > set_event_pid
> [ -f set_ftrace_pid ] && echo > set_ftrace_pid
> [ -f set_ftrace_notrace ] && echo > set_ftrace_notrace
> --
> 2.30.2
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists