All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miroslav Lichvar <mlichvar@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Thomas Gleixner <tglx@kernel.org>,
	John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>,
	Rodolfo Giometti <giometti@enneenne.com>,
	Ryan Luu <rluu@amazon.com>, Julien Ridoux <ridouxj@amazon.com>,
	linux-kernel@vger.kernel.org, David Woodhouse <dwmw@amazon.co.uk>
Subject: Re: [PATCH 4/5] timekeeping: Reinstate proportional correction of ntp_error
Date: Mon, 5 Oct 2026 12:04:53 +0200	[thread overview]
Message-ID: <asN2RcjoTNN5rpaK@localhost> (raw)
In-Reply-To: <20261001202134.33929-5-dwmw2@infradead.org>

On Thu, Oct 01, 2026 at 09:21:33PM +0100, David Woodhouse wrote:
> From: David Woodhouse <dwmw@amazon.co.uk>
> 
> The ±1 mult dithering is sufficient to keep ntp_error at zero once
> it's already there, but it doesn't do much to reduce it once any
> significant ntp_error has accumulated (e.g. from frequency or phase
> adjustments) — it can typically only drain single-digit nanoseconds
> per second. Commit dc491596f639 ("timekeeping: Rework frequency
> adjustments to work better w/ nohz") removed a larger skew because in
> a tickless kernel, it would remain in effect for a full idle period
> and overshoot. Now that timekeeping_max_deferment() ensures that the
> system wakes at the top of the second when skew is active, the
> correction can be reinstated. If ntp_error exceeds an amount that a
> single ±1 change to mult can drain within a minute, add an
> additional bias to mult to close the gap.

The dithering is switching between an adjustment of +0 and +1, there
is no -1. The time to drain depends on the direction. If the mult
division has no remainder, it's infinite for +0. I think that's ok for
this change, but the message and comment could be more clear.

A faster correction creates a larger frequency error.

Is this patch considered a requirement of the one adding the ntp_error
correction to PPS and other timestamps to avoid larger inconsistencies
with clock_gettime()?

I'm wondering if this duality of the clock wrt the way it's read
couldn't cause any issues. Any chance there could be a new clock ID
for applications to do clock_gettime() with the ntp_error corrected as
well?

-- 
Miroslav Lichvar


  reply	other threads:[~2026-10-05 10:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 20:21 [PATCH 0/5] timekeeping: Reduce magnitude of ntp_error David Woodhouse
2026-10-01 20:21 ` [PATCH 1/5] timekeeping: Allow tick_length changes to apply mid-tick David Woodhouse
2026-10-21 19:01   ` John Stultz
2026-10-22 13:39     ` David Woodhouse
2026-10-22 19:40       ` John Stultz
2026-10-01 20:21 ` [PATCH 2/5] ntp: Recalculate skew_delta when the phase offset changes David Woodhouse
2026-10-21 19:05   ` John Stultz
2026-10-01 20:21 ` [PATCH 3/5] timekeeping: Bound idle sleep while a phase slew is in flight David Woodhouse
2026-10-22 21:14   ` John Stultz
2026-10-22 21:49     ` David Woodhouse
2026-10-01 20:21 ` [PATCH 4/5] timekeeping: Reinstate proportional correction of ntp_error David Woodhouse
2026-10-05 10:04   ` Miroslav Lichvar [this message]
2026-10-05 13:17     ` David Woodhouse
2026-10-22 21:09   ` John Stultz
2026-10-01 20:21 ` [PATCH 5/5] [DO NOT MERGE] timekeeping: Apply extrapolated ntp_error to clock snapshots David Woodhouse
2026-10-02  8:30   ` Rodolfo Giometti
2026-10-02  9:14     ` David Woodhouse
2026-10-02 10:26       ` Rodolfo Giometti
2026-10-02 22:47         ` David Woodhouse
2026-10-05  8:15           ` Rodolfo Giometti
2026-10-05  8:49             ` David Woodhouse
2026-10-05 10:15               ` Rodolfo Giometti
2026-10-05 10:49                 ` David Woodhouse
2026-10-21 14:37 ` [PATCH 0/5] timekeeping: Reduce magnitude of ntp_error David Woodhouse
2026-10-22  9:05   ` Rodolfo Giometti
2026-10-22 13:52     ` Miroslav Lichvar
2026-10-22 16:17       ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=asN2RcjoTNN5rpaK@localhost \
    --to=mlichvar@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=dwmw@amazon.co.uk \
    --cc=giometti@enneenne.com \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ridouxj@amazon.com \
    --cc=rluu@amazon.com \
    --cc=sboyd@kernel.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.