On Fri, Dec 04 2020 at 10:51, Alexandre Belloni wrote: > On 04/12/2020 10:34:13+0100, Thomas Gleixner wrote: >> So either the RTC knows the requirements for tsched, e.g. the MC14xxx >> datasheet, or it can retrieve that information from DT or by querying >> the underlying bus mechanics for the xfer time estimate or just by >> timing an xfer for reference. >> > > What I do from userspace is that the caller is the one estimating the > transfer time and this works very well. I really think that the ntp code > could do just the same. For MC14xxx type RTCs tsched is defined by a constant, so heuristics are really horrible because you have to poll the RTC to get it correct. What's the point if the driver can just provide the value from the data sheet? For RTC's behind a bus the driver its pretty simple to let the driver tell at RTC registration time that the transfer time is unknown. So you don't have to add the estimation procedure to each driver. You simply can add it to the core in one place and expose that info to user space as well as a starting point. Sticking that into the NTP code is really the wrong place. That's like asking the users of a timer device to calibrate it before usage. The requirements for writing a RTC are not a problem of the caller, they are fundamental properties of the RTC itself. So why on earth are you asking every user to implement heuristics to figure these out themself? Having it as property of the RTC device gives at least a halfways correct value for the periodic kernel side update and if user space want's to do better then it still can do so. Thanks, tglx