]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
tracing: disable update max tracer while reading trace
authorSteven Rostedt <srostedt@redhat.com>
Tue, 1 Sep 2009 02:32:27 +0000 (22:32 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 4 Sep 2009 15:52:24 +0000 (11:52 -0400)
When reading the tracer from the trace file, updating the max latency
may corrupt the output. This patch disables the tracing of the max
latency while reading the trace file.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c

index df2c9f730ac6c19276ac322b8691b68a772f20de..e521f1e8f2bb7571fc40afa0ce080053fcf68044 100644 (file)
@@ -263,6 +263,9 @@ unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
        TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME |
        TRACE_ITER_GRAPH_TIME;
 
+static int trace_stop_count;
+static DEFINE_SPINLOCK(tracing_start_lock);
+
 /**
  * trace_wake_up - wake up tasks waiting for trace input
  *
@@ -442,6 +445,9 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
 {
        struct ring_buffer *buf = tr->buffer;
 
+       if (trace_stop_count)
+               return;
+
        WARN_ON_ONCE(!irqs_disabled());
        __raw_spin_lock(&ftrace_max_lock);
 
@@ -469,6 +475,9 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
 {
        int ret;
 
+       if (trace_stop_count)
+               return;
+
        WARN_ON_ONCE(!irqs_disabled());
        __raw_spin_lock(&ftrace_max_lock);
 
@@ -685,9 +694,6 @@ static void trace_init_cmdlines(void)
        cmdline_idx = 0;
 }
 
-static int trace_stop_count;
-static DEFINE_SPINLOCK(tracing_start_lock);
-
 /**
  * ftrace_off_permanent - disable all ftrace code permanently
  *