mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
Miscellaneous timer fixes:
- 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
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-----BEGIN PGP SIGNATURE-----
iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmf4OQURHG1pbmdvQGtl
cm5lbC5vcmcACgkQEnMQ0APhK1jKmQ/+MyaBxoFwUknE9IcFb7E2TGI4dJew0JeJ
zSwhkvve63jo0B8//BzdVLN5BlYsYhKwkHn3KT5GJ258PlO3j9vbwadboHVCGQ/E
3bCRWvMvE2B1p+nve67WXnm5+s8+3O/Y+FEWfY5r94M/SUhun0uN4CiJ8WTruqAk
zoX7fwnX7f1EmDNZmCwWrTt1iSisxFQM0C5ELOv4n7Zs9KKDw623bhKtoxPgVwW+
5uVRua6fdz19IV7j2N5pon3Hu5qbgFEP3K9elGMxPQfHfSoySZReqaU6a+3xmDje
QrhT20N8NTXs3+Xkjc6vxg8jzBo7hsx2qKv0dAvF9tIXxD7L7eXwZwSQTk6QOl9O
T5bcoMY2aIY01khlN7xDNIdC+7OEDJGZU+F1hqWkX+teSNuUwyf/MBlOw24dfqT3
Dh5B9BVLfnTFqd6RHNieMv/kcemA9S2im7gleBrr7IkjGAs5KTH+WcV2UcNvUJ76
j1oVFvF6GVrNWuQSJrRvWyi1JZz7lZxR71elUqtlow2DcVsz8PoiDywmnvG3LeuA
OH1bXWwS6Rq7biyfZYFxsj/+BBS5ShPcwvkL0gw2hlXE9VB5X5gzi5TzSiDcMXQl
e+eWKhHL4lIlU8s1prQKrVgXMd0OFFYE7lTKIrGLRt3mvp4U9gKmm7hD6s4SBTC4
qWScmmIGAyo=
=Yv6j
-----END PGP SIGNATURE-----
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
This commit is contained in:
commit
34833819d2
|
|
@ -345,7 +345,7 @@ static inline void hrtimer_update_function(struct hrtimer *timer,
|
|||
if (WARN_ON_ONCE(!function))
|
||||
return;
|
||||
#endif
|
||||
timer->function = function;
|
||||
ACCESS_PRIVATE(timer, function) = function;
|
||||
}
|
||||
|
||||
/* Forward a hrtimer so it expires after now: */
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
#ifndef __VDSO_UNALIGNED_H
|
||||
#define __VDSO_UNALIGNED_H
|
||||
|
||||
#define __get_unaligned_t(type, ptr) ({ \
|
||||
const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
|
||||
__pptr->x; \
|
||||
#define __get_unaligned_t(type, ptr) ({ \
|
||||
const struct { type x; } __packed * __get_pptr = (typeof(__get_pptr))(ptr); \
|
||||
__get_pptr->x; \
|
||||
})
|
||||
|
||||
#define __put_unaligned_t(type, val, ptr) do { \
|
||||
struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
|
||||
__pptr->x = (val); \
|
||||
#define __put_unaligned_t(type, val, ptr) do { \
|
||||
struct { type x; } __packed * __put_pptr = (typeof(__put_pptr))(ptr); \
|
||||
__put_pptr->x = (val); \
|
||||
} while (0)
|
||||
|
||||
#endif /* __VDSO_UNALIGNED_H */
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ static const struct debug_obj_descr hrtimer_debug_descr;
|
|||
|
||||
static void *hrtimer_debug_hint(void *addr)
|
||||
{
|
||||
return ((struct hrtimer *) addr)->function;
|
||||
return ACCESS_PRIVATE((struct hrtimer *)addr, function);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -509,6 +509,7 @@ void tick_resume(void)
|
|||
|
||||
#ifdef CONFIG_SUSPEND
|
||||
static DEFINE_RAW_SPINLOCK(tick_freeze_lock);
|
||||
static DEFINE_WAIT_OVERRIDE_MAP(tick_freeze_map, LD_WAIT_SLEEP);
|
||||
static unsigned int tick_freeze_depth;
|
||||
|
||||
/**
|
||||
|
|
@ -528,9 +529,22 @@ void tick_freeze(void)
|
|||
if (tick_freeze_depth == num_online_cpus()) {
|
||||
trace_suspend_resume(TPS("timekeeping_freeze"),
|
||||
smp_processor_id(), true);
|
||||
/*
|
||||
* All other CPUs have their interrupts disabled and are
|
||||
* suspended to idle. Other tasks have been frozen so there
|
||||
* is no scheduling happening. This means that there is no
|
||||
* concurrency in the system at this point. Therefore it is
|
||||
* okay to acquire a sleeping lock on PREEMPT_RT, such as a
|
||||
* spinlock, because the lock cannot be held by other CPUs
|
||||
* or threads and acquiring it cannot block.
|
||||
*
|
||||
* Inform lockdep about the situation.
|
||||
*/
|
||||
lock_map_acquire_try(&tick_freeze_map);
|
||||
system_state = SYSTEM_SUSPEND;
|
||||
sched_clock_suspend();
|
||||
timekeeping_suspend();
|
||||
lock_map_release(&tick_freeze_map);
|
||||
} else {
|
||||
tick_suspend_local();
|
||||
}
|
||||
|
|
@ -552,8 +566,16 @@ void tick_unfreeze(void)
|
|||
raw_spin_lock(&tick_freeze_lock);
|
||||
|
||||
if (tick_freeze_depth == num_online_cpus()) {
|
||||
/*
|
||||
* Similar to tick_freeze(). On resumption the first CPU may
|
||||
* acquire uncontended sleeping locks while other CPUs block on
|
||||
* tick_freeze_lock.
|
||||
*/
|
||||
lock_map_acquire_try(&tick_freeze_map);
|
||||
timekeeping_resume();
|
||||
sched_clock_resume();
|
||||
lock_map_release(&tick_freeze_map);
|
||||
|
||||
system_state = SYSTEM_RUNNING;
|
||||
trace_suspend_resume(TPS("timekeeping_freeze"),
|
||||
smp_processor_id(), false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user