Re: [PATCH] timer_list: Annotate the clock event deadline snapshot
From: Thomas Gleixner
Date: Thu Nov 12 2026 - 05:32:43 EST
On Wed, Nov 11 2026 at 16:41, Zhu Jun wrote:
> print_tickdevice() reads next_event while the remote CPU can update it
> from its timer interrupt. The value is only printed to /proc/timer_list,
> so synchronizing the clock event device is unnecessary.
>
> Use a single diagnostic snapshot and mark the intentional race, as is
> already done for the tick scheduler statistics in print_cpu().
>
> Fixes: 289f480af87e ("[PATCH] Add debugging feature /proc/timer_list")
This really fixes nothing.
> Signed-off-by: Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
> ---
> kernel/time/timer_list.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
> index 0406bf4488e9..5f80af00729e 100644
> --- a/kernel/time/timer_list.c
> +++ b/kernel/time/timer_list.c
> @@ -177,6 +177,7 @@ static void
> print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu)
> {
> struct clock_event_device *dev = td->evtdev;
> + ktime_t next_event;
>
> touch_nmi_watchdog();
>
> @@ -199,7 +200,9 @@ print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu)
> SEQ_printf(m, " mult: %u\n", dev->mult);
> SEQ_printf(m, " shift: %u\n", dev->shift);
> SEQ_printf(m, " mode: %d\n", clockevent_get_state(dev));
> - SEQ_printf(m, " next_event: %lld nsecs\n", (long long)dev->next_event);
> + /* Take a diagnostic snapshot without locking the clock event device. */
> + next_event = data_race(READ_ONCE(dev->next_event));
data_race(READ_ONCE()) ?
READ_ONCE() needs to be paired with WRITE_ONCE(), which is not there to
write dev->next_event. And no, we don't add it as there is zero value to
it for the regular usage outside of this debug code.
data_race() is sufficient to shut KCSAN up and you neither need an extra
variable nor a comment. data_race() in debug code is selfexplaining, no?
Thanks,
tglx