DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix counter query fail during port closing
@ 2020-05-15  8:56 Suanming Mou
  2020-05-28  9:22 ` [dpdk-dev] [PATCH v2] net/mlx5: fix interrupt installation timing Suanming Mou
  0 siblings, 1 reply; 3+ messages in thread
From: Suanming Mou @ 2020-05-15  8:56 UTC (permalink / raw)
  To: Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko; +Cc: dev, rasland, stable

Currently, the DevX counter query works asynchronously with Devx
interrupt handler return the query result. When port closes, the
interrupt handler will be uninstalled and the Devx comp obj will
also be destroyed. Meanwhile the query is still not cancelled.
In this case, counter query may use the invalid Devx comp which
has been destroyed, and query failure with invalid FD will be
reported.

Move the query alarm cancel before Devx interrupt uninstall to
avoid query failure with invalid FD issue.

Fixes: f15db67df09c ("net/mlx5: accelerate DV flow counter query")
Cc: stable@dpdk.org

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
Please apply the patch after the patch below:
https://patches.dpdk.org/patch/70310/
---
 drivers/net/mlx5/mlx5.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index be16841..579da76 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -506,15 +506,7 @@ struct mlx5_flow_id_pool *
 	struct mlx5_counter_stats_mem_mng *mng;
 	int i;
 	int j;
-	int retries = 1024;
 
-	rte_errno = 0;
-	while (--retries) {
-		rte_eal_alarm_cancel(mlx5_flow_query_alarm, sh);
-		if (rte_errno != EINPROGRESS)
-			break;
-		rte_pause();
-	}
 	for (i = 0; i < MLX5_CCONT_TYPE_MAX; ++i) {
 		struct mlx5_flow_counter_pool *pool;
 		uint32_t batch = !!(i > 1);
@@ -1427,6 +1419,23 @@ struct mlx5_flow_id_pool *
 		dev->data->port_id,
 		((priv->sh && priv->sh->ctx) ?
 		priv->sh->ctx->device->name : ""));
+	/*
+	 * The devx->comp is going to be destroyed in
+	 * mlx5_dev_interrupt_handler_devx_uninstall(), stop the asynchronous
+	 * counter query in advanced in case the devx->comp destroyed during
+	 * query causes invalid fd used.
+	 */
+	if (priv->sh) {
+		int retries = 1024;
+
+		rte_errno = 0;
+		while (--retries) {
+			rte_eal_alarm_cancel(mlx5_flow_query_alarm, priv->sh);
+			if (rte_errno != EINPROGRESS)
+				break;
+			rte_pause();
+		}
+	}
 	/* In case mlx5_dev_stop() has not been called. */
 	mlx5_dev_interrupt_handler_uninstall(dev);
 	mlx5_dev_interrupt_handler_devx_uninstall(dev);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-31 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15  8:56 [dpdk-dev] [PATCH] net/mlx5: fix counter query fail during port closing Suanming Mou
2020-05-28  9:22 ` [dpdk-dev] [PATCH v2] net/mlx5: fix interrupt installation timing Suanming Mou
2020-05-31 14:04   ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).