Skip to contentSkip to conversation

ftrace: perform an initialization for ftrace to enable it

PATCH Applied Frederic Weisbecker 2 participants 2 messages Oct 28, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ftrace: perform an initialization for ftrace to enable it

Impact: Corrects a bug which made the function tracer not functionnal

With latest git, the function tracer didn't get any trace.
The problem was the fact that ftrace_enabled wasn't
initialized to 1 because ftrace hasn't any init function when DYNAMIC_FTRACE is disabled.
So when a tracer tries to register an ftrace_ops struct, __register_ftrace_function failed to set the hook.

This patch corrects it by setting an init function to initialize ftrace during the boot.

---

kernel/trace/ftrace.c +8 -0
index 7618c52..4a39d24 100644
@@ -1339,6 +1339,14 @@ void __init ftrace_init(void)
 }
 
 #else
+
+static int __init ftrace_nodyn_init(void)
+{
+	ftrace_enabled = 1;
+	return 0;
+}
+device_initcall(ftrace_nodyn_init);
+
 # define ftrace_startup()		do { } while (0)
 # define ftrace_shutdown()		do { } while (0)
 # define ftrace_startup_sysctl()	do { } while (0)
Applied
#1 lore raw
Quoted 8 lines · Frederic Weisbecker

Impact: Corrects a bug which made the function tracer not functionnal

With latest git, the function tracer didn't get any trace. The problem was the fact that ftrace_enabled wasn't initialized to 1 because ftrace hasn't any init function when DYNAMIC_FTRACE is disabled. So when a tracer tries to register an ftrace_ops struct, __register_ftrace_function failed to set the hook.

Quoted 4 lines

This patch corrects it by setting an init function to initialize ftrace during the boot.

applied to tip/tracing/urgent, thanks Frederic!

Ingo