diff options
-rw-r--r-- | kernel/trace/trace.h | 2 | ||||
-rw-r--r-- | kernel/trace/trace_boot.c | 9 | ||||
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 15 |
3 files changed, 22 insertions, 4 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 3422489fad5e..db12e16137e1 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -49,7 +49,6 @@ 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 */ | ||
53 | 52 | ||
54 | /* | 53 | /* |
55 | * Context switch trace entry - which task (and prio) we switched from/to: | 54 | * Context switch trace entry - which task (and prio) we switched from/to: |
@@ -325,6 +324,7 @@ void trace_function(struct trace_array *tr, | |||
325 | 324 | ||
326 | void tracing_start_cmdline_record(void); | 325 | void tracing_start_cmdline_record(void); |
327 | void tracing_stop_cmdline_record(void); | 326 | void tracing_stop_cmdline_record(void); |
327 | void tracing_cmdline_assign_trace(struct trace_array *tr); | ||
328 | int register_tracer(struct tracer *type); | 328 | int register_tracer(struct tracer *type); |
329 | void unregister_tracer(struct tracer *type); | 329 | void unregister_tracer(struct tracer *type); |
330 | 330 | ||
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c index bd5046c9deb7..662cb9198906 100644 --- a/kernel/trace/trace_boot.c +++ b/kernel/trace/trace_boot.c | |||
@@ -39,7 +39,12 @@ void disable_boot_trace(void) | |||
39 | 39 | ||
40 | static void reset_boot_trace(struct trace_array *tr) | 40 | static void reset_boot_trace(struct trace_array *tr) |
41 | { | 41 | { |
42 | sched_switch_trace.reset(tr); | 42 | int cpu; |
43 | |||
44 | tr->time_start = ftrace_now(tr->cpu); | ||
45 | |||
46 | for_each_online_cpu(cpu) | ||
47 | tracing_reset(tr, cpu); | ||
43 | } | 48 | } |
44 | 49 | ||
45 | static void boot_trace_init(struct trace_array *tr) | 50 | static void boot_trace_init(struct trace_array *tr) |
@@ -50,7 +55,7 @@ static void boot_trace_init(struct trace_array *tr) | |||
50 | for_each_cpu_mask(cpu, cpu_possible_map) | 55 | for_each_cpu_mask(cpu, cpu_possible_map) |
51 | tracing_reset(tr, cpu); | 56 | tracing_reset(tr, cpu); |
52 | 57 | ||
53 | sched_switch_trace.init(tr); | 58 | tracing_cmdline_assign_trace(tr); |
54 | } | 59 | } |
55 | 60 | ||
56 | static void boot_trace_ctrl_update(struct trace_array *tr) | 61 | 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 91c699be8c87..fbf05df7134d 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -152,6 +152,19 @@ void tracing_stop_cmdline_record(void) | |||
152 | tracing_stop_sched_switch(); | 152 | tracing_stop_sched_switch(); |
153 | } | 153 | } |
154 | 154 | ||
155 | /** | ||
156 | * tracing_cmdline_assign_trace - assign a trace array for ctx switch | ||
157 | * @tr: trace array pointer to assign | ||
158 | * | ||
159 | * Some tracers might want to record the context switches in their | ||
160 | * trace. This function lets those tracers assign the trace array | ||
161 | * to use. | ||
162 | */ | ||
163 | void tracing_cmdline_assign_trace(struct trace_array *tr) | ||
164 | { | ||
165 | ctx_trace = tr; | ||
166 | } | ||
167 | |||
155 | static void start_sched_trace(struct trace_array *tr) | 168 | static void start_sched_trace(struct trace_array *tr) |
156 | { | 169 | { |
157 | sched_switch_reset(tr); | 170 | sched_switch_reset(tr); |
@@ -197,7 +210,7 @@ static void sched_switch_trace_stop(struct trace_array *tr) | |||
197 | tracing_stop_sched_switch(); | 210 | tracing_stop_sched_switch(); |
198 | } | 211 | } |
199 | 212 | ||
200 | struct tracer sched_switch_trace __read_mostly = | 213 | static struct tracer sched_switch_trace __read_mostly = |
201 | { | 214 | { |
202 | .name = "sched_switch", | 215 | .name = "sched_switch", |
203 | .init = sched_switch_trace_init, | 216 | .init = sched_switch_trace_init, |