tracing: Apply trace_clock changes to instance max buffer
authorBaohong Liu <baohong.liu@intel.com>
Tue, 5 Sep 2017 21:57:19 +0000 (16:57 -0500)
committerWilly Tarreau <w@1wt.eu>
Thu, 2 Nov 2017 09:46:01 +0000 (10:46 +0100)
commit 170b3b1050e28d1ba0700e262f0899ffa4fccc52 upstream.

Currently trace_clock timestamps are applied to both regular and max
buffers only for global trace. For instance trace, trace_clock
timestamps are applied only to regular buffer. But, regular and max
buffers can be swapped, for example, following a snapshot. So, for
instance trace, bad timestamps can be seen following a snapshot.
Let's apply trace_clock timestamps to instance max buffer as well.

Link: http://lkml.kernel.org/r/ebdb168d0be042dcdf51f81e696b17fabe3609c1.1504642143.git.tom.zanussi@linux.intel.com
Cc: stable@vger.kernel.org
Fixes: 277ba0446 ("tracing: Add interface to allow multiple trace buffers")
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
kernel/trace/trace.c

index edffb6781c0edc895021839c4e38b553c3f670b7..df820d9ebc896c16cf9249a7c3e405c04e53001f 100644 (file)
@@ -4654,7 +4654,7 @@ static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf,
        tracing_reset_online_cpus(&tr->trace_buffer);
 
 #ifdef CONFIG_TRACER_MAX_TRACE
-       if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer)
+       if (tr->max_buffer.buffer)
                ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func);
        tracing_reset_online_cpus(&tr->max_buffer);
 #endif