From: Rodolfo Giometti <giometti@enneenne.com>
To: David Woodhouse <dwmw2@infradead.org>,
Richard Cochran <richardcochran@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
John Stultz <jstultz@google.com>,
Thomas Gleixner <tglx@kernel.org>,
Stephen Boyd <sboyd@kernel.org>,
Miroslav Lichvar <mlichvar@redhat.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Alexander Gordeev <agordeev@linux.ibm.com>
Subject: Re: [PATCH v4 3/4] pps: Always use ktime_get_snapshot_id() for pps_get_ts()
Date: Mon, 28 Sep 2026 18:41:28 +0200 [thread overview]
Message-ID: <2ccdc198-8284-4a6c-8afd-32dafbaf27cf@enneenne.com> (raw)
In-Reply-To: <aa9a0ec325a0cff908d19542b71b780424a4af30.camel@infradead.org>
On Mon, 2026-09-28 at 13:59 +0100, David Woodhouse wrote:
> Theoretically, absent other bugs (qv), ntp_error should rarely be more
> than a few tens of nanoseconds and even that is the extreme case.
[...]
> However, I *have* seen (and fixed) the tick_length changes at chrony
> startup introducing 83µs into ntp_error, which would take *days* to
> drain through the normal ±1 dithering, and would screw up the actual
> frequency settings while it was draining.
Thanks, that gives the order of magnitude I was asking for. Tens of
nanoseconds is below what chrony or ntpd can resolve from a PPS
source, so in the normal case the two lines are indistinguishable.
I think the "Allow tick_length changes to apply mid-tick" fix should
land before (or together with) the patch applying ntp_error to the
snapshots, and the commit message of the latter should say so.
> I wonder if we should switch PPS to using ktime_get_snapshot_id() in an
> *earlier* patch, which wouldn't then include the behavioural change.
> Then the note in the 'Apply extrapolated error' patch can then cover
> PPS and we consider them all together.
Yes, please. That split works well for me:
- the patch switching pps_get_ts() to ktime_get_snapshot_id() is pure
plumbing: ts_real keeps its current meaning, and its cost is the
one you measured and I already accepted. I can ack that one;
- the semantic change then lives in "timekeeping: Apply extrapolated
ntp_error to clock snapshots", covering PPS and the other snapshot
users together. That is a timekeeping decision, and it is the patch
where the chrony and ntpd maintainers should be Cc'ed and ack.
As a bonus the two changes can be bisected and reverted independently,
which helps if userspace does notice something.
> The PPS change does stand alone anyway — regardless of the snapshot
> *corrections*, I want PPS using snapshots so that it can report the
> actual *counter* values to userspace, like PTP is going to be able to.
That is new ABI for the PPS subsystem, so please post it as a separate
series, and I would like to see the proposed interface before the
code. Things I would want settled there: how userspace learns which
counter the value refers to (and what happens when the clocksource
changes), and that the existing ioctls and struct pps_ktime stay
unchanged for current users.
Please also keep RFC 2783 in mind: the PPS API is defined there and
LinuxPPS has to stay compliant with it, so the counter values should
come as an extension on top of it that RFC-based users (e.g.
time_pps_fetch() via timepps.h) can simply ignore.
> They shouldn't be compared directly with a clock_gettime() where
> userspace... is preempted and... calls into the vDSO to get the time...
> is preempted again and... eventually does something with that timestamp
> which it considers to be current, or worse paired with whatever happens
> before or after it.
Agreed for a single reading. My concern is systematic rather than
per-sample: chrony and ntpd do compare PPS timestamps with timestamps
taken from the sanitized clock (e.g. NTP packet timestamps), and a
slowly varying offset between the two lines does not average out the
way preemption jitter does. With ntp_error in the tens of nanoseconds
it is irrelevant; I just want the larger cases fixed first and
documented. I'll wait for Miroslav's opinion on the userspace side.
Ciao,
Rodolfo
next prev parent reply other threads:[~2026-09-28 16:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-29 20:56 [PATCH v4 0/4] Add ntp_error to clock snapshot, enable NTP_PPS on tickless kernel David Woodhouse
2026-08-29 20:56 ` [PATCH v4 1/4] timekeeping: Apply extrapolated ntp_error to clock snapshots David Woodhouse
2026-08-29 20:57 ` [PATCH v4 2/4] pps: Drop the !NO_HZ_COMMON dependency from NTP_PPS David Woodhouse
2026-09-01 15:35 ` Rodolfo Giometti
2026-09-02 0:13 ` David Woodhouse
2026-09-28 13:37 ` David Woodhouse
2026-09-28 16:41 ` Rodolfo Giometti
2026-09-28 19:28 ` David Woodhouse
2026-09-29 6:33 ` Rodolfo Giometti
2026-09-29 9:32 ` David Woodhouse
2026-09-29 11:48 ` Rodolfo Giometti
2026-09-29 12:02 ` David Woodhouse
2026-08-29 20:57 ` [PATCH v4 3/4] pps: Always use ktime_get_snapshot_id() for pps_get_ts() David Woodhouse
2026-09-01 15:35 ` Rodolfo Giometti
2026-09-01 23:56 ` David Woodhouse
2026-09-26 20:38 ` David Woodhouse
2026-09-28 7:58 ` Rodolfo Giometti
2026-09-28 12:59 ` David Woodhouse
2026-09-28 16:41 ` Rodolfo Giometti [this message]
2026-08-29 20:57 ` [PATCH v4 4/4] [DO NOT MERGE] ptp: ptp_vmclock: Add simulated 1PPS support David Woodhouse
2026-09-01 15:35 ` [PATCH v4 0/4] Add ntp_error to clock snapshot, enable NTP_PPS on tickless kernel Rodolfo Giometti
2026-09-01 23:37 ` 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=2ccdc198-8284-4a6c-8afd-32dafbaf27cf@enneenne.com \
--to=giometti@enneenne.com \
--cc=agordeev@linux.ibm.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dwmw2@infradead.org \
--cc=edumazet@google.com \
--cc=jstultz@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mlichvar@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®