From: Miroslav Lichvar <mlichvar@redhat.com>
To: John Stultz <jstultz@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Stephen Boyd <sboyd@kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, kernel-team@android.com,
Lei Chen <lei.chen@smartx.com>
Subject: Re: [PATCH v2 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids
Date: Tue, 25 Mar 2025 12:32:21 +0100 [thread overview]
Message-ID: <Z-KURRE_Gr72Xv_n@localhost> (raw)
In-Reply-To: <20250320200306.1712599-1-jstultz@google.com>
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
next prev parent reply other threads:[~2025-03-25 11:32 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 20:03 [PATCH v2 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids John Stultz
2025-03-20 20:03 ` [PATCH v2 2/2] selftests/timers: Improve skew_consistency by testing with other clockids John Stultz
2025-03-25 11:32 ` Miroslav Lichvar [this message]
2025-03-27 9:22 ` [PATCH v2 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids Thomas Gleixner
2025-03-27 15:42 ` Miroslav Lichvar
2025-03-27 17:32 ` Thomas Gleixner
2025-03-31 7:53 ` Miroslav Lichvar
2025-04-17 2:55 ` John Stultz
2025-03-31 14:53 ` Miroslav Lichvar
2025-04-01 6:34 ` Thomas Gleixner
2025-04-01 11:19 ` Miroslav Lichvar
2025-04-01 18:29 ` Thomas Gleixner
2025-04-03 8:32 ` Miroslav Lichvar
2025-04-03 11:29 ` Thomas Gleixner
2025-04-05 21:40 ` [PATCH] timekeeping: Prevent coarse clocks going backwards Thomas Gleixner
2025-04-17 5:29 ` John Stultz
2025-04-17 12:36 ` Thomas Gleixner
2025-04-18 0:46 ` John Stultz
2025-04-18 6:37 ` Thomas Gleixner
2025-04-18 7:00 ` Thomas Gleixner
2025-04-19 5:55 ` John Stultz
2025-04-18 18:40 ` John Stultz
2025-04-19 5:46 ` [PATCH v3] " John Stultz
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=Z-KURRE_Gr72Xv_n@localhost \
--to=mlichvar@redhat.com \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=jstultz@google.com \
--cc=kernel-team@android.com \
--cc=lei.chen@smartx.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).