On Tue, May 26, 2026 at 07:14:13PM +0200, Thomas Gleixner wrote:
(...)

>  static inline void tk_update_aux_offs(struct timekeeper *tk, ktime_t offs)
> @@ -1218,6 +1223,12 @@ bool ktime_get_snapshot_id(struct system
>               tkd = &tk_core;
>               offs = &tk_core.timekeeper.offs_boot;
>               break;
> +     case CLOCK_AUX ... CLOCK_AUX_LAST:
> +             tkd = aux_get_tk_data(clock_id);
> +             if (!tkd)
> +                     return false;
> +             offs = &tkd->timekeeper.offs_aux;
> +             break;

'tkd' is also used to compute 'monoraw'. However 'tkr_raw' and 'tkr_mono'
are the same for auxilary clocks, so this will compute a wrong 'monoraw'.
Instead 'monoraw' should be computed based on 'tk_core'.
Which then also requires the sequence locking of 'tk_core'.

As you know I have a series which unifies the locking between the
different timekeepers. Maybe we revert this patch for 7.2 and I send
a fixed variant including the prerequisites for 7.3.

(The same goes for get_device_system_crosststamp())

>       default:
>               WARN_ON_ONCE(1);
>               return false;
> @@ -1228,6 +1239,10 @@ bool ktime_get_snapshot_id(struct system
>       do {
>               seq = read_seqcount_begin(&tkd->seq);
>  
> +             /* Aux clocks can be invalid */
> +             if (!tk->clock_valid)
> +                     return false;
> +
>               now = tk_clock_read(&tk->tkr_mono);
>               systime_snapshot->cs_id = tk->tkr_mono.clock->id;
>               systime_snapshot->cs_was_changed_seq = tk->cs_was_changed_seq;
> 

Reply via email to