diff mbox series

[v1,5/8] vhost: relax full barriers for desc flags

Message ID 20201221155033.6771-6-joyce.kong@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers show
Series replace smp barriers in vhost with C11 atomic | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Joyce Kong Dec. 21, 2020, 3:50 p.m. UTC
Relax the full read barrier to one-way barrier for desc flags in
packed vring.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/librte_vhost/virtio_net.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Maxime Coquelin Jan. 7, 2021, 4:45 p.m. UTC | #1
On 12/21/20 4:50 PM, Joyce Kong wrote:
> Relax the full read barrier to one-way barrier for desc flags in
> packed vring.
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  lib/librte_vhost/virtio_net.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
diff mbox series

Patch

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index c912ae354..b779034dc 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -222,8 +222,9 @@  vhost_flush_dequeue_shadow_packed(struct virtio_net *dev,
 	struct vring_used_elem_packed *used_elem = &vq->shadow_used_packed[0];
 
 	vq->desc_packed[vq->shadow_last_used_idx].id = used_elem->id;
-	rte_smp_wmb();
-	vq->desc_packed[vq->shadow_last_used_idx].flags = used_elem->flags;
+	/* desc flags is the synchronization point for virtio packed vring */
+	__atomic_store_n(&vq->desc_packed[vq->shadow_last_used_idx].flags,
+			 used_elem->flags, __ATOMIC_RELEASE);
 
 	vhost_log_cache_used_vring(dev, vq, vq->shadow_last_used_idx *
 				   sizeof(struct vring_packed_desc),