aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/net.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-06-05 08:20:27 -0400
committerMichael S. Tsirkin <mst@redhat.com>2014-06-09 09:21:07 -0400
commit47283bef7ed356629467d1fac61687756e48f254 (patch)
tree464f8f6973cf9da00fc57679a62638a6c7aee593 /drivers/vhost/net.c
parentea16c51433510f7f758382dec5b933fc0797f244 (diff)
vhost: move memory pointer to VQs
commit 2ae76693b8bcabf370b981cd00c36cd41d33fabc vhost: replace rcu with mutex replaced rcu sync for memory accesses with VQ mutex locl/unlock. This is correct since all accesses are under VQ mutex, but incomplete: we still do useless rcu lock/unlock operations, someone might copy this code into some other context where this won't be right. This use of RCU is also non standard and hard to understand. Let's copy the pointer to each VQ structure, this way the access rules become straight-forward, and there's no need for RCU anymore. Reported-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/net.c')
-rw-r--r--drivers/vhost/net.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 2bc8f298a4e7..971a760af4a1 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -374,7 +374,7 @@ static void handle_tx(struct vhost_net *net)
374 % UIO_MAXIOV == nvq->done_idx)) 374 % UIO_MAXIOV == nvq->done_idx))
375 break; 375 break;
376 376
377 head = vhost_get_vq_desc(&net->dev, vq, vq->iov, 377 head = vhost_get_vq_desc(vq, vq->iov,
378 ARRAY_SIZE(vq->iov), 378 ARRAY_SIZE(vq->iov),
379 &out, &in, 379 &out, &in,
380 NULL, NULL); 380 NULL, NULL);
@@ -506,7 +506,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
506 r = -ENOBUFS; 506 r = -ENOBUFS;
507 goto err; 507 goto err;
508 } 508 }
509 r = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg, 509 r = vhost_get_vq_desc(vq, vq->iov + seg,
510 ARRAY_SIZE(vq->iov) - seg, &out, 510 ARRAY_SIZE(vq->iov) - seg, &out,
511 &in, log, log_num); 511 &in, log, log_num);
512 if (unlikely(r < 0)) 512 if (unlikely(r < 0))