@@ -23,6 +23,7 @@
#define __hot __section(".text.hot")
+static DEFINE_STATIC_KEY_FALSE(ftrace_graph_enabled);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
/*
* Hook the return address and push it in the stack of return addrs
@@ -61,9 +62,7 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent,
ftrace_trace_function(self_addr, parent, function_trace_op, fregs);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
- if (dereference_function_descriptor(ftrace_graph_return) !=
- dereference_function_descriptor(ftrace_stub) ||
- ftrace_graph_entry != ftrace_graph_entry_stub) {
+ if (static_branch_unlikely(&ftrace_graph_enabled)) {
unsigned long *parent_rp;
/* calculate pointer to %rp in stack */
@@ -81,11 +80,13 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent,
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
int ftrace_enable_ftrace_graph_caller(void)
{
+ static_key_enable(&ftrace_graph_enabled.key);
return 0;
}
int ftrace_disable_ftrace_graph_caller(void)
{
+ static_key_disable(&ftrace_graph_enabled.key);
return 0;
}
#endif
Instead of comparing function descriptors add a static branch so the condition gets patched during runtime. Signed-off-by: Sven Schnelle <svens@stackframe.org> --- arch/parisc/kernel/ftrace.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)