Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull misc timer fixes from Ingo Molnar:

- Fix missing ACCESS_PRIVATE() that triggered a Sparse warning

- Fix lockdep false positive in tick_freeze() on CONFIG_PREEMPT_RT=y

- Avoid <vdso/unaligned.h> macro's variable shadowing to address build
warning that triggers under W=2 builds

* tag 'timers-urgent-2025-04-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
vdso: Address variable shadowing in macros
timekeeping: Add a lockdep override in tick_freeze()
hrtimer: Add missing ACCESS_PRIVATE() for hrtimer::function

+30 -8
+1 -1
include/linux/hrtimer.h
··· 345 345 if (WARN_ON_ONCE(!function)) 346 346 return; 347 347 #endif 348 - timer->function = function; 348 + ACCESS_PRIVATE(timer, function) = function; 349 349 } 350 350 351 351 /* Forward a hrtimer so it expires after now: */
+6 -6
include/vdso/unaligned.h
··· 2 2 #ifndef __VDSO_UNALIGNED_H 3 3 #define __VDSO_UNALIGNED_H 4 4 5 - #define __get_unaligned_t(type, ptr) ({ \ 6 - const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ 7 - __pptr->x; \ 5 + #define __get_unaligned_t(type, ptr) ({ \ 6 + const struct { type x; } __packed * __get_pptr = (typeof(__get_pptr))(ptr); \ 7 + __get_pptr->x; \ 8 8 }) 9 9 10 - #define __put_unaligned_t(type, val, ptr) do { \ 11 - struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ 12 - __pptr->x = (val); \ 10 + #define __put_unaligned_t(type, val, ptr) do { \ 11 + struct { type x; } __packed * __put_pptr = (typeof(__put_pptr))(ptr); \ 12 + __put_pptr->x = (val); \ 13 13 } while (0) 14 14 15 15 #endif /* __VDSO_UNALIGNED_H */
+1 -1
kernel/time/hrtimer.c
··· 366 366 367 367 static void *hrtimer_debug_hint(void *addr) 368 368 { 369 - return ((struct hrtimer *) addr)->function; 369 + return ACCESS_PRIVATE((struct hrtimer *)addr, function); 370 370 } 371 371 372 372 /*
+22
kernel/time/tick-common.c
··· 509 509 510 510 #ifdef CONFIG_SUSPEND 511 511 static DEFINE_RAW_SPINLOCK(tick_freeze_lock); 512 + static DEFINE_WAIT_OVERRIDE_MAP(tick_freeze_map, LD_WAIT_SLEEP); 512 513 static unsigned int tick_freeze_depth; 513 514 514 515 /** ··· 529 528 if (tick_freeze_depth == num_online_cpus()) { 530 529 trace_suspend_resume(TPS("timekeeping_freeze"), 531 530 smp_processor_id(), true); 531 + /* 532 + * All other CPUs have their interrupts disabled and are 533 + * suspended to idle. Other tasks have been frozen so there 534 + * is no scheduling happening. This means that there is no 535 + * concurrency in the system at this point. Therefore it is 536 + * okay to acquire a sleeping lock on PREEMPT_RT, such as a 537 + * spinlock, because the lock cannot be held by other CPUs 538 + * or threads and acquiring it cannot block. 539 + * 540 + * Inform lockdep about the situation. 541 + */ 542 + lock_map_acquire_try(&tick_freeze_map); 532 543 system_state = SYSTEM_SUSPEND; 533 544 sched_clock_suspend(); 534 545 timekeeping_suspend(); 546 + lock_map_release(&tick_freeze_map); 535 547 } else { 536 548 tick_suspend_local(); 537 549 } ··· 566 552 raw_spin_lock(&tick_freeze_lock); 567 553 568 554 if (tick_freeze_depth == num_online_cpus()) { 555 + /* 556 + * Similar to tick_freeze(). On resumption the first CPU may 557 + * acquire uncontended sleeping locks while other CPUs block on 558 + * tick_freeze_lock. 559 + */ 560 + lock_map_acquire_try(&tick_freeze_map); 569 561 timekeeping_resume(); 570 562 sched_clock_resume(); 563 + lock_map_release(&tick_freeze_map); 564 + 571 565 system_state = SYSTEM_RUNNING; 572 566 trace_suspend_resume(TPS("timekeeping_freeze"), 573 567 smp_processor_id(), false);