From 41592115435779d7c41e7f1677520b9c641289d9 Mon Sep 17 00:00:00 2001 From: wenglianfa Date: Wed, 12 Jun 2024 17:11:13 +0800 Subject: [PATCH 4/4] libhns: Fix the exception branch of wr_start() is not locked The provider should provide locking to ensure that ibv_wr_start() and ibv_wr_complete()/abort() form a per-QP critical section where no other threads can enter. The exception branch of wr_start() is not locked, fix it here. Because check_qp_send () does not require lock protection, hns_roce_spin_lock () is placed after check_qp_send (). Fixes: 36446a56eea5 ("libhns: Extended QP supports the new post send mechanism") Signed-off-by: wenglianfa --- providers/hns/hns_roce_u_hw_v2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c index af25e6e..79f225c 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -2975,6 +2975,7 @@ static void wr_start(struct ibv_qp_ex *ibv_qp) ret = check_qp_send(qp, ctx); if (ret) { + hns_roce_spin_lock(&qp->sq.hr_lock); qp->err = ret; return; } -- 2.33.0