vdpa/mlx5: fix configuration mutex cleanup
authorMatan Azrad <matan@nvidia.com>
Wed, 6 Jan 2021 06:43:29 +0000 (06:43 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:10 +0000 (18:16 +0100)
commitf00e5a15af5a0c5df1a7390364b6454d34586335
tree32f3ad36b7dde42ae70da7a54b528d8bf90ca457
parent1790c29e2aa970951372e0e167196b25c94de7af
vdpa/mlx5: fix configuration mutex cleanup

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>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/vdpa/mlx5/mlx5_vdpa.c