Merge tag 'timers-urgent-2024-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
"Two fixes for the timer/clocksource code:

- The recent fix to make the take over of the broadcast timer more
reliable retrieves a per CPU pointer in preemptible context.

This went unnoticed in testing as some compilers hoist the access
into the non-preemotible section where the pointer is actually
used, but obviously compilers can rightfully invoke it where the
code put it.

Move it into the non-preemptible section right to the actual usage
side to cure it.

- The clocksource watchdog is supposed to emit a warning when the
retry count is greater than one and the number of retries reaches
the limit.

The condition is backwards and warns always when the count is
greater than one. Fixup the condition to prevent spamming dmesg"

* tag 'timers-urgent-2024-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
clocksource: Fix brown-bag boolean thinko in cs_watchdog_read()
tick/broadcast: Move per CPU pointer access into the atomic section

Changed files
+3 -2
kernel
+1 -1
kernel/time/clocksource.c
··· 246 246 247 247 wd_delay = cycles_to_nsec_safe(watchdog, *wdnow, wd_end); 248 248 if (wd_delay <= WATCHDOG_MAX_SKEW) { 249 - if (nretries > 1 || nretries >= max_retries) { 249 + if (nretries > 1 && nretries >= max_retries) { 250 250 pr_warn("timekeeping watchdog on CPU%d: %s retried %d times before success\n", 251 251 smp_processor_id(), watchdog->name, nretries); 252 252 }
+2 -1
kernel/time/tick-broadcast.c
··· 1141 1141 #ifdef CONFIG_HOTPLUG_CPU 1142 1142 void hotplug_cpu__broadcast_tick_pull(int deadcpu) 1143 1143 { 1144 - struct tick_device *td = this_cpu_ptr(&tick_cpu_device); 1145 1144 struct clock_event_device *bc; 1146 1145 unsigned long flags; 1147 1146 ··· 1166 1167 * device to avoid the starvation. 1167 1168 */ 1168 1169 if (tick_check_broadcast_expired()) { 1170 + struct tick_device *td = this_cpu_ptr(&tick_cpu_device); 1171 + 1169 1172 cpumask_clear_cpu(smp_processor_id(), tick_broadcast_force_mask); 1170 1173 tick_program_event(td->evtdev->next_event, 1); 1171 1174 }