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.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f147f198b9a6..0c22fe2d43a7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2835,7 +2835,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
2835{ 2835{
2836 unsigned long val; 2836 unsigned long val;
2837 char buf[64]; 2837 char buf[64];
2838 int ret; 2838 int ret, cpu;
2839 2839
2840 if (cnt >= sizeof(buf)) 2840 if (cnt >= sizeof(buf))
2841 return -EINVAL; 2841 return -EINVAL;
@@ -2857,6 +2857,14 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
2857 2857
2858 tracing_stop(); 2858 tracing_stop();
2859 2859
2860 /* disable all cpu buffers */
2861 for_each_tracing_cpu(cpu) {
2862 if (global_trace.data[cpu])
2863 atomic_inc(&global_trace.data[cpu]->disabled);
2864 if (max_tr.data[cpu])
2865 atomic_inc(&max_tr.data[cpu]->disabled);
2866 }
2867
2860 if (val != global_trace.entries) { 2868 if (val != global_trace.entries) {
2861 ret = ring_buffer_resize(global_trace.buffer, val); 2869 ret = ring_buffer_resize(global_trace.buffer, val);
2862 if (ret < 0) { 2870 if (ret < 0) {
@@ -2888,6 +2896,13 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
2888 if (tracing_disabled) 2896 if (tracing_disabled)
2889 cnt = -ENOMEM; 2897 cnt = -ENOMEM;
2890 out: 2898 out:
2899 for_each_tracing_cpu(cpu) {
2900 if (global_trace.data[cpu])
2901 atomic_dec(&global_trace.data[cpu]->disabled);
2902 if (max_tr.data[cpu])
2903 atomic_dec(&max_tr.data[cpu]->disabled);
2904 }
2905
2891 tracing_start(); 2906 tracing_start();
2892 max_tr.entries = global_trace.entries; 2907 max_tr.entries = global_trace.entries;
2893 mutex_unlock(&trace_types_lock); 2908 mutex_unlock(&trace_types_lock);