diff options
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 33a67925d900..3503c17ac1d3 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -970,6 +970,25 @@ EXPORT_SYMBOL(try_to_del_timer_sync); | |||
970 | * add_timer_on(). Upon exit the timer is not queued and the handler is | 970 | * add_timer_on(). Upon exit the timer is not queued and the handler is |
971 | * not running on any CPU. | 971 | * not running on any CPU. |
972 | * | 972 | * |
973 | * Note: You must not hold locks that are held in interrupt context | ||
974 | * while calling this function. Even if the lock has nothing to do | ||
975 | * with the timer in question. Here's why: | ||
976 | * | ||
977 | * CPU0 CPU1 | ||
978 | * ---- ---- | ||
979 | * <SOFTIRQ> | ||
980 | * call_timer_fn(); | ||
981 | * base->running_timer = mytimer; | ||
982 | * spin_lock_irq(somelock); | ||
983 | * <IRQ> | ||
984 | * spin_lock(somelock); | ||
985 | * del_timer_sync(mytimer); | ||
986 | * while (base->running_timer == mytimer); | ||
987 | * | ||
988 | * Now del_timer_sync() will never return and never release somelock. | ||
989 | * The interrupt on the other CPU is waiting to grab somelock but | ||
990 | * it has interrupted the softirq that CPU0 is waiting to finish. | ||
991 | * | ||
973 | * The function returns whether it has deactivated a pending timer or not. | 992 | * The function returns whether it has deactivated a pending timer or not. |
974 | */ | 993 | */ |
975 | int del_timer_sync(struct timer_list *timer) | 994 | int del_timer_sync(struct timer_list *timer) |
@@ -977,6 +996,10 @@ int del_timer_sync(struct timer_list *timer) | |||
977 | #ifdef CONFIG_LOCKDEP | 996 | #ifdef CONFIG_LOCKDEP |
978 | unsigned long flags; | 997 | unsigned long flags; |
979 | 998 | ||
999 | /* | ||
1000 | * If lockdep gives a backtrace here, please reference | ||
1001 | * the synchronization rules above. | ||
1002 | */ | ||
980 | local_irq_save(flags); | 1003 | local_irq_save(flags); |
981 | lock_map_acquire(&timer->lockdep_map); | 1004 | lock_map_acquire(&timer->lockdep_map); |
982 | lock_map_release(&timer->lockdep_map); | 1005 | lock_map_release(&timer->lockdep_map); |