[dpdk-stable] patch 'vhost: avoid memory barriers when no descriptors dequeued' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Thu Nov 22 17:49:46 CET 2018


Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/28/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From e0ac20188fdc6b7b0fddb4c813385dc5982fd3b4 Mon Sep 17 00:00:00 2001
From: Maxime Coquelin <maxime.coquelin at redhat.com>
Date: Tue, 23 Oct 2018 12:07:10 +0200
Subject: [PATCH] vhost: avoid memory barriers when no descriptors dequeued

[ upstream commit e988a6d84599f83321f8036dc45acf26a97ad7ea ]

In both split and packed dequeue paths, flush_shadow_used_ring
and vhost_ring_call variants gets called even if not packets
have been dequeued, and so no descriptors updates happened.

It has an impact on CPU pipeline, as memory barriers are used
in these functions.

This patch don't call these functions if no descriptors have
been dequeued. The performance gain with split ring when
dequeue zero-copy is disabled should be null, but should be
noticeable with packed ring or dequeue zero-copy enabled.

Fixes: ae999ce49dcb ("vhost: add Tx support for packed ring")
Fixes: 915cf9404225 ("vhost: use shadow used ring in dequeue path")

Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
Reviewed-by: Jens Freimann <jfreimann at redhat.com>
Tested-by: Jens Freimann <jfreimann at redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie at intel.com>
---
 lib/librte_vhost/virtio_net.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 1c31c0562..8ad30c94a 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1361,6 +1361,8 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		}
 
-		flush_shadow_used_ring_split(dev, vq);
-		vhost_vring_call_split(dev, vq);
+		if (likely(vq->shadow_used_idx)) {
+			flush_shadow_used_ring_split(dev, vq);
+			vhost_vring_call_split(dev, vq);
+		}
 	}
 
@@ -1441,6 +1443,8 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		if (unlikely(i < count))
 			vq->shadow_used_idx = i;
-		flush_shadow_used_ring_split(dev, vq);
-		vhost_vring_call_split(dev, vq);
+		if (likely(vq->shadow_used_idx)) {
+			flush_shadow_used_ring_split(dev, vq);
+			vhost_vring_call_split(dev, vq);
+		}
 	}
 
@@ -1477,6 +1481,8 @@ virtio_dev_tx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		}
 
-		flush_shadow_used_ring_packed(dev, vq);
-		vhost_vring_call_packed(dev, vq);
+		if (likely(vq->shadow_used_idx)) {
+			flush_shadow_used_ring_packed(dev, vq);
+			vhost_vring_call_packed(dev, vq);
+		}
 	}
 
@@ -1556,6 +1562,8 @@ virtio_dev_tx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		if (unlikely(i < count))
 			vq->shadow_used_idx = i;
-		flush_shadow_used_ring_packed(dev, vq);
-		vhost_vring_call_packed(dev, vq);
+		if (likely(vq->shadow_used_idx)) {
+			flush_shadow_used_ring_packed(dev, vq);
+			vhost_vring_call_packed(dev, vq);
+		}
 	}
 
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-22 16:47:33.690885454 +0000
+++ 0054-vhost-avoid-memory-barriers-when-no-descriptors-dequ.patch	2018-11-22 16:47:32.000000000 +0000
@@ -1,8 +1,10 @@
-From e988a6d84599f83321f8036dc45acf26a97ad7ea Mon Sep 17 00:00:00 2001
+From e0ac20188fdc6b7b0fddb4c813385dc5982fd3b4 Mon Sep 17 00:00:00 2001
 From: Maxime Coquelin <maxime.coquelin at redhat.com>
 Date: Tue, 23 Oct 2018 12:07:10 +0200
 Subject: [PATCH] vhost: avoid memory barriers when no descriptors dequeued
 
+[ upstream commit e988a6d84599f83321f8036dc45acf26a97ad7ea ]
+
 In both split and packed dequeue paths, flush_shadow_used_ring
 and vhost_ring_call variants gets called even if not packets
 have been dequeued, and so no descriptors updates happened.
@@ -17,7 +19,6 @@
 
 Fixes: ae999ce49dcb ("vhost: add Tx support for packed ring")
 Fixes: 915cf9404225 ("vhost: use shadow used ring in dequeue path")
-Cc: stable at dpdk.org
 
 Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
 Reviewed-by: Jens Freimann <jfreimann at redhat.com>


More information about the stable mailing list