diff options
author | Asias He <asias@redhat.com> | 2013-05-07 02:54:36 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2013-07-11 08:38:40 -0400 |
commit | 22fa90c7fb479694d6affebc049d21f06b714be6 (patch) | |
tree | fd62ad11e27171f38d29470e5935736d835d3a4c /drivers/vhost/net.c | |
parent | e7802212ea4bbbd5db99181942a19ab36ca4b914 (diff) |
vhost: Remove custom vhost rcu usage
Now, vq->private_data is always accessed under vq mutex. No need to play
the vhost rcu trick.
Signed-off-by: Asias He <asias@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/net.c')
-rw-r--r-- | drivers/vhost/net.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 99f8d63491aa..969a85960e9f 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
17 | #include <linux/workqueue.h> | 17 | #include <linux/workqueue.h> |
18 | #include <linux/rcupdate.h> | ||
19 | #include <linux/file.h> | 18 | #include <linux/file.h> |
20 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
21 | 20 | ||
@@ -749,8 +748,7 @@ static int vhost_net_enable_vq(struct vhost_net *n, | |||
749 | struct vhost_poll *poll = n->poll + (nvq - n->vqs); | 748 | struct vhost_poll *poll = n->poll + (nvq - n->vqs); |
750 | struct socket *sock; | 749 | struct socket *sock; |
751 | 750 | ||
752 | sock = rcu_dereference_protected(vq->private_data, | 751 | sock = vq->private_data; |
753 | lockdep_is_held(&vq->mutex)); | ||
754 | if (!sock) | 752 | if (!sock) |
755 | return 0; | 753 | return 0; |
756 | 754 | ||
@@ -763,10 +761,9 @@ static struct socket *vhost_net_stop_vq(struct vhost_net *n, | |||
763 | struct socket *sock; | 761 | struct socket *sock; |
764 | 762 | ||
765 | mutex_lock(&vq->mutex); | 763 | mutex_lock(&vq->mutex); |
766 | sock = rcu_dereference_protected(vq->private_data, | 764 | sock = vq->private_data; |
767 | lockdep_is_held(&vq->mutex)); | ||
768 | vhost_net_disable_vq(n, vq); | 765 | vhost_net_disable_vq(n, vq); |
769 | rcu_assign_pointer(vq->private_data, NULL); | 766 | vq->private_data = NULL; |
770 | mutex_unlock(&vq->mutex); | 767 | mutex_unlock(&vq->mutex); |
771 | return sock; | 768 | return sock; |
772 | } | 769 | } |
@@ -922,8 +919,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) | |||
922 | } | 919 | } |
923 | 920 | ||
924 | /* start polling new socket */ | 921 | /* start polling new socket */ |
925 | oldsock = rcu_dereference_protected(vq->private_data, | 922 | oldsock = vq->private_data; |
926 | lockdep_is_held(&vq->mutex)); | ||
927 | if (sock != oldsock) { | 923 | if (sock != oldsock) { |
928 | ubufs = vhost_net_ubuf_alloc(vq, | 924 | ubufs = vhost_net_ubuf_alloc(vq, |
929 | sock && vhost_sock_zcopy(sock)); | 925 | sock && vhost_sock_zcopy(sock)); |
@@ -933,7 +929,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) | |||
933 | } | 929 | } |
934 | 930 | ||
935 | vhost_net_disable_vq(n, vq); | 931 | vhost_net_disable_vq(n, vq); |
936 | rcu_assign_pointer(vq->private_data, sock); | 932 | vq->private_data = sock; |
937 | r = vhost_init_used(vq); | 933 | r = vhost_init_used(vq); |
938 | if (r) | 934 | if (r) |
939 | goto err_used; | 935 | goto err_used; |
@@ -967,7 +963,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) | |||
967 | return 0; | 963 | return 0; |
968 | 964 | ||
969 | err_used: | 965 | err_used: |
970 | rcu_assign_pointer(vq->private_data, oldsock); | 966 | vq->private_data = oldsock; |
971 | vhost_net_enable_vq(n, vq); | 967 | vhost_net_enable_vq(n, vq); |
972 | if (ubufs) | 968 | if (ubufs) |
973 | vhost_net_ubuf_put_wait_and_free(ubufs); | 969 | vhost_net_ubuf_put_wait_and_free(ubufs); |