aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/test.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-06-05 08:20:23 -0400
committerMichael S. Tsirkin <mst@redhat.com>2014-06-09 09:21:06 -0400
commitea16c51433510f7f758382dec5b933fc0797f244 (patch)
tree51f7ff47424fef4d9a8750f92723782e2d17e63a /drivers/vhost/test.c
parent98f9ca0a3faa99b7388578d55eccecf272be4038 (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/test.c')
-rw-r--r--drivers/vhost/test.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index c2a54fbf7f99..6fa3bf8bdec7 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -241,15 +241,18 @@ done:
241 241
242static int vhost_test_set_features(struct vhost_test *n, u64 features) 242static int vhost_test_set_features(struct vhost_test *n, u64 features)
243{ 243{
244 struct vhost_virtqueue *vq;
245
244 mutex_lock(&n->dev.mutex); 246 mutex_lock(&n->dev.mutex);
245 if ((features & (1 << VHOST_F_LOG_ALL)) && 247 if ((features & (1 << VHOST_F_LOG_ALL)) &&
246 !vhost_log_access_ok(&n->dev)) { 248 !vhost_log_access_ok(&n->dev)) {
247 mutex_unlock(&n->dev.mutex); 249 mutex_unlock(&n->dev.mutex);
248 return -EFAULT; 250 return -EFAULT;
249 } 251 }
250 n->dev.acked_features = features; 252 vq = &n->vqs[VHOST_TEST_VQ];
251 smp_wmb(); 253 mutex_lock(&vq->mutex);
252 vhost_test_flush(n); 254 vq->acked_features = features;
255 mutex_unlock(&vq->mutex);
253 mutex_unlock(&n->dev.mutex); 256 mutex_unlock(&n->dev.mutex);
254 return 0; 257 return 0;
255} 258}