]> git.baikalelectronics.ru Git - kernel.git/commit
timers: Don't block on ->expiry_lock for TIMER_IRQSAFE timers
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Tue, 3 Nov 2020 19:09:37 +0000 (20:09 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sun, 15 Nov 2020 19:59:26 +0000 (20:59 +0100)
commitc8e95e4d78b4411f941539f9b55ef84de883a8cf
tree1abeecb6c63a7eb107a2b77e054f153c8ed822d0
parent91f518bbac0329d72dc379444c637bca8e56d740
timers: Don't block on ->expiry_lock for TIMER_IRQSAFE timers

PREEMPT_RT does not spin and wait until a running timer completes its
callback but instead it blocks on a sleeping lock to prevent a livelock in
the case that the task waiting for the callback completion preempted the
callback.

This cannot be done for timers flagged with TIMER_IRQSAFE. These timers can
be canceled from an interrupt disabled context even on RT kernels.

The expiry callback of such timers is invoked with interrupts disabled so
there is no need to use the expiry lock mechanism because obviously the
callback cannot be preempted even on RT kernels.

Do not use the timer_base::expiry_lock mechanism when waiting for a running
callback to complete if the timer is flagged with TIMER_IRQSAFE.

Also add a lockdep assertion for RT kernels to validate that the expiry
lock mechanism is always invoked in preemptible context.

Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201103190937.hga67rqhvknki3tp@linutronix.de
kernel/time/timer.c