diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-02-01 02:21:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-15 01:42:53 -0500 |
commit | 5659338c88963ea791118e5e11e314b24f90c3eb (patch) | |
tree | 1fbaa549d012e2ba9cd327ed6ac5dbcc773a0244 /drivers/vhost/vhost.c | |
parent | f10a1f2e7e93a35cb603b63090ff0e70a576a641 (diff) |
vhost-net: switch to smp barriers
vhost-net only uses memory barriers to control SMP effects
(communication with userspace potentially running on a different CPU),
so it should use SMP barriers and not mandatory barriers for memory
access ordering, as suggested by Documentation/memory-barriers.txt
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c8c25dbc5857..6eb15259f5ae 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -685,7 +685,7 @@ int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, | |||
685 | int i, r; | 685 | int i, r; |
686 | 686 | ||
687 | /* Make sure data written is seen before log. */ | 687 | /* Make sure data written is seen before log. */ |
688 | wmb(); | 688 | smp_wmb(); |
689 | for (i = 0; i < log_num; ++i) { | 689 | for (i = 0; i < log_num; ++i) { |
690 | u64 l = min(log[i].len, len); | 690 | u64 l = min(log[i].len, len); |
691 | r = log_write(vq->log_base, log[i].addr, l); | 691 | r = log_write(vq->log_base, log[i].addr, l); |
@@ -884,7 +884,7 @@ unsigned vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq, | |||
884 | return vq->num; | 884 | return vq->num; |
885 | 885 | ||
886 | /* Only get avail ring entries after they have been exposed by guest. */ | 886 | /* Only get avail ring entries after they have been exposed by guest. */ |
887 | rmb(); | 887 | smp_rmb(); |
888 | 888 | ||
889 | /* Grab the next descriptor number they're advertising, and increment | 889 | /* Grab the next descriptor number they're advertising, and increment |
890 | * the index we've seen. */ | 890 | * the index we've seen. */ |
@@ -996,14 +996,14 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) | |||
996 | return -EFAULT; | 996 | return -EFAULT; |
997 | } | 997 | } |
998 | /* Make sure buffer is written before we update index. */ | 998 | /* Make sure buffer is written before we update index. */ |
999 | wmb(); | 999 | smp_wmb(); |
1000 | if (put_user(vq->last_used_idx + 1, &vq->used->idx)) { | 1000 | if (put_user(vq->last_used_idx + 1, &vq->used->idx)) { |
1001 | vq_err(vq, "Failed to increment used idx"); | 1001 | vq_err(vq, "Failed to increment used idx"); |
1002 | return -EFAULT; | 1002 | return -EFAULT; |
1003 | } | 1003 | } |
1004 | if (unlikely(vq->log_used)) { | 1004 | if (unlikely(vq->log_used)) { |
1005 | /* Make sure data is seen before log. */ | 1005 | /* Make sure data is seen before log. */ |
1006 | wmb(); | 1006 | smp_wmb(); |
1007 | log_write(vq->log_base, vq->log_addr + sizeof *vq->used->ring * | 1007 | log_write(vq->log_base, vq->log_addr + sizeof *vq->used->ring * |
1008 | (vq->last_used_idx % vq->num), | 1008 | (vq->last_used_idx % vq->num), |
1009 | sizeof *vq->used->ring); | 1009 | sizeof *vq->used->ring); |
@@ -1060,7 +1060,7 @@ bool vhost_enable_notify(struct vhost_virtqueue *vq) | |||
1060 | } | 1060 | } |
1061 | /* They could have slipped one in as we were doing that: make | 1061 | /* They could have slipped one in as we were doing that: make |
1062 | * sure it's written, then check again. */ | 1062 | * sure it's written, then check again. */ |
1063 | mb(); | 1063 | smp_mb(); |
1064 | r = get_user(avail_idx, &vq->avail->idx); | 1064 | r = get_user(avail_idx, &vq->avail->idx); |
1065 | if (r) { | 1065 | if (r) { |
1066 | vq_err(vq, "Failed to check avail idx at %p: %d\n", | 1066 | vq_err(vq, "Failed to check avail idx at %p: %d\n", |