Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756363AbcK2RLz (ORCPT ); Tue, 29 Nov 2016 12:11:55 -0500 Received: from terminus.zytor.com ([198.137.202.10]:38648 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756240AbcK2RLm (ORCPT ); Tue, 29 Nov 2016 12:11:42 -0500 Date: Tue, 29 Nov 2016 09:11:23 -0800 From: tip-bot for Chris Metcalf Message-ID: Cc: richardcochran@gmail.com, linux-kernel@vger.kernel.org, prarit@redhat.com, tglx@linutronix.de, mingo@kernel.org, cmetcalf@mellanox.com, hpa@zytor.com, john.stultz@linaro.org Reply-To: richardcochran@gmail.com, linux-kernel@vger.kernel.org, prarit@redhat.com, tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, cmetcalf@mellanox.com, john.stultz@linaro.org In-Reply-To: <1480372524-15181-4-git-send-email-john.stultz@linaro.org> References: <1480372524-15181-4-git-send-email-john.stultz@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] timekeeping/clocksource_cyc2ns: Document intended range limitation Git-Commit-ID: ec4101e8903e318b9fd4e3bbf72b1eaba53c64e1 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2051 Lines: 46 Commit-ID: ec4101e8903e318b9fd4e3bbf72b1eaba53c64e1 Gitweb: http://git.kernel.org/tip/ec4101e8903e318b9fd4e3bbf72b1eaba53c64e1 Author: Chris Metcalf AuthorDate: Mon, 28 Nov 2016 14:35:20 -0800 Committer: Thomas Gleixner 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 Signed-off-by: John Stultz Cc: Prarit Bhargava Cc: Richard Cochran Link: http://lkml.kernel.org/r/1480372524-15181-4-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner --- 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 */