Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3641423imm; Tue, 29 May 2018 10:43:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQ3Bv8LOrMO3XGd1UrhpGKi6Riz18JWZkCQ8AIxrx9lnE8tXc1GZVPjSjKbNGO82khv3oU X-Received: by 2002:a17:902:14b:: with SMTP id 69-v6mr18845939plb.184.1527615810012; Tue, 29 May 2018 10:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527615809; cv=none; d=google.com; s=arc-20160816; b=tKfiHa5lZGyt6Y3w6BT60WyF1TNAUyyq+ezAXctBOakY7c3nylMzLhqUfYeQwdp8jq uydg2m2YEZO8DDHp9zQJ/T+WmzjEw+bwOeVOCnbt/KAm/U9xR/g2XdkSk5c3i99pLw6r 3GJ7DQ62qnmWex27hxC8AFyeewvFrEcxLQanoeLCevBmvrlkOc3WjPUD/taA4zmiJzXf WjSt5jWkDUWtTPhgyxAAF8HDEcYvuMvdRZDewyGHW9yHDkUJln754UH1NWt9YBZSrDM1 Ll6OInrk6bmzIetdrK4c9cXwlDeoDQP9cLOxS+kthFg9PmUR6/wtw0SKz1t0iBwQcr8v HNUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=vZ/85ZmCI3HRBw6N5C/IcnpCmDhIrdYH1LSWhvJX1O8=; b=MduPxrlyHGik6PFhRpG5fEBrNnvdv0+I/NmSUm7dPa5LXnlG7U2y4zphkQgskuKf5q KHtI+RN/lxCLLxeY6fi58yBqmV7TmWuXAwftEORT50TIJ5aPBuoFGxXFEEFo37LQxlLb kENOqf4SSQvaXlkTjbYWZm9DG/7GZ+nvCH+5D9NqmPNbfW7/o1HWu1Q1qjovYAPJ+bbJ MZOByVdsnoJMkObBkRPuyfngDfqFGtZb6NzSi8Hx/fCRJNZfI8EhI/KIP0JtftRKeOEV bRIuvRcStOa4+EgtUQJP8wSzQpb5cKY052GzvA1YXvR8J27EPMwMtu+W+dEZPvITuEIB mP9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E0ncgO15; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si34035602pfi.212.2018.05.29.10.43.16; Tue, 29 May 2018 10:43:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E0ncgO15; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965602AbeE2RmJ (ORCPT + 99 others); Tue, 29 May 2018 13:42:09 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:40210 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965376AbeE2RmI (ORCPT ); Tue, 29 May 2018 13:42:08 -0400 Received: by mail-wm0-f66.google.com with SMTP id x2-v6so35472634wmh.5 for ; Tue, 29 May 2018 10:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vZ/85ZmCI3HRBw6N5C/IcnpCmDhIrdYH1LSWhvJX1O8=; b=E0ncgO154H7leQkiquhemHDMomQKgdcOOv8rajr2OygRySKs4QvwdOMZ2MSgVsEE7v rNbSPAEqJOnWH10EDVHJtHxTBupXoiRQHQuuN58vSPJRyOt4sr6vj8G9WFII6wjO++/M 3R03knY2CTn99UHrG7PXnMbzGrskRydwksVT4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vZ/85ZmCI3HRBw6N5C/IcnpCmDhIrdYH1LSWhvJX1O8=; b=rcpT3DMwfx8XvWmc1CH7Ssp6FTannq51EHP7zMpWMnlppnwBmGXHNS0WrsfbeSn3Vj TK4i3aO6/tOy80D9vQF2778bijyLHFokrNjoYrSCjx0qwI0aenM12Y9BsjTavXlliLJe h3CmGLT1dbKUdR4UFMfwsdVJoJ0dnmnokKocaCd+MKpFuLUFiy/C4aHO9fD6BNI0uGJ7 TcxWLgCzAV8xVWEg+NVmbSBjPgkLgtqEsljfYxOilyrtvtQXvVh1nDDFu6byazl2VH2k 6FTqaadbFW7Kd5jSTAIpUH5GPeqq1Dx126n30DjVincyAI5b/7Oy5Vt9IuSDTUnoWR0u tccQ== X-Gm-Message-State: ALKqPwftKs3Xczalihkd2AbDQQNwixCWXAjhRSedr9HQhQZgv0B7Ifr+ rHoz6nkz9v49qrHi1AasDraw1V3NyuUVolkCZbq6Ug== X-Received: by 2002:a1c:355:: with SMTP id 82-v6mr10769095wmd.96.1527615727029; Tue, 29 May 2018 10:42:07 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:160e:0:0:0:0:0 with HTTP; Tue, 29 May 2018 10:42:05 -0700 (PDT) In-Reply-To: <20180529105343.26870-1-mlichvar@redhat.com> References: <20180529105343.26870-1-mlichvar@redhat.com> From: John Stultz Date: Tue, 29 May 2018 10:42:05 -0700 Message-ID: Subject: Re: [PATCHv1] timekeeping: Update multiplier when NTP frequency is set directly To: Miroslav Lichvar Cc: lkml , Thomas Gleixner , Richard Cochran , Prarit Bhargava Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 29, 2018 at 3:53 AM, Miroslav Lichvar wrote: > When the NTP frequency is set directly from userspace using the > ADJ_FREQUENCY or ADJ_TICK timex mode, immediately update the > timekeeper's multiplier instead of waiting for the next tick. > > This removes a hidden non-deterministic delay in setting of the > frequency and allows an extremely tight control of the system clock > with update rates close to or even exceeding the kernel HZ. > > Cc: Thomas Gleixner > Cc: John Stultz > Cc: Richard Cochran > Cc: Prarit Bhargava > Signed-off-by: Miroslav Lichvar > --- > > Notes: > RFC->v1: > - added a new parameter to force the update of the timekeeper to the current > NTP tick length only from adjtimex() > - added timekeeping_advance() to keep the parameter local to timekeeping.c > > kernel/time/timekeeping.c | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c > index 49cbceef5deb..5524c07d43e3 100644 > --- a/kernel/time/timekeeping.c > +++ b/kernel/time/timekeeping.c > @@ -2021,11 +2021,11 @@ static u64 logarithmic_accumulation(struct timekeeper *tk, u64 offset, > return offset; > } > > -/** > - * update_wall_time - Uses the current clocksource to increment the wall time > - * > +/* > + * timekeeping_advance - Updates the timekeeper to the current time and > + * current NTP tick length > */ > -void update_wall_time(void) > +static void timekeeping_advance(bool force_update) This is kind of a nit, but mind switching out bool for an enum? Using something like TK_ADV_NORMAL and TK_ADV_FORCE? > +void update_wall_time(void) > +{ > + timekeeping_advance(false); > +} The enum makes usage like timekeeping_advance(false) a little less opaque to the reader ("Wait, don't advance? Let me go look at the function"). We got bitten by this earlier when we had the old "timekeeping_update(tk, true, false, true)" usage. thanks -john