diff options
author | Arnd Bergmann <arnd@relay.de.ibm.com> | 2010-03-09 19:24:45 +0100 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2010-08-21 16:27:36 -0700 |
commit | 28457ee69c473a903e51e26c7bcd6f1e9eceb93e (patch) | |
tree | 7f872922577ec45ce655d68770c95082ad858a45 /drivers/vhost/vhost.h | |
parent | 65e6bf484c497f02d47a0faae69ee398cd59cfda (diff) | |
download | op-kernel-dev-28457ee69c473a903e51e26c7bcd6f1e9eceb93e.zip op-kernel-dev-28457ee69c473a903e51e26c7bcd6f1e9eceb93e.tar.gz |
vhost: add __rcu annotations
Also add rcu_dereference_protected() for code paths where locks are held.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.h')
-rw-r--r-- | drivers/vhost/vhost.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index afd7729..af3c11d 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@ -106,7 +106,7 @@ struct vhost_virtqueue { * vhost_work execution acts instead of rcu_read_lock() and the end of * vhost_work execution acts instead of rcu_read_lock(). * Writers use virtqueue mutex. */ - void *private_data; + void __rcu *private_data; /* Log write descriptors */ void __user *log_base; struct vhost_log log[VHOST_NET_MAX_SG]; @@ -116,7 +116,7 @@ struct vhost_dev { /* Readers use RCU to access memory table pointer * log base pointer and features. * Writers use mutex below.*/ - struct vhost_memory *memory; + struct vhost_memory __rcu *memory; struct mm_struct *mm; struct mutex mutex; unsigned acked_features; @@ -173,7 +173,11 @@ enum { static inline int vhost_has_feature(struct vhost_dev *dev, int bit) { - unsigned acked_features = rcu_dereference(dev->acked_features); + unsigned acked_features; + + acked_features = + rcu_dereference_index_check(dev->acked_features, + lockdep_is_held(&dev->mutex)); return acked_features & (1 << bit); } |