[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20240823090412.d63468ab89ba28415d7bc649@kernel.org>
Date: Fri, 23 Aug 2024 09:04:12 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Mark Rutland <mark.rutland@....com>, Masami Hiramatsu
<mhiramat@...nel.org>, Sami Tolvanen <samitolvanen@...gle.com>, Linux Trace
Kernel <linux-trace-kernel@...r.kernel.org>, linux-kernel@...r.kernel.org,
clang-built-linux <llvm@...ts.linux.dev>, Nathan Chancellor
<nathan@...nel.org>
Subject: Re: [BUG] tracing: dynamic ftrace selftest detected failures
On Wed, 21 Aug 2024 11:50:00 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Wed, 21 Aug 2024 16:42:07 +0100
> Mark Rutland <mark.rutland@....com> wrote:
>
> > FWIW, that was in samples/ftrace/ftrace-ops.c, where tracee_relevant() and
> > tracee_irrelevant() have the barrier():
> >
> > | /*
> > | * Marked as noinline to ensure that an out-of-line traceable copy is
> > | * generated by the compiler.
> > | *
> > | * The barrier() ensures the compiler won't elide calls by determining there
> > | * are no side-effects.
> > | */
> > | static noinline void tracee_relevant(void)
> > | {
> > | barrier();
> > | }
> >
> > ... so we already have precedent for that in tracing code.
>
> If adding a barrier() fixes things, then I'm 100% for adding them.
>
> Masami, does this fix it?
Interesting, this fixes the issue!
And it is great to find how to avoid the LTO removes function like this.
Tested-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
Thank you,
>
> -- Steve
>
> diff --git a/kernel/trace/trace_selftest_dynamic.c b/kernel/trace/trace_selftest_dynamic.c
> index c364cf777e1a..a112433d78ce 100644
> --- a/kernel/trace/trace_selftest_dynamic.c
> +++ b/kernel/trace/trace_selftest_dynamic.c
> @@ -4,12 +4,20 @@
>
> noinline __noclone int DYN_FTRACE_TEST_NAME(void)
> {
> - /* used to call mcount */
> + /*
> + * Used to test function tracing. Make sure the compiler doesn't
> + * remove it.
> + */
> + barrier();
> return 0;
> }
>
> noinline __noclone int DYN_FTRACE_TEST_NAME2(void)
> {
> - /* used to call mcount */
> + /*
> + * Used to test function tracing. Make sure the compiler doesn't
> + * remove it.
> + */
> + barrier();
> return 0;
> }
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists