public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 05/14] ring-buffer: Move the adding of the extended timestamp out of line
Date: Sat, 29 Aug 2015 11:02:20 -0400	[thread overview]
Message-ID: <20150829150238.909507140@goodmis.org> (raw)
In-Reply-To: 20150829150215.458315917@goodmis.org

[-- Attachment #1: 0005-ring-buffer-Move-the-adding-of-the-extended-timestam.patch --]
[-- Type: text/plain, Size: 2604 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

Requiring a extended time stamp is an uncommon occurrence, and it is
best to do it out of line when needed.

Add a noinline function that handles the extended timestamp and
have it called with an unlikely to completely move it out of the
fast path.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ring_buffer.c | 41 +++++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index ba8f25ffcf6f..a78d4ee4bc58 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2396,6 +2396,29 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
 	return NULL;
 }
 
+#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
+static inline bool sched_clock_stable(void)
+{
+	return true;
+}
+#endif
+
+static noinline void
+rb_handle_timestamp(struct ring_buffer_per_cpu *cpu_buffer,
+		    struct rb_event_info *info)
+{
+	WARN_ONCE(info->delta > (1ULL << 59),
+		  KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n%s",
+		  (unsigned long long)info->delta,
+		  (unsigned long long)info->ts,
+		  (unsigned long long)cpu_buffer->write_stamp,
+		  sched_clock_stable() ? "" :
+		  "If you just came from a suspend/resume,\n"
+		  "please switch to the trace global clock:\n"
+		  "  echo global > /sys/kernel/debug/tracing/trace_clock\n");
+	info->add_timestamp = 1;
+}
+
 static struct ring_buffer_event *
 __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
 		  struct rb_event_info *info)
@@ -2582,22 +2605,8 @@ rb_reserve_next_event(struct ring_buffer *buffer,
 	/* Did the write stamp get updated already? */
 	if (likely(info.ts >= cpu_buffer->write_stamp)) {
 		info.delta = diff;
-		if (unlikely(test_time_stamp(info.delta))) {
-			int local_clock_stable = 1;
-#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
-			local_clock_stable = sched_clock_stable();
-#endif
-			WARN_ONCE(info.delta > (1ULL << 59),
-				  KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n%s",
-				  (unsigned long long)info.delta,
-				  (unsigned long long)info.ts,
-				  (unsigned long long)cpu_buffer->write_stamp,
-				  local_clock_stable ? "" :
-				  "If you just came from a suspend/resume,\n"
-				  "please switch to the trace global clock:\n"
-				  "  echo global > /sys/kernel/debug/tracing/trace_clock\n");
-			info.add_timestamp = 1;
-		}
+		if (unlikely(test_time_stamp(info.delta)))
+			rb_handle_timestamp(cpu_buffer, &info);
 	}
 
 	event = __rb_reserve_next(cpu_buffer, &info);
-- 
2.4.6



  parent reply	other threads:[~2015-08-29 15:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29 15:02 [for-next][PATCH 00/14] tracing: Updates for 4.3 Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 01/14] tracing: Prefer kcalloc over kzalloc with multiply Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 02/14] tracing: Fix for non-continuous cpu ids Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 03/14] ftrace: correct the counter increment for trace_buffer data Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 04/14] ring-buffer: Add event descriptor to simplify passing data Steven Rostedt
2015-08-29 15:02 ` Steven Rostedt [this message]
2015-08-29 15:02 ` [for-next][PATCH 06/14] ring-buffer: Get timestamp after event is allocated Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 07/14] ring-buffer: Make sure event has enough room for extend and padding Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 08/14] ring-buffer: Reorganize function locations Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 09/14] tracing: Clean up stack tracing and fix fentry updates Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 10/14] ftrace: add tracing_thresh to function profile Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 11/14] ftrace: Fix function_graph duration spacing with 7-digits Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 12/14] tracing: Introduce two additional marks for delay Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 13/14] ftrace: Format MCOUNT_ADDR address as type unsigned long Steven Rostedt
2015-08-29 15:02 ` [for-next][PATCH 14/14] tracing: Allow triggers to filter for CPU ids and process names Steven Rostedt

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=20150829150238.909507140@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.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