diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-09-04 12:02:35 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-09-04 12:02:35 -0400 |
commit | 621968cdb2563b667d6ecb484ba91ef4c3a797b3 (patch) | |
tree | a4b8e3ba1f55d6b725b37a4e42c2f376d6150cdc /kernel/trace/trace.c | |
parent | b8de7bd168fa54d059b16d3057b2f8a32cc5bdc3 (diff) |
tracing: disable buffers and synchronize_sched before resetting
Resetting the ring buffers while traces are happening can corrupt
the ring buffer and disable it (no kernel crash to worry about).
The safest thing to do is disable the ring buffers, call synchronize_sched()
to wait for all current writers to finish and then reset the buffer.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index e521f1e8f2bb..9110329ecf77 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -658,12 +658,20 @@ void tracing_reset(struct trace_array *tr, int cpu) | |||
658 | 658 | ||
659 | void tracing_reset_online_cpus(struct trace_array *tr) | 659 | void tracing_reset_online_cpus(struct trace_array *tr) |
660 | { | 660 | { |
661 | struct ring_buffer *buffer = tr->buffer; | ||
661 | int cpu; | 662 | int cpu; |
662 | 663 | ||
664 | ring_buffer_record_disable(buffer); | ||
665 | |||
666 | /* Make sure all commits have finished */ | ||
667 | synchronize_sched(); | ||
668 | |||
663 | tr->time_start = ftrace_now(tr->cpu); | 669 | tr->time_start = ftrace_now(tr->cpu); |
664 | 670 | ||
665 | for_each_online_cpu(cpu) | 671 | for_each_online_cpu(cpu) |
666 | tracing_reset(tr, cpu); | 672 | tracing_reset(tr, cpu); |
673 | |||
674 | ring_buffer_record_enable(buffer); | ||
667 | } | 675 | } |
668 | 676 | ||
669 | void tracing_reset_current(int cpu) | 677 | void tracing_reset_current(int cpu) |