lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF2d9jj6H+jOfUbbw1ZEHmgqroXmn+oFV8NwTyKJ_P_T4G_5xg@mail.gmail.com>
Date: Mon, 22 Apr 2024 15:04:27 -0700
From: Mahesh Bandewar (महेश बंडेवार) <maheshb@...gle.com>
To: David Laight <David.Laight@...lab.com>
Cc: Netdev <netdev@...r.kernel.org>, Linux <linux-kernel@...r.kernel.org>, 
	David Miller <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, 
	Thomas Gleixner <tglx@...utronix.de>, Richard Cochran <richardcochran@...il.com>, 
	Arnd Bergmann <arnd@...db.de>, Sagi Maimon <maimon.sagi@...il.com>, Jonathan Corbet <corbet@....net>, 
	John Stultz <jstultz@...gle.com>, Mahesh Bandewar <mahesh@...dewar.net>
Subject: Re: [PATCHv2 next] ptp: update gettimex64 to provide ts optionally in
 mono-raw base.

On Sun, Apr 21, 2024 at 11:27 AM David Laight <David.Laight@...lab.com> wrote:
>
> From: Mahesh Bandewar
> > Sent: 18 April 2024 05:27
> >
> > The current implementation of PTP_SYS_OFFSET_EXTENDED provides
> > PHC reads in the form of [pre-TS, PHC, post-TS]. These pre and
> > post timestamps are useful to measure the width of the PHC read.
> > However, the current implementation provides these timestamps in
> > CLOCK_REALTIME only. Since CLOCK_REALTIME is disciplined by NTP
> > or NTP-like service(s), the value is subjected to change. This
> > makes some applications that are very sensitive to time change
> > have these timestamps delivered in different time-base.
> ...
>
> Isn't using CLOCK_REALTIME just a big bug?
> As well as minor 'corrections' done by NTP it suffers from
> major time-warps that can jump in either direction by arbitrary amounts.
>
Yes, this arbitrary jump in either direction is a problem and hence
the proposed update. However, since it's a UAPI and there could be use
cases that are happy with the current implementation, we can't break
them. Of course the use case that I'm bringing in (and probably what
you have in mind) differs but backward compatibility needs to be
maintained.

> If I understand the intent of the UAPI, a possibly solution is
> to get the offset between CLOCK_REALTIME and CLOCK_MONATONIC and
> ensure the same offset is added CLOCK_MONATONIC for the pre- and
> post- timestamps.
>
As I understand, the UAPI is to read the PHC and also use the pre/post
timestamps to see the latency of that PHC read as well. CLOCK_REALTIME
is disciplined by NTP and to certain extents CLOCK_MONOTONIC as well
(only freq adjustments are applied). CLOCK_MONOTONIC_RAW is the only
unaffected time-base and hence this proposal / enhancement.

> This doesn't solve the problem of the NTP adjusted clock always
> running slightly slow or fast.
> The big NTP errors happen in the first (IIRC up to ~20 mins after boot)
> when the system clock is being synchronised.
Yes, a big step is a high possibility at the beginning (at boot) but
smaller steps as well as ppm adjustments are real possibilities
throughout and hence CLOCK_REALTIME and CLOCK_MONOTONIC are affected.
By adding the timestamps in CLOCK_MONOTONIC_RAW (as proposed in this
patch) should address this issue.

> It really would be nice if those big adjustments didn't affect
> CLOCK_MONATONIC.
> (as an example try sending RTP audio every 20ms)
>
Hmm, probably this is out of context for this patch and probably a
question for the time maintainers / experts?

>         David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ