Skip to content

Commit

Permalink
lockdep, timer: Fix del_timer_sync() annotation
Browse files Browse the repository at this point in the history
Calling local_bh_enable() will want to actually start processing
softirqs, which isn't a good idea since this can get called with IRQs
disabled.

Cure this by using _local_bh_enable() which doesn't start processing
softirqs, and use raw_local_irq_save() to avoid any softirqs from
happening without letting lockdep think IRQs are in fact disabled.

Reported-by: Nick Bowler <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Reviewed-by: Yong Zhang <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
Peter Zijlstra authored and KAGA-KOKO committed Feb 4, 2011
1 parent 831d52b commit f266a51
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,10 +969,14 @@ EXPORT_SYMBOL(try_to_del_timer_sync);
int del_timer_sync(struct timer_list *timer)
{
#ifdef CONFIG_LOCKDEP
unsigned long flags;

raw_local_irq_save(flags);
local_bh_disable();
lock_map_acquire(&timer->lockdep_map);
lock_map_release(&timer->lockdep_map);
local_bh_enable();
_local_bh_enable();
raw_local_irq_restore(flags);
#endif
/*
* don't use it in hardirq context, because it
Expand Down

0 comments on commit f266a51

Please sign in to comment.