Commit 8dcc3be2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'trace-fixes-v3.16-rc6' of...

Merge tag 'trace-fixes-v3.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull trace fix from Steven Rostedt:
 "Tony Luck found that using the "uptime" trace clock that uses jiffies
  as a counter was converted to nanoseconds (silly), and after 1 hour 11
  minutes and 34 seconds, this monotonic clock would wrap, causing havoc
  with the tracing system and making the clock useless.

  He converted that clock to use jiffies_64 and made it into a counter
  instead of nanosecond conversions, and displayed the clock with the
  straight jiffy count, which works much better than it did in the past"

* tag 'trace-fixes-v3.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Fix wraparound problems in "uptime" trace clock
parents 67dd8f35 58d4e21e
...@@ -823,7 +823,7 @@ static struct { ...@@ -823,7 +823,7 @@ static struct {
{ trace_clock_local, "local", 1 }, { trace_clock_local, "local", 1 },
{ trace_clock_global, "global", 1 }, { trace_clock_global, "global", 1 },
{ trace_clock_counter, "counter", 0 }, { trace_clock_counter, "counter", 0 },
{ trace_clock_jiffies, "uptime", 1 }, { trace_clock_jiffies, "uptime", 0 },
{ trace_clock, "perf", 1 }, { trace_clock, "perf", 1 },
ARCH_TRACE_CLOCKS ARCH_TRACE_CLOCKS
}; };
......
...@@ -59,13 +59,14 @@ u64 notrace trace_clock(void) ...@@ -59,13 +59,14 @@ u64 notrace trace_clock(void)
/* /*
* trace_jiffy_clock(): Simply use jiffies as a clock counter. * trace_jiffy_clock(): Simply use jiffies as a clock counter.
* Note that this use of jiffies_64 is not completely safe on
* 32-bit systems. But the window is tiny, and the effect if
* we are affected is that we will have an obviously bogus
* timestamp on a trace event - i.e. not life threatening.
*/ */
u64 notrace trace_clock_jiffies(void) u64 notrace trace_clock_jiffies(void)
{ {
u64 jiffy = jiffies - INITIAL_JIFFIES; return jiffies_64_to_clock_t(jiffies_64 - INITIAL_JIFFIES);
/* Return nsecs */
return (u64)jiffies_to_usecs(jiffy) * 1000ULL;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment