[PATCH 0/9] ftrace: Have callbacks handle their own recursion

From: Steven Rostedt
Date: Wed Oct 28 2020 - 18:20:15 EST


I found that having the ftrace infrastructure use its own trampoline to
handle recursion and RCU by defaulte unless the ftrace_ops set the
appropriate flags, was an issue that nobody set those flags. But then their
callbacks would suffer from an unnecessary overhead instead of simply
handling the recursion itself.

This series makes it mandatory that ftrace callbacks handle recursion or set
a flag asking ftrace to do it for it. It also creates helper functions to
help these callbacks to have recursion protection.

Steven Rostedt (VMware) (9):
ftrace: Move the recursion testing into global headers
ftrace: Add ftrace_test_recursion_trylock() helper function
ftrace: Optimize testing what context current is in
pstore/ftrace: Add recursion protection to the ftrace callback
kprobes/ftrace: Add recursion protection to the ftrace callback
livepatch/ftrace: Add recursion protection to the ftrace callback
perf/ftrace: Add recursion protection to the ftrace callback
perf/ftrace: Check for rcu_is_watching() in callback function
ftrace: Reverse what the RECURSION flag means in the ftrace_ops

----
Documentation/trace/ftrace-uses.rst | 82 +++++++++++----
arch/csky/kernel/probes/ftrace.c | 12 ++-
arch/parisc/kernel/ftrace.c | 13 ++-
arch/powerpc/kernel/kprobes-ftrace.c | 11 +-
arch/s390/kernel/ftrace.c | 13 ++-
arch/x86/kernel/kprobes/ftrace.c | 12 ++-
fs/pstore/ftrace.c | 6 ++
include/linux/ftrace.h | 13 +--
include/linux/trace_recursion.h | 199 +++++++++++++++++++++++++++++++++++
kernel/livepatch/patch.c | 5 +
kernel/trace/fgraph.c | 3 +-
kernel/trace/ftrace.c | 20 ++--
kernel/trace/trace.h | 156 ---------------------------
kernel/trace/trace_event_perf.c | 13 ++-
kernel/trace/trace_events.c | 1 -
kernel/trace/trace_functions.c | 14 ++-
kernel/trace/trace_selftest.c | 7 +-
kernel/trace/trace_stack.c | 1 -
18 files changed, 358 insertions(+), 223 deletions(-)
create mode 100644 include/linux/trace_recursion.h