Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1532552

[tip:timers/core] timekeeping/clocksource_cyc2ns: Document intended range limitation

From tip-bot for Chris Metcalf <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:timers/core] timekeeping/clocksource_cyc2ns: Document intended range limitation
Date 2016-11-29 18:20 +0100
Message-ID <sIUeu-2Xs-35@gated-at.bofh.it> (permalink)
References <sICKC-89o-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  ec4101e8903e318b9fd4e3bbf72b1eaba53c64e1
Gitweb:     http://git.kernel.org/tip/ec4101e8903e318b9fd4e3bbf72b1eaba53c64e1
Author:     Chris Metcalf <cmetcalf@mellanox.com>
AuthorDate: Mon, 28 Nov 2016 14:35:20 -0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 29 Nov 2016 18:02:58 +0100

timekeeping/clocksource_cyc2ns: Document intended range limitation

The "cycles" argument should not be an absolute clocksource cycle
value, as the implementation's arithmetic will overflow relatively
easily with wide (64 bit) clocksource counters.

For performance, the implementation is simple and fast, since the
function is intended for only relatively small delta values of
clocksource cycles.

[jstultz: Fixed up to merge against HEAD & commit message tweaks,
 also included rewording suggestion by Ingo]
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Link: http://lkml.kernel.org/r/1480372524-15181-4-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 include/linux/clocksource.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 0839818..65602d3 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -169,7 +169,10 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
  * @mult:	cycle to nanosecond multiplier
  * @shift:	cycle to nanosecond divisor (power of two)
  *
- * Converts cycles to nanoseconds, using the given mult and shift.
+ * Converts clocksource cycles to nanoseconds, using the given @mult and @shift.
+ * The code is optimized for performance and is not intended to work
+ * with absolute clocksource cycles (as those will easily overflow),
+ * but is only intended to be used with relative (delta) clocksource cycles.
  *
  * XXX - This could use some mult_lxl_ll() asm optimization
  */

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL][PATCH 0/7] Timekeeping changes for 4.10 (take 2) John Stultz <john.stultz@linaro.org> - 2016-11-28 23:40 +0100
  [PATCH 3/7] timekeeping: clocksource_cyc2ns: Document intended range limitation John Stultz <john.stultz@linaro.org> - 2016-11-28 23:40 +0100
    [tip:timers/core] timekeeping/clocksource_cyc2ns: Document intended  range limitation tip-bot for Chris Metcalf <tipbot@zytor.com> - 2016-11-29 18:20 +0100
  [PATCH 5/7] timekeeping: Add a fast and NMI safe boot clock John Stultz <john.stultz@linaro.org> - 2016-11-28 23:40 +0100
    [tip:timers/core] timekeeping: Add a fast and NMI safe boot clock tip-bot for Joel Fernandes <tipbot@zytor.com> - 2016-11-29 18:20 +0100
  [PATCH 7/7] trace: Update documentation for mono, mono_raw and boot clock John Stultz <john.stultz@linaro.org> - 2016-11-28 23:40 +0100
    Re: [PATCH 7/7] trace: Update documentation for mono, mono_raw and  boot clock Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 00:10 +0100
    Re: [PATCH 7/7] trace: Update documentation for mono, mono_raw and  boot clock Ingo Molnar <mingo@kernel.org> - 2016-11-29 08:30 +0100
      Re: [PATCH 7/7] trace: Update documentation for mono, mono_raw and  boot clock Thomas Gleixner <tglx@linutronix.de> - 2016-11-29 17:20 +0100
      Re: [PATCH 7/7] trace: Update documentation for mono, mono_raw and  boot clock Joel Fernandes <joelaf@google.com> - 2016-11-29 17:20 +0100
    [tip:timers/core] trace: Update documentation for mono, mono_raw  and boot clock tip-bot for Joel Fernandes <tipbot@zytor.com> - 2016-11-29 18:20 +0100

csiph-web