vdpa/mlx5: fix queue update synchronization
authorXueming Li <xuemingl@mellanox.com>
Sun, 2 Aug 2020 09:21:51 +0000 (09:21 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 5 Aug 2020 16:12:10 +0000 (18:12 +0200)
commit99abbd62c272bef0a86f8df6a99c3bc5642e6b59
treebca32f6f44d222eeab605345875d0286ba4649d2
parent3eee636809e449b8b4c0cdfaf841f2d0e4a558e8
vdpa/mlx5: fix queue update synchronization

The driver CQ event management is done by non vhost library thread,
either the dpdk host thread or the internal vDPA driver thread.

When a queue is updated the CQ may be destroyed and created by the vhost
library thread via the queue state operation.

When the queue update feature was added, it didn't synchronize the CQ
management to the queue update what may cause invalid memory access.

Add the aforementioned synchronization by a new per device configuration
mutex.

Fixes: c47d6e83334e ("vdpa/mlx5: support queue update")

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/vdpa/mlx5/mlx5_vdpa.c
drivers/vdpa/mlx5/mlx5_vdpa.h
drivers/vdpa/mlx5/mlx5_vdpa_event.c