diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-07-03 03:24:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-03 18:27:04 -0400 |
commit | 4ea2176dfa714882e88180b474e4cbcd888b70af (patch) | |
tree | 7ff3810f6b8750c226234887bb3063d91e1d71c3 /include/linux/rwsem-spinlock.h | |
parent | a8f24a3978c5f82419e1c90dc90460731204f46f (diff) |
[PATCH] lockdep: prove rwsem locking correctness
Use the lock validator framework to prove rwsem locking correctness.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/rwsem-spinlock.h')
-rw-r--r-- | include/linux/rwsem-spinlock.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h index d68afcc36ac9..ae1fcadd598e 100644 --- a/include/linux/rwsem-spinlock.h +++ b/include/linux/rwsem-spinlock.h | |||
@@ -32,18 +32,37 @@ struct rw_semaphore { | |||
32 | __s32 activity; | 32 | __s32 activity; |
33 | spinlock_t wait_lock; | 33 | spinlock_t wait_lock; |
34 | struct list_head wait_list; | 34 | struct list_head wait_list; |
35 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
36 | struct lockdep_map dep_map; | ||
37 | #endif | ||
35 | }; | 38 | }; |
36 | 39 | ||
40 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
41 | # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } | ||
42 | #else | ||
43 | # define __RWSEM_DEP_MAP_INIT(lockname) | ||
44 | #endif | ||
45 | |||
37 | #define __RWSEM_INITIALIZER(name) \ | 46 | #define __RWSEM_INITIALIZER(name) \ |
38 | { 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) } | 47 | { 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } |
39 | 48 | ||
40 | #define DECLARE_RWSEM(name) \ | 49 | #define DECLARE_RWSEM(name) \ |
41 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | 50 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) |
42 | 51 | ||
43 | extern void FASTCALL(init_rwsem(struct rw_semaphore *sem)); | 52 | extern void __init_rwsem(struct rw_semaphore *sem, const char *name, |
53 | struct lock_class_key *key); | ||
54 | |||
55 | #define init_rwsem(sem) \ | ||
56 | do { \ | ||
57 | static struct lock_class_key __key; \ | ||
58 | \ | ||
59 | __init_rwsem((sem), #sem, &__key); \ | ||
60 | } while (0) | ||
61 | |||
44 | extern void FASTCALL(__down_read(struct rw_semaphore *sem)); | 62 | extern void FASTCALL(__down_read(struct rw_semaphore *sem)); |
45 | extern int FASTCALL(__down_read_trylock(struct rw_semaphore *sem)); | 63 | extern int FASTCALL(__down_read_trylock(struct rw_semaphore *sem)); |
46 | extern void FASTCALL(__down_write(struct rw_semaphore *sem)); | 64 | extern void FASTCALL(__down_write(struct rw_semaphore *sem)); |
65 | extern void FASTCALL(__down_write_nested(struct rw_semaphore *sem, int subclass)); | ||
47 | extern int FASTCALL(__down_write_trylock(struct rw_semaphore *sem)); | 66 | extern int FASTCALL(__down_write_trylock(struct rw_semaphore *sem)); |
48 | extern void FASTCALL(__up_read(struct rw_semaphore *sem)); | 67 | extern void FASTCALL(__up_read(struct rw_semaphore *sem)); |
49 | extern void FASTCALL(__up_write(struct rw_semaphore *sem)); | 68 | extern void FASTCALL(__up_write(struct rw_semaphore *sem)); |