mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 14:31:46 +00:00
[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>
This commit is contained in:
parent
a8f24a3978
commit
4ea2176dfa
9 changed files with 184 additions and 51 deletions
|
@ -32,18 +32,37 @@ struct rw_semaphore {
|
|||
__s32 activity;
|
||||
spinlock_t wait_lock;
|
||||
struct list_head wait_list;
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
struct lockdep_map dep_map;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
|
||||
#else
|
||||
# define __RWSEM_DEP_MAP_INIT(lockname)
|
||||
#endif
|
||||
|
||||
#define __RWSEM_INITIALIZER(name) \
|
||||
{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) }
|
||||
{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
|
||||
|
||||
#define DECLARE_RWSEM(name) \
|
||||
struct rw_semaphore name = __RWSEM_INITIALIZER(name)
|
||||
|
||||
extern void FASTCALL(init_rwsem(struct rw_semaphore *sem));
|
||||
extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
|
||||
struct lock_class_key *key);
|
||||
|
||||
#define init_rwsem(sem) \
|
||||
do { \
|
||||
static struct lock_class_key __key; \
|
||||
\
|
||||
__init_rwsem((sem), #sem, &__key); \
|
||||
} while (0)
|
||||
|
||||
extern void FASTCALL(__down_read(struct rw_semaphore *sem));
|
||||
extern int FASTCALL(__down_read_trylock(struct rw_semaphore *sem));
|
||||
extern void FASTCALL(__down_write(struct rw_semaphore *sem));
|
||||
extern void FASTCALL(__down_write_nested(struct rw_semaphore *sem, int subclass));
|
||||
extern int FASTCALL(__down_write_trylock(struct rw_semaphore *sem));
|
||||
extern void FASTCALL(__up_read(struct rw_semaphore *sem));
|
||||
extern void FASTCALL(__up_write(struct rw_semaphore *sem));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue