mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[PATCH] lockdep: annotate sk_locks
Teach sk_lock semantics to the lock validator. In the softirq path the slock has mutex_trylock()+mutex_unlock() semantics, in the process context sock_lock() case it has mutex_lock()/mutex_unlock() semantics. Thus we treat sock_owned_by_user() flagged areas as an exclusion area too, not just those areas covered by a held sk_lock.slock. Effect on non-lockdep kernels: minimal, sk_lock_sock_init() has been turned into an inline function. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
0afffc723c
commit
a5b5bb9a05
2 changed files with 98 additions and 19 deletions
|
@ -44,6 +44,7 @@
|
|||
#include <linux/timer.h>
|
||||
#include <linux/cache.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/lockdep.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h> /* struct sk_buff */
|
||||
#include <linux/security.h>
|
||||
|
@ -78,18 +79,17 @@ typedef struct {
|
|||
spinlock_t slock;
|
||||
struct sock_iocb *owner;
|
||||
wait_queue_head_t wq;
|
||||
/*
|
||||
* We express the mutex-alike socket_lock semantics
|
||||
* to the lock validator by explicitly managing
|
||||
* the slock as a lock variant (in addition to
|
||||
* the slock itself):
|
||||
*/
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
struct lockdep_map dep_map;
|
||||
#endif
|
||||
} socket_lock_t;
|
||||
|
||||
extern struct lock_class_key af_family_keys[AF_MAX];
|
||||
|
||||
#define sock_lock_init(__sk) \
|
||||
do { spin_lock_init(&((__sk)->sk_lock.slock)); \
|
||||
lockdep_set_class(&(__sk)->sk_lock.slock, \
|
||||
af_family_keys + (__sk)->sk_family); \
|
||||
(__sk)->sk_lock.owner = NULL; \
|
||||
init_waitqueue_head(&((__sk)->sk_lock.wq)); \
|
||||
} while(0)
|
||||
|
||||
struct sock;
|
||||
struct proto;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue