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

From: Thomas Gleixner
Date: Fri Mar 21 2025 - 12:18:04 EST


On Thu, Mar 20 2025 at 19:01, John Stultz wrote:
> On Sun, Mar 16, 2025 at 9:56 PM Thomas Gleixner <tglx@xxxxxxxxxxxxx> 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 slow reply here. So I agree with you that we don't
> want to set clock_set above, that was my mistake. But this last bit I
> don't think is right, as timekeeping advance() just returns a bool
> (return !!clock_set;), which is used to decide to call clock_was_set()
> or not - not the argument passed to clock_was_set().

timekeeping_advance() also uses the clock_set internally.

clock_set |= ....
timekeeping_update_from_shadow(..., clock_set);

timekeeping_update_from_shadow() evaluates the TK... bits.

Thanks,

tglx