[PATCH 2/3] parisc/ftrace: use static key to enable function graph

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of comparing function descriptors add a static branch
so the condition gets patched during runtime.

Signed-off-by: Sven Schnelle <svens@xxxxxxxxxxxxxx>
---
 arch/parisc/kernel/ftrace.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c
index f5f467ebf94c..7a2de664242a 100644
--- a/arch/parisc/kernel/ftrace.c
+++ b/arch/parisc/kernel/ftrace.c
@@ -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
-- 
2.33.0




[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux