diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2008-10-31 08:20:08 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-04 11:14:06 -0500 |
commit | d7ad44b697c9d13e445ddc7d16f736fbac333249 (patch) | |
tree | a18ac8995bf7158835c69ca1c9ab9b674fc617fa | |
parent | e55f605c14679c30be41473e60b7ad26524cdc35 (diff) |
tracing/fastboot: use sched switch tracer from boot tracer
Impact: enhance boot trace output with scheduling events
Use the sched_switch tracer from the boot tracer.
We also can trace schedule events inside the initcalls.
Sched tracing is disabled after the initcall has finished and
then reenabled before the next one is started.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/trace/trace.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 | ||||
-rw-r--r-- | kernel/trace/trace_boot.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 6 |
4 files changed, 12 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index e4c40c868d67..50d7018163f6 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -3251,6 +3251,8 @@ __init static int tracer_alloc_buffers(void) | |||
3251 | 3251 | ||
3252 | register_tracer(&nop_trace); | 3252 | register_tracer(&nop_trace); |
3253 | #ifdef CONFIG_BOOT_TRACER | 3253 | #ifdef CONFIG_BOOT_TRACER |
3254 | /* We don't want to launch sched_switch tracer yet */ | ||
3255 | global_trace.ctrl = 0; | ||
3254 | register_tracer(&boot_tracer); | 3256 | register_tracer(&boot_tracer); |
3255 | current_trace = &boot_tracer; | 3257 | current_trace = &boot_tracer; |
3256 | current_trace->init(&global_trace); | 3258 | current_trace->init(&global_trace); |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 8465ad052707..9911277b268b 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -49,6 +49,7 @@ struct ftrace_entry { | |||
49 | unsigned long parent_ip; | 49 | unsigned long parent_ip; |
50 | }; | 50 | }; |
51 | extern struct tracer boot_tracer; | 51 | extern struct tracer boot_tracer; |
52 | extern struct tracer sched_switch_trace; /* Used by the boot tracer */ | ||
52 | 53 | ||
53 | /* | 54 | /* |
54 | * Context switch trace entry - which task (and prio) we switched from/to: | 55 | * Context switch trace entry - which task (and prio) we switched from/to: |
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c index d104d5b46413..6bbc8794a6df 100644 --- a/kernel/trace/trace_boot.c +++ b/kernel/trace/trace_boot.c | |||
@@ -27,10 +27,14 @@ void start_boot_trace(void) | |||
27 | 27 | ||
28 | void enable_boot_trace(void) | 28 | void enable_boot_trace(void) |
29 | { | 29 | { |
30 | if (pre_initcalls_finished) | ||
31 | tracing_start_cmdline_record(); | ||
30 | } | 32 | } |
31 | 33 | ||
32 | void disable_boot_trace(void) | 34 | void disable_boot_trace(void) |
33 | { | 35 | { |
36 | if (pre_initcalls_finished) | ||
37 | tracing_stop_cmdline_record(); | ||
34 | } | 38 | } |
35 | 39 | ||
36 | void reset_boot_trace(struct trace_array *tr) | 40 | void reset_boot_trace(struct trace_array *tr) |
@@ -45,6 +49,8 @@ static void boot_trace_init(struct trace_array *tr) | |||
45 | 49 | ||
46 | for_each_cpu_mask(cpu, cpu_possible_map) | 50 | for_each_cpu_mask(cpu, cpu_possible_map) |
47 | tracing_reset(tr, cpu); | 51 | tracing_reset(tr, cpu); |
52 | |||
53 | sched_switch_trace.init(tr); | ||
48 | } | 54 | } |
49 | 55 | ||
50 | static void boot_trace_ctrl_update(struct trace_array *tr) | 56 | static void boot_trace_ctrl_update(struct trace_array *tr) |
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index 96620c714300..9d7bdac331dd 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -127,6 +127,7 @@ static void tracing_start_sched_switch(void) | |||
127 | long ref; | 127 | long ref; |
128 | 128 | ||
129 | mutex_lock(&tracepoint_mutex); | 129 | mutex_lock(&tracepoint_mutex); |
130 | tracer_enabled = 1; | ||
130 | ref = atomic_inc_return(&sched_ref); | 131 | ref = atomic_inc_return(&sched_ref); |
131 | if (ref == 1) | 132 | if (ref == 1) |
132 | tracing_sched_register(); | 133 | tracing_sched_register(); |
@@ -138,6 +139,7 @@ static void tracing_stop_sched_switch(void) | |||
138 | long ref; | 139 | long ref; |
139 | 140 | ||
140 | mutex_lock(&tracepoint_mutex); | 141 | mutex_lock(&tracepoint_mutex); |
142 | tracer_enabled = 0; | ||
141 | ref = atomic_dec_and_test(&sched_ref); | 143 | ref = atomic_dec_and_test(&sched_ref); |
142 | if (ref) | 144 | if (ref) |
143 | tracing_sched_unregister(); | 145 | tracing_sched_unregister(); |
@@ -158,12 +160,10 @@ static void start_sched_trace(struct trace_array *tr) | |||
158 | { | 160 | { |
159 | sched_switch_reset(tr); | 161 | sched_switch_reset(tr); |
160 | tracing_start_cmdline_record(); | 162 | tracing_start_cmdline_record(); |
161 | tracer_enabled = 1; | ||
162 | } | 163 | } |
163 | 164 | ||
164 | static void stop_sched_trace(struct trace_array *tr) | 165 | static void stop_sched_trace(struct trace_array *tr) |
165 | { | 166 | { |
166 | tracer_enabled = 0; | ||
167 | tracing_stop_cmdline_record(); | 167 | tracing_stop_cmdline_record(); |
168 | } | 168 | } |
169 | 169 | ||
@@ -190,7 +190,7 @@ static void sched_switch_trace_ctrl_update(struct trace_array *tr) | |||
190 | stop_sched_trace(tr); | 190 | stop_sched_trace(tr); |
191 | } | 191 | } |
192 | 192 | ||
193 | static struct tracer sched_switch_trace __read_mostly = | 193 | struct tracer sched_switch_trace __read_mostly = |
194 | { | 194 | { |
195 | .name = "sched_switch", | 195 | .name = "sched_switch", |
196 | .init = sched_switch_trace_init, | 196 | .init = sched_switch_trace_init, |