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>
This commit is contained in:

committed by
Paul E. McKenney

parent
65e6bf484c
commit
28457ee69c
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user