All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for David Sharp <dhsharp@google.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	masami.hiramatsu.pt@hitachi.com, rostedt@goodmis.org,
	dhsharp@google.com, tglx@linutronix.de
Subject: [tip:perf/core] tracing: Reset ring buffer when changing trace_clocks
Date: Tue, 13 Nov 2012 23:02:52 -0800	[thread overview]
Message-ID: <tip-60303ed3f4b9332b9aa9bc17c68bc174e7343e2d@git.kernel.org> (raw)
In-Reply-To: <1349998076-15495-3-git-send-email-dhsharp@google.com>

Commit-ID:  60303ed3f4b9332b9aa9bc17c68bc174e7343e2d
Gitweb:     http://git.kernel.org/tip/60303ed3f4b9332b9aa9bc17c68bc174e7343e2d
Author:     David Sharp <dhsharp@google.com>
AuthorDate: Thu, 11 Oct 2012 16:27:52 -0700
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Fri, 2 Nov 2012 10:21:47 -0400

tracing: Reset ring buffer when changing trace_clocks

Because the "tsc" clock isn't in nanoseconds, the ring buffer must be
reset when changing clocks so that incomparable timestamps don't end up
in the same trace.

Tested: Confirmed switching clocks resets the trace buffer.

Google-Bug-Id: 6980623
Link: http://lkml.kernel.org/r/1349998076-15495-3-git-send-email-dhsharp@google.com

Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: David Sharp <dhsharp@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 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 88111b0..6ed6013 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4073,6 +4073,14 @@ static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf,
 	if (max_tr.buffer)
 		ring_buffer_set_clock(max_tr.buffer, trace_clocks[i].func);
 
+	/*
+	 * New clock may not be consistent with the previous clock.
+	 * Reset the buffer so that it doesn't have incomparable timestamps.
+	 */
+	tracing_reset_online_cpus(&global_trace);
+	if (max_tr.buffer)
+		tracing_reset_online_cpus(&max_tr);
+
 	mutex_unlock(&trace_types_lock);
 
 	*fpos += cnt;

  reply	other threads:[~2012-11-14  7:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 23:27 [PATCH v6 0/6] TSC trace_clock David Sharp
2012-10-11 23:27 ` [PATCH v6 1/6] tracing,x86: Add a " David Sharp
2012-10-12  5:05   ` Geert Uytterhoeven
2012-10-12 11:41     ` Steven Rostedt
2012-10-15 19:05       ` David Sharp
2012-10-16 20:05       ` [PATCH v7 1/5] " David Sharp
2012-10-15 21:42     ` [PATCH v6 1/6] " David Sharp
2012-10-16 12:53       ` David Howells
2012-10-16 20:02         ` David Sharp
2012-10-11 23:27 ` [PATCH v6 2/6] tracing: Reset ring buffer when changing trace_clocks David Sharp
2012-11-14  7:02   ` tip-bot for David Sharp [this message]
2012-10-11 23:27 ` [PATCH v6 3/6] tracing: Format non-nanosec times from tsc clock without a decimal point David Sharp
2012-10-11 23:27 ` [PATCH v6 4/6] ftrace: Change unsigned long type of ring_buffer_oldest_event_ts() to u64 David Sharp
2012-11-14  7:03   ` [tip:perf/core] ring-buffer: " tip-bot for Yoshihiro YUNOMAE
2012-10-11 23:27 ` [PATCH v6 5/6] ftrace: Show raw time stamp on stats per cpu using counter or tsc mode for trace_clock David Sharp
2012-10-11 23:27 ` [PATCH v6 6/6] tracing: Fix maybe-uninitialized warning in ftrace_function_set_regexp David Sharp
2012-10-12  1:36   ` Steven Rostedt
2012-10-12  2:33     ` David Sharp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-60303ed3f4b9332b9aa9bc17c68bc174e7343e2d@git.kernel.org \
    --to=dhsharp@google.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.