The last commit was found when I created a XRC SRQ in lock-free mode but failed to destroy it because of the refcnt check added in the previous commit. The failure was because the PAD was acquired through ibv_srq->pd in destroy_srq(), while ibv_srq->pd wasn't assigned when the SRQ was created by ibv_create_srq_ex(). So let's assign ibv_srq->pd in the common ibv_icmd_create_srq() , so that drivers can get the correct pd no matter which api the SRQ is created by. Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com> (cherry picked from commit 3ac30fc125c7cff122f21ff8593294060c92429f)
60 lines
1.9 KiB
Diff
60 lines
1.9 KiB
Diff
From 40c7b406829bc1250d93af527d70836e02c1fbac Mon Sep 17 00:00:00 2001
|
|
From: Junxian Huang <huangjunxian6@hisilicon.com>
|
|
Date: Thu, 24 Apr 2025 20:32:12 +0800
|
|
Subject: [PATCH 58/62] libhns: Add debug log for lock-free mode
|
|
|
|
mainline inclusion
|
|
from mainline-v56.0-65
|
|
commit fb96940fcf6f96185d407d57bcaf775ccf8f1762
|
|
category: cheanup
|
|
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IC3X57
|
|
CVE: NA
|
|
|
|
Reference:
|
|
https://github.com/linux-rdma/rdma-core/pull/1599/commits/fb96940fcf6f96185d...
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
Currently there is no way to observe whether the lock-free mode is
|
|
configured from the driver's perspective. Add debug log for this.
|
|
|
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
|
Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
|
|
---
|
|
providers/hns/hns_roce_u_verbs.c | 7 ++++++-
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
|
|
index 5fe169e..3efc2f4 100644
|
|
--- a/providers/hns/hns_roce_u_verbs.c
|
|
+++ b/providers/hns/hns_roce_u_verbs.c
|
|
@@ -182,6 +182,7 @@ err:
|
|
struct ibv_pd *hns_roce_u_alloc_pad(struct ibv_context *context,
|
|
struct ibv_parent_domain_init_attr *attr)
|
|
{
|
|
+ struct hns_roce_pd *protection_domain;
|
|
struct hns_roce_pad *pad;
|
|
|
|
if (ibv_check_alloc_parent_domain(attr))
|
|
@@ -198,12 +199,16 @@ struct ibv_pd *hns_roce_u_alloc_pad(struct ibv_context *context,
|
|
return NULL;
|
|
}
|
|
|
|
+ protection_domain = to_hr_pd(attr->pd);
|
|
if (attr->td) {
|
|
pad->td = to_hr_td(attr->td);
|
|
atomic_fetch_add(&pad->td->refcount, 1);
|
|
+ verbs_debug(verbs_get_ctx(context),
|
|
+ "set PAD(0x%x) to lock-free mode.\n",
|
|
+ protection_domain->pdn);
|
|
}
|
|
|
|
- pad->pd.protection_domain = to_hr_pd(attr->pd);
|
|
+ pad->pd.protection_domain = protection_domain;
|
|
atomic_fetch_add(&pad->pd.protection_domain->refcount, 1);
|
|
|
|
atomic_init(&pad->pd.refcount, 1);
|
|
--
|
|
2.25.1
|
|
|