aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_boot.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_boot.c')
-rw-r--r--kernel/trace/trace_boot.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
index d0a5e50eeff2..bd5046c9deb7 100644
--- a/kernel/trace/trace_boot.c
+++ b/kernel/trace/trace_boot.c
@@ -13,23 +13,33 @@
13#include "trace.h" 13#include "trace.h"
14 14
15static struct trace_array *boot_trace; 15static struct trace_array *boot_trace;
16static int trace_boot_enabled; 16static bool pre_initcalls_finished;
17 17
18 18/* Tells the boot tracer that the pre_smp_initcalls are finished.
19/* Should be started after do_pre_smp_initcalls() in init/main.c */ 19 * So we are ready .
20 * It doesn't enable sched events tracing however.
21 * You have to call enable_boot_trace to do so.
22 */
20void start_boot_trace(void) 23void start_boot_trace(void)
21{ 24{
22 trace_boot_enabled = 1; 25 pre_initcalls_finished = true;
23} 26}
24 27
25void stop_boot_trace(void) 28void enable_boot_trace(void)
26{ 29{
27 trace_boot_enabled = 0; 30 if (pre_initcalls_finished)
31 tracing_start_cmdline_record();
28} 32}
29 33
30void reset_boot_trace(struct trace_array *tr) 34void disable_boot_trace(void)
31{ 35{
32 stop_boot_trace(); 36 if (pre_initcalls_finished)
37 tracing_stop_cmdline_record();
38}
39
40static void reset_boot_trace(struct trace_array *tr)
41{
42 sched_switch_trace.reset(tr);
33} 43}
34 44
35static void boot_trace_init(struct trace_array *tr) 45static void boot_trace_init(struct trace_array *tr)
@@ -37,18 +47,18 @@ static void boot_trace_init(struct trace_array *tr)
37 int cpu; 47 int cpu;
38 boot_trace = tr; 48 boot_trace = tr;
39 49
40 trace_boot_enabled = 0;
41
42 for_each_cpu_mask(cpu, cpu_possible_map) 50 for_each_cpu_mask(cpu, cpu_possible_map)
43 tracing_reset(tr, cpu); 51 tracing_reset(tr, cpu);
52
53 sched_switch_trace.init(tr);
44} 54}
45 55
46static void boot_trace_ctrl_update(struct trace_array *tr) 56static void boot_trace_ctrl_update(struct trace_array *tr)
47{ 57{
48 if (tr->ctrl) 58 if (tr->ctrl)
49 start_boot_trace(); 59 enable_boot_trace();
50 else 60 else
51 stop_boot_trace(); 61 disable_boot_trace();
52} 62}
53 63
54static enum print_line_t initcall_print_line(struct trace_iterator *iter) 64static enum print_line_t initcall_print_line(struct trace_iterator *iter)
@@ -99,7 +109,7 @@ void trace_boot(struct boot_trace *it, initcall_t fn)
99 unsigned long irq_flags; 109 unsigned long irq_flags;
100 struct trace_array *tr = boot_trace; 110 struct trace_array *tr = boot_trace;
101 111
102 if (!trace_boot_enabled) 112 if (!pre_initcalls_finished)
103 return; 113 return;
104 114
105 /* Get its name now since this function could 115 /* Get its name now since this function could