Re: [PATCH net-next] ptp: add vclock timestamp conversion IOCTL

From: Richard Cochran
Date: Mon Oct 11 2021 - 08:58:21 EST


On Fri, Oct 08, 2021 at 09:13:58AM +0200, Sebastien Laveze wrote:
> Of course, so what tests and measurements can we bring on the table to
> convince you that it doesn't lead to chaos ?

So, to restate what I've said before, you cannot adjust both the
physical clock and the virtual clock at the same time.

Here is a simple example that has no solution, AFAICT.

- Imagine one physical and one virtual clock based on it.

- A user space program using the virtual clock synchronizes to within
100 nanoseconds of its upstream PTP Domain. So far, so good.

- Now a second program using the physical clock starts up, and
proceeds to measure, then correct the gross phase offset to its
upstream PTP Domain.

- The driver must now add, as your proposal entails, the reverse
correction into the virtual clock's timecounter/cyclecounter.

- However, this particular physical clock uses a RMW pattern to
program the offset correction.

- Boom. Now the duration of the RMW becomes an offset error in the
virtual clock. The magnitude may be microseconds or even
milliseconds for devices behind slow MDIO buses, for example.

End of story.

Thanks,
Richard