vdpa/mlx5: fix unregister kick handler order
Subsystems (2)
PATCH 1/1 vdpa/mlx5: fix unregister kick handler order
The mlx5_vdpa_virtq_kick_handler function may still be running and waiting on virtq->virtq_lock while mlx5_vdpa_cqe_event_unset function is trying to re-initialize the virtq->virtq_lock.
This causes mlx5_vdpa_virtq_kick_handler thread can't be wake up and can't be unregister. Following print may loop forever when calling rte_vhost_driver_unregister(socket_path):
mlx5_vdpa: Try again to unregister fd 154 of virtq 11 interrupt
mlx5_vdpa: Try again to unregister fd 154 of virtq 11 interrupt
...
The fix is to move mlx5_vdpa_virtq_unregister_intr_handle before mlx5_vdpa_cqe_event_unset.
--- drivers/vdpa/mlx5/mlx5_vdpa.c | 1 + drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/mlx5/mlx5_vdpa.c +1 -0
@@ -282,6 +282,7 @@ _internal_mlx5_vdpa_dev_close(struct mlx5_vdpa_priv *priv,int ret =0 ;int vid = priv->vid; +mlx5_vdpa_virtq_unreg_intr_handle_all (priv);mlx5_vdpa_cqe_event_unset (priv);if (priv->state ==MLX5_VDPA_STATE_CONFIGURED ) { ret |=mlx5_vdpa_lm_log (priv);
drivers/vdpa/mlx5/mlx5_vdpa_cthread.c +0 -1
@@ -190,7 +190,6 @@ mlx5_vdpa_c_thread_handle(void *arg)pthread_mutex_unlock (&virtq->virtq_lock);break ;case MLX5_VDPA_TASK_DEV_CLOSE_NOWAIT : -mlx5_vdpa_virtq_unreg_intr_handle_all (priv);pthread_mutex_lock (&priv->steer_update_lock);mlx5_vdpa_steer_unset (priv);pthread_mutex_unlock (&priv->steer_update_lock);
Signature · 1 line
2.27.0
Quoted 42 lines · Yajun Wu
The
mlx5_vdpa_virtq_kick_handlerfunction may still be running and waiting onvirtq->virtq_lockwhilemlx5_vdpa_cqe_event_unsetfunction is trying to re-initialize thevirtq->virtq_lock.This causes
mlx5_vdpa_virtq_kick_handlerthread can't be wake up and can't be unregister. Following print may loop forever when callingrte_vhost_driver_unregister(socket_path):
mlx5_vdpa: Try again to unregister fd 154 of virtq 11 interrupt
mlx5_vdpa: Try again to unregister fd 154 of virtq 11 interrupt
...The fix is to move
mlx5_vdpa_virtq_unregister_intr_handlebeforemlx5_vdpa_cqe_event_unset.Fixes 057f7d2084 ("vdpa/mlx5: optimize datapath-control synchronization")Signed-off-by Yajun Wu <[email protected]>Acked-by Matan Azrad <[email protected]>--- drivers/vdpa/mlx5/mlx5_vdpa.c | 1 + drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)drivers/vdpa/mlx5/mlx5_vdpa.c +1
-0@@ -282,6 +282,7 @@ _internal_mlx5_vdpa_dev_close(struct mlx5_vdpa_priv *priv,int ret =0 ;int vid = priv->vid; +mlx5_vdpa_virtq_unreg_intr_handle_all (priv);mlx5_vdpa_cqe_event_unset (priv);if (priv->state ==MLX5_VDPA_STATE_CONFIGURED ) { ret |=mlx5_vdpa_lm_log (priv);drivers/vdpa/mlx5/mlx5_vdpa_cthread.c +0
-0
drivers/vdpa/mlx5/mlx5_vdpa_cthread.c mlx5_vdpa_c_thread_handle(void *arg) · line 195
Quoted 7 lines
drivers/vdpa/mlx5/mlx5_vdpa_cthread.c +0
-1@@ -190,7 +190,6 @@ mlx5_vdpa_c_thread_handle(void *arg)pthread_mutex_unlock (&virtq->virtq_lock);break ;case MLX5_VDPA_TASK_DEV_CLOSE_NOWAIT : -mlx5_vdpa_virtq_unreg_intr_handle_all (priv);pthread_mutex_lock (&priv->steer_update_lock);mlx5_vdpa_steer_unset (priv);pthread_mutex_unlock (&priv->steer_update_lock);
Thanks,
Maxime
Maxime Coquelin
AppliedQuoted 18 lines · Yajun Wu
The
mlx5_vdpa_virtq_kick_handlerfunction may still be running and waiting onvirtq->virtq_lockwhilemlx5_vdpa_cqe_event_unsetfunction is trying to re-initialize thevirtq->virtq_lock.This causes
mlx5_vdpa_virtq_kick_handlerthread can't be wake up and can't be unregister. Following print may loop forever when callingrte_vhost_driver_unregister(socket_path):
mlx5_vdpa: Try again to unregister fd 154 of virtq 11 interrupt
mlx5_vdpa: Try again to unregister fd 154 of virtq 11 interrupt
...The fix is to move
mlx5_vdpa_virtq_unregister_intr_handlebeforemlx5_vdpa_cqe_event_unset.Fixes 057f7d2084 ("vdpa/mlx5: optimize datapath-control synchronization")
Quoted 6 lines
Signed-off-by Yajun Wu <[email protected]>Acked-by Matan Azrad <[email protected]>--- drivers/vdpa/mlx5/mlx5_vdpa.c | 1 + drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
Applied to nex-virtio/for-next-net.
Thanks,
Maxime