From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
linux-kernel@vger.kernel.org,
clang-built-linux <llvm@lists.linux.dev>,
Nathan Chancellor <nathan@kernel.org>
Subject: Re: [BUG] tracing: dynamic ftrace selftest detected failures
Date: Fri, 23 Aug 2024 09:04:12 +0900 [thread overview]
Message-ID: <20240823090412.d63468ab89ba28415d7bc649@kernel.org> (raw)
In-Reply-To: <20240821115000.387de298@gandalf.local.home>
On Wed, 21 Aug 2024 11:50:00 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 21 Aug 2024 16:42:07 +0100
> Mark Rutland <mark.rutland@arm.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@kernel.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@kernel.org>
prev parent reply other threads:[~2024-08-23 0:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 8:11 [BUG] tracing: dynamic ftrace selftest detected failures Masami Hiramatsu
2024-08-19 15:29 ` Steven Rostedt
2024-08-19 15:56 ` Masami Hiramatsu
2024-08-19 16:02 ` Steven Rostedt
2024-08-19 23:34 ` Masami Hiramatsu
2024-08-20 1:03 ` Masami Hiramatsu
2024-08-20 10:48 ` Mark Rutland
2024-08-20 13:56 ` Steven Rostedt
2024-08-20 15:10 ` Sami Tolvanen
2024-08-20 15:20 ` Steven Rostedt
2024-08-20 22:05 ` Masami Hiramatsu
2024-08-20 22:11 ` Steven Rostedt
2024-08-20 23:43 ` Masami Hiramatsu
2024-08-20 23:49 ` Steven Rostedt
2024-08-21 0:15 ` Masami Hiramatsu
2024-08-21 0:21 ` Masami Hiramatsu
2024-08-21 15:06 ` Sami Tolvanen
2024-08-21 15:32 ` Mark Rutland
2024-08-21 15:42 ` Mark Rutland
2024-08-21 15:50 ` Steven Rostedt
2024-08-23 0:04 ` Masami Hiramatsu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240823090412.d63468ab89ba28415d7bc649@kernel.org \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=nathan@kernel.org \
--cc=rostedt@goodmis.org \
--cc=samitolvanen@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.