John Stultz
78c7b55b36
timekeeping: Fix __ktime_get_fast_ns() regression
commit 58bfea9532 upstream.
In commit 27727df240 ("Avoid taking lock in NMI path with
CONFIG_DEBUG_TIMEKEEPING"), I changed the logic to open-code
the timekeeping_get_ns() function, but I forgot to include
the unit conversion from cycles to nanoseconds, breaking the
function's output, which impacts users like perf.
This results in bogus perf timestamps like:
swapper 0 [000] 253.427536: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 254.426573: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 254.426687: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 254.426800: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 254.426905: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 254.427022: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 254.427127: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 254.427239: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 254.427346: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 254.427463: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 255.426572: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
Instead of more reasonable expected timestamps like:
swapper 0 [000] 39.953768: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 40.064839: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 40.175956: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 40.287103: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 40.398217: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 40.509324: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 40.620437: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 40.731546: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 40.842654: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 40.953772: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
swapper 0 [000] 41.064881: 111111111 cpu-clock: ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
Add the proper use of timekeeping_delta_to_ns() to convert
the cycle delta to nanoseconds as needed.
Thanks to Brendan and Alexei for finding this quickly after
the v4.8 release. Unfortunately the problematic commit has
landed in some -stable trees so they'll need this fix as
well.
Many apologies for this mistake. I'll be looking to add a
perf-clock sanity test to the kselftest timers tests soon.
Fixes: 27727df240 "timekeeping: Avoid taking lock in NMI path with CONFIG_DEBUG_TIMEKEEPING"
Reported-by: Brendan Gregg <bgregg@netflix.com>
Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Tested-and-reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1475636148-26539-1-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 17:36:14 +02:00
..
2016-06-24 10:18:17 -07:00
2016-09-24 10:07:42 +02:00
2015-02-19 12:39:03 -06:00
2016-10-07 15:23:41 +02:00
2015-06-30 19:44:57 -07:00
2016-09-24 10:07:46 +02:00
2015-11-11 17:36:04 +01:00
2016-07-27 09:47:29 -07:00
2016-09-30 10:18:39 +02:00
2016-10-07 15:23:43 +02:00
2015-10-07 16:06:25 -07:00
2016-09-24 10:07:42 +02:00
2016-10-16 17:36:14 +02:00
2016-09-30 10:18:38 +02:00
2015-10-21 15:18:35 +01:00
2015-04-11 22:27:55 -04:00
2015-08-06 16:14:53 -04:00
2015-11-04 08:23:51 -05:00
2016-09-24 10:07:36 +02:00
2015-11-06 17:50:42 -08:00
2015-11-04 08:23:51 -05:00
2015-11-04 08:23:51 -05:00
2016-08-20 18:09:22 +02:00
2016-09-15 08:27:50 +02:00
2015-12-03 10:18:21 -05:00
2015-12-03 10:18:21 -05:00
2016-08-10 11:49:27 +02:00
2015-06-04 23:57:18 +02:00
2015-11-10 12:06:23 +01:00
2015-09-03 02:42:20 +02:00
2015-11-03 18:03:50 -08:00
2016-10-07 15:23:40 +02:00
2016-09-15 08:27:49 +02:00
2015-04-12 21:03:31 +02:00
2016-06-07 18:14:35 -07:00
2015-09-10 13:29:01 -07:00
2016-10-07 15:23:46 +02:00
2016-02-25 12:01:16 -08:00
2016-05-04 14:48:43 -07:00
2015-04-15 16:35:22 -07:00
2015-04-15 16:35:22 -07:00
2015-11-23 09:44:58 +01:00
2016-07-27 09:47:29 -07:00
2016-02-25 12:01:16 -08:00
2015-05-12 09:46:00 +02:00
2015-11-06 17:50:42 -08:00
2016-09-24 10:07:36 +02:00
2015-09-10 13:29:01 -07:00
2015-11-06 17:50:42 -08:00
2015-10-23 17:55:10 +09:00
2015-08-04 10:16:54 +02:00
2015-09-10 13:29:01 -07:00
2015-09-04 16:54:41 -07:00
2015-09-11 15:21:34 -07:00
2015-09-11 15:21:34 -07:00
2016-03-03 15:07:08 -08:00
2015-10-21 15:18:36 +01:00
2016-08-20 18:09:27 +02:00
2015-09-01 08:40:25 -07:00
2016-02-17 12:30:57 -08:00
2015-11-09 15:53:39 -08:00
2015-11-24 12:03:55 -08:00
2015-09-08 15:35:28 -07:00
2016-02-25 12:01:16 -08:00
2015-09-10 13:29:01 -07:00
2015-06-30 19:44:59 -07:00
2016-03-03 15:07:29 -08:00
2016-03-03 15:07:25 -08:00
2015-11-20 16:17:32 -08:00
2015-11-06 17:50:42 -08:00
2015-10-20 10:23:55 +02:00
2015-12-12 10:15:34 -08:00
2015-11-05 19:34:48 -08:00
2016-02-25 12:01:25 -08:00
2016-04-12 09:08:58 -07:00
2016-10-07 15:23:46 +02:00
2015-09-05 13:46:58 -07:00
2015-10-06 11:25:01 -07:00
2015-10-25 21:33:54 -04:00
2015-09-04 16:54:41 -07:00
2016-04-12 09:08:54 -07:00
2016-05-18 17:06:50 -07:00