On 5/26/2026 10:13 AM, Thomas Gleixner wrote:

>  /**
> - * ktime_get_snapshot - snapshots the realtime/monotonic raw clocks with 
> counter
> - * @systime_snapshot:        pointer to struct receiving the system time 
> snapshot
> + * ktime_get_snapshot_id -  Simultaneously snapshot a given clock ID with
> + *                       CLOCK_MONOTONIC_RAW and the underlying
> + *                       clocksource counter value.
> + * @systime_snapshot:        Pointer to struct receiving the system time 
> snapshot
> + * @clock_id:                The clock ID to snapshot
>   */
> -void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot)
> +bool ktime_get_snapshot_id(struct system_time_snapshot *systime_snapshot, 
> clockid_t clock_id)
>  {

Since this function now returns a bool would it make sense to add a
"Return:" comment to the kdoc to help explain what the return value means?

I saw that you have a WARN_ON with the ktime_get_snapshot wrapper. I
guess it returns false if timekeeping_suspended.

> -     struct timekeeper *tk = &tk_core.timekeeper;
> +     ktime_t base_raw, base_sys, offs_sys, *offs, offs_zero = 0;
> +     u64 nsec_raw, nsec_sys, now;
> +     struct timekeeper *tk;
> +     struct tk_data *tkd;
>       unsigned int seq;
> -     ktime_t base_raw;
>       ktime_t base_real;
>       ktime_t base_boot;
> -     u64 nsec_raw;
> -     u64 nsec_real;
> -     u64 now;
>  
> -     WARN_ON_ONCE(timekeeping_suspended);
> +     /* Invalidate the snapshot for all failure cases */
> +     systime_snapshot->valid = false;
> +
> +     if (WARN_ON_ONCE(timekeeping_suspended))
> +             return false;
> +

This warns here, and the wrapper ktime_get_snapshot also warns. Does
that make sense? I guess eventually the ktime_get_snapshot will be removed?

Reply via email to