From patchwork Fri Mar 9 18:42:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 131210 Delivered-To: patches@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1324130lja; Fri, 9 Mar 2018 10:42:58 -0800 (PST) X-Received: by 10.99.112.20 with SMTP id l20mr25617917pgc.412.1520620978108; Fri, 09 Mar 2018 10:42:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520620978; cv=none; d=google.com; s=arc-20160816; b=QdiWGb95wka1A4ZmDQCgKx6AYq8PAW2HpPkQbjR5+7mzWCglEkxByz/8E9iJ+rdfo5 2y1vwEPurqS2PZ3/NAupB8/5CLdwG2gqt9CWRyn4vC8HFXnr0j/HJul81YVBC6tLo513 jaImREtUEwXbXZblBS8RkgriURH/+fPXnUECkc7uWFhSgM/s6Ofr+YP7oScA9fNucQ5f XSpz7eNVphPVyHBA8odjBQ4kiDY0qD83NWuO1QX62j18NM7WP1Eh+S2qR0YGu/0z7IWl R8ckk3uDfYEtbsTGvvxyT4miZGdJTXMs+LpViR1/h2coFVMRGIAasFHQVLQNTGTc0UcJ 9QQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=dDhQrW8k/crEqc16SqOAjwwmtcmK3nmq6diyp2pWXoY=; b=gDMQp9rCXOFgWvCsDhxHuVwgGFih0Gq8lCnGlMz+RjCbcIOGk4qgPflzrQCOr3A9n8 YMSizvGuEfTBCj1SE0R9oCAObsxeIdYDHj9nSao8uR9fTlPOytJlAFI/jxR6hwmmY64l UgSQqlkN+HBiLs1Wjs2WN0veGxG57cuzhCiWlaUeX+XGdFjvx5CIzsCviZc3QtRN+zm+ cuCF8MLYIIAsNyzEs7lVd8UIZHibNb9H953OZmwl7wgpLJg8OW99ul1g6eFhfcdAY9HC o1m5rseOCF1E8t0oUY14M1Bzkb0+yCoeAlr4Cm7cZv2p5j7sgPAqHaZyJR8ZDRujlxF5 vz6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R7sj9NBY; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c1-v6sor723042plz.130.2018.03.09.10.42.57 for (Google Transport Security); Fri, 09 Mar 2018 10:42:58 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R7sj9NBY; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dDhQrW8k/crEqc16SqOAjwwmtcmK3nmq6diyp2pWXoY=; b=R7sj9NBYHct4p4Y64frwipMAeW42nCTIenz7Lt8V7z1ijjtLOJv8dJvT1js+NoNnM2 Mo2jNt889CUGOp0UAt38QCcAjdpfsAQNOht1Kuabzd0Kn7TXJMq368il4cs5pTwiYHqn xCr9PPE+By3RaeNL5FfPsu81LU0FGrOHdkJoY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dDhQrW8k/crEqc16SqOAjwwmtcmK3nmq6diyp2pWXoY=; b=kEpJsr+0UTvc/ULxveYzDRDJKAZvvfnm5E+J7wNegik2qPonZn4Js/FG9XHWBqZL0+ tqaiLD5ZDBmsUEq/fvsLJuixbSAzYjSO0rerD6nfNSs0IUbG4x9nSFuRRFIoe6jH+MIk 6Lqz39hhsW6MYcPlTXt0sdTDTooQ/n4A0k7fP4tqIjg2KufZGW7ebn3NdYtC4Kb3fbJS O0BrFvkpkDDXJFgXdW5t1D6lOh0v/Od9Ch7YsXCkwgQYwapmouJVPKlfGAXf2zJI163c qwHtl9Re7f2HsgwrH0y/109HgpXWYq5CnCsH2WeblcvGVQWNZbSh0K2CY/I7S4X6H4tJ sJnw== X-Gm-Message-State: APf1xPAHYurPZmPDwGnYTVSELymzQ9Mahc0HbUM35JQimoL+ZTIWav90 7aiYWuVeCinHrbqPEuvo9DcjarwF X-Google-Smtp-Source: AG47ELuITQin7v0zJ2C1PyL4csXYe35oqq9LKAEMViD/hUi3TSpASr9Rk9qFSZ3u/n2B0zETsCH5GQ== X-Received: by 2002:a17:902:3041:: with SMTP id u59-v6mr28605532plb.115.1520620977605; Fri, 09 Mar 2018 10:42:57 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:600:5100:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id y5sm4333162pfd.85.2018.03.09.10.42.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 10:42:56 -0800 (PST) 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> 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(-) -- 2.7.4 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; } /*