On Fri, Apr 18, 2025 at 12:00 AM Thomas Gleixner tglx@linutronix.de wrote:
On Fri, Apr 18 2025 at 08:37, Thomas Gleixner wrote:
On Thu, Apr 17 2025 at 17:46, John Stultz wrote:
Instead it seems like we should just do: tk->coarse_nsec = tk->tkr_mono.xtime_nsec >> tk->tkr_mono.shift;
You end up with the same problem again because xtime_nsec can move backwards when the multiplier is updated, no?
Something like the below should work.
Hey Thomas, So I did test this version (I'll call it v2) of the patch and it does avoid the problem I was seeing earlier with your first patch.
Though I also just sent my own slight rework of your patch (https://lore.kernel.org/lkml/20250419054706.2319105-1-jstultz@google.com/). The main difference with my version is just the avoidance of mid-tick updates to the coarse clock by adjtime calls (and the slight benefit of avoiding the mult in the update path, but this is probably minor).
It's done ok in my testing so far, but obviously the effects of these changes can be subtle.
I'm ok with either approach, so let me know what you'd prefer. For your version: Acked-by: John Stultz jstultz@google.com
thanks -john