From 058cb01e3dc0871568691e07bcbd514aea9b70f4 Mon Sep 17 00:00:00 2001 From: Juan Zhou Date: Mon, 6 May 2024 10:04:50 +0800 Subject: [PATCH] Fix flexible WQE buffer page related issues 1. Fix missing flexible WQE buffer page flag 2. Fix ext_sge page size Signed-off-by: Chengchang Tang Signed-off-by: Juan Zhou (cherry picked from commit e8a0671cf69d32baa72c4430f2b3ac279fbce147) --- ...issing-flexible-WQE-buffer-page-flag.patch | 35 +++++++++++++ 0029-libhns-Fix-ext_sge-page-size.patch | 52 +++++++++++++++++++ rdma-core.spec | 10 +++- 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 0028-libhns-Fix-missing-flexible-WQE-buffer-page-flag.patch create mode 100644 0029-libhns-Fix-ext_sge-page-size.patch diff --git a/0028-libhns-Fix-missing-flexible-WQE-buffer-page-flag.patch b/0028-libhns-Fix-missing-flexible-WQE-buffer-page-flag.patch new file mode 100644 index 0000000..dd27179 --- /dev/null +++ b/0028-libhns-Fix-missing-flexible-WQE-buffer-page-flag.patch @@ -0,0 +1,35 @@ +From 6ee60b49872472129e26fbb4d19061e7a864a32a Mon Sep 17 00:00:00 2001 +From: Chengchang Tang +Date: Tue, 30 Jan 2024 20:57:02 +0800 +Subject: [PATCH] libhns: Fix missing flexible WQE buffer page flag + +driver inclusion +category: bugfix +bugzilla: https://gitee.com/openeuler/kernel/issues/I98HIN + +-------------------------------------------------------------------------- + +Due to the lack of this flag, this feature cannot actually take effect. + +Fixes: bf57963e729c ("libhns: Support flexible WQE buffer page size") +Signed-off-by: Chengchang Tang +--- + providers/hns/hns_roce_u.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c +index 7a3d1a2..c4a3ba5 100644 +--- a/providers/hns/hns_roce_u.c ++++ b/providers/hns/hns_roce_u.c +@@ -342,7 +342,7 @@ static void ucontext_set_cmd(struct hns_roce_alloc_ucontext *cmd, + struct hnsdv_context_attr *attr) + { + cmd->config |= HNS_ROCE_EXSGE_FLAGS | HNS_ROCE_RQ_INLINE_FLAGS | +- HNS_ROCE_CQE_INLINE_FLAGS; ++ HNS_ROCE_CQE_INLINE_FLAGS | HNS_ROCE_UCTX_DYN_QP_PGSZ; + + if (!attr || !(attr->flags & HNSDV_CONTEXT_FLAGS_DCA)) + return; +-- +2.33.0 + diff --git a/0029-libhns-Fix-ext_sge-page-size.patch b/0029-libhns-Fix-ext_sge-page-size.patch new file mode 100644 index 0000000..3ae1da3 --- /dev/null +++ b/0029-libhns-Fix-ext_sge-page-size.patch @@ -0,0 +1,52 @@ +From 85b6e60f3ec97d2479373111b2a4bceb6ef286cd Mon Sep 17 00:00:00 2001 +From: Chengchang Tang +Date: Fri, 19 Apr 2024 12:06:12 +0800 +Subject: [PATCH] libhns: Fix ext_sge page size + +driver inclusion +category: bugfix +bugzilla: https://gitee.com/openeuler/kernel/issues/I98HIN + +-------------------------------------------------------------------------- + +The buffer for extending SGE must be equal to the WQE buffer page +size. + +Fixes: bf57963e729c ("libhns: Support flexible WQE buffer page size") +Signed-off-by: Chengchang Tang +--- + providers/hns/hns_roce_u_verbs.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c +index 8964d53..a680339 100644 +--- a/providers/hns/hns_roce_u_verbs.c ++++ b/providers/hns/hns_roce_u_verbs.c +@@ -1270,8 +1270,10 @@ static void get_best_multi_region_pg_shift(struct hns_roce_device *hr_dev, + /* + * The larger the pagesize used, the better the performance, but it + * may waste more memory. Therefore, we use the least common multiple +- * (aligned to power of 2) of sq wqe buffer size, rq wqe buffer size, + * and ext_sge buffer size as the pagesize. Additionally, since the ++ * (aligned to power of 2) of sq wqe buffer size and rq wqe buffer ++ * size as the pagesize. And the wqe buffer page cannot be larger ++ * than the buffer size used by extend sge. Additionally, since the + * kernel cannot guarantee the allocation of contiguous memory larger + * than the system page, the pagesize must be smaller than the system + * page. +@@ -1281,8 +1283,10 @@ static void get_best_multi_region_pg_shift(struct hns_roce_device *hr_dev, + rq_size = qp->rq.wqe_cnt << qp->rq.wqe_shift; + + pg_shift = max_t(uint8_t, sq_size ? hr_ilog32(sq_size) : 0, +- ext_sge_size ? hr_ilog32(ext_sge_size) : 0); +- pg_shift = max_t(uint8_t, pg_shift, rq_size ? hr_ilog32(rq_size) : 0); ++ rq_size ? hr_ilog32(rq_size) : 0); ++ pg_shift = ext_sge_size ? ++ min_t(uint8_t, pg_shift, hr_ilog32(ext_sge_size)) : ++ pg_shift; + pg_shift = max_t(uint8_t, pg_shift, HNS_HW_PAGE_SHIFT); + qp->pageshift = min_t(uint8_t, pg_shift, hr_ilog32(hr_dev->page_size)); + } +-- +2.33.0 + diff --git a/rdma-core.spec b/rdma-core.spec index 6b101ba..5ba0596 100644 --- a/rdma-core.spec +++ b/rdma-core.spec @@ -1,6 +1,6 @@ Name: rdma-core Version: 50.0 -Release: 7 +Release: 8 Summary: RDMA core userspace libraries and daemons License: GPLv2 or BSD Url: https://github.com/linux-rdma/rdma-core @@ -33,6 +33,8 @@ patch24: 0024-libhns-Sync-DCA-status-by-shared-memory.patch patch25: 0025-libhns-Add-direct-verbs-support-to-config-DCA.patch patch26: 0026-libhns-Add-RoH-device-IDs.patch patch27: 0027-libhns-Add-the-parsing-of-mac-type-in-RoH-mode.patch +patch28: 0028-libhns-Fix-missing-flexible-WQE-buffer-page-flag.patch +patch29: 0029-libhns-Fix-ext_sge-page-size.patch BuildRequires: binutils cmake >= 2.8.11 gcc libudev-devel pkgconfig pkgconfig(libnl-3.0) BuildRequires: pkgconfig(libnl-route-3.0) valgrind-devel systemd systemd-devel @@ -612,6 +614,12 @@ fi %doc %{_docdir}/%{name}-%{version}/70-persistent-ipoib.rules %changelog +* Mon May 6 2024 Juan Zhou - 50.0-8 +- Type: bugfix +- ID: NA +- SUG: NA +- DESC: Fix flexible WQE buffer page related issues + * Fri Apr 12 2024 Ke Chen - 50.0-7 - Type: requirement - ID: NA -- Gitee