diff options
Diffstat (limited to 'kernel/trace/trace_boot.c')
-rw-r--r-- | kernel/trace/trace_boot.c | 36 |
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 | ||
15 | static struct trace_array *boot_trace; | 15 | static struct trace_array *boot_trace; |
16 | static int trace_boot_enabled; | 16 | static 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 | */ | ||
20 | void start_boot_trace(void) | 23 | void start_boot_trace(void) |
21 | { | 24 | { |
22 | trace_boot_enabled = 1; | 25 | pre_initcalls_finished = true; |
23 | } | 26 | } |
24 | 27 | ||
25 | void stop_boot_trace(void) | 28 | void 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 | ||
30 | void reset_boot_trace(struct trace_array *tr) | 34 | void disable_boot_trace(void) |
31 | { | 35 | { |
32 | stop_boot_trace(); | 36 | if (pre_initcalls_finished) |
37 | tracing_stop_cmdline_record(); | ||
38 | } | ||
39 | |||
40 | static void reset_boot_trace(struct trace_array *tr) | ||
41 | { | ||
42 | sched_switch_trace.reset(tr); | ||
33 | } | 43 | } |
34 | 44 | ||
35 | static void boot_trace_init(struct trace_array *tr) | 45 | static 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 | ||
46 | static void boot_trace_ctrl_update(struct trace_array *tr) | 56 | static 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 | ||
54 | static enum print_line_t initcall_print_line(struct trace_iterator *iter) | 64 | static 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 |