John Stultz
58bfea9532
timekeeping: Fix __ktime_get_fast_ns() regression
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: stable <stable@vger.kernel.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>
2016-10-05 15:44:46 +02:00
..
2016-08-12 21:53:33 -07:00
2016-09-01 17:52:01 -07:00
2016-02-22 08:51:37 +01:00
2016-09-23 07:20:33 +02:00
2016-07-15 14:54:27 +09:00
2016-09-25 16:46:52 -04:00
2016-08-04 10:16:55 +09:30
2016-09-22 15:25:56 +02:00
2016-09-13 02:35:27 +02:00
2016-09-01 17:52:01 -07:00
2016-10-03 12:15:00 -07:00
2016-10-03 16:13:28 -07:00
2016-10-05 15:44:46 +02:00
2016-10-03 16:13:28 -07:00
2015-10-21 15:18:35 +01:00
2015-11-19 17:51:48 +01:00
2016-01-22 18:04:28 -05:00
2016-04-04 09:46:47 -04:00
2016-09-01 15:55:56 -07:00
2016-07-29 17:54:17 -07:00
2016-07-29 17:54:17 -07:00
2016-06-27 11:01:00 -04:00
2016-07-29 17:54:17 -07:00
2016-06-06 20:16:18 +10:00
2015-12-03 10:24:08 -05:00
2016-06-21 15:03:36 -04:00
2016-09-30 10:54:46 +02:00
2015-11-24 09:56:43 +01:00
2015-09-03 02:42:20 +02:00
2016-10-03 19:43:08 -07:00
2016-09-16 11:31:17 -04:00
2016-06-30 18:05:09 -05:00
2016-01-14 16:00:49 -08:00
2016-09-22 14:53:45 +02:00
2015-09-10 13:29:01 -07:00
2016-09-16 09:18:54 +02:00
2016-07-28 16:07:41 -07:00
2016-01-20 17:09:18 -08:00
2016-09-05 17:20:18 +02:00
2016-08-24 12:16:13 +02:00
2015-11-23 09:44:58 +01:00
2016-08-05 09:00:54 -04:00
2016-03-15 16:55:16 -07:00
2016-01-20 17:09:18 -08:00
2016-06-15 04:56:35 -07:00
2016-08-02 19:35:31 -04:00
2016-09-01 17:52:01 -07:00
2016-01-20 17:09:18 -08:00
2016-08-02 19:35:27 -04:00
2015-10-23 17:55:10 +09:00
2015-08-04 10:16:54 +02:00
2016-08-02 19:35:30 -04:00
2016-09-16 09:18:53 +02:00
2016-02-09 11:54:23 +01:00
2016-05-23 17:04:14 -07:00
2015-09-11 15:21:34 -07:00
2016-09-09 17:34:46 -07:00
2016-04-11 22:43:43 +01:00
2016-08-04 09:14:38 -04:00
2015-09-01 08:40:25 -07:00
2016-02-16 13:04:58 -05:00
2016-09-19 21:44:30 +02:00
2016-08-02 19:35:29 -04:00
2015-11-09 15:53:39 -08:00
2016-05-27 15:26:11 -07:00
2016-07-15 10:41:42 +02:00
2016-08-04 08:50:07 -04:00
2015-09-10 13:29:01 -07:00
2016-09-06 18:30:20 +02:00
2016-04-14 12:56:09 -07:00
2016-08-30 16:12:46 -07:00
2016-09-14 21:28:11 +02:00
2016-09-22 14:49:10 +02:00
2016-09-22 12:28:00 +02:00
2016-03-01 20:36:56 +01:00
2016-10-03 19:43:08 -07:00
2016-10-03 13:39:00 -07:00
2015-12-01 14:00:53 -05:00
2016-05-23 17:04:14 -07:00
2016-05-20 17:58:30 -07:00
2016-08-26 17:39:35 -07:00
2016-08-02 19:35:02 -04:00
2016-04-23 20:13:25 -04:00
2016-08-22 10:01:49 -07:00
2016-03-22 15:36:02 -07:00
2016-02-29 09:53:09 +01:00
2016-09-05 13:52:39 +02:00
2016-06-24 10:40:31 -05:00
2016-07-10 20:58:36 +02:00
2016-03-02 10:28:47 -05:00
2016-07-29 13:55:30 -07:00