vhost: remove unnecessary SMP barrier for avail idx
authorJoyce Kong <joyce.kong@arm.com>
Mon, 21 Dec 2020 15:50:29 +0000 (23:50 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 17:07:55 +0000 (18:07 +0100)
The ordering between avail index and desc reads has been enforced
by load-acquire for split vring, so smp_rmb barrier is not needed
behind it.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/virtio_net.c

index ae67237..c912ae3 100644 (file)
@@ -1494,13 +1494,10 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,
        struct async_inflight_info *pkts_info = vq->async_pkts_info;
        int n_pkts = 0;
 
-       avail_head = __atomic_load_n(&vq->avail->idx, __ATOMIC_ACQUIRE);
-
        /*
-        * The ordering between avail index and
-        * desc reads needs to be enforced.
+        * The ordering between avail index and desc reads need to be enforced.
         */
-       rte_smp_rmb();
+       avail_head = __atomic_load_n(&vq->avail->idx, __ATOMIC_ACQUIRE);
 
        rte_prefetch0(&vq->avail->ring[vq->last_avail_idx & (vq->size - 1)]);