From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753402AbbDCIVp (ORCPT ); Fri, 3 Apr 2015 04:21:45 -0400 Received: from terminus.zytor.com ([198.137.202.10]:44799 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753310AbbDCIVX (ORCPT ); Fri, 3 Apr 2015 04:21:23 -0400 Date: Fri, 3 Apr 2015 01:20:49 -0700 From: tip-bot for John Stultz Message-ID: Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com, richardcochran@gmail.com, mingo@kernel.org, john.stultz@linaro.org, peterz@infradead.org, prarit@redhat.com Reply-To: john.stultz@linaro.org, prarit@redhat.com, peterz@infradead.org, richardcochran@gmail.com, mingo@kernel.org, hpa@zytor.com, tglx@linutronix.de, linux-kernel@vger.kernel.org In-Reply-To: <1427945681-29972-20-git-send-email-john.stultz@linaro.org> References: <1427945681-29972-20-git-send-email-john.stultz@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] clocksource: Improve comment explaining clocks_calc_max_nsecs()'s 50% safety margin Git-Commit-ID: 8e56f33f8439b2f8e7f4ae7f3d0bfe683ecc3b09 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 Commit-ID: 8e56f33f8439b2f8e7f4ae7f3d0bfe683ecc3b09 Gitweb: http://git.kernel.org/tip/8e56f33f8439b2f8e7f4ae7f3d0bfe683ecc3b09 Author: John Stultz AuthorDate: Wed, 1 Apr 2015 20:34:39 -0700 Committer: Ingo Molnar CommitDate: Fri, 3 Apr 2015 08:18:35 +0200 clocksource: Improve comment explaining clocks_calc_max_nsecs()'s 50% safety margin Ingo noted that the description of clocks_calc_max_nsecs()'s 50% safety margin was somewhat circular. So this patch tries to improve the comment to better explain what we mean by the 50% safety margin and why we need it. Signed-off-by: John Stultz Cc: Peter Zijlstra Cc: Prarit Bhargava Cc: Richard Cochran Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1427945681-29972-20-git-send-email-john.stultz@linaro.org Signed-off-by: Ingo Molnar --- kernel/time/clocksource.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index c3be3c7..15facb1 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -472,8 +472,11 @@ static u32 clocksource_max_adjustment(struct clocksource *cs) * @max_cyc: maximum cycle value before potential overflow (does not include * any safety margin) * - * NOTE: This function includes a safety margin of 50%, so that bad clock values - * can be detected. + * NOTE: This function includes a safety margin of 50%, in other words, we + * return half the number of nanoseconds the hardware counter can technically + * cover. This is done so that we can potentially detect problems caused by + * delayed timers or bad hardware, which might result in time intervals that + * are larger then what the math used can handle without overflows. */ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask, u64 *max_cyc) {