History

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.

Frederic Weisbecker committed 18 years ago

Commit d7ad44b1 parent e55f6054 files · +12 −3Browse files

Unified · Split

4 files
  1. kernel/trace/trace.c +2 −0
  2. kernel/trace/trace.h +1 −0
  3. kernel/trace/trace_boot.c +6 −0
  4. kernel/trace/trace_sched_switch.c +3 −3
kernel/trace/trace.c+2−0
@@ -3251,6 +3251,8 @@ __init static int tracer_alloc_buffers(void) · 3250 unmodified lines
32513251
32523252 register_tracer(&nop_trace);
32533253 #ifdef CONFIG_BOOT_TRACER
3254+ /* We don't want to launch sched_switch tracer yet */
3255+ global_trace.ctrl = 0;
32543256 register_tracer(&boot_tracer);
32553257 current_trace = &boot_tracer;
32563258 current_trace->init(&global_trace);
kernel/trace/trace.h+1−0
@@ -49,6 +49,7 @@ struct ftrace_entry { · 48 unmodified lines
4949 unsigned long parent_ip;
5050 };
5151 extern struct tracer boot_tracer;
52+extern struct tracer sched_switch_trace; /* Used by the boot tracer */
5253
5354 /*
5455 * Context switch trace entry - which task (and prio) we switched from/to:
kernel/trace/trace_boot.c+6−0
@@ -27,10 +27,14 @@ void start_boot_trace(void) · 26 unmodified lines
2727
2828 void enable_boot_trace(void)
2929 {
30+ if (pre_initcalls_finished)
31+ tracing_start_cmdline_record();
3032 }
3133
3234 void disable_boot_trace(void)
3335 {
36+ if (pre_initcalls_finished)
37+ tracing_stop_cmdline_record();
3438 }
3539
3640 void reset_boot_trace(struct trace_array *tr)
@@ -45,6 +49,8 @@ static void boot_trace_init(struct trace_array *tr) · 8 unmodified lines
4549
4650 for_each_cpu_mask(cpu, cpu_possible_map)
4751 tracing_reset(tr, cpu);
52+
53+ sched_switch_trace.init(tr);
4854 }
4955
5056 static void boot_trace_ctrl_update(struct trace_array *tr)
kernel/trace/trace_sched_switch.c+3−3
@@ -127,6 +127,7 @@ static void tracing_start_sched_switch(void) · 126 unmodified lines
127127 long ref;
128128
129129 mutex_lock(&tracepoint_mutex);
130+ tracer_enabled = 1;
130131 ref = atomic_inc_return(&sched_ref);
131132 if (ref == 1)
132133 tracing_sched_register();
@@ -138,6 +139,7 @@ static void tracing_stop_sched_switch(void) · 5 unmodified lines
138139 long ref;
139140
140141 mutex_lock(&tracepoint_mutex);
142+ tracer_enabled = 0;
141143 ref = atomic_dec_and_test(&sched_ref);
142144 if (ref)
143145 tracing_sched_unregister();
@@ -158,12 +160,10 @@ static void start_sched_trace(struct trace_array *tr) · 14 unmodified lines
158160 {
159161 sched_switch_reset(tr);
160162 tracing_start_cmdline_record();
161− tracer_enabled = 1;
162163 }
163164
164165 static void stop_sched_trace(struct trace_array *tr)
165166 {
166− tracer_enabled = 0;
167167 tracing_stop_cmdline_record();
168168 }
169169
@@ -190,7 +190,7 @@ static void sched_switch_trace_ctrl_update(struct trace_array *tr) · 20 unmodified lines
190190 stop_sched_trace(tr);
191191 }
192192
193−static struct tracer sched_switch_trace __read_mostly =
193+struct tracer sched_switch_trace __read_mostly =
194194 {
195195 .name = "sched_switch",
196196 .init = sched_switch_trace_init,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t