Re: [chrony-dev] SW/HW timestamping on Linux

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Fri, Nov 11, 2016 at 10:06:25AM -0800, Denny Page wrote:
> Following is output from test 4. Please let me know if this gives you the information that you are looking for.

It does. Thanks.

> 2016-11-11T17:45:06Z ntp_io.c:657:(process_message) Received 48 bytes from 192.168.230.244:123 to 192.168.230.3 fd=8 if=2 tss=2 delay=0.000022516
> 2016-11-11T17:45:06Z sourcestats.c:808:(SST_IsGoodSample) Bad sample: offset=-0.000002 delay=0.000042 incr_delay=0.000003 allowed=0.000014
> 2016-11-11T17:45:06Z ntp_core.c:1484:(receive_packet) NTP packet lvm=44 stratum=1 poll=4 prec=-25 root_delay=0.000000 root_disp=0.000000 refid=47505300 []
> 2016-11-11T17:45:06Z ntp_core.c:1489:(receive_packet) reference=1478886306.000000000 origin=882400267.756283207 receive=1478886306.082181777 transmit=1478886306.082186496
> 2016-11-11T17:45:06Z ntp_core.c:1491:(receive_packet) offset=0.000008163 delay=0.000042087 dispersion=0.000000 root_delay=0.000042 root_dispersion=0.000000
> 2016-11-11T17:45:06Z ntp_core.c:1495:(receive_packet) test123=111 test567=111 testABCD=1101 kod_rate=0 interleaved=0 valid=1 good=0 updated=1
> 2016-11-11T17:45:06Z ntp_io_linux.c:444:(NIO_Linux_ProcessMessage) Received 48 bytes from error queue for 192.168.230.244:123 fd=8 if=2 tss=2
> 2016-11-11T17:45:06Z ntp_core.c:1888:(update_tx_timestamp) Updated TX timestamp delay=0.000016447

This shows the problem is indeed in late reception of the transmit timestamp.
It comes after the response from the server is received, so the sample
is calculated with HW RX timestamp but only daemon TX timestamp.

I'm not sure if this is a driver or HW bug, or it's working as expected and
chrony just needs to be smarter and wait for the timestamp. This would be
tricky as we don't save packets and we generally don't know if there will
actually be a timestamp. I'll ask the kernel developers.

As a quick workaround I'd suggest to try it with this change:

--- a/ntp_io_linux.c
+++ b/ntp_io_linux.c
@@ -465,6 +465,8 @@ NIO_Linux_RequestTxTimestamp(struct msghdr *msg, int cmsglen, int sock_fd)
 {
   struct cmsghdr *cmsg;
 
+  usleep(100);
+
   /* Check if TX timestamping is disabled on this socket */
   if (permanent_ts_options || !NIO_IsServerSocket(sock_fd))
     return cmsglen;


-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/