Re: [patch V3 01/11] timekeeping: Update auxiliary timekeepers on clocksource change
From: John Stultz
Date: Fri Jun 27 2025 - 00:44:07 EST
On Wed, Jun 25, 2025 at 11:38 AM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> Propagate a system clocksource change to the auxiliary timekeepers so that
> they can pick up the new clocksource.
>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
> kernel/time/timekeeping.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
> ---
>
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -119,8 +119,10 @@ static struct tk_fast tk_fast_raw ____c
>
> #ifdef CONFIG_POSIX_AUX_CLOCKS
> static __init void tk_aux_setup(void);
> +static void tk_aux_update_clocksource(void);
> #else
> static inline void tk_aux_setup(void) { }
> +static inline void tk_aux_update_clocksource(void) { }
> #endif
>
> unsigned long timekeeper_lock_irqsave(void)
> @@ -1548,6 +1550,8 @@ static int change_clocksource(void *data
> timekeeping_update_from_shadow(&tk_core, TK_UPDATE_ALL);
> }
>
> + tk_aux_update_clocksource();
> +
> if (old) {
> if (old->disable)
> old->disable(old);
> @@ -2651,6 +2655,30 @@ EXPORT_SYMBOL(hardpps);
> #endif /* CONFIG_NTP_PPS */
>
> #ifdef CONFIG_POSIX_AUX_CLOCKS
> +
> +/* Bitmap for the activated auxiliary timekeepers */
> +static unsigned long aux_timekeepers;
> +
Nit: Would it be useful to clarify this is accessed without locks, and
the related tks->clock_valid *must* be checked while holding the lock
before using a timekeeper that is considered activated in the
aux_timekeepers bitmap?
Otherwise,
Acked-by: John Stultz <jstultz@xxxxxxxxxx>