parisc/ftrace: set function trace function
authorSven Schnelle <svens@stackframe.org>
Sat, 23 Oct 2021 18:21:00 +0000 (20:21 +0200)
committerHelge Deller <deller@gmx.de>
Mon, 1 Nov 2021 06:36:01 +0000 (07:36 +0100)
With DYNAMIC_FTRACE, we need to implement ftrace_update_trace_func
and not call ftrace_trace_function() directly, as ftrace doesn't
expect calls to this function during code patching.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/kernel/ftrace.c

index 0a1e75a..3a57718 100644 (file)
@@ -48,20 +48,16 @@ static void __hot prepare_ftrace_return(unsigned long *parent,
 }
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 
+static ftrace_func_t ftrace_func;
+
 void notrace __hot ftrace_function_trampoline(unsigned long parent,
                                unsigned long self_addr,
                                unsigned long org_sp_gr3,
                                struct ftrace_regs *fregs)
 {
-#ifndef CONFIG_DYNAMIC_FTRACE
-       extern ftrace_func_t ftrace_trace_function;
-#endif
        extern struct ftrace_ops *function_trace_op;
 
-       if (function_trace_op->flags & FTRACE_OPS_FL_ENABLED &&
-           ftrace_trace_function != ftrace_stub)
-               ftrace_trace_function(self_addr, parent,
-                               function_trace_op, fregs);
+       ftrace_func(self_addr, parent, function_trace_op, fregs);
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
        if (dereference_function_descriptor(ftrace_graph_return) !=
@@ -99,8 +95,10 @@ int __init ftrace_dyn_arch_init(void)
 {
        return 0;
 }
+
 int ftrace_update_ftrace_func(ftrace_func_t func)
 {
+       ftrace_func = func;
        return 0;
 }