patch 'vhost: fix async access' has been queued to stable release 21.11.2

Kevin Traynor ktraynor at redhat.com
Thu Jun 9 13:36:35 CEST 2022


Hi,

FYI, your patch has been queued to stable release 21.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/13/22. 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. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/fadc687f559274967c43c55317b66e924002a261

Thanks.

Kevin

---
>From fadc687f559274967c43c55317b66e924002a261 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Mon, 11 Apr 2022 13:00:08 +0200
Subject: [PATCH] vhost: fix async access

[ upstream commit 2d47fd3dfb596d266b89d82c2c4b2351c3d6fe20 ]

vq->async accesses must be protected with vq->access_lock.

Fixes: eb666d24085f ("vhost: fix async unregister deadlock")
Fixes: 0c0935c5f794 ("vhost: allow to check in-flight packets for async vhost")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Sunil Pai G <sunil.pai.g at intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 lib/vhost/vhost.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
index 474645b64e..24f94495c6 100644
--- a/lib/vhost/vhost.c
+++ b/lib/vhost/vhost.c
@@ -1784,24 +1784,20 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
 		return ret;
 
-	ret = 0;
-
-	if (!vq->async)
-		return ret;
-
 	if (!rte_spinlock_trylock(&vq->access_lock)) {
 		VHOST_LOG_CONFIG(ERR, "Failed to unregister async channel. "
 			"virt queue busy.\n");
-		return -1;
+		return ret;
 	}
 
-	if (vq->async->pkts_inflight_n) {
+	if (!vq->async) {
+		ret = 0;
+	} else if (vq->async->pkts_inflight_n) {
 		VHOST_LOG_CONFIG(ERR, "Failed to unregister async channel. "
 			"async inflight packets must be completed before unregistration.\n");
-		ret = -1;
-		goto out;
+	} else {
+		vhost_free_async_mem(vq);
+		ret = 0;
 	}
 
-	vhost_free_async_mem(vq);
-out:
 	rte_spinlock_unlock(&vq->access_lock);
 
@@ -1858,7 +1854,4 @@ rte_vhost_async_get_inflight(int vid, uint16_t queue_id)
 		return ret;
 
-	if (!vq->async)
-		return ret;
-
 	if (!rte_spinlock_trylock(&vq->access_lock)) {
 		VHOST_LOG_CONFIG(DEBUG, "Failed to check in-flight packets. "
@@ -1867,5 +1860,7 @@ rte_vhost_async_get_inflight(int vid, uint16_t queue_id)
 	}
 
-	ret = vq->async->pkts_inflight_n;
+	if (vq->async)
+		ret = vq->async->pkts_inflight_n;
+
 	rte_spinlock_unlock(&vq->access_lock);
 
-- 
2.34.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-09 12:34:30.882751020 +0100
+++ 0048-vhost-fix-async-access.patch	2022-06-09 12:34:29.763980671 +0100
@@ -1 +1 @@
-From 2d47fd3dfb596d266b89d82c2c4b2351c3d6fe20 Mon Sep 17 00:00:00 2001
+From fadc687f559274967c43c55317b66e924002a261 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2d47fd3dfb596d266b89d82c2c4b2351c3d6fe20 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index df0bb9d043..14863144f3 100644
+index 474645b64e..24f94495c6 100644
@@ -23 +24 @@
-@@ -1754,25 +1754,21 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
+@@ -1784,24 +1784,20 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
@@ -32,2 +33,2 @@
- 		VHOST_LOG_CONFIG(ERR, "(%s) failed to unregister async channel, virtqueue busy.\n",
- 				dev->ifname);
+ 		VHOST_LOG_CONFIG(ERR, "Failed to unregister async channel. "
+ 			"virt queue busy.\n");
@@ -42,3 +43,2 @@
- 		VHOST_LOG_CONFIG(ERR, "(%s) failed to unregister async channel.\n", dev->ifname);
- 		VHOST_LOG_CONFIG(ERR, "(%s) inflight packets must be completed before unregistration.\n",
- 			dev->ifname);
+ 		VHOST_LOG_CONFIG(ERR, "Failed to unregister async channel. "
+ 			"async inflight packets must be completed before unregistration.\n");
@@ -56 +56 @@
-@@ -1892,7 +1888,4 @@ rte_vhost_async_get_inflight(int vid, uint16_t queue_id)
+@@ -1858,7 +1854,4 @@ rte_vhost_async_get_inflight(int vid, uint16_t queue_id)
@@ -63,2 +63,2 @@
- 		VHOST_LOG_CONFIG(DEBUG,
-@@ -1902,5 +1895,7 @@ rte_vhost_async_get_inflight(int vid, uint16_t queue_id)
+ 		VHOST_LOG_CONFIG(DEBUG, "Failed to check in-flight packets. "
+@@ -1867,5 +1860,7 @@ rte_vhost_async_get_inflight(int vid, uint16_t queue_id)



More information about the stable mailing list