1DEL_TIMER_SYNC(9)                Driver Basics               DEL_TIMER_SYNC(9)
2
3
4

NAME

6       del_timer_sync - deactivate a timer and wait for the handler to finish.
7

SYNOPSIS

9       int del_timer_sync(struct timer_list * timer);
10

ARGUMENTS

12       timer
13           the timer to be deactivated
14

DESCRIPTION

16       This function only differs from del_timer on SMP: besides deactivating
17       the timer it also makes sure the handler has finished executing on
18       other CPUs.
19

SYNCHRONIZATION RULES

21       Callers must prevent restarting of the timer, otherwise this function
22       is meaningless. It must not be called from interrupt contexts unless
23       the timer is an irqsafe one. The caller must not hold locks which would
24       prevent completion of the timer's handler. The timer's handler must not
25       call add_timer_on. Upon exit the timer is not queued and the handler is
26       not running on any CPU.
27

NOTE

29       For !irqsafe timers, you must not hold locks that are held in interrupt
30       context while calling this function. Even if the lock has nothing to do
31       with the timer in question. Here's why:
32
33       CPU0 CPU1 ---- ---- <SOFTIRQ> call_timer_fn; base->running_timer =
34       mytimer; spin_lock_irq(somelock); <IRQ> spin_lock(somelock);
35       del_timer_sync(mytimer); while (base->running_timer == mytimer);
36
37       Now del_timer_sync will never return and never release somelock. The
38       interrupt on the other CPU is waiting to grab somelock but it has
39       interrupted the softirq that CPU0 is waiting to finish.
40
41       The function returns whether it has deactivated a pending timer or not.
42
44Kernel Hackers Manual 3.10         June 2019                 DEL_TIMER_SYNC(9)
Impressum