diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-06-05 08:20:23 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-06-09 09:21:06 -0400 |
commit | ea16c51433510f7f758382dec5b933fc0797f244 (patch) | |
tree | 51f7ff47424fef4d9a8750f92723782e2d17e63a /drivers/vhost/vhost.h | |
parent | 98f9ca0a3faa99b7388578d55eccecf272be4038 (diff) |
vhost: move acked_features to VQs
Refactor code to make sure features are only accessed
under VQ mutex. This makes everything simpler, no need
for RCU here anymore.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.h')
-rw-r--r-- | drivers/vhost/vhost.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 35eeb2a1bada..ff454a0ec6f5 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -105,6 +105,7 @@ struct vhost_virtqueue { | |||
105 | struct vring_used_elem *heads; | 105 | struct vring_used_elem *heads; |
106 | /* Protected by virtqueue mutex. */ | 106 | /* Protected by virtqueue mutex. */ |
107 | void *private_data; | 107 | void *private_data; |
108 | unsigned acked_features; | ||
108 | /* Log write descriptors */ | 109 | /* Log write descriptors */ |
109 | void __user *log_base; | 110 | void __user *log_base; |
110 | struct vhost_log *log; | 111 | struct vhost_log *log; |
@@ -117,7 +118,6 @@ struct vhost_dev { | |||
117 | struct vhost_memory __rcu *memory; | 118 | struct vhost_memory __rcu *memory; |
118 | struct mm_struct *mm; | 119 | struct mm_struct *mm; |
119 | struct mutex mutex; | 120 | struct mutex mutex; |
120 | unsigned acked_features; | ||
121 | struct vhost_virtqueue **vqs; | 121 | struct vhost_virtqueue **vqs; |
122 | int nvqs; | 122 | int nvqs; |
123 | struct file *log_file; | 123 | struct file *log_file; |
@@ -174,13 +174,8 @@ enum { | |||
174 | (1ULL << VHOST_F_LOG_ALL), | 174 | (1ULL << VHOST_F_LOG_ALL), |
175 | }; | 175 | }; |
176 | 176 | ||
177 | static inline int vhost_has_feature(struct vhost_dev *dev, int bit) | 177 | static inline int vhost_has_feature(struct vhost_virtqueue *vq, int bit) |
178 | { | 178 | { |
179 | unsigned acked_features; | 179 | return vq->acked_features & (1 << bit); |
180 | |||
181 | /* TODO: check that we are running from vhost_worker or dev mutex is | ||
182 | * held? */ | ||
183 | acked_features = rcu_dereference_index_check(dev->acked_features, 1); | ||
184 | return acked_features & (1 << bit); | ||
185 | } | 180 | } |
186 | #endif | 181 | #endif |