!182 [sync] PR-180: libhns: Fixes several bugs for libhns

From: @openeuler-sync-bot 
Reviewed-by: @hellotcc 
Signed-off-by: @hellotcc
This commit is contained in:
openeuler-ci-bot 2024-11-26 11:18:48 +00:00 committed by Gitee
commit f0e4558f89
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 91 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From e7613ae249465ebca5434421199fe97aee845a90 Mon Sep 17 00:00:00 2001
From: wenglianfa <wenglianfa@huawei.com>
Date: Wed, 12 Jun 2024 17:11:13 +0800
Subject: [PATCH] libhns: Fix the exception branch of wr_start() is not locked
driver inclusion
category: feature
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IB66RT
------------------------------------------------------------------
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 <wenglianfa@huawei.com>
Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
---
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 465ef1e..e4232ea 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -2930,6 +2930,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.25.1

View File

@ -0,0 +1,40 @@
From edaf09dbfc7203ea68becfcb56eecf4af31ba555 Mon Sep 17 00:00:00 2001
From: wenglianfa <wenglianfa@huawei.com>
Date: Thu, 25 Jul 2024 11:06:01 +0800
Subject: [PATCH] libhns: Fix memory leakage when DCA is enabled
driver inclusion
category: feature
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IB66RT
------------------------------------------------------------------
After DCA is enabled and a QP is created, the memory block
applied for DCA is not free when the QP is destroyed. Here
fix it.
Fixes: 41e39ab792c8 ("[BigDipperV3R9,NeZha][ROCE] libhns: Add support for at taching QP's WQE buffer")
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
---
providers/hns/hns_roce_u_verbs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index e30880c..c733b21 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -1357,7 +1357,8 @@ static void qp_free_wqe(struct hns_roce_qp *qp)
if (qp->rq.wqe_cnt)
free(qp->rq.wrid);
- hns_roce_free_buf(&qp->buf);
+ else
+ hns_roce_free_buf(&qp->buf);
}
static int qp_alloc_wqe(struct ibv_qp_init_attr_ex *attr,
--
2.25.1

View File

@ -1,6 +1,6 @@
Name: rdma-core
Version: 50.0
Release: 15
Release: 16
Summary: RDMA core userspace libraries and daemons
License: GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
Url: https://github.com/linux-rdma/rdma-core
@ -44,6 +44,8 @@ patch35: 0035-Fix-the-stride-calculation-for-MSN-PSN-area.patch
patch36: 0036-add-ZTE-Dinghai-rdma-driver.patch
patch37: 0037-libhns-Fix-out-of-order-issue-of-requester-when-sett.patch
patch38: 0038-libhns-Fix-reference-to-uninitialized-cq-pointer.patch
patch39: 0039-libhns-Fix-the-exception-branch-of-wr_start-is-not-l.patch
patch40: 0040-libhns-Fix-memory-leakage-when-DCA-is-enabled.patch
BuildRequires: binutils cmake >= 2.8.11 gcc libudev-devel pkgconfig pkgconfig(libnl-3.0)
BuildRequires: pkgconfig(libnl-route-3.0) systemd systemd-devel
@ -623,6 +625,12 @@ fi
%doc %{_docdir}/%{name}-%{version}/70-persistent-ipoib.rules
%changelog
* Mon Nov 25 2024 Xinghai Cen <cenxinghai@h-partners.com> - 50.0-16
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: Fixes several bugs for libhns
* Fri Nov 15 2024 Xinghai Cen <cenxinghai@h-partners.com> - 50.0-15
- Type: bugfix
- ID: NA