* [PATCH] tracing: make ftrace_likely_update() declaration visible
@ 2023-05-17 12:47 Arnd Bergmann
2023-05-17 16:39 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2023-05-17 12:47 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: linux-trace-kernel, Arnd Bergmann, Luc Van Oostenryck, Kees Cook,
Bart Van Assche, Sami Tolvanen, Peter Zijlstra (Intel),
linux-sparse, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
This function is only used when CONFIG_TRACE_BRANCH_PROFILING is
set, and the declaration is hidden behind this Kconfig symbol,
which causes a warning if disabled:
kernel/trace/trace_branch.c:205:6: error: no previous prototype for 'ftrace_likely_update' [-Werror=missing-prototypes]
Move the declaration out of the #ifdef to avoid the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/linux/compiler.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 947a60b801db..d7779a18b24f 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -12,11 +12,10 @@
* Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
* to disable branch tracing on a per file basis.
*/
-#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
- && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
void ftrace_likely_update(struct ftrace_likely_data *f, int val,
int expect, int is_constant);
-
+#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
+ && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
#define likely_notrace(x) __builtin_expect(!!(x), 1)
#define unlikely_notrace(x) __builtin_expect(!!(x), 0)
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tracing: make ftrace_likely_update() declaration visible
2023-05-17 12:47 [PATCH] tracing: make ftrace_likely_update() declaration visible Arnd Bergmann
@ 2023-05-17 16:39 ` Linus Torvalds
2023-05-17 18:44 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2023-05-17 16:39 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Steven Rostedt, Masami Hiramatsu, linux-trace-kernel,
Arnd Bergmann, Luc Van Oostenryck, Kees Cook, Bart Van Assche,
Sami Tolvanen, Peter Zijlstra (Intel), linux-sparse, linux-kernel
On Wed, May 17, 2023 at 5:47 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> This function is only used when CONFIG_TRACE_BRANCH_PROFILING is
> set, and the declaration is hidden behind this Kconfig symbol,
> which causes a warning if disabled:
That explanation is not very clear.
The problem is that the tracing code itself is built with
DISABLE_BRANCH_PROFILING, in order to not recurse. And that hides the
declaration when the definition is compiled, leading to the problem.
CONFIG_TRACE_BRANCH_PROFILING isn't the problem in itself - *that*
part of the test is consistent (not used, not declared, and not
compiled if it is off).
The problem is that DISABLE_BRANCH_PROFILING case, where it is used
elsewhere, but not declared when it is itself compiled.
I applied the patch, but I tried to reword the explanation to be more
clear. I may have failed.
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tracing: make ftrace_likely_update() declaration visible
2023-05-17 16:39 ` Linus Torvalds
@ 2023-05-17 18:44 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2023-05-17 18:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: Arnd Bergmann, Masami Hiramatsu, linux-trace-kernel,
Arnd Bergmann, Luc Van Oostenryck, Kees Cook, Bart Van Assche,
Sami Tolvanen, Peter Zijlstra (Intel), linux-sparse, linux-kernel
On Wed, 17 May 2023 09:39:41 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Wed, May 17, 2023 at 5:47 AM Arnd Bergmann <arnd@kernel.org> wrote:
> >
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > This function is only used when CONFIG_TRACE_BRANCH_PROFILING is
> > set, and the declaration is hidden behind this Kconfig symbol,
> > which causes a warning if disabled:
>
> That explanation is not very clear.
>
> The problem is that the tracing code itself is built with
> DISABLE_BRANCH_PROFILING, in order to not recurse. And that hides the
> declaration when the definition is compiled, leading to the problem.
>
> CONFIG_TRACE_BRANCH_PROFILING isn't the problem in itself - *that*
> part of the test is consistent (not used, not declared, and not
> compiled if it is off).
>
> The problem is that DISABLE_BRANCH_PROFILING case, where it is used
> elsewhere, but not declared when it is itself compiled.
>
> I applied the patch, but I tried to reword the explanation to be more
> clear. I may have failed.
>
That's pretty much it. The DISABLE_BRANCH_PROFILING is to disable it in
various places where it will crash if used (vdso is one of them). It is
also used to prevent the code that declares it from recursing on itself (as
you stated).
Thus, the issue is simply that the declaration is hidden by the recursion
protection where the function is actually defined.
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-17 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-17 12:47 [PATCH] tracing: make ftrace_likely_update() declaration visible Arnd Bergmann
2023-05-17 16:39 ` Linus Torvalds
2023-05-17 18:44 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).