patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] vdpa/mlx5: fix configuration mutex cleanup
@ 2021-01-06  6:43 Matan Azrad
  2021-01-07 18:09 ` Maxime Coquelin
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Matan Azrad @ 2021-01-06  6:43 UTC (permalink / raw)
  To: dev; +Cc: Maxime Coquelin, stable

When the vDPA device is closed, the driver polling thread is canceled.
The polling thread locks the configuration mutex while it polls the CQs.

When the cancellation happens, it may terminate the thread inside the
critical section what remains the configuration mutex locked.

After device close, the driver may be configured again, in this case,
for example, when the first queue state is updated, the driver tries to
lock the mutex again and deadlock appears.

Initialize the mutex after the polling thread cancellation.

Fixes: 99abbd62c272 ("vdpa/mlx5: fix queue update synchronization")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index b64f364..0b2f1ab 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -295,6 +295,8 @@
 	}
 	priv->configured = 0;
 	priv->vid = 0;
+	/* The mutex may stay locked after event thread cancel - initiate it. */
+	pthread_mutex_init(&priv->vq_config_lock, NULL);
 	DRV_LOG(INFO, "vDPA device %d was closed.", vid);
 	return ret;
 }
-- 
1.8.3.1


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

end of thread, other threads:[~2021-01-27 12:01 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06  6:43 [dpdk-stable] [PATCH] vdpa/mlx5: fix configuration mutex cleanup Matan Azrad
2021-01-07 18:09 ` Maxime Coquelin
2021-01-08  8:48   ` David Marchand
2021-01-14  8:34     ` David Marchand
2021-01-14 11:49       ` Matan Azrad
2021-01-14 12:38         ` Maxime Coquelin
2021-01-14 13:09           ` Matan Azrad
2021-01-14 14:27             ` Maxime Coquelin
2021-01-14 15:23               ` Matan Azrad
2021-01-21 10:46                 ` Maxime Coquelin
2021-01-21 20:13                   ` Matan Azrad
2021-01-26 10:22                     ` Maxime Coquelin
2021-01-26 10:45                       ` Matan Azrad
2021-01-26 13:00                         ` Maxime Coquelin
2021-01-26 18:23                           ` Matan Azrad
2021-01-27 10:45 ` Maxime Coquelin
2021-01-27 12:01 ` Maxime Coquelin

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).