[dpdk-dev] [PATCH v1 6/8] vhost: relax full barriers for used idx

Joyce Kong joyce.kong at arm.com
Mon Dec 21 16:50:31 CET 2020


Used idx can be synchronized by one-way barrier instead of full
write barrier for split vring.

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

diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c
index ae6fdd24e..99a926a77 100644
--- a/lib/librte_vhost/vdpa.c
+++ b/lib/librte_vhost/vdpa.c
@@ -217,8 +217,8 @@ rte_vdpa_relay_vring_used(int vid, uint16_t qid, void *vring_m)
 		idx++;
 	}
 
-	rte_smp_wmb();
-	vq->used->idx = idx_m;
+	/* used idx is the synchronization point for the split vring */
+	__atomic_store_n(&vq->used->idx, idx_m, __ATOMIC_RELEASE);
 
 	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX))
 		vring_used_event(s_vring) = idx_m;
-- 
2.29.2



More information about the dev mailing list