Skip to content

Commit

Permalink
fix potential CQ deadlock in mlx5 provider
Browse files Browse the repository at this point in the history
[ Upstream commit e677dc6 ]

We saw deadlock in mlx5_destroy_qp() if ibv_start_poll() returns EBUSY failure.
According to reference (https://man7.org/linux/man-pages/man3/ibv_create_cq_ex.3.html), if ibv_start_poll() returns error, ibv_end_poll() shouldn't be called.
Therefore, we must release the CQ lock in mlx5_start_poll() if mlx5dv_get_clock_info() returns error e.g. EBUSY.

Fixes: 4745c80 ("mlx5: Implement read_completion_wallclock_ns")
Signed-off-by: Yijing Zeng <zengyijing19900106@gmail.com>
Signed-off-by: Nicolas Morey <nmorey@suse.com>
  • Loading branch information
zengyijing authored and nmorey committed Jun 10, 2024
1 parent 2be33e6 commit 2c8b104
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion providers/mlx5/cq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,11 @@ static inline int mlx5_start_poll(struct ibv_cq_ex *ibcq, struct ibv_poll_cq_att
goto out;
}

if (clock_update && !err)
if (clock_update && !err) {
err = mlx5dv_get_clock_info(ibcq->context, &cq->last_clock_info);
if (lock && err)
mlx5_spin_unlock(&cq->lock);
}

out:
return err;
Expand Down

0 comments on commit 2c8b104

Please sign in to comment.