diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace.c | 8 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 | ||||
-rw-r--r-- | kernel/trace/trace_branch.c | 1 | ||||
-rw-r--r-- | kernel/trace/trace_functions.c | 17 | ||||
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 1 | ||||
-rw-r--r-- | kernel/trace/trace_hw_branches.c | 1 | ||||
-rw-r--r-- | kernel/trace/trace_nop.c | 1 | ||||
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 8 | ||||
-rw-r--r-- | kernel/trace/trace_selftest.c | 18 | ||||
-rw-r--r-- | kernel/trace/trace_sysprof.c | 14 |
10 files changed, 25 insertions, 45 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 8fad3776e843..ef4dbac95568 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -2171,6 +2171,12 @@ tracing_set_trace_read(struct file *filp, char __user *ubuf, | |||
2171 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); | 2171 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); |
2172 | } | 2172 | } |
2173 | 2173 | ||
2174 | int tracer_init(struct tracer *t, struct trace_array *tr) | ||
2175 | { | ||
2176 | tracing_reset_online_cpus(tr); | ||
2177 | return t->init(tr); | ||
2178 | } | ||
2179 | |||
2174 | static int tracing_set_tracer(const char *buf) | 2180 | static int tracing_set_tracer(const char *buf) |
2175 | { | 2181 | { |
2176 | struct trace_array *tr = &global_trace; | 2182 | struct trace_array *tr = &global_trace; |
@@ -2195,7 +2201,7 @@ static int tracing_set_tracer(const char *buf) | |||
2195 | 2201 | ||
2196 | current_trace = t; | 2202 | current_trace = t; |
2197 | if (t->init) { | 2203 | if (t->init) { |
2198 | ret = t->init(tr); | 2204 | ret = tracer_init(t, tr); |
2199 | if (ret) | 2205 | if (ret) |
2200 | goto out; | 2206 | goto out; |
2201 | } | 2207 | } |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index e03f157c772e..f2742fb1575a 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -395,6 +395,7 @@ struct trace_iterator { | |||
395 | cpumask_var_t started; | 395 | cpumask_var_t started; |
396 | }; | 396 | }; |
397 | 397 | ||
398 | int tracer_init(struct tracer *t, struct trace_array *tr); | ||
398 | int tracing_is_enabled(void); | 399 | int tracing_is_enabled(void); |
399 | void trace_wake_up(void); | 400 | void trace_wake_up(void); |
400 | void tracing_reset(struct trace_array *tr, int cpu); | 401 | void tracing_reset(struct trace_array *tr, int cpu); |
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c index 48b2196abe37..f8ae2c50e01d 100644 --- a/kernel/trace/trace_branch.c +++ b/kernel/trace/trace_branch.c | |||
@@ -131,7 +131,6 @@ static void stop_branch_trace(struct trace_array *tr) | |||
131 | 131 | ||
132 | static int branch_trace_init(struct trace_array *tr) | 132 | static int branch_trace_init(struct trace_array *tr) |
133 | { | 133 | { |
134 | tracing_reset_online_cpus(tr); | ||
135 | start_branch_trace(tr); | 134 | start_branch_trace(tr); |
136 | return 0; | 135 | return 0; |
137 | } | 136 | } |
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index d067cea2ccc3..36bf9568ccd9 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c | |||
@@ -24,32 +24,21 @@ static struct trace_array *func_trace; | |||
24 | static void tracing_start_function_trace(void); | 24 | static void tracing_start_function_trace(void); |
25 | static void tracing_stop_function_trace(void); | 25 | static void tracing_stop_function_trace(void); |
26 | 26 | ||
27 | static void start_function_trace(struct trace_array *tr) | 27 | static int function_trace_init(struct trace_array *tr) |
28 | { | 28 | { |
29 | func_trace = tr; | 29 | func_trace = tr; |
30 | tr->cpu = get_cpu(); | 30 | tr->cpu = get_cpu(); |
31 | tracing_reset_online_cpus(tr); | ||
32 | put_cpu(); | 31 | put_cpu(); |
33 | 32 | ||
34 | tracing_start_cmdline_record(); | 33 | tracing_start_cmdline_record(); |
35 | tracing_start_function_trace(); | 34 | tracing_start_function_trace(); |
36 | } | ||
37 | |||
38 | static void stop_function_trace(struct trace_array *tr) | ||
39 | { | ||
40 | tracing_stop_function_trace(); | ||
41 | tracing_stop_cmdline_record(); | ||
42 | } | ||
43 | |||
44 | static int function_trace_init(struct trace_array *tr) | ||
45 | { | ||
46 | start_function_trace(tr); | ||
47 | return 0; | 35 | return 0; |
48 | } | 36 | } |
49 | 37 | ||
50 | static void function_trace_reset(struct trace_array *tr) | 38 | static void function_trace_reset(struct trace_array *tr) |
51 | { | 39 | { |
52 | stop_function_trace(tr); | 40 | tracing_stop_function_trace(); |
41 | tracing_stop_cmdline_record(); | ||
53 | } | 42 | } |
54 | 43 | ||
55 | static void function_trace_start(struct trace_array *tr) | 44 | static void function_trace_start(struct trace_array *tr) |
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index c97594d826bc..222f97d336a6 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -56,7 +56,6 @@ static int graph_trace_init(struct trace_array *tr) | |||
56 | &trace_graph_entry); | 56 | &trace_graph_entry); |
57 | if (ret) | 57 | if (ret) |
58 | return ret; | 58 | return ret; |
59 | tracing_reset_online_cpus(tr); | ||
60 | tracing_start_cmdline_record(); | 59 | tracing_start_cmdline_record(); |
61 | 60 | ||
62 | return 0; | 61 | return 0; |
diff --git a/kernel/trace/trace_hw_branches.c b/kernel/trace/trace_hw_branches.c index 2aa1c9f4c7d8..ca4bbcfb9e2c 100644 --- a/kernel/trace/trace_hw_branches.c +++ b/kernel/trace/trace_hw_branches.c | |||
@@ -132,7 +132,6 @@ static int bts_trace_init(struct trace_array *tr) | |||
132 | hw_branch_trace = tr; | 132 | hw_branch_trace = tr; |
133 | 133 | ||
134 | register_hotcpu_notifier(&bts_hotcpu_notifier); | 134 | register_hotcpu_notifier(&bts_hotcpu_notifier); |
135 | tracing_reset_online_cpus(tr); | ||
136 | bts_trace_start(tr); | 135 | bts_trace_start(tr); |
137 | 136 | ||
138 | return 0; | 137 | return 0; |
diff --git a/kernel/trace/trace_nop.c b/kernel/trace/trace_nop.c index 087b6cbf4ea5..9aa84bde23cd 100644 --- a/kernel/trace/trace_nop.c +++ b/kernel/trace/trace_nop.c | |||
@@ -48,7 +48,6 @@ static void stop_nop_trace(struct trace_array *tr) | |||
48 | static int nop_trace_init(struct trace_array *tr) | 48 | static int nop_trace_init(struct trace_array *tr) |
49 | { | 49 | { |
50 | ctx_trace = tr; | 50 | ctx_trace = tr; |
51 | tracing_reset_online_cpus(tr); | ||
52 | start_nop_trace(tr); | 51 | start_nop_trace(tr); |
53 | return 0; | 52 | return 0; |
54 | } | 53 | } |
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index c4f9add5ec90..30e14fe85896 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -185,12 +185,6 @@ void tracing_sched_switch_assign_trace(struct trace_array *tr) | |||
185 | ctx_trace = tr; | 185 | ctx_trace = tr; |
186 | } | 186 | } |
187 | 187 | ||
188 | static void start_sched_trace(struct trace_array *tr) | ||
189 | { | ||
190 | tracing_reset_online_cpus(tr); | ||
191 | tracing_start_sched_switch_record(); | ||
192 | } | ||
193 | |||
194 | static void stop_sched_trace(struct trace_array *tr) | 188 | static void stop_sched_trace(struct trace_array *tr) |
195 | { | 189 | { |
196 | tracing_stop_sched_switch_record(); | 190 | tracing_stop_sched_switch_record(); |
@@ -199,7 +193,7 @@ static void stop_sched_trace(struct trace_array *tr) | |||
199 | static int sched_switch_trace_init(struct trace_array *tr) | 193 | static int sched_switch_trace_init(struct trace_array *tr) |
200 | { | 194 | { |
201 | ctx_trace = tr; | 195 | ctx_trace = tr; |
202 | start_sched_trace(tr); | 196 | tracing_start_sched_switch_record(); |
203 | return 0; | 197 | return 0; |
204 | } | 198 | } |
205 | 199 | ||
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c index 5013812578b1..445700e51f6d 100644 --- a/kernel/trace/trace_selftest.c +++ b/kernel/trace/trace_selftest.c | |||
@@ -115,7 +115,7 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace, | |||
115 | ftrace_set_filter(func_name, strlen(func_name), 1); | 115 | ftrace_set_filter(func_name, strlen(func_name), 1); |
116 | 116 | ||
117 | /* enable tracing */ | 117 | /* enable tracing */ |
118 | ret = trace->init(tr); | 118 | ret = tracer_init(trace, tr); |
119 | if (ret) { | 119 | if (ret) { |
120 | warn_failed_init_tracer(trace, ret); | 120 | warn_failed_init_tracer(trace, ret); |
121 | goto out; | 121 | goto out; |
@@ -189,7 +189,7 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr) | |||
189 | ftrace_enabled = 1; | 189 | ftrace_enabled = 1; |
190 | tracer_enabled = 1; | 190 | tracer_enabled = 1; |
191 | 191 | ||
192 | ret = trace->init(tr); | 192 | ret = tracer_init(trace, tr); |
193 | if (ret) { | 193 | if (ret) { |
194 | warn_failed_init_tracer(trace, ret); | 194 | warn_failed_init_tracer(trace, ret); |
195 | goto out; | 195 | goto out; |
@@ -236,7 +236,7 @@ trace_selftest_startup_irqsoff(struct tracer *trace, struct trace_array *tr) | |||
236 | int ret; | 236 | int ret; |
237 | 237 | ||
238 | /* start the tracing */ | 238 | /* start the tracing */ |
239 | ret = trace->init(tr); | 239 | ret = tracer_init(trace, tr); |
240 | if (ret) { | 240 | if (ret) { |
241 | warn_failed_init_tracer(trace, ret); | 241 | warn_failed_init_tracer(trace, ret); |
242 | return ret; | 242 | return ret; |
@@ -290,7 +290,7 @@ trace_selftest_startup_preemptoff(struct tracer *trace, struct trace_array *tr) | |||
290 | } | 290 | } |
291 | 291 | ||
292 | /* start the tracing */ | 292 | /* start the tracing */ |
293 | ret = trace->init(tr); | 293 | ret = tracer_init(trace, tr); |
294 | if (ret) { | 294 | if (ret) { |
295 | warn_failed_init_tracer(trace, ret); | 295 | warn_failed_init_tracer(trace, ret); |
296 | return ret; | 296 | return ret; |
@@ -344,7 +344,7 @@ trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array * | |||
344 | } | 344 | } |
345 | 345 | ||
346 | /* start the tracing */ | 346 | /* start the tracing */ |
347 | ret = trace->init(tr); | 347 | ret = tracer_init(trace, tr); |
348 | if (ret) { | 348 | if (ret) { |
349 | warn_failed_init_tracer(trace, ret); | 349 | warn_failed_init_tracer(trace, ret); |
350 | goto out; | 350 | goto out; |
@@ -476,7 +476,7 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr) | |||
476 | wait_for_completion(&isrt); | 476 | wait_for_completion(&isrt); |
477 | 477 | ||
478 | /* start the tracing */ | 478 | /* start the tracing */ |
479 | ret = trace->init(tr); | 479 | ret = tracer_init(trace, tr); |
480 | if (ret) { | 480 | if (ret) { |
481 | warn_failed_init_tracer(trace, ret); | 481 | warn_failed_init_tracer(trace, ret); |
482 | return ret; | 482 | return ret; |
@@ -537,7 +537,7 @@ trace_selftest_startup_sched_switch(struct tracer *trace, struct trace_array *tr | |||
537 | int ret; | 537 | int ret; |
538 | 538 | ||
539 | /* start the tracing */ | 539 | /* start the tracing */ |
540 | ret = trace->init(tr); | 540 | ret = tracer_init(trace, tr); |
541 | if (ret) { | 541 | if (ret) { |
542 | warn_failed_init_tracer(trace, ret); | 542 | warn_failed_init_tracer(trace, ret); |
543 | return ret; | 543 | return ret; |
@@ -569,7 +569,7 @@ trace_selftest_startup_sysprof(struct tracer *trace, struct trace_array *tr) | |||
569 | int ret; | 569 | int ret; |
570 | 570 | ||
571 | /* start the tracing */ | 571 | /* start the tracing */ |
572 | ret = trace->init(tr); | 572 | ret = tracer_init(trace, tr); |
573 | if (ret) { | 573 | if (ret) { |
574 | warn_failed_init_tracer(trace, ret); | 574 | warn_failed_init_tracer(trace, ret); |
575 | return 0; | 575 | return 0; |
@@ -596,7 +596,7 @@ trace_selftest_startup_branch(struct tracer *trace, struct trace_array *tr) | |||
596 | int ret; | 596 | int ret; |
597 | 597 | ||
598 | /* start the tracing */ | 598 | /* start the tracing */ |
599 | ret = trace->init(tr); | 599 | ret = tracer_init(trace, tr); |
600 | if (ret) { | 600 | if (ret) { |
601 | warn_failed_init_tracer(trace, ret); | 601 | warn_failed_init_tracer(trace, ret); |
602 | return ret; | 602 | return ret; |
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c index eaca5ad803ff..84ca9d81e74d 100644 --- a/kernel/trace/trace_sysprof.c +++ b/kernel/trace/trace_sysprof.c | |||
@@ -226,15 +226,6 @@ static void stop_stack_timers(void) | |||
226 | stop_stack_timer(cpu); | 226 | stop_stack_timer(cpu); |
227 | } | 227 | } |
228 | 228 | ||
229 | static void start_stack_trace(struct trace_array *tr) | ||
230 | { | ||
231 | mutex_lock(&sample_timer_lock); | ||
232 | tracing_reset_online_cpus(tr); | ||
233 | start_stack_timers(); | ||
234 | tracer_enabled = 1; | ||
235 | mutex_unlock(&sample_timer_lock); | ||
236 | } | ||
237 | |||
238 | static void stop_stack_trace(struct trace_array *tr) | 229 | static void stop_stack_trace(struct trace_array *tr) |
239 | { | 230 | { |
240 | mutex_lock(&sample_timer_lock); | 231 | mutex_lock(&sample_timer_lock); |
@@ -247,7 +238,10 @@ static int stack_trace_init(struct trace_array *tr) | |||
247 | { | 238 | { |
248 | sysprof_trace = tr; | 239 | sysprof_trace = tr; |
249 | 240 | ||
250 | start_stack_trace(tr); | 241 | mutex_lock(&sample_timer_lock); |
242 | start_stack_timers(); | ||
243 | tracer_enabled = 1; | ||
244 | mutex_unlock(&sample_timer_lock); | ||
251 | return 0; | 245 | return 0; |
252 | } | 246 | } |
253 | 247 | ||