Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753490AbcKUIyI (ORCPT ); Mon, 21 Nov 2016 03:54:08 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35719 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752180AbcKUIyG (ORCPT ); Mon, 21 Nov 2016 03:54:06 -0500 Date: Mon, 21 Nov 2016 09:54:02 +0100 From: Ingo Molnar To: John Stultz Cc: lkml , Chris Metcalf , Richard Cochran , Prarit Bhargava , Thomas Gleixner Subject: Re: [PATCH 4/4] timekeeping: clocksource_cyc2ns: Document intended range limitation Message-ID: <20161121085402.GA529@gmail.com> References: <1479531014-25264-1-git-send-email-john.stultz@linaro.org> <1479531014-25264-5-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1479531014-25264-5-git-send-email-john.stultz@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2014 Lines: 50 * John Stultz wrote: > From: Chris Metcalf > > 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. > > Cc: Richard Cochran > Cc: Ingo Molnar > Cc: Prarit Bhargava > Cc: Thomas Gleixner > Signed-off-by: Chris Metcalf > [jstultz: Fixed up to merge against HEAD & commit message tweaks] > Signed-off-by: John Stultz > --- > 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..0881bca 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 not intended to work > + * with absolute clocksource cycles, as it will easily overflow, > + * but just intended for relative (delta) clocksource cycles. Had to read this explanation twice, how about: * 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. Did I get it right? Thanks, Ingo