From: David Sharp <dhsharp@google.com>
To: linux-kernel@vger.kernel.org
Cc: David Sharp <dhsharp@google.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: [PATCH v3 2/3] tracing: reset ring buffer when changing trace_clocks
Date: Thu, 20 Sep 2012 15:52:29 -0700 [thread overview]
Message-ID: <1348181550-21931-2-git-send-email-dhsharp@google.com> (raw)
In-Reply-To: <1348181550-21931-1-git-send-email-dhsharp@google.com>
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
Signed-off-by: David Sharp <dhsharp@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
---
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 92fb08e..4e26df3 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4012,6 +4012,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;
--
1.7.7.3
next prev parent reply other threads:[~2012-09-20 22:52 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 2:41 [PATCH 0/3] TSC trace_clock David Sharp
2012-09-12 2:41 ` [PATCH 1/3] tracing,x86: add a TSC trace_clock; reset buffer on clock change David Sharp
2012-09-12 3:48 ` Steven Rostedt
2012-09-12 18:48 ` David Sharp
2012-09-12 2:41 ` [PATCH 2/3] tracing: reset ring buffer when changing trace_clocks David Sharp
2012-09-12 2:41 ` [PATCH 3/3] tracing: format non-nanosec times from tsc clock without a decimal point David Sharp
2012-09-12 23:31 ` [PATCH v2 0/3] TSC trace_clock David Sharp
2012-09-12 23:31 ` [PATCH 1/3] tracing,x86: add a TSC trace_clock; reset buffer on clock change David Sharp
2012-09-12 23:31 ` [PATCH v2 1/3] tracing,x86: add a TSC trace_clock David Sharp
2012-09-13 1:15 ` Masami Hiramatsu
2012-09-13 1:23 ` Steven Rostedt
2012-09-18 21:37 ` David Sharp
2012-09-18 21:37 ` [PATCH v2 2/3] tracing: reset ring buffer when changing trace_clocks David Sharp
2012-09-18 21:37 ` [PATCH v2 3/3] tracing: format non-nanosec times from tsc clock without a decimal point David Sharp
2012-09-19 2:10 ` [PATCH v2 1/3] tracing,x86: add a TSC trace_clock Steven Rostedt
2012-09-20 8:55 ` Ingo Molnar
2012-09-20 13:34 ` Steven Rostedt
2012-09-20 22:52 ` [PATCH v3 " David Sharp
2012-09-20 22:52 ` David Sharp [this message]
2012-09-20 22:52 ` [PATCH v3 3/3] tracing: format non-nanosec times from tsc clock without a decimal point David Sharp
2012-09-25 3:27 ` Steven Rostedt
2012-09-25 20:48 ` David Sharp
2012-09-25 20:49 ` [PATCH v4 " David Sharp
2012-09-25 21:42 ` Steven Rostedt
2012-09-25 22:29 ` David Sharp
2012-09-25 22:29 ` David Sharp
2012-09-26 18:30 ` Steven Rostedt
2012-09-26 21:03 ` David Sharp
2012-09-25 23:36 ` Steven Rostedt
2012-09-26 0:32 ` David Sharp
2012-09-29 3:15 ` [PATCH v3 1/3] tracing,x86: add a TSC trace_clock Steven Rostedt
2012-10-02 0:33 ` David Sharp
2012-10-02 0:43 ` Steven Rostedt
2012-09-20 22:53 ` [PATCH v2 " David Sharp
2012-09-18 21:46 ` David Sharp
2012-09-12 23:31 ` [PATCH v2 2/3] tracing: reset ring buffer when changing trace_clocks David Sharp
2012-09-12 23:32 ` [PATCH v2 3/3] tracing: format non-nanosec times from tsc clock without a decimal point 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=1348181550-21931-2-git-send-email-dhsharp@google.com \
--to=dhsharp@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=rostedt@goodmis.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).