From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932667AbeCISrH (ORCPT ); Fri, 9 Mar 2018 13:47:07 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:43292 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932496AbeCISm6 (ORCPT ); Fri, 9 Mar 2018 13:42:58 -0500 X-Google-Smtp-Source: AG47ELuITQin7v0zJ2C1PyL4csXYe35oqq9LKAEMViD/hUi3TSpASr9Rk9qFSZ3u/n2B0zETsCH5GQ== From: John Stultz To: lkml Cc: Miroslav Lichvar , Thomas Gleixner , Ingo Molnar , Richard Cochran , Prarit Bhargava , Stephen Boyd , John Stultz Subject: [PATCH 1/4] timekeeping: Don't align frequency adjustments to ticks Date: Fri, 9 Mar 2018 10:42:47 -0800 Message-Id: <1520620971-9567-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520620971-9567-1-git-send-email-john.stultz@linaro.org> References: <1520620971-9567-1-git-send-email-john.stultz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miroslav Lichvar When the timekeeping multiplier is changed, the NTP error is updated to correct the clock for the delay between the tick and the update of the clock. This error is corrected in later updates and the clock appears as if the frequency was changed exactly on the tick. Remove this correction to keep the point where the frequency is effectively changed at the time of the update. This removes a major source of the NTP error. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Miroslav Lichvar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Stephen Boyd Signed-off-by: Miroslav Lichvar Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index cd03317..c1a0ac1 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1860,8 +1860,6 @@ static __always_inline void timekeeping_apply_adjustment(struct timekeeper *tk, * xtime_nsec_2 = xtime_nsec_1 - offset * Which simplfies to: * xtime_nsec -= offset - * - * XXX - TODO: Doc ntp_error calculation. */ if ((mult_adj > 0) && (tk->tkr_mono.mult + mult_adj < mult_adj)) { /* NTP adjustment caused clocksource mult overflow */ @@ -1872,7 +1870,6 @@ static __always_inline void timekeeping_apply_adjustment(struct timekeeper *tk, tk->tkr_mono.mult += mult_adj; tk->xtime_interval += interval; tk->tkr_mono.xtime_nsec -= offset; - tk->ntp_error -= (interval - offset) << tk->ntp_error_shift; } /* -- 2.7.4