Re: [BUG] tracing: dynamic ftrace selftest detected failures

Masami Hiramatsu
2024-08-20T23:43:56Z

On Tue, 20 Aug 2024 18:11:09 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Wed, 21 Aug 2024 07:05:39 +0900
> Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
>
>
> > Does the noinline attribute prevent embedding callsite too? I mean
> >
> > extern callee()
> >
> > noinline callee()
> > {
> > ...
> > }
> >
> > caller()
> > {
> > callee() // (*)
> > }
> >
> > In this case, does noinline prevent LTO to embed the callee at the callsite(*)
> > or prevent LTO remove the callee() symbol?
> >
>
> Even though we have it passed as a parameter, I think the compiler and
> linker is smart enough to see that and notice its use, and that the
> function passed in is a nop, which doesn't break the flow.
>
> Can you add the __used and see if it fixes it?

Adding __used to DYN_FTRACE_TEST_NAME() and DYN_FTRACE_TEST_NAME2() does
not change, the test still fails. Hmm, what about makes the caller
(trace_selftest_startup_dynamic_tracing()) called via a function pointer?
In that case, wouldn't it be subject to constant propagetion?

Let me try.

Thanks,

>
> -- Steve

--
Masami Hiramatsu (Google) <mhiramat@kernel.org>