[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211026231314.1b5c1f378f9c5410b01a2d85@kernel.org>
Date: Tue, 26 Oct 2021 23:13:14 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Li Zhijian <lizhijian@...fujitsu.com>, <mingo@...hat.com>,
<shuah@...nel.org>, <linux-kselftest@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Philip Li <philip.li@...el.com>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] kselftests: ftrace: limit the executing time by reading
from cached trace
On Tue, 26 Oct 2021 09:15:34 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Tue, 26 Oct 2021 21:13:31 +0900
> Masami Hiramatsu <mhiramat@...nel.org> wrote:
>
> > > > No, since each testcase must be run under the clean state. Would we need to
> > > > recover the settings?
> > >
> > > I would at least put it back to the default. If someone runs the tests,
> > > it should at least put it back to what it was at boot. Otherwise,
> > > someone might run the tests, and then wonder why events are being
> > > dropped when they are reading the trace.
> >
> > Umm, we may need to have a knob to reset the ftrace options...
> > Can we warn such user that if the ftracetest finds that the current
> > value is not the same what it sets?
>
> You mean before we set pause-on-trace, make sure that it was cleared?
>
> That could work too, and then just set everything back to what we expected
> it to be at the start.
No, it costs much higher (to save the default settings and recover)
OK, then just make it recover to the build default setting.
>From e6ab7217c8f50dabee0f565764489fdd32e1ff07 Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <mhiramat@...nel.org>
Date: Wed, 20 Oct 2021 11:55:22 +0900
Subject: [PATCH v2] selftests/ftrace: Stop tracing while reading the trace file
by default
Stop tracing while reading the trace file by default, to prevent
the test results while checking it and to avoid taking a long time
to check the result.
If there is any testcase which wants to test the tracing while reading
the trace file, please override this setting inside the test case.
This also recovers the pause-on-trace when clean it up.
Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
---
Changes in v2:
- Recover pause-on-trace to 0 when exit.
---
tools/testing/selftests/ftrace/ftracetest | 2 +-
tools/testing/selftests/ftrace/test.d/functions | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index 8ec1922e974e..c3311c8c4089 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -428,7 +428,7 @@ for t in $TEST_CASES; do
exit 1
fi
done
-(cd $TRACING_DIR; initialize_ftrace) # for cleanup
+(cd $TRACING_DIR; finish_ftrace) # for cleanup
prlog ""
prlog "# of passed: " `echo $PASSED_CASES | wc -w`
diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
index 000fd05e84b1..5f6cbec847fc 100644
--- a/tools/testing/selftests/ftrace/test.d/functions
+++ b/tools/testing/selftests/ftrace/test.d/functions
@@ -124,10 +124,22 @@ initialize_ftrace() { # Reset ftrace to initial-state
[ -f uprobe_events ] && echo > uprobe_events
[ -f synthetic_events ] && echo > synthetic_events
[ -f snapshot ] && echo 0 > snapshot
+
+# Stop tracing while reading the trace file by default, to prevent
+# the test results while checking it and to avoid taking a long time
+# to check the result.
+ [ -f options/pause-on-trace ] && echo 1 > options/pause-on-trace
+
clear_trace
enable_tracing
}
+finish_ftrace() {
+ initialize_ftrace
+# And recover it to default.
+ [ -f options/pause-on-trace ] && echo 0 > options/pause-on-trace
+}
+
check_requires() { # Check required files and tracers
for i in "$@" ; do
r=${i%:README}
--
2.25.1
Powered by blists - more mailing lists