All of
 help / color / mirror / Atom feed
From: Steven Rostedt <>
To: LKML <>,
	Linux Trace Kernel <>
Cc: Masami Hiramatsu <>,
	Andrew Morton <>,
	Thomas Gleixner <>,
	Peter Zijlstra <>,
	Mark Rutland <>, Song Liu <>,, Kees Cook <>,
	Miguel Ojeda <>,
	Nick Desaulniers <>,
	Ingo Molnar <>
Subject: [PATCH] ftrace: Allow inline functions not inlined to be traced
Date: Tue, 2 May 2023 16:41:02 -0400	[thread overview]
Message-ID: <20230502164102.1a51cdb4@gandalf.local.home> (raw)

From: "Steven Rostedt (Google)" <>

Over 10 years ago there were many bugs that caused function tracing to
crash because some inlined function was not inlined and should not have
been traced. This made it hard to debug because when the developer tried
to reproduce it, if their compiler still inlined the function, the bug
would not trigger. The solution back then was simply to add "notrace" to
"inline" which would make sure all functions that are marked inline are
never traced even when the compiler decides to not inline them.

A lot has changed over the last 10 years.

1) ftrace_test_recursion_trylock() is now used by all ftrace hooks which
   will prevent the recursive crashes from happening that was caused by
   inlined functions being traced.

2) noinstr is now used to mark pretty much all functions that would also
   cause problems if they are traced.

Today, it is no longer a problem if an inlined function is not inlined and
is traced. Removing notrace from inline has been requested several times
over the years. I believe it is now safe to do so.

Signed-off-by: Steven Rostedt (Google) <>
 include/linux/compiler_types.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 547ea1ff806e..c8f23ba1c339 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -182,9 +182,8 @@ struct ftrace_likely_data {
  * externally visible function. This makes extern inline behave as per gnu89
  * semantics rather than c99. This prevents multiple symbol definition errors
  * of extern inline functions at link time.
- * A lot of inline functions can cause havoc with function tracing.
-#define inline inline __gnu_inline __inline_maybe_unused notrace
+#define inline inline __gnu_inline __inline_maybe_unused
  * gcc provides both __inline__ and __inline as alternate spellings of
@@ -230,7 +229,7 @@ struct ftrace_likely_data {
  * '__maybe_unused' allows us to avoid defined-but-not-used warnings.
-# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused
+# define __no_kasan_or_inline __no_sanitize_address __maybe_unused
 # define __no_sanitize_or_inline __no_kasan_or_inline
 # define __no_kasan_or_inline __always_inline
@@ -247,7 +246,7 @@ struct ftrace_likely_data {
  * disable all instrumentation. See Kconfig.kcsan where this is mandatory.
 # define __no_kcsan __no_sanitize_thread __disable_sanitizer_instrumentation
-# define __no_sanitize_or_inline __no_kcsan notrace __maybe_unused
+# define __no_sanitize_or_inline __no_kcsan __maybe_unused
 # define __no_kcsan

             reply	other threads:[~2023-05-02 20:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02 20:41 Steven Rostedt [this message]
2023-05-02 22:25 ` [PATCH] ftrace: Allow inline functions not inlined to be traced Song Liu
2023-05-31 21:50 ` Josh Poimboeuf

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230502164102.1a51cdb4@gandalf.local.home \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* 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.