diff options
-rw-r--r-- | kernel/trace/Kconfig | 7 | ||||
-rw-r--r-- | kernel/trace/trace.c | 5 | ||||
-rw-r--r-- | kernel/trace/trace_boot.c | 11 |
3 files changed, 11 insertions, 12 deletions
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index dde1d46f77e5..28f2644484d9 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -164,9 +164,8 @@ config BOOT_TRACER | |||
164 | representation of the delays during initcalls - but the raw | 164 | representation of the delays during initcalls - but the raw |
165 | /debug/tracing/trace text output is readable too. | 165 | /debug/tracing/trace text output is readable too. |
166 | 166 | ||
167 | ( Note that tracing self tests can't be enabled if this tracer is | 167 | You must pass in ftrace=initcall to the kernel command line |
168 | selected, because the self-tests are an initcall as well and that | 168 | to enable this on bootup. |
169 | would invalidate the boot trace. ) | ||
170 | 169 | ||
171 | config TRACE_BRANCH_PROFILING | 170 | config TRACE_BRANCH_PROFILING |
172 | bool "Trace likely/unlikely profiler" | 171 | bool "Trace likely/unlikely profiler" |
@@ -326,7 +325,7 @@ config FTRACE_SELFTEST | |||
326 | 325 | ||
327 | config FTRACE_STARTUP_TEST | 326 | config FTRACE_STARTUP_TEST |
328 | bool "Perform a startup test on ftrace" | 327 | bool "Perform a startup test on ftrace" |
329 | depends on TRACING && DEBUG_KERNEL && !BOOT_TRACER | 328 | depends on TRACING && DEBUG_KERNEL |
330 | select FTRACE_SELFTEST | 329 | select FTRACE_SELFTEST |
331 | help | 330 | help |
332 | This option performs a series of startup tests on ftrace. On bootup | 331 | This option performs a series of startup tests on ftrace. On bootup |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 2c720c79bc60..40edef4255c5 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -3167,12 +3167,9 @@ __init static int tracer_alloc_buffers(void) | |||
3167 | trace_init_cmdlines(); | 3167 | trace_init_cmdlines(); |
3168 | 3168 | ||
3169 | register_tracer(&nop_trace); | 3169 | register_tracer(&nop_trace); |
3170 | current_trace = &nop_trace; | ||
3170 | #ifdef CONFIG_BOOT_TRACER | 3171 | #ifdef CONFIG_BOOT_TRACER |
3171 | register_tracer(&boot_tracer); | 3172 | register_tracer(&boot_tracer); |
3172 | current_trace = &boot_tracer; | ||
3173 | current_trace->init(&global_trace); | ||
3174 | #else | ||
3175 | current_trace = &nop_trace; | ||
3176 | #endif | 3173 | #endif |
3177 | /* All seems OK, enable tracing */ | 3174 | /* All seems OK, enable tracing */ |
3178 | tracing_disabled = 0; | 3175 | tracing_disabled = 0; |
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c index 0e94b3d091f7..1f07895977a0 100644 --- a/kernel/trace/trace_boot.c +++ b/kernel/trace/trace_boot.c | |||
@@ -28,13 +28,13 @@ void start_boot_trace(void) | |||
28 | 28 | ||
29 | void enable_boot_trace(void) | 29 | void enable_boot_trace(void) |
30 | { | 30 | { |
31 | if (pre_initcalls_finished) | 31 | if (boot_trace && pre_initcalls_finished) |
32 | tracing_start_sched_switch_record(); | 32 | tracing_start_sched_switch_record(); |
33 | } | 33 | } |
34 | 34 | ||
35 | void disable_boot_trace(void) | 35 | void disable_boot_trace(void) |
36 | { | 36 | { |
37 | if (pre_initcalls_finished) | 37 | if (boot_trace && pre_initcalls_finished) |
38 | tracing_stop_sched_switch_record(); | 38 | tracing_stop_sched_switch_record(); |
39 | } | 39 | } |
40 | 40 | ||
@@ -43,6 +43,9 @@ static int boot_trace_init(struct trace_array *tr) | |||
43 | int cpu; | 43 | int cpu; |
44 | boot_trace = tr; | 44 | boot_trace = tr; |
45 | 45 | ||
46 | if (!tr) | ||
47 | return 0; | ||
48 | |||
46 | for_each_cpu(cpu, cpu_possible_mask) | 49 | for_each_cpu(cpu, cpu_possible_mask) |
47 | tracing_reset(tr, cpu); | 50 | tracing_reset(tr, cpu); |
48 | 51 | ||
@@ -132,7 +135,7 @@ void trace_boot_call(struct boot_trace_call *bt, initcall_t fn) | |||
132 | unsigned long irq_flags; | 135 | unsigned long irq_flags; |
133 | struct trace_array *tr = boot_trace; | 136 | struct trace_array *tr = boot_trace; |
134 | 137 | ||
135 | if (!pre_initcalls_finished) | 138 | if (!tr || !pre_initcalls_finished) |
136 | return; | 139 | return; |
137 | 140 | ||
138 | /* Get its name now since this function could | 141 | /* Get its name now since this function could |
@@ -164,7 +167,7 @@ void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn) | |||
164 | unsigned long irq_flags; | 167 | unsigned long irq_flags; |
165 | struct trace_array *tr = boot_trace; | 168 | struct trace_array *tr = boot_trace; |
166 | 169 | ||
167 | if (!pre_initcalls_finished) | 170 | if (!tr || !pre_initcalls_finished) |
168 | return; | 171 | return; |
169 | 172 | ||
170 | sprint_symbol(bt->func, (unsigned long)fn); | 173 | sprint_symbol(bt->func, (unsigned long)fn); |