diff options
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 9f3b478f9171..d86e3252f300 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1755,7 +1755,7 @@ static enum print_line_t print_bin_fmt(struct trace_iterator *iter) | |||
1755 | return TRACE_TYPE_HANDLED; | 1755 | return TRACE_TYPE_HANDLED; |
1756 | 1756 | ||
1757 | SEQ_PUT_FIELD_RET(s, entry->pid); | 1757 | SEQ_PUT_FIELD_RET(s, entry->pid); |
1758 | SEQ_PUT_FIELD_RET(s, iter->cpu); | 1758 | SEQ_PUT_FIELD_RET(s, entry->cpu); |
1759 | SEQ_PUT_FIELD_RET(s, iter->ts); | 1759 | SEQ_PUT_FIELD_RET(s, iter->ts); |
1760 | 1760 | ||
1761 | switch (entry->type) { | 1761 | switch (entry->type) { |
@@ -1936,6 +1936,7 @@ __tracing_open(struct inode *inode, struct file *file, int *ret) | |||
1936 | ring_buffer_read_finish(iter->buffer_iter[cpu]); | 1936 | ring_buffer_read_finish(iter->buffer_iter[cpu]); |
1937 | } | 1937 | } |
1938 | mutex_unlock(&trace_types_lock); | 1938 | mutex_unlock(&trace_types_lock); |
1939 | kfree(iter); | ||
1939 | 1940 | ||
1940 | return ERR_PTR(-ENOMEM); | 1941 | return ERR_PTR(-ENOMEM); |
1941 | } | 1942 | } |
@@ -2676,7 +2677,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
2676 | { | 2677 | { |
2677 | unsigned long val; | 2678 | unsigned long val; |
2678 | char buf[64]; | 2679 | char buf[64]; |
2679 | int ret; | 2680 | int ret, cpu; |
2680 | struct trace_array *tr = filp->private_data; | 2681 | struct trace_array *tr = filp->private_data; |
2681 | 2682 | ||
2682 | if (cnt >= sizeof(buf)) | 2683 | if (cnt >= sizeof(buf)) |
@@ -2704,6 +2705,14 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
2704 | goto out; | 2705 | goto out; |
2705 | } | 2706 | } |
2706 | 2707 | ||
2708 | /* disable all cpu buffers */ | ||
2709 | for_each_tracing_cpu(cpu) { | ||
2710 | if (global_trace.data[cpu]) | ||
2711 | atomic_inc(&global_trace.data[cpu]->disabled); | ||
2712 | if (max_tr.data[cpu]) | ||
2713 | atomic_inc(&max_tr.data[cpu]->disabled); | ||
2714 | } | ||
2715 | |||
2707 | if (val != global_trace.entries) { | 2716 | if (val != global_trace.entries) { |
2708 | ret = ring_buffer_resize(global_trace.buffer, val); | 2717 | ret = ring_buffer_resize(global_trace.buffer, val); |
2709 | if (ret < 0) { | 2718 | if (ret < 0) { |
@@ -2735,6 +2744,13 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
2735 | if (tracing_disabled) | 2744 | if (tracing_disabled) |
2736 | cnt = -ENOMEM; | 2745 | cnt = -ENOMEM; |
2737 | out: | 2746 | out: |
2747 | for_each_tracing_cpu(cpu) { | ||
2748 | if (global_trace.data[cpu]) | ||
2749 | atomic_dec(&global_trace.data[cpu]->disabled); | ||
2750 | if (max_tr.data[cpu]) | ||
2751 | atomic_dec(&max_tr.data[cpu]->disabled); | ||
2752 | } | ||
2753 | |||
2738 | max_tr.entries = global_trace.entries; | 2754 | max_tr.entries = global_trace.entries; |
2739 | mutex_unlock(&trace_types_lock); | 2755 | mutex_unlock(&trace_types_lock); |
2740 | 2756 | ||