diff options
-rw-r--r-- | kernel/trace/trace.c | 20 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 | ||||
-rw-r--r-- | kernel/trace/trace_functions.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_irqsoff.c | 7 | ||||
-rw-r--r-- | kernel/trace/trace_mmiotrace.c | 11 | ||||
-rw-r--r-- | kernel/trace/trace_nop.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_sched_wakeup.c | 12 | ||||
-rw-r--r-- | kernel/trace/trace_selftest.c | 8 | ||||
-rw-r--r-- | kernel/trace/trace_sysprof.c | 6 |
10 files changed, 24 insertions, 59 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 9e83188172a1..58435415b366 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -537,7 +537,6 @@ int register_tracer(struct tracer *type) | |||
537 | if (type->selftest) { | 537 | if (type->selftest) { |
538 | struct tracer *saved_tracer = current_trace; | 538 | struct tracer *saved_tracer = current_trace; |
539 | struct trace_array *tr = &global_trace; | 539 | struct trace_array *tr = &global_trace; |
540 | int saved_ctrl = tr->ctrl; | ||
541 | int i; | 540 | int i; |
542 | /* | 541 | /* |
543 | * Run a selftest on this tracer. | 542 | * Run a selftest on this tracer. |
@@ -550,13 +549,11 @@ int register_tracer(struct tracer *type) | |||
550 | tracing_reset(tr, i); | 549 | tracing_reset(tr, i); |
551 | } | 550 | } |
552 | current_trace = type; | 551 | current_trace = type; |
553 | tr->ctrl = 0; | ||
554 | /* the test is responsible for initializing and enabling */ | 552 | /* the test is responsible for initializing and enabling */ |
555 | pr_info("Testing tracer %s: ", type->name); | 553 | pr_info("Testing tracer %s: ", type->name); |
556 | ret = type->selftest(type, tr); | 554 | ret = type->selftest(type, tr); |
557 | /* the test is responsible for resetting too */ | 555 | /* the test is responsible for resetting too */ |
558 | current_trace = saved_tracer; | 556 | current_trace = saved_tracer; |
559 | tr->ctrl = saved_ctrl; | ||
560 | if (ret) { | 557 | if (ret) { |
561 | printk(KERN_CONT "FAILED!\n"); | 558 | printk(KERN_CONT "FAILED!\n"); |
562 | goto out; | 559 | goto out; |
@@ -966,7 +963,7 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) | |||
966 | int cpu; | 963 | int cpu; |
967 | int pc; | 964 | int pc; |
968 | 965 | ||
969 | if (tracing_disabled || !tr->ctrl) | 966 | if (tracing_disabled) |
970 | return; | 967 | return; |
971 | 968 | ||
972 | pc = preempt_count(); | 969 | pc = preempt_count(); |
@@ -2820,7 +2817,6 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
2820 | unsigned long val; | 2817 | unsigned long val; |
2821 | char buf[64]; | 2818 | char buf[64]; |
2822 | int ret; | 2819 | int ret; |
2823 | struct trace_array *tr = filp->private_data; | ||
2824 | 2820 | ||
2825 | if (cnt >= sizeof(buf)) | 2821 | if (cnt >= sizeof(buf)) |
2826 | return -EINVAL; | 2822 | return -EINVAL; |
@@ -2840,12 +2836,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
2840 | 2836 | ||
2841 | mutex_lock(&trace_types_lock); | 2837 | mutex_lock(&trace_types_lock); |
2842 | 2838 | ||
2843 | if (tr->ctrl) { | 2839 | tracing_stop(); |
2844 | cnt = -EBUSY; | ||
2845 | pr_info("ftrace: please disable tracing" | ||
2846 | " before modifying buffer size\n"); | ||
2847 | goto out; | ||
2848 | } | ||
2849 | 2840 | ||
2850 | if (val != global_trace.entries) { | 2841 | if (val != global_trace.entries) { |
2851 | ret = ring_buffer_resize(global_trace.buffer, val); | 2842 | ret = ring_buffer_resize(global_trace.buffer, val); |
@@ -2878,6 +2869,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
2878 | if (tracing_disabled) | 2869 | if (tracing_disabled) |
2879 | cnt = -ENOMEM; | 2870 | cnt = -ENOMEM; |
2880 | out: | 2871 | out: |
2872 | tracing_start(); | ||
2881 | max_tr.entries = global_trace.entries; | 2873 | max_tr.entries = global_trace.entries; |
2882 | mutex_unlock(&trace_types_lock); | 2874 | mutex_unlock(&trace_types_lock); |
2883 | 2875 | ||
@@ -2900,9 +2892,8 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, | |||
2900 | { | 2892 | { |
2901 | char *buf; | 2893 | char *buf; |
2902 | char *end; | 2894 | char *end; |
2903 | struct trace_array *tr = &global_trace; | ||
2904 | 2895 | ||
2905 | if (!tr->ctrl || tracing_disabled) | 2896 | if (tracing_disabled) |
2906 | return -EINVAL; | 2897 | return -EINVAL; |
2907 | 2898 | ||
2908 | if (cnt > TRACE_BUF_SIZE) | 2899 | if (cnt > TRACE_BUF_SIZE) |
@@ -3131,7 +3122,7 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | |||
3131 | unsigned long flags, irq_flags; | 3122 | unsigned long flags, irq_flags; |
3132 | int cpu, len = 0, size, pc; | 3123 | int cpu, len = 0, size, pc; |
3133 | 3124 | ||
3134 | if (!tr->ctrl || tracing_disabled) | 3125 | if (tracing_disabled) |
3135 | return 0; | 3126 | return 0; |
3136 | 3127 | ||
3137 | pc = preempt_count(); | 3128 | pc = preempt_count(); |
@@ -3365,7 +3356,6 @@ __init static int tracer_alloc_buffers(void) | |||
3365 | #endif | 3356 | #endif |
3366 | 3357 | ||
3367 | /* All seems OK, enable tracing */ | 3358 | /* All seems OK, enable tracing */ |
3368 | global_trace.ctrl = 1; | ||
3369 | tracing_disabled = 0; | 3359 | tracing_disabled = 0; |
3370 | 3360 | ||
3371 | atomic_notifier_chain_register(&panic_notifier_list, | 3361 | atomic_notifier_chain_register(&panic_notifier_list, |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index e481edaae1c4..cfda9d219e66 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -172,7 +172,6 @@ struct trace_iterator; | |||
172 | struct trace_array { | 172 | struct trace_array { |
173 | struct ring_buffer *buffer; | 173 | struct ring_buffer *buffer; |
174 | unsigned long entries; | 174 | unsigned long entries; |
175 | long ctrl; | ||
176 | int cpu; | 175 | int cpu; |
177 | cycle_t time_start; | 176 | cycle_t time_start; |
178 | struct task_struct *waiter; | 177 | struct task_struct *waiter; |
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index e980b872bef5..8693b7a0a5b2 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c | |||
@@ -44,14 +44,12 @@ static void stop_function_trace(struct trace_array *tr) | |||
44 | 44 | ||
45 | static void function_trace_init(struct trace_array *tr) | 45 | static void function_trace_init(struct trace_array *tr) |
46 | { | 46 | { |
47 | if (tr->ctrl) | 47 | start_function_trace(tr); |
48 | start_function_trace(tr); | ||
49 | } | 48 | } |
50 | 49 | ||
51 | static void function_trace_reset(struct trace_array *tr) | 50 | static void function_trace_reset(struct trace_array *tr) |
52 | { | 51 | { |
53 | if (tr->ctrl) | 52 | stop_function_trace(tr); |
54 | stop_function_trace(tr); | ||
55 | } | 53 | } |
56 | 54 | ||
57 | static void function_trace_start(struct trace_array *tr) | 55 | static void function_trace_start(struct trace_array *tr) |
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index ffdf592a54e3..d919d4eaa7cc 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
@@ -383,15 +383,12 @@ static void __irqsoff_tracer_init(struct trace_array *tr) | |||
383 | irqsoff_trace = tr; | 383 | irqsoff_trace = tr; |
384 | /* make sure that the tracer is visible */ | 384 | /* make sure that the tracer is visible */ |
385 | smp_wmb(); | 385 | smp_wmb(); |
386 | 386 | start_irqsoff_tracer(tr); | |
387 | if (tr->ctrl) | ||
388 | start_irqsoff_tracer(tr); | ||
389 | } | 387 | } |
390 | 388 | ||
391 | static void irqsoff_tracer_reset(struct trace_array *tr) | 389 | static void irqsoff_tracer_reset(struct trace_array *tr) |
392 | { | 390 | { |
393 | if (tr->ctrl) | 391 | stop_irqsoff_tracer(tr); |
394 | stop_irqsoff_tracer(tr); | ||
395 | } | 392 | } |
396 | 393 | ||
397 | static void irqsoff_tracer_start(struct trace_array *tr) | 394 | static void irqsoff_tracer_start(struct trace_array *tr) |
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c index fa9354e78b57..51bcf370215e 100644 --- a/kernel/trace/trace_mmiotrace.c +++ b/kernel/trace/trace_mmiotrace.c | |||
@@ -34,17 +34,16 @@ static void mmio_trace_init(struct trace_array *tr) | |||
34 | { | 34 | { |
35 | pr_debug("in %s\n", __func__); | 35 | pr_debug("in %s\n", __func__); |
36 | mmio_trace_array = tr; | 36 | mmio_trace_array = tr; |
37 | if (tr->ctrl) { | 37 | |
38 | mmio_reset_data(tr); | 38 | mmio_reset_data(tr); |
39 | enable_mmiotrace(); | 39 | enable_mmiotrace(); |
40 | } | ||
41 | } | 40 | } |
42 | 41 | ||
43 | static void mmio_trace_reset(struct trace_array *tr) | 42 | static void mmio_trace_reset(struct trace_array *tr) |
44 | { | 43 | { |
45 | pr_debug("in %s\n", __func__); | 44 | pr_debug("in %s\n", __func__); |
46 | if (tr->ctrl) | 45 | |
47 | disable_mmiotrace(); | 46 | disable_mmiotrace(); |
48 | mmio_reset_data(tr); | 47 | mmio_reset_data(tr); |
49 | mmio_trace_array = NULL; | 48 | mmio_trace_array = NULL; |
50 | } | 49 | } |
diff --git a/kernel/trace/trace_nop.c b/kernel/trace/trace_nop.c index e3c5fbfcdd36..2ef1d227e7d8 100644 --- a/kernel/trace/trace_nop.c +++ b/kernel/trace/trace_nop.c | |||
@@ -32,14 +32,12 @@ static void nop_trace_init(struct trace_array *tr) | |||
32 | for_each_online_cpu(cpu) | 32 | for_each_online_cpu(cpu) |
33 | tracing_reset(tr, cpu); | 33 | tracing_reset(tr, cpu); |
34 | 34 | ||
35 | if (tr->ctrl) | 35 | start_nop_trace(tr); |
36 | start_nop_trace(tr); | ||
37 | } | 36 | } |
38 | 37 | ||
39 | static void nop_trace_reset(struct trace_array *tr) | 38 | static void nop_trace_reset(struct trace_array *tr) |
40 | { | 39 | { |
41 | if (tr->ctrl) | 40 | stop_nop_trace(tr); |
42 | stop_nop_trace(tr); | ||
43 | } | 41 | } |
44 | 42 | ||
45 | struct tracer nop_trace __read_mostly = | 43 | struct tracer nop_trace __read_mostly = |
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index 7b73fd11e4aa..be35bdfe2e38 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -209,14 +209,12 @@ static void stop_sched_trace(struct trace_array *tr) | |||
209 | static void sched_switch_trace_init(struct trace_array *tr) | 209 | static void sched_switch_trace_init(struct trace_array *tr) |
210 | { | 210 | { |
211 | ctx_trace = tr; | 211 | ctx_trace = tr; |
212 | 212 | start_sched_trace(tr); | |
213 | if (tr->ctrl) | ||
214 | start_sched_trace(tr); | ||
215 | } | 213 | } |
216 | 214 | ||
217 | static void sched_switch_trace_reset(struct trace_array *tr) | 215 | static void sched_switch_trace_reset(struct trace_array *tr) |
218 | { | 216 | { |
219 | if (tr->ctrl && sched_ref) | 217 | if (sched_ref) |
220 | stop_sched_trace(tr); | 218 | stop_sched_trace(tr); |
221 | } | 219 | } |
222 | 220 | ||
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 23e54d4e4d92..983f2b1478c9 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -334,18 +334,14 @@ static void stop_wakeup_tracer(struct trace_array *tr) | |||
334 | static void wakeup_tracer_init(struct trace_array *tr) | 334 | static void wakeup_tracer_init(struct trace_array *tr) |
335 | { | 335 | { |
336 | wakeup_trace = tr; | 336 | wakeup_trace = tr; |
337 | 337 | start_wakeup_tracer(tr); | |
338 | if (tr->ctrl) | ||
339 | start_wakeup_tracer(tr); | ||
340 | } | 338 | } |
341 | 339 | ||
342 | static void wakeup_tracer_reset(struct trace_array *tr) | 340 | static void wakeup_tracer_reset(struct trace_array *tr) |
343 | { | 341 | { |
344 | if (tr->ctrl) { | 342 | stop_wakeup_tracer(tr); |
345 | stop_wakeup_tracer(tr); | 343 | /* make sure we put back any tasks we are tracing */ |
346 | /* make sure we put back any tasks we are tracing */ | 344 | wakeup_reset(tr); |
347 | wakeup_reset(tr); | ||
348 | } | ||
349 | } | 345 | } |
350 | 346 | ||
351 | static void wakeup_tracer_start(struct trace_array *tr) | 347 | static void wakeup_tracer_start(struct trace_array *tr) |
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c index 746934340474..ea4e5d3b15df 100644 --- a/kernel/trace/trace_selftest.c +++ b/kernel/trace/trace_selftest.c | |||
@@ -110,7 +110,6 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace, | |||
110 | ftrace_set_filter(func_name, strlen(func_name), 1); | 110 | ftrace_set_filter(func_name, strlen(func_name), 1); |
111 | 111 | ||
112 | /* enable tracing */ | 112 | /* enable tracing */ |
113 | tr->ctrl = 1; | ||
114 | trace->init(tr); | 113 | trace->init(tr); |
115 | 114 | ||
116 | /* Sleep for a 1/10 of a second */ | 115 | /* Sleep for a 1/10 of a second */ |
@@ -181,7 +180,6 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr) | |||
181 | ftrace_enabled = 1; | 180 | ftrace_enabled = 1; |
182 | tracer_enabled = 1; | 181 | tracer_enabled = 1; |
183 | 182 | ||
184 | tr->ctrl = 1; | ||
185 | trace->init(tr); | 183 | trace->init(tr); |
186 | /* Sleep for a 1/10 of a second */ | 184 | /* Sleep for a 1/10 of a second */ |
187 | msleep(100); | 185 | msleep(100); |
@@ -224,7 +222,6 @@ trace_selftest_startup_irqsoff(struct tracer *trace, struct trace_array *tr) | |||
224 | int ret; | 222 | int ret; |
225 | 223 | ||
226 | /* start the tracing */ | 224 | /* start the tracing */ |
227 | tr->ctrl = 1; | ||
228 | trace->init(tr); | 225 | trace->init(tr); |
229 | /* reset the max latency */ | 226 | /* reset the max latency */ |
230 | tracing_max_latency = 0; | 227 | tracing_max_latency = 0; |
@@ -261,7 +258,6 @@ trace_selftest_startup_preemptoff(struct tracer *trace, struct trace_array *tr) | |||
261 | int ret; | 258 | int ret; |
262 | 259 | ||
263 | /* start the tracing */ | 260 | /* start the tracing */ |
264 | tr->ctrl = 1; | ||
265 | trace->init(tr); | 261 | trace->init(tr); |
266 | /* reset the max latency */ | 262 | /* reset the max latency */ |
267 | tracing_max_latency = 0; | 263 | tracing_max_latency = 0; |
@@ -298,7 +294,6 @@ trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array * | |||
298 | int ret; | 294 | int ret; |
299 | 295 | ||
300 | /* start the tracing */ | 296 | /* start the tracing */ |
301 | tr->ctrl = 1; | ||
302 | trace->init(tr); | 297 | trace->init(tr); |
303 | 298 | ||
304 | /* reset the max latency */ | 299 | /* reset the max latency */ |
@@ -427,7 +422,6 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr) | |||
427 | wait_for_completion(&isrt); | 422 | wait_for_completion(&isrt); |
428 | 423 | ||
429 | /* start the tracing */ | 424 | /* start the tracing */ |
430 | tr->ctrl = 1; | ||
431 | trace->init(tr); | 425 | trace->init(tr); |
432 | /* reset the max latency */ | 426 | /* reset the max latency */ |
433 | tracing_max_latency = 0; | 427 | tracing_max_latency = 0; |
@@ -484,7 +478,6 @@ trace_selftest_startup_sched_switch(struct tracer *trace, struct trace_array *tr | |||
484 | int ret; | 478 | int ret; |
485 | 479 | ||
486 | /* start the tracing */ | 480 | /* start the tracing */ |
487 | tr->ctrl = 1; | ||
488 | trace->init(tr); | 481 | trace->init(tr); |
489 | /* Sleep for a 1/10 of a second */ | 482 | /* Sleep for a 1/10 of a second */ |
490 | msleep(100); | 483 | msleep(100); |
@@ -512,7 +505,6 @@ trace_selftest_startup_sysprof(struct tracer *trace, struct trace_array *tr) | |||
512 | int ret; | 505 | int ret; |
513 | 506 | ||
514 | /* start the tracing */ | 507 | /* start the tracing */ |
515 | tr->ctrl = 1; | ||
516 | trace->init(tr); | 508 | trace->init(tr); |
517 | /* Sleep for a 1/10 of a second */ | 509 | /* Sleep for a 1/10 of a second */ |
518 | msleep(100); | 510 | msleep(100); |
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c index 8097430edff9..05f753422aea 100644 --- a/kernel/trace/trace_sysprof.c +++ b/kernel/trace/trace_sysprof.c | |||
@@ -265,14 +265,12 @@ static void stack_trace_init(struct trace_array *tr) | |||
265 | { | 265 | { |
266 | sysprof_trace = tr; | 266 | sysprof_trace = tr; |
267 | 267 | ||
268 | if (tr->ctrl) | 268 | start_stack_trace(tr); |
269 | start_stack_trace(tr); | ||
270 | } | 269 | } |
271 | 270 | ||
272 | static void stack_trace_reset(struct trace_array *tr) | 271 | static void stack_trace_reset(struct trace_array *tr) |
273 | { | 272 | { |
274 | if (tr->ctrl) | 273 | stop_stack_trace(tr); |
275 | stop_stack_trace(tr); | ||
276 | } | 274 | } |
277 | 275 | ||
278 | static struct tracer stack_trace __read_mostly = | 276 | static struct tracer stack_trace __read_mostly = |