Skip to content

Commit

Permalink
[PATCH] lockdep: fix seqlock_init()
Browse files Browse the repository at this point in the history
seqlock_init() needs to use spin_lock_init() for dynamic locks, so that
lockdep is notified about the presence of a new lock.

(this is a fallout of the recent networking merge, which started using
the so-far unused seqlock_init() API.)

This fix solves the following lockdep-internal warning on current -git:

 INFO: trying to register non-static key.
 the code is fine but needs lockdep annotation.
 turning off the locking correctness validator.
     __lock_acquire+0x10c/0x9f9
     lock_acquire+0x56/0x72
     _spin_lock+0x35/0x42
     neigh_destroy+0x9d/0x12e
     neigh_periodic_timer+0x10a/0x15c
     run_timer_softirq+0x126/0x18e
     __do_softirq+0x6b/0xe6
     do_softirq+0x64/0xd2
     ksoftirqd+0x82/0x138

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Dec 12, 2006
1 parent d907dd2 commit 99a3eb3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/linux/seqlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ typedef struct {
#define SEQLOCK_UNLOCKED \
__SEQLOCK_UNLOCKED(old_style_seqlock_init)

#define seqlock_init(x) \
do { *(x) = (seqlock_t) __SEQLOCK_UNLOCKED(x); } while (0)
#define seqlock_init(x) \
do { \
(x)->sequence = 0; \
spin_lock_init(&(x)->lock); \
} while (0)

#define DEFINE_SEQLOCK(x) \
seqlock_t x = __SEQLOCK_UNLOCKED(x)
Expand Down

0 comments on commit 99a3eb3

Please sign in to comment.