• Thomas Gleixner's avatar
    ntp: Make the RTC synchronization more reliable · c9e6189f
    Thomas Gleixner authored
    Miroslav reported that the periodic RTC synchronization in the NTP code
    fails more often than not to hit the specified update window.
    
    The reason is that the code uses delayed_work to schedule the update which
    needs to be in thread context as the underlying RTC might be connected via
    a slow bus, e.g. I2C. In the update function it verifies whether the
    current time is correct vs. the requirements of the underlying RTC.
    
    But delayed_work is using the timer wheel for scheduling which is
    inaccurate by design. Depending on the distance to the expiry the wheel
    gets less granular to allow batching and to avoid the cascading of the
    original timer wheel. See 500462a9 ("timers: Switch to a non-cascading
    wheel") and the code for further details.
    
    The code already deals with this by splitting the 660 seconds period into a
    long 659 seconds timer and then retrying with a smaller delta.
    
    But looking at the actual granularities of the timer wheel (which depend on
    the HZ...
    c9e6189f
ntp_internal.h 783 Bytes