From: David Laight <David.Laight@ACULAB.COM>
To: "'Thomas Gleixner'" <tglx@linutronix.de>,
"Mahesh Bandewar (महेश बंडेवार)" <maheshb@google.com>
Cc: Netdev <netdev@vger.kernel.org>,
Linux <linux-kernel@vger.kernel.org>,
David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
"Richard Cochran" <richardcochran@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
"Sagi Maimon" <maimon.sagi@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
John Stultz <jstultz@google.com>,
Mahesh Bandewar <mahesh@bandewar.net>
Subject: RE: [PATCHv2 next] ptp: update gettimex64 to provide ts optionally in mono-raw base.
Date: Tue, 23 Apr 2024 09:22:06 +0000 [thread overview]
Message-ID: <f2ac461445f44addb521ef79ecedc584@AcuMS.aculab.com> (raw)
In-Reply-To: <87edaxudr8.ffs@tglx>
From: Thomas Gleixner
> Sent: 23 April 2024 01:25
...
> >> It really would be nice if those big adjustments didn't affect
> >> CLOCK_MONATONIC. (as an example try sending RTP audio every 20ms)
>
> They don't affect CLOCK_MONATONIC at all because there is no such clock :)
>
> > Hmm, probably this is out of context for this patch and probably a
> > question for the time maintainers / experts?
>
> The quantity of the initial frequency adjustments depends on the
> accuracy of the initial clock frequency calibration which is on most
> sane systems within +/- 500ppm.
>
> 500ppm of 20ms == 10us
>
> If the clock calibration is off by a larger margin then that needs to be
> fixed.
The initial adjustment depends on the accuracy of the initial RTC
value read from the local hardware.
This is unlikely to be more accurate than 1 second and can easily
be a few seconds out.
Correcting this causes NTP to adjust the clock at its maximum drift
rate for a while - I'm sure I've seen this happen for minutes.
Once this completes there is a 'step change' in the frequency adjustment.
Once the system has been running for a while the adjustments are minor.
Time runs alternately fast and slow to maintain long term accuracy.
This is noticeable if you use schedule_hrtimeout_range(,, HRTIMER_MODE_ABS)
to synchronize to an accurate external clock [1].
(Without NTP it has to adjust for temperature changing the frequency.)
David
[1] Imagine some hardware that counts usecs after the 1-second GPS pulse.
and a driver that adjusts a sleep to wake up when that count is between
(say) 400 and 600.
Using a timer and a single readl() is far faster than taking an interrupt.
(In our case it is a 10ms pulse derived from the clock recovered from
an E1/T1 telecoms link.)
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2024-04-23 9:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 4:27 [PATCHv2 next] ptp: update gettimex64 to provide ts optionally in mono-raw base Mahesh Bandewar
2024-04-19 1:55 ` Jakub Kicinski
2024-04-19 22:14 ` Mahesh Bandewar (महेश बंडेवार)
2024-04-19 4:56 ` Thomas Gleixner
2024-04-19 22:32 ` Mahesh Bandewar (महेश बंडेवार)
2024-04-21 18:27 ` David Laight
2024-04-22 22:04 ` Mahesh Bandewar (महेश बंडेवार)
2024-04-23 0:24 ` Thomas Gleixner
2024-04-23 9:22 ` David Laight [this message]
2024-04-23 13:22 ` Thomas Gleixner
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=f2ac461445f44addb521ef79ecedc584@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jstultz@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mahesh@bandewar.net \
--cc=maheshb@google.com \
--cc=maimon.sagi@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--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).