Re: [PATCH net 1/2] ptp: idt82p33: optimize idt82p33_adjtime

From: Richard Cochran
Date: Wed Jun 23 2021 - 23:40:33 EST


On Wed, Jun 23, 2021 at 10:46:24AM -0400, min.li.xe@xxxxxxxxxxx wrote:
> From: Min Li <min.li.xe@xxxxxxxxxxx>
>
> The current adjtime implementation is read-modify-write and immediately
> triggered, which is not accurate due to slow i2c bus access. Therefore,
> we will use internally generated 1 PPS pulse as trigger, which will
> improve adjtime accuracy significantly. On the other hand, the new trigger
> will not change TOD immediately but delay it to the next 1 PPS pulse.

Delaying the adjustment by one second (in the worst case) will cause
problems. User space expects the adjustment to happen before the call
to adjtimex() returns.

In the case of PTP, if new Sync messages arrive before the delayed
adjustment completes, there will be a HUGE offset error, and that will
hurt the PI servo.

So it is better to accept a less accurate jump then to delay the
adjustment.

Thanks,
Richard