diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-06-05 15:20:23 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-06-09 16:21:06 +0300 |
commit | ea16c51433510f7f758382dec5b933fc0797f244 (patch) | |
tree | 51f7ff47424fef4d9a8750f92723782e2d17e63a /drivers/vhost/test.c | |
parent | 98f9ca0a3faa99b7388578d55eccecf272be4038 (diff) | |
download | op-kernel-dev-ea16c51433510f7f758382dec5b933fc0797f244.zip op-kernel-dev-ea16c51433510f7f758382dec5b933fc0797f244.tar.gz |
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.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index c2a54fb..6fa3bf8 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -241,15 +241,18 @@ done: static int vhost_test_set_features(struct vhost_test *n, u64 features) { + struct vhost_virtqueue *vq; + mutex_lock(&n->dev.mutex); if ((features & (1 << VHOST_F_LOG_ALL)) && !vhost_log_access_ok(&n->dev)) { mutex_unlock(&n->dev.mutex); return -EFAULT; } - n->dev.acked_features = features; - smp_wmb(); - vhost_test_flush(n); + vq = &n->vqs[VHOST_TEST_VQ]; + mutex_lock(&vq->mutex); + vq->acked_features = features; + mutex_unlock(&vq->mutex); mutex_unlock(&n->dev.mutex); return 0; } |