Re: [chrony-dev] Support for Multiple PPS Inputs on single PHC

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




On 2/16/23 12:19 AM, Miroslav Lichvar wrote:
On Wed, Feb 15, 2023 at 10:27:15PM -0800, Matt Corallo wrote:
My naive solution from skimming the code would be to shove
formerly-discarded samples into a global limited queue and check for
available timestamps in `phc_poll`. However, I have no idea if the time
difference between when the sample was taken by the hardware and when the
`HCL_CookTime` call is done would impact accuracy (or maybe the opposite,
since we'd then be cooking time with the hardware clock right after taking
the HCL sample rather than when the PHC timestamp happens), or if such a
patch would simply be rejected as a dirty, dirty hack rather than unifying
the PHC read sockets across the devices into one socket (via some global
tracking the device -> socket mapping?) and passing the samples out
appropriately. Let me know what makes the most sense here.

My first thought is that this should be addressed in the kernel, so
even different processes having open the PHC device can receive all
extts samples. If it turns out it's too difficult to do for the
character device (I'm not very familiar with that subsystem), maybe it
could be done at least in sysfs (/sys/class/ptp/ptp*/fifo or a new
file showing the last event like the PPS assert and clear).

I mean my first thought seeing an ioctl on a socket that gives an explicit channel and then receives crap from other channels on the same socket was "wtf" so I went and read the kernel to figure out why first to see if its a driver bug. I can't seem to find *any* documentation for how these ioctls are supposed to work, but it seems the "request" here is kinda misnomer, its really a "configure hardware" request, and is unrelated to future reads on the socket, or really the specific socket at all.

As for duplicating the output across sockets, ptp_chardev.c's `ptp_read` is pretty trivial - just pop the next sample off the queue and return it. Tweaking that to copy the sample into every reader is probably above my paygrade (and has a whole host of leak risk I'd probably screw up). `extts_fifo_show` appears to be functionally identical.

I've CC'd the MAINTAINERs for ptp to see what they think about this, though it won't let chrony support this without a kernel upgrade - not sure if that's an issue for chrony or not.

Matt

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