Re: [RFC PATCH 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids

2025-04-05 Thread John Stultz
On Sun, Mar 16, 2025 at 9:56 PM Thomas Gleixner wrote: > On Sat, Mar 15 2025 at 16:22, John Stultz wrote: > > On Sat, Mar 15, 2025 at 12:23 PM Thomas Gleixner wrote: > >> > So to fix this, rework the timekeeping_advance() logic a bit > >> > so that when we are called from do_adjtimex() and the of

Re: [RFC PATCH 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids

2025-04-04 Thread Thomas Gleixner
On Thu, Mar 20 2025 at 19:01, John Stultz wrote: > On Sun, Mar 16, 2025 at 9:56 PM Thomas Gleixner wrote: >> #define TK_CLEAR_NTP(1 << 0) >> #define TK_CLOCK_WAS_SET(1 << 1) >> >> So it clears NTP instead. Not really what you want either. :) > > Hey Thomas, >Sorry for the s

Re: [RFC PATCH 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids

2025-03-16 Thread Thomas Gleixner
On Sat, Mar 15 2025 at 16:22, John Stultz wrote: > On Sat, Mar 15, 2025 at 12:23 PM Thomas Gleixner wrote: >> > So to fix this, rework the timekeeping_advance() logic a bit >> > so that when we are called from do_adjtimex() and the offset >> > is smaller then cycle_interval, that we call >> > time

Re: [RFC PATCH 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids

2025-03-15 Thread John Stultz
On Sat, Mar 15, 2025 at 12:23 PM Thomas Gleixner wrote: > On Fri, Mar 14 2025 at 17:37, John Stultz wrote: > > Here because we did not accumulate anything, we have a window > > where the _COARSE clockids that don't utilize the mult*offset > > value, can see an inconsistency. > > > > So to fix this

Re: [RFC PATCH 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids

2025-03-15 Thread Thomas Gleixner
On Fri, Mar 14 2025 at 17:37, John Stultz wrote: > Now, by design, this negative adjustment should be fine, because > the logic run from timekeeping_adjust() is done after we > accumulate approx mult*interval_cycles into xtime_nsec. > The accumulated (mult*interval_cycles) will be larger then the >

[RFC PATCH 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids

2025-03-14 Thread John Stultz
Lei Chen raised an issue with CLOCK_MONOTONIC_COARSE seeing time inconsistencies. Lei tracked down that this was being caused by the adjustment tk->tkr_mono.xtime_nsec -= offset; which is made to compensate for the unaccumulated cycles in offset when the mult value is adjusted forward, so that