patch 'vdpa/mlx5: fix dead loop when process interrupted' has been queued to stable release 20.11.6

Xueming Li xuemingl at nvidia.com
Tue Jun 21 10:01:38 CEST 2022


Hi,

FYI, your patch has been queued to stable release 20.11.6

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/23/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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/6111eb8b88a84f181d9c70e5de22a82df355d2f1

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 6111eb8b88a84f181d9c70e5de22a82df355d2f1 Mon Sep 17 00:00:00 2001
From: Xueming Li <xuemingl at nvidia.com>
Date: Sun, 8 May 2022 17:25:49 +0300
Subject: [PATCH] vdpa/mlx5: fix dead loop when process interrupted
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 301ef4a18586ae1763206d7e75d9eddb58a7d05e ]

In Ctrl+C handling, sometimes kick handling thread gets endless EGAIN
error and fall into dead lock.

Kick happens frequently in real system due to busy traffic or retry
mechanism. This patch simplifies kick firmware anyway and skip setting
hardware notifier due to potential device error, notifier could be set
in next successful kick request.

Fixes: 62c813706e41 ("vdpa/mlx5: map doorbell")

Signed-off-by: Xueming Li <xuemingl at nvidia.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index c8c615054a..0d31e1d957 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -23,8 +23,9 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
 	struct mlx5_vdpa_priv *priv = virtq->priv;
 	uint64_t buf;
 	int nbytes;
+	int retry;
 
-	do {
+	for (retry = 0; retry < 3; ++retry) {
 		nbytes = read(virtq->intr_handle.fd, &buf, 8);
 		if (nbytes < 0) {
 			if (errno == EINTR ||
@@ -35,7 +36,9 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
 				virtq->index, strerror(errno));
 		}
 		break;
-	} while (1);
+	}
+	if (nbytes < 0)
+		return;
 	rte_write32(virtq->index, priv->virtq_db_addr);
 	if (virtq->notifier_state == MLX5_VDPA_NOTIFIER_STATE_DISABLED) {
 		if (rte_vhost_host_notifier_ctrl(priv->vid, virtq->index, true))
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-21 15:37:50.782973610 +0800
+++ 0032-vdpa-mlx5-fix-dead-loop-when-process-interrupted.patch	2022-06-21 15:37:49.007784479 +0800
@@ -1 +1 @@
-From 301ef4a18586ae1763206d7e75d9eddb58a7d05e Mon Sep 17 00:00:00 2001
+From 6111eb8b88a84f181d9c70e5de22a82df355d2f1 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 301ef4a18586ae1763206d7e75d9eddb58a7d05e ]
@@ -15 +17,0 @@
-Cc: stable at dpdk.org
@@ -20,2 +22,2 @@
- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
+ drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
@@ -24 +26 @@
-index 2e517beda2..2696d54b41 100644
+index c8c615054a..0d31e1d957 100644
@@ -27 +29 @@
-@@ -23,11 +23,11 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
+@@ -23,8 +23,9 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
@@ -33,3 +34,0 @@
- 	if (rte_intr_fd_get(virtq->intr_handle) < 0)
- 		return;
--
@@ -38,2 +37 @@
- 		nbytes = read(rte_intr_fd_get(virtq->intr_handle), &buf,
- 			      8);
+ 		nbytes = read(virtq->intr_handle.fd, &buf, 8);
@@ -41 +39,2 @@
-@@ -39,7 +39,9 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
+ 			if (errno == EINTR ||
+@@ -35,7 +36,9 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)


More information about the stable mailing list