From d1d0ac518e20dc1eca4fcc62d091c69e20b114da Mon Sep 17 00:00:00 2001 From: wenglianfa Date: Tue, 30 Jul 2024 21:57:56 +0800 Subject: [PATCH] libhns: Fix no locking in the exception branch of wr start() According to the man page ibv_wr_post.3.md, "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." Currently the exception branch of wr_start() is not locked, add a lock here. Fixes: 36446a56eea5 ("libhns: Extended QP supports the new post send mechanism") Signed-off-by: wenglianfa Signed-off-by: Junxian Huang --- 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 be7f99b65..88bf55fd1 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -2558,6 +2558,7 @@ static void wr_start(struct ibv_qp_ex *ibv_qp) if (state == IBV_QPS_RESET || state == IBV_QPS_INIT || state == IBV_QPS_RTR) { + hns_roce_spin_lock(&qp->sq.hr_lock); qp->err = EINVAL; return; }