tracing: dynamic ftrace selftest detected failures
Masami Hiramatsu (Google)
maintainerHi Steve,
On trace-v6.11-rc3, ftrace selftest detected failures. I attached kconfigs and dmesg. I've built this with clang 16.0.6 (debian). And it seems v6.11-rc3 also has this issue. Can you also check it?
Thank you,
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Steven Rostedt
maintainerQuoted 2 lines · On Mon, 19 Aug 2024 17:11:52 +0900 Masami Hiramatsu (Google)…
CONFIG_LTO=yCONFIG_LTO_CLANG=y
Hi Masami,
Does it still fail if you disable the above?
I wonder if that causes functions to not be part of the available filter functions that the ftrace filter test is using :-/
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
-- Steve
Masami Hiramatsu (Google)
maintainerQuoted 9 lines · On Mon, 19 Aug 2024 11:29:02 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 2 lines · On Mon, 19 Aug 2024 17:11:52 +0900 Masami Hiramatsu (Google)…
CONFIG_LTO=yCONFIG_LTO_CLANG=yHi Masami,
Does it still fail if you disable the above?
No, I found that caused these failure.
Quoted 2 lines
I wonder if that causes functions to not be part of the available filter functions that the ftrace filter test is using :-/
Ah, LTO optimized the target function call... (same as ftrace-direct example)
Quoted 3 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Yeah, we need such option at least for function call test.
Thank you,
Quoted 2 lines
-- Steve
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Steven Rostedt
maintainerQuoted 6 lines · On Tue, 20 Aug 2024 00:56:49 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Yeah, we need such option at least for function call test.
Could you add the noinline, and if it fixes the issue send a patch?
Thanks,
-- Steve
Masami Hiramatsu (Google)
maintainerQuoted 10 lines · On Mon, 19 Aug 2024 12:02:44 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Tue, 20 Aug 2024 00:56:49 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Yeah, we need such option at least for function call test.
Could you add the noinline, and if it fixes the issue send a patch?
OK, BTW, I got warnings from kmemleak when I disabled LTO in the selftest. Let me fix it too.
Thanks,
Quoted 5 lines
Thanks,
-- Steve
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Masami Hiramatsu (Google)
maintainerQuoted 10 lines · On Mon, 19 Aug 2024 12:02:44 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Tue, 20 Aug 2024 00:56:49 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Yeah, we need such option at least for function call test.
Could you add the noinline, and if it fixes the issue send a patch?
I found the target function already has "noinline". I tried to add noinline to the testing function (callsite), but it also did not work.
I think "noinline" is for the compiler, but LTO is done by the linker.
I found a discussion similar to this problem, but it seems very hacky.
https://groups.google.com/g/llvm-dev/c/6baI9LISmSU/m/uEeY_CRbBQAJ?pli=1
Thank you,
Quoted 5 lines
Thanks,
-- Steve
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Quoted 10 lines · Masami Hiramatsu
Quoted 7 lines · On Mon, 19 Aug 2024 12:02:44 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines · On Tue, 20 Aug 2024 00:56:49 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Yeah, we need such option at least for function call test.
Could you add the noinline, and if it fixes the issue send a patch?
I found the target function already has "noinline". I tried to add noinline to the testing function (callsite), but it also did not work.
I think "noinline" is for the compiler, but LTO is done by the linker.
If LTO is breaking noinline, then that has much larger implications for noinstr code and similar, and means that LTO is unsound...
Quoted 3 lines
I found a discussion similar to this problem, but it seems very hacky.
https://groups.google.com/g/llvm-dev/c/6baI9LISmSU/m/uEeY_CRbBQAJ?pli=1
Thanks for the link!
Mark.
Steven Rostedt
maintainerQuoted 6 lines · On Tue, 20 Aug 2024 11:48:07 +0100 Mark Rutland <[email protected]> wrote:
Quoted 3 lines
I found the target function already has "noinline". I tried to add noinline to the testing function (callsite), but it also did not work.
I think "noinline" is for the compiler, but LTO is done by the linker.If LTO is breaking noinline, then that has much larger implications for noinstr code and similar, and means that LTO is unsound...
Hmm, doesn't noinstr place the code in a separate section?
I wonder if we create a separate section for the test function that LTO is inlining, if it will prevent it from being inlined. That is, noinline tells the compiler not to inline, but LTO happens after the compiler is done and may inline functions in the same section. But the linker does see separate sections and I don't think it will try to inline that code into another section. But I could be wrong. ;-)
-- Steve
Quoted 14 lines · Mark Rutland
Quoted 12 lines · Masami Hiramatsu
Quoted 9 lines · On Mon, 19 Aug 2024 12:02:44 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Tue, 20 Aug 2024 00:56:49 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Yeah, we need such option at least for function call test.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Could you add the noinline, and if it fixes the issue send a patch?
I found the target function already has "noinline". I tried to add noinline to the testing function (callsite), but it also did not work.
I think "noinline" is for the compiler, but LTO is done by the linker.If LTO is breaking noinline, then that has much larger implications for noinstr code and similar, and means that LTO is unsound...
The noinline attribute is preserved in LLVM IR, so it should continue to work with LTO. Which function are we talking about here? Are you sure the function was inlined instead of being dropped completely? Does marking the function __used help?
Sami
Steven Rostedt
maintainerQuoted 21 lines · On Tue, 20 Aug 2024 08:10:42 -0700 Sami Tolvanen <[email protected]>…
Quoted 20 lines · Mark Rutland
Quoted 17 lines · Masami Hiramatsu
Quoted 10 lines · On Mon, 19 Aug 2024 12:02:44 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Tue, 20 Aug 2024 00:56:49 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Yeah, we need such option at least for function call test.
Could you add the noinline, and if it fixes the issue send a patch?
I found the target function already has "noinline". I tried to add noinline to the testing function (callsite), but it also did not work.
I think "noinline" is for the compiler, but LTO is done by the linker.
Quoted 7 lines
Quoted 2 lines
If LTO is breaking noinline, then that has much larger implications for noinstr code and similar, and means that LTO is unsound...
The noinline attribute is preserved in LLVM IR, so it should continue to work with LTO. Which function are we talking about here? Are you sure the function was inlined instead of being dropped completely? Does marking the function
__usedhelp?
Hmm, maybe it was dropped, as the functions are basically just stubs.
Masami, can you add __used to the functions in trace_selftests_dynamic.c and see if that fixes it?
-- Steve
Masami Hiramatsu (Google)
maintainerQuoted 21 lines · On Tue, 20 Aug 2024 08:10:42 -0700 Sami Tolvanen <[email protected]>…
Quoted 20 lines · Mark Rutland
Quoted 17 lines · Masami Hiramatsu
Quoted 10 lines · On Mon, 19 Aug 2024 12:02:44 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Tue, 20 Aug 2024 00:56:49 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Yeah, we need such option at least for function call test.
Could you add the noinline, and if it fixes the issue send a patch?
I found the target function already has "noinline". I tried to add noinline to the testing function (callsite), but it also did not work.
I think "noinline" is for the compiler, but LTO is done by the linker.
Quoted 7 lines
Quoted 2 lines
If LTO is breaking noinline, then that has much larger implications for noinstr code and similar, and means that LTO is unsound...
The noinline attribute is preserved in LLVM IR, so it should continue to work with LTO. Which function are we talking about here? Are you sure the function was inlined instead of being dropped completely? Does marking the function
__usedhelp?
We are talking about trace_selftest_startup_dynamic_tracing() in kernel/trace/trace_selftest.c. The callee is func() which is actually DYN_FTRACE_TEST_NAME() in kernel/trace/trace_selftest_dynamic.c. That function passed as pointer (but the compiler can embed it by constant propagation.)
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?
Thank you,
Quoted 3 lines
Sami
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Steven Rostedt
maintainerQuoted 9 lines · On Wed, 21 Aug 2024 07:05:39 +0900 Masami Hiramatsu (Google)…
Does the noinline attribute prevent embedding callsite too? I mean
extern
callee()noinline
callee()
{
...
}
Quoted 8 lines
caller(){ callee() // (*) }In this case, does noinline prevent LTO to embed the callee at the
callsite(*)or prevent LTO remove thecallee()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?
-- Steve
Masami Hiramatsu (Google)
maintainerQuoted 22 lines · On Tue, 20 Aug 2024 18:11:09 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 9 lines · On Wed, 21 Aug 2024 07:05:39 +0900 Masami Hiramatsu (Google)…
Does the noinline attribute prevent embedding callsite too? I mean
extern
callee()noinline
callee()
{
...
}Quoted 8 lines
caller(){ callee() // (*) }In this case, does noinline prevent LTO to embed the callee at the
callsite(*)or prevent LTO remove thecallee()symbol?
Quoted 5 lines
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
__usedand 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,
Quoted 2 lines
-- Steve
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Steven Rostedt
maintainerQuoted 4 lines · On Wed, 21 Aug 2024 08:43:51 +0900 Masami Hiramatsu (Google)…
Quoted 1 line
Can you add the
__usedand see if it fixes it?Adding
__usedtoDYN_FTRACE_TEST_NAME()andDYN_FTRACE_TEST_NAME2()does not change, the test still fails.
OK, now that sounds like a bug in LTO itself.
-- Steve
Masami Hiramatsu (Google)
maintainerQuoted 9 lines · On Tue, 20 Aug 2024 19:49:14 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 4 lines · On Wed, 21 Aug 2024 08:43:51 +0900 Masami Hiramatsu (Google)…
Quoted 1 line
Can you add the
__usedand see if it fixes it?Adding
__usedtoDYN_FTRACE_TEST_NAME()andDYN_FTRACE_TEST_NAME2()does not change, the test still fails.OK, now that sounds like a bug in LTO itself.
Hmm, I think __used just preserve the function exists as a function. But the callsite can be optimized. This mean the __used function code is duplicated, and embedded one copy in the callsite, but keep another copy as a function which can be used from outside. But "noinline" attribute seems to be expected not embedded in the callsite (because that is what "inlined" mean), so it looks like a bug.
Thank you,
Quoted 2 lines
-- Steve
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Masami Hiramatsu (Google)
maintainerQuoted 29 lines · On Wed, 21 Aug 2024 08:43:51 +0900 Masami Hiramatsu (Google)…
Quoted 26 lines · On Tue, 20 Aug 2024 18:11:09 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 9 lines · On Wed, 21 Aug 2024 07:05:39 +0900 Masami Hiramatsu (Google)…
Does the noinline attribute prevent embedding callsite too? I mean
extern
callee()noinline
callee()
{
...
}Quoted 8 lines
caller(){ callee() // (*) }In this case, does noinline prevent LTO to embed the callee at the
callsite(*)or prevent LTO remove thecallee()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.
Quoted 8 lines
Quoted 1 line
Can you add the
__usedand see if it fixes it?Adding
__usedtoDYN_FTRACE_TEST_NAME()andDYN_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.
OK, it is succeeded! Calling caller via global function pointer makes it run as we expected. It passed the dynamic_ftrace test, but other tests still fails. Those need to be called via function pointer too.
[ 1.851324] Testing dynamic ftrace: PASSED [ 2.083329] Testing dynamic ftrace ops #1: [ 2.173751] (0 0 0 0 0) FAILED! [ 2.182337] ------------[ cut here ]------------ [ 2.183323] WARNING: CPU: 0 PID: 1 at kernel/trace/trace.c:2143 run_tracer_sel0 [ 2.184323] Modules linked in:
Anyway, here is what I did.
kernel/trace/trace_selftest.c +18 -5
@@ -353,9 +353,10 @@ static int trace_selftest_ops(struct trace_array *tr, int cnt) }/* Test dynamic code modification and ftrace filters */ -static int trace_selftest_startup_dynamic_tracing (struct tracer *trace, -struct trace_array *tr, -int (*func)(void )) +static int noinline +trace_selftest_startup_dynamic_tracing (struct tracer *trace, +struct trace_array *tr, +int (*func)(void )) {int save_ftrace_enabled = ftrace_enabled;unsigned long count;
@@ -569,10 +570,22 @@ trace_selftest_function_recursion(void)return ret; }#else -# define trace_selftest_startup_dynamic_tracing (trace, tr, func) ({ 0; }) +static int trace_selftest_startup_dynamic_tracing (struct tracer *trace, +struct trace_array *tr, +int (*func)(void )) +{ +if (!trace || !tr || !func) +return -EINVAL ; +return 0 ; +}# define trace_selftest_function_recursion () ({ 0; })#endif /* CONFIG_DYNAMIC_FTRACE */ +int (*global_trace_selftest_startup_dynamic_tracing)(struct tracer *trace, +struct trace_array *tr, +int (*func)(void )) + = trace_selftest_startup_dynamic_tracing; + static enum { TRACE_SELFTEST_REGS_START, TRACE_SELFTEST_REGS_FOUND,
@@ -732,7 +745,7 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr) goto out; } - ret =trace_selftest_startup_dynamic_tracing (trace, tr, + ret =global_trace_selftest_startup_dynamic_tracing (trace, tr,DYN_FTRACE_TEST_NAME );if (ret) goto out;
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Quoted 40 lines · Masami Hiramatsu
Quoted 36 lines · On Wed, 21 Aug 2024 08:43:51 +0900 Masami Hiramatsu (Google)…
Quoted 22 lines · On Tue, 20 Aug 2024 18:11:09 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 9 lines · On Wed, 21 Aug 2024 07:05:39 +0900 Masami Hiramatsu (Google)…
Does the noinline attribute prevent embedding callsite too? I mean
extern
callee()noinline
callee()
{
...
}Quoted 8 lines
caller()
{
callee()// (*)
}In this case, does noinline prevent LTO to embed the callee at the
callsite(*)or prevent LTO remove thecallee()symbol?Quoted 5 lines
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
__usedand see if it fixes it?Adding
__usedtoDYN_FTRACE_TEST_NAME()andDYN_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?
Quoted 5 lines
Quoted 1 line
Let me try.
OK, it is succeeded! Calling
callervia global function pointer makes it run as we expected. It passed thedynamic_ftracetest, but other tests still fails. Those need to be called via function pointer too.
I was able to reproduce this with LTO_CLANG_FULL, and it indeed optimizes away the direct calls to the empty stubs, but the functions are still there. LTO_CLANG_THIN doesn't perform this optimization, presumably because it doesn't have full visibility to the other TU.
Sami
Quoted 32 lines · Masami Hiramatsu
Quoted 21 lines · On Tue, 20 Aug 2024 08:10:42 -0700 Sami Tolvanen <[email protected]>…
Quoted 20 lines · Mark Rutland
Quoted 17 lines · Masami Hiramatsu
Quoted 10 lines · On Mon, 19 Aug 2024 12:02:44 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Tue, 20 Aug 2024 00:56:49 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Yeah, we need such option at least for function call test.
Could you add the noinline, and if it fixes the issue send a patch?
I found the target function already has "noinline". I tried to add noinline to the testing function (callsite), but it also did not work.
I think "noinline" is for the compiler, but LTO is done by the linker.Quoted 7 lines
Quoted 2 lines
If LTO is breaking noinline, then that has much larger implications for noinstr code and similar, and means that LTO is unsound...
The noinline attribute is preserved in LLVM IR, so it should continue to work with LTO. Which function are we talking about here? Are you sure the function was inlined instead of being dropped completely? Does marking the function
__usedhelp?
Quoted 5 lines
We are talking about
trace_selftest_startup_dynamic_tracing()inkernel/trace/trace_selftest.c. The callee isfunc()which is actuallyDYN_FTRACE_TEST_NAME()inkernel/trace/trace_selftest_dynamic.c. That function passed as pointer (but the compiler can embed it by constant propagation.)
Ah, so IIUC the function isn't being inlined; the call is being optimized away becase callee() has no side-effects.
That can happen without LTO if the caller is in the same compilation unit, and I have worked around that in the past by adding a barrier() into the callee.
If you add a barrier() into the callee, does it work? I suspect that's a reasonable workaround.
Mark.
Quoted 39 lines · Mark Rutland
Quoted 32 lines · Masami Hiramatsu
Quoted 21 lines · On Tue, 20 Aug 2024 08:10:42 -0700 Sami Tolvanen <[email protected]>…
Quoted 20 lines · Mark Rutland
Quoted 17 lines · Masami Hiramatsu
Quoted 10 lines · On Mon, 19 Aug 2024 12:02:44 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Tue, 20 Aug 2024 00:56:49 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines
We may need to add "noinline" or something to make sure those functions don't get inlined for LTO.
Yeah, we need such option at least for function call test.
Could you add the noinline, and if it fixes the issue send a patch?
I found the target function already has "noinline". I tried to add noinline to the testing function (callsite), but it also did not work.
I think "noinline" is for the compiler, but LTO is done by the linker.Quoted 7 lines
Quoted 2 lines
If LTO is breaking noinline, then that has much larger implications for noinstr code and similar, and means that LTO is unsound...
The noinline attribute is preserved in LLVM IR, so it should continue to work with LTO. Which function are we talking about here? Are you sure the function was inlined instead of being dropped completely? Does marking the function
__usedhelp?Quoted 5 lines
We are talking about
trace_selftest_startup_dynamic_tracing()inkernel/trace/trace_selftest.c. The callee isfunc()which is actuallyDYN_FTRACE_TEST_NAME()inkernel/trace/trace_selftest_dynamic.c. That function passed as pointer (but the compiler can embed it by constant propagation.)
Quoted 6 lines
Ah, so IIUC the function isn't being inlined; the call is being optimized away becase
callee()has no side-effects.That can happen without LTO if the caller is in the same compilation unit, and I have worked around that in the past by adding a
barrier()into the callee.
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.
Mark.
Steven Rostedt
maintainerQuoted 15 lines · On Wed, 21 Aug 2024 16:42:07 +0100 Mark Rutland <[email protected]> wrote:
FWIW, that was in
samples/ftrace/ftrace-ops.c, wheretracee_relevant()andtracee_irrelevant()have thebarrier():| /* | * 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(); | }
Quoted 1 line
... 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?
-- Steve
kernel/trace/trace_selftest_dynamic.c +10 -2
@@ -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 ; }
Quoted 18 lines · On Wed, 21 Aug 2024 11:50:00 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 15 lines · On Wed, 21 Aug 2024 16:42:07 +0100 Mark Rutland <[email protected]> wrote:
FWIW, that was in
samples/ftrace/ftrace-ops.c, wheretracee_relevant()andtracee_irrelevant()have thebarrier():| /* | * 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(); | }
Quoted 5 lines
Quoted 1 line
... 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.
Thank you,
Quoted 30 lines
-- Steve
kernel/trace/trace_selftest_dynamic.c +10
-2@@ -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 ; }
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>