[v1,3/8] vhost: remove unnecessary smp barrier for desc flags

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

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Joyce Kong Dec. 21, 2020, 3:50 p.m. UTC
  As function desc_is_avail performs a load-acquire barrier to
enforce the ordering between desc flags and desc content, it is
unnecessary to add a rte_smp_rmb barrier around the trace which
follows desc_is_avail.

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

Comments

Maxime Coquelin Jan. 7, 2021, 4:38 p.m. UTC | #1
On 12/21/20 4:50 PM, Joyce Kong wrote:
> As function desc_is_avail performs a load-acquire barrier to
> enforce the ordering between desc flags and desc content, it is
> unnecessary to add a rte_smp_rmb barrier around the trace which
> follows desc_is_avail.
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  lib/librte_vhost/virtio_net.c | 3 ---
>  1 file changed, 3 deletions(-)
> 

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

Thanks,
Maxime
  

Patch

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 6c5128665..ae6723766 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1281,8 +1281,6 @@  virtio_dev_rx_batch_packed(struct virtio_net *dev,
 			return -1;
 	}
 
-	rte_smp_rmb();
-
 	vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)
 		lens[i] = descs[avail_idx + i].len;
 
@@ -1343,7 +1341,6 @@  virtio_dev_rx_single_packed(struct virtio_net *dev,
 	struct buf_vector buf_vec[BUF_VECTOR_MAX];
 	uint16_t nr_descs = 0;
 
-	rte_smp_rmb();
 	if (unlikely(vhost_enqueue_single_packed(dev, vq, pkt, buf_vec,
 						 &nr_descs) < 0)) {
 		VHOST_LOG_DATA(DEBUG,