[Patch -tip 2/4] Tracing/ftrace: Make tracing suitable to run theinitcall tracer

From: Frédéric Weisbecker
Date: Tue Sep 23 2008 - 05:29:01 EST


The tracing engine have now to be init in early_initcall to set the initcall tracer.
Only the debugfs settings will be initialized at fs_initcall time.

Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
---
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f2ef72f..16f1409 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2990,7 +2990,7 @@ struct dentry *tracing_init_dentry(void)
#include "trace_selftest.c"
#endif

-static __init void tracer_init_debugfs(void)
+static __init int tracer_init_debugfs(void)
{
struct dentry *d_tracer;
struct dentry *entry;
@@ -3078,6 +3078,7 @@ static __init void tracer_init_debugfs(void)
#ifdef CONFIG_SYSPROF_TRACER
init_tracer_sysprof_debugfs(d_tracer);
#endif
+ return 0;
}

int trace_vprintk(unsigned long ip, const char *fmt, va_list args)
@@ -3504,12 +3505,16 @@ __init static int tracer_alloc_buffers(void)
pages, trace_nr_entries, (long)TRACE_ENTRY_SIZE);
pr_info(" actual entries %ld\n", global_trace.entries);

- tracer_init_debugfs();
-
trace_init_cmdlines();

register_tracer(&nop_trace);
+#ifdef CONFIG_INITCALL_TRACER
+ register_tracer(&initcall_tracer);
+ current_trace = &initcall_tracer;
+ current_trace->init(&global_trace);
+#else
current_trace = &nop_trace;
+#endif

/* All seems OK, enable tracing */
global_trace.ctrl = tracer_enabled;
@@ -3519,7 +3524,6 @@ __init static int tracer_alloc_buffers(void)
&trace_panic_notifier);

register_die_notifier(&trace_die_notifier);
-
return 0;

free_buffers:
@@ -3548,4 +3552,5 @@ __init static int tracer_alloc_buffers(void)
}
return ret;
}
-fs_initcall(tracer_alloc_buffers);
+early_initcall(tracer_alloc_buffers);
+fs_initcall(tracer_init_debugfs);