tracing: Explain about unstable clock on resume with ring buffer warning
Jiri Olsa [Fri, 18 Feb 2011 14:52:19 +0000 (15:52 +0100)]
The "Delta way too big" warning might appear on a system with a
unstable shed clock right after the system is resumed and tracing
was enabled at time of suspend.

Since it's not realy a bug, and the unstable sched clock is working
fast and reliable otherwise, Steven suggested to keep using the
sched clock in any case and just to make note in the warning itself.

v2 changes:
- added #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
LKML-Reference: <20110218145219.GD2604@jolsa.brq.redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

kernel/trace/ring_buffer.c

index 3237d96..db7b439 100644 (file)
@@ -2172,11 +2172,19 @@ rb_reserve_next_event(struct ring_buffer *buffer,
        if (likely(ts >= cpu_buffer->write_stamp)) {
                delta = diff;
                if (unlikely(test_time_stamp(delta))) {
+                       int local_clock_stable = 1;
+#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
+                       local_clock_stable = sched_clock_stable;
+#endif
                        WARN_ONCE(delta > (1ULL << 59),
-                                 KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n",
+                                 KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n%s",
                                  (unsigned long long)delta,
                                  (unsigned long long)ts,
-                                 (unsigned long long)cpu_buffer->write_stamp);
+                                 (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");
                        add_timestamp = 1;
                }
        }