trace: let boot trace be chosen by command line
authorSteven Rostedt <srostedt@redhat.com>
Tue, 3 Feb 2009 02:38:33 +0000 (21:38 -0500)
committerIngo Molnar <mingo@elte.hu>
Tue, 3 Feb 2009 05:26:12 +0000 (06:26 +0100)
Now that we have a working ftrace=<tracer> function, make the boot
tracer get activated by it. This way we can turn it on or off without
recompiling the kernel, as well as keeping the selftests on. The
selftests are disabled whenever a default tracer starts running.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/Kconfig
kernel/trace/trace.c
kernel/trace/trace_boot.c

index dde1d46f77e5b3e5181335597bb701ac660f22b3..28f2644484d9bd70fc0ef16f2ca85d4e38f03741 100644 (file)
@@ -164,9 +164,8 @@ config BOOT_TRACER
          representation of the delays during initcalls - but the raw
          /debug/tracing/trace text output is readable too.
 
-         ( Note that tracing self tests can't be enabled if this tracer is
-           selected, because the self-tests are an initcall as well and that
-           would invalidate the boot trace. )
+         You must pass in ftrace=initcall to the kernel command line
+         to enable this on bootup.
 
 config TRACE_BRANCH_PROFILING
        bool "Trace likely/unlikely profiler"
@@ -326,7 +325,7 @@ config FTRACE_SELFTEST
 
 config FTRACE_STARTUP_TEST
        bool "Perform a startup test on ftrace"
-       depends on TRACING && DEBUG_KERNEL && !BOOT_TRACER
+       depends on TRACING && DEBUG_KERNEL
        select FTRACE_SELFTEST
        help
          This option performs a series of startup tests on ftrace. On bootup
index 2c720c79bc603ae1f0c890c6315a2782b60e2598..40edef4255c5956a7e9737f9a5a570dfdaf26f47 100644 (file)
@@ -3167,12 +3167,9 @@ __init static int tracer_alloc_buffers(void)
        trace_init_cmdlines();
 
        register_tracer(&nop_trace);
+       current_trace = &nop_trace;
 #ifdef CONFIG_BOOT_TRACER
        register_tracer(&boot_tracer);
-       current_trace = &boot_tracer;
-       current_trace->init(&global_trace);
-#else
-       current_trace = &nop_trace;
 #endif
        /* All seems OK, enable tracing */
        tracing_disabled = 0;
index 0e94b3d091f70229d4ff521ea18aa3823c6b5ed7..1f07895977a046ac3b34fa4fbecd004bcaf00480 100644 (file)
@@ -28,13 +28,13 @@ void start_boot_trace(void)
 
 void enable_boot_trace(void)
 {
-       if (pre_initcalls_finished)
+       if (boot_trace && pre_initcalls_finished)
                tracing_start_sched_switch_record();
 }
 
 void disable_boot_trace(void)
 {
-       if (pre_initcalls_finished)
+       if (boot_trace && pre_initcalls_finished)
                tracing_stop_sched_switch_record();
 }
 
@@ -43,6 +43,9 @@ static int boot_trace_init(struct trace_array *tr)
        int cpu;
        boot_trace = tr;
 
+       if (!tr)
+               return 0;
+
        for_each_cpu(cpu, cpu_possible_mask)
                tracing_reset(tr, cpu);
 
@@ -132,7 +135,7 @@ void trace_boot_call(struct boot_trace_call *bt, initcall_t fn)
        unsigned long irq_flags;
        struct trace_array *tr = boot_trace;
 
-       if (!pre_initcalls_finished)
+       if (!tr || !pre_initcalls_finished)
                return;
 
        /* Get its name now since this function could
@@ -164,7 +167,7 @@ void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn)
        unsigned long irq_flags;
        struct trace_array *tr = boot_trace;
 
-       if (!pre_initcalls_finished)
+       if (!tr || !pre_initcalls_finished)
                return;
 
        sprint_symbol(bt->func, (unsigned long)fn);