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

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


On Tue, Nov 15, 2016 at 08:14:28PM -0800, Denny Page wrote:
> The chip is actually a I354, which is slightly different than the I350, but I don’t think it matters much. I also have interfaces with I211 chips, and the ordering issue appears to happen there as well. I don’t think the sleep after the send is going to affect the order of the timestamp and response messages since both are requested at the point of the outbound send.

I think what matters is the order in which they are received from the
socket. I don't know much about kernel internals. I assume the error
queue is separate and if chronyd waits until they are both queued, the
one in the error queue will be picked first, even if the response from
the server was processed by the kernel first. If the response does
need to be received from the socket before the tx timestamp and this
expected behavior, then I'm not sure how we will work around that.

Can you please try it again with the following patch and post the
debug output if the problem persists?

--- a/ntp_io.c
+++ b/ntp_io.c
@@ -29,6 +29,7 @@
 #include "config.h"
 
 #include "sysincl.h"
+#include <poll.h>
 
 #include "array.h"
 #include "ntp_io.h"
@@ -829,5 +830,17 @@ NIO_SendPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr,
       UTI_IPToString(&remote_addr->ip_addr), remote_addr->port,
       UTI_IPToString(&local_addr->ip_addr), local_addr->sock_fd);
 
+  struct timespec ts1, ts2;
+  struct pollfd pfd;
+  pfd.fd = local_addr->sock_fd;
+  pfd.events = POLLPRI;
+  clock_gettime(CLOCK_REALTIME, &ts1);
+  if (poll(&pfd, 1, 100)) {
+    clock_gettime(CLOCK_REALTIME, &ts2);
+    DEBUG_LOG(LOGF_NtpIO, "poll fd ready after %.9f seconds", UTI_DiffTimespecsToDouble(&ts2, &ts1));
+  } else {
+    DEBUG_LOG(LOGF_NtpIO, "poll timeout");
+  }
+
   return 1;
 }


-- 
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/