LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ftrace: perform an initialization for ftrace to enable it
@ 2008-10-28 19:17 Frederic Weisbecker
  2008-10-28 18:16 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Frederic Weisbecker @ 2008-10-28 19:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, linux-kernel

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.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7618c52..4a39d24 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-28 18:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-28 19:17 [PATCH] ftrace: perform an initialization for ftrace to enable it Frederic Weisbecker
2008-10-28 18:16 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).