Skip to content

Commit

Permalink
vdpa/mlx5: fix dead loop when process interrupted
Browse files Browse the repository at this point in the history
[ upstream commit 301ef4a ]

In Ctrl+C handling, sometimes kick handling thread gets endless EGAIN
error and fall into dead lock.

Kick happens frequently in real system due to busy traffic or retry
mechanism. This patch simplifies kick firmware anyway and skip setting
hardware notifier due to potential device error, notifier could be set
in next successful kick request.

Fixes: 62c8137 ("vdpa/mlx5: map doorbell")

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
  • Loading branch information
steevenlee authored and kevintraynor committed May 24, 2022
1 parent 879fb64 commit d24d639
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
struct mlx5_vdpa_priv *priv = virtq->priv;
uint64_t buf;
int nbytes;
int retry;

if (rte_intr_fd_get(virtq->intr_handle) < 0)
return;

do {
for (retry = 0; retry < 3; ++retry) {
nbytes = read(rte_intr_fd_get(virtq->intr_handle), &buf,
8);
if (nbytes < 0) {
Expand All @@ -39,7 +39,9 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
virtq->index, strerror(errno));
}
break;
} while (1);
}
if (nbytes < 0)
return;
rte_write32(virtq->index, priv->virtq_db_addr);
if (virtq->notifier_state == MLX5_VDPA_NOTIFIER_STATE_DISABLED) {
if (rte_vhost_host_notifier_ctrl(priv->vid, virtq->index, true))
Expand Down

0 comments on commit d24d639

Please sign in to comment.