From 63b113afa51f223325642705685d3f1004cfdcaa Mon Sep 17 00:00:00 2001 From: Maxime Coquelin Date: Thu, 7 Jun 2018 16:38:26 +0200 Subject: [PATCH] vhost: use SMP memory barrier before kicking guest vhost_vring_call() used rte_mb(), which translates into mfence instruction on x86. This patch changes to use rte_smp_mb(), which changed recently to translate into a locked ADD instruction for performance reason. The measured gain is up to 3% with the testpmd benchmarks. Signed-off-by: Maxime Coquelin Reviewed-by: Tiwei Bie --- lib/librte_vhost/vhost.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 588b7cf9a7..528e01c8f9 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -593,7 +593,7 @@ static __rte_always_inline void vhost_vring_call(struct virtio_net *dev, struct vhost_virtqueue *vq) { /* Flush used->idx update before we read avail->flags. */ - rte_mb(); + rte_smp_mb(); /* Don't kick guest if we don't reach index specified by guest. */ if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) { -- 2.20.1