diff mbox series

ftrace: Allow tracing rcuref_*_slowpath

Message ID 20250115-rcuref-ftrace-v1-1-76fa408c9884@cloudflare.com (mailing list archive)
State New
Headers show
Series ftrace: Allow tracing rcuref_*_slowpath | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 1 of 1 maintainers
netdev/build_clang success Errors and warnings before: 33 this patch: 33
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jakub Sitnicki Jan. 15, 2025, 11:24 a.m. UTC
All objects under lib/ are built as non-traceable for performance reasons
since commit 2464a609ded0 ("ftrace: do not trace library functions"):

This prevents users not only from tracing library functions with ftrace but
also from attaching kprobes to them:

  # perf probe -a rcuref_put_slowpath:32
  [   65.228593] trace_kprobe: Could not probe notrace function rcuref_put_slowpath

The available solution is to rebuild the kernel with
CONFIG_KPROBE_EVENTS_ON_NOTRACE=y. A usually disabled option because of its
potential pitfalls, intended for those debugging ftrace itself.

By default, in face of any bugs with reference counting, like the one we
are currently tracking down [1], users cannot leverage kprobes to collect
additional info like stack traces or data from the rcuref container, for
example dst_entry. Building a debug kernel is the only option.

Make it easier for users to troubleshoot reference counting issues by
making the two rcuref_*_slowpath functions traceable.

[1] https://lore.kernel.org/all/87ikxtfhky.fsf@cloudflare.com/

Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
---
 lib/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/lib/Makefile b/lib/Makefile
index a8155c972f02856fcc61ee949ddda436cfe211ff..1f5c9557c4cb5bf2b6e4ac7e87ed30bb3c8f4664 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -5,6 +5,10 @@ 
 
 ccflags-remove-$(CONFIG_FUNCTION_TRACER) += $(CC_FLAGS_FTRACE)
 
+ifdef CONFIG_FUNCTION_TRACER
+CFLAGS_rcuref.o += $(CC_FLAGS_FTRACE)
+endif
+
 # These files are disabled because they produce lots of non-interesting and/or
 # flaky coverage that is not a function of syscall inputs. For example,
 # rbtree can be global and individual rotations don't correlate with inputs.