aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c20
1 files changed, 5 insertions, 15 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,