[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z-KURRE_Gr72Xv_n@localhost>
Date: Tue, 25 Mar 2025 12:32:21 +0100
From: Miroslav Lichvar <mlichvar@...hat.com>
To: John Stultz <jstultz@...gle.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Stephen Boyd <sboyd@...nel.org>,
Anna-Maria Behnsen <anna-maria@...utronix.de>,
Frederic Weisbecker <frederic@...nel.org>,
Shuah Khan <shuah@...nel.org>, linux-kselftest@...r.kernel.org,
kernel-team@...roid.com, Lei Chen <lei.chen@...rtx.com>
Subject: Re: [PATCH v2 1/2] time/timekeeping: Fix possible inconsistencies in
_COARSE clockids
On Thu, Mar 20, 2025 at 01:03:00PM -0700, John Stultz wrote:
> +static u64 timekeeping_accumulate(struct timekeeper *tk, u64 offset,
> + enum timekeeping_adv_mode mode,
> + unsigned int *clock_set)
> + * Also reset tk::ntp_error as it does not make sense to keep the
> + * old accumulated error around in this case.
> + */
I'm not sure if I still understand the timekeeping code correctly, but
that doesn't seem right to me. At least the comment should explain why
it does not make sense to keep the NTP error.
Resetting the NTP error causes a small time step. An NTP/PTP client
can be setting the frequency very frequently, e.g. up to 128 times per
second and the interval between updates can be random. If the timing
was right, I suspect it could cause a measurable drift. The client
should be able to compensate for it, but why make its job harder by
making the clock less predictable. My expectation for the clock is
that its frequency will not change if the same (or only slightly
different) frequency is set repeatedly by adjtimex().
> + if (mode == TK_ADV_FREQ) {
> + timekeeping_forward(tk, tk->tkr_mono.cycle_last + offset);
> + tk->ntp_error = 0;
> + return 0;
> + }
--
Miroslav Lichvar
Powered by blists - more mailing lists