Perftest: Fix failure in creating cq when create cq ex is not
The previous TD lock-free patch introduced ibv_create_cq_ex() to
perftest, but it breaks the provider devices which do not support
this API yet. For these devices calling this API leads to an errno
of EOPNOTSUPP. So add a check of errno, and if it is EOPNOTSUPP,
use ibv_create_cq() as a fallback.
Fixes: b6f957f ("Perftest: Add support for TD lock-free mode")
(cherry picked from commit c6e2261f2d5be0856a7e2be14ae794a0ef8649df)
This commit is contained in:
parent
d43ced9ba0
commit
9a7735ee77
@ -27,7 +27,7 @@ index 54fc2cc..d976663 100755
|
|||||||
@@ -298,6 +298,20 @@ if [test $HAVE_HNSDV = yes]; then
|
@@ -298,6 +298,20 @@ if [test $HAVE_HNSDV = yes]; then
|
||||||
AC_SUBST([LIBHNS])
|
AC_SUBST([LIBHNS])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
+AC_TRY_LINK([#include <infiniband/verbs.h>],
|
+AC_TRY_LINK([#include <infiniband/verbs.h>],
|
||||||
+ [ibv_cq_ex_to_cq], [HAVE_CQ_EX=yes], [HAVE_CQ_EX=no])
|
+ [ibv_cq_ex_to_cq], [HAVE_CQ_EX=yes], [HAVE_CQ_EX=no])
|
||||||
+AM_CONDITIONAL([HAVE_CQ_EX], [test "x$HAVE_CQ_EX" = "xyes"])
|
+AM_CONDITIONAL([HAVE_CQ_EX], [test "x$HAVE_CQ_EX" = "xyes"])
|
||||||
@ -52,7 +52,7 @@ index 16af503..4c6ba4f 100755
|
|||||||
@@ -464,6 +464,11 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
|
@@ -464,6 +464,11 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
|
||||||
printf(" Use a Shared Receive Queue. --rx-depth controls max-wr size of the SRQ \n");
|
printf(" Use a Shared Receive Queue. --rx-depth controls max-wr size of the SRQ \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
+ #ifdef HAVE_TD_API
|
+ #ifdef HAVE_TD_API
|
||||||
+ printf(" --no_lock ");
|
+ printf(" --no_lock ");
|
||||||
+ printf(" No lock in IO, including post send, post recv, post srq recv and poll cq \n");
|
+ printf(" No lock in IO, including post send, post recv, post srq recv and poll cq \n");
|
||||||
@ -68,7 +68,7 @@ index 16af503..4c6ba4f 100755
|
|||||||
+ #ifdef HAVE_TD_API
|
+ #ifdef HAVE_TD_API
|
||||||
+ static int no_lock_flag = 0;
|
+ static int no_lock_flag = 0;
|
||||||
+ #endif
|
+ #endif
|
||||||
|
|
||||||
char *server_ip = NULL;
|
char *server_ip = NULL;
|
||||||
char *client_ip = NULL;
|
char *client_ip = NULL;
|
||||||
@@ -2300,6 +2308,9 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
|
@@ -2300,6 +2308,9 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
|
||||||
@ -77,14 +77,14 @@ index 16af503..4c6ba4f 100755
|
|||||||
{ .name = "use-srq", .has_arg = 0, .flag = &srq_flag, .val = 1},
|
{ .name = "use-srq", .has_arg = 0, .flag = &srq_flag, .val = 1},
|
||||||
+ #ifdef HAVE_TD_API
|
+ #ifdef HAVE_TD_API
|
||||||
+ { .name = "no_lock", .has_arg = 0, .flag = &no_lock_flag, .val = 1},
|
+ { .name = "no_lock", .has_arg = 0, .flag = &no_lock_flag, .val = 1},
|
||||||
+ #endif
|
+ #endif
|
||||||
{ .name = "report-both", .has_arg = 0, .flag = &report_both_flag, .val = 1},
|
{ .name = "report-both", .has_arg = 0, .flag = &report_both_flag, .val = 1},
|
||||||
{ .name = "reversed", .has_arg = 0, .flag = &is_reversed_flag, .val = 1},
|
{ .name = "reversed", .has_arg = 0, .flag = &is_reversed_flag, .val = 1},
|
||||||
{ .name = "pkey_index", .has_arg = 1, .flag = &pkey_flag, .val = 1},
|
{ .name = "pkey_index", .has_arg = 1, .flag = &pkey_flag, .val = 1},
|
||||||
@@ -2944,6 +2955,12 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
|
@@ -2944,6 +2955,12 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
|
||||||
user_param->use_srq = 1;
|
user_param->use_srq = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ #ifdef HAVE_TD_API
|
+ #ifdef HAVE_TD_API
|
||||||
+ if (no_lock_flag) {
|
+ if (no_lock_flag) {
|
||||||
+ user_param->no_lock = 1;
|
+ user_param->no_lock = 1;
|
||||||
@ -140,7 +140,7 @@ index 451f11d..0e2b9a3 100755
|
|||||||
@@ -1360,6 +1360,20 @@ int destroy_ctx(struct pingpong_context *ctx,
|
@@ -1360,6 +1360,20 @@ int destroy_ctx(struct pingpong_context *ctx,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
+ #ifdef HAVE_TD_API
|
+ #ifdef HAVE_TD_API
|
||||||
+ if (user_param->no_lock) {
|
+ if (user_param->no_lock) {
|
||||||
+ if (ibv_dealloc_pd(ctx->pad)) {
|
+ if (ibv_dealloc_pd(ctx->pad)) {
|
||||||
@ -208,11 +208,11 @@ index 451f11d..0e2b9a3 100755
|
|||||||
if (!ctx->send_cq) {
|
if (!ctx->send_cq) {
|
||||||
@@ -1519,6 +1574,7 @@ int create_reg_cqs(struct pingpong_context *ctx,
|
@@ -1519,6 +1574,7 @@ int create_reg_cqs(struct pingpong_context *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
+#endif
|
+#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1906,6 +1962,31 @@ int ctx_init(struct pingpong_context *ctx, struct perftest_parameters *user_para
|
@@ -1906,6 +1962,31 @@ int ctx_init(struct pingpong_context *ctx, struct perftest_parameters *user_para
|
||||||
fprintf(stderr, "Couldn't allocate PD\n");
|
fprintf(stderr, "Couldn't allocate PD\n");
|
||||||
@ -261,6 +261,6 @@ index cf0502c..ba8630b 100755
|
|||||||
struct ibv_mr **mr;
|
struct ibv_mr **mr;
|
||||||
struct ibv_cq *send_cq;
|
struct ibv_cq *send_cq;
|
||||||
struct ibv_cq *recv_cq;
|
struct ibv_cq *recv_cq;
|
||||||
--
|
--
|
||||||
2.25.1
|
2.25.1
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
From f8f97b189e9af6cff8559b10c749ff289219b754 Mon Sep 17 00:00:00 2001
|
From f8f97b189e9af6cff8559b10c749ff289219b754 Mon Sep 17 00:00:00 2001
|
||||||
From: Xinghai Cen <cenxinghai@h-partners.com>
|
From: Xinghai Cen <cenxinghai@h-partners.com>
|
||||||
Date: Wed, 21 Aug 2024 20:06:50 +0800
|
Date: Wed, 21 Aug 2024 20:06:50 +0800
|
||||||
Subject: [PATCH] Perftest: Fix TD lock-free mode not working for QP When
|
Subject: [PATCH] Perftest: Fix TD lock-free mode not working for QP
|
||||||
creating QP in TD lock-free mode, set attr_ex.pd with ctx->pad instead of
|
|
||||||
ctx->pd, otherwise the lock-free won't work.
|
Fix TD lock-free mode not working for QP When
|
||||||
|
creating QP in TD lock-free mode, set attr_ex.pd with ctx->pad instead of
|
||||||
|
ctx->pd, otherwise the lock-free won't work.
|
||||||
|
|
||||||
Fixes: "Perftest: Add support for TD lock-free mode"
|
Fixes: "Perftest: Add support for TD lock-free mode"
|
||||||
Signed-off-by: Guofeng Yue <yueguofeng@h-partners.com>
|
Signed-off-by: Guofeng Yue <yueguofeng@h-partners.com>
|
||||||
|
|||||||
@ -0,0 +1,64 @@
|
|||||||
|
From 3ea6ea2490eb19e5951201804ab9df525338c799 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ge Hu <huge4@huawei.com>
|
||||||
|
Date: Mon, 2 Sep 2024 19:43:09 +0800
|
||||||
|
Subject: [PATCH] Perftest: Fix failure in creating cq when create cq ex is not
|
||||||
|
supported by providers
|
||||||
|
|
||||||
|
The previous TD lock-free patch introduced ibv_create_cq_ex() to
|
||||||
|
perftest, but it breaks the provider devices which do not support
|
||||||
|
this API yet. For these devices calling this API leads to an errno
|
||||||
|
of EOPNOTSUPP. So add a check of errno, and if it is EOPNOTSUPP,
|
||||||
|
use ibv_create_cq() as a fallback.
|
||||||
|
|
||||||
|
Fixes: b6f957f6bc6c ("Perftest: Add support for TD lock-free mode")
|
||||||
|
Tested-By: Selvin Xavier <selvin.xavier@broadcom.com>
|
||||||
|
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
|
||||||
|
Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
|
||||||
|
---
|
||||||
|
src/perftest_resources.c | 9 ++++++---
|
||||||
|
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/perftest_resources.c b/src/perftest_resources.c
|
||||||
|
index 58dbdef..843c45f 100755
|
||||||
|
--- a/src/perftest_resources.c
|
||||||
|
+++ b/src/perftest_resources.c
|
||||||
|
@@ -1516,7 +1516,7 @@ int create_reg_cqs(struct pingpong_context *ctx,
|
||||||
|
struct perftest_parameters *user_param,
|
||||||
|
int tx_buffer_depth, int need_recv_cq)
|
||||||
|
{
|
||||||
|
- #ifdef HAVE_CQ_EX
|
||||||
|
+#ifdef HAVE_CQ_EX
|
||||||
|
struct ibv_cq_init_attr_ex send_cq_attr = {
|
||||||
|
.cqe = tx_buffer_depth * user_param->num_of_qps,
|
||||||
|
.cq_context = NULL,
|
||||||
|
@@ -1532,6 +1532,8 @@ int create_reg_cqs(struct pingpong_context *ctx,
|
||||||
|
#endif
|
||||||
|
ctx->send_cq = ibv_cq_ex_to_cq(ibv_create_cq_ex(ctx->context, &send_cq_attr));
|
||||||
|
if (!ctx->send_cq) {
|
||||||
|
+ if (!user_param->no_lock && errno == EOPNOTSUPP)
|
||||||
|
+ goto cq_ex_not_supported;
|
||||||
|
fprintf(stderr, "Couldn't create CQ\n");
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
@@ -1556,7 +1558,9 @@ int create_reg_cqs(struct pingpong_context *ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SUCCESS;
|
||||||
|
-#else
|
||||||
|
+
|
||||||
|
+cq_ex_not_supported:
|
||||||
|
+#endif
|
||||||
|
ctx->send_cq = ibv_create_cq(ctx->context,tx_buffer_depth *
|
||||||
|
user_param->num_of_qps, NULL, ctx->channel, user_param->eq_num);
|
||||||
|
if (!ctx->send_cq) {
|
||||||
|
@@ -1574,7 +1578,6 @@ int create_reg_cqs(struct pingpong_context *ctx,
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
-#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: perftest
|
Name: perftest
|
||||||
Version: 4.5
|
Version: 4.5
|
||||||
Release: 10
|
Release: 11
|
||||||
License: GPLv2 or BSD
|
License: GPLv2 or BSD
|
||||||
Summary: RDMA Performance Testing Tools
|
Summary: RDMA Performance Testing Tools
|
||||||
Url: https://github.com/linux-rdma/perftest
|
Url: https://github.com/linux-rdma/perftest
|
||||||
@ -19,6 +19,7 @@ Patch10: 0010-Perftest-Support-selecting-congestion-control-algori.patch
|
|||||||
Patch11: 0011-Perftest-Fix-rx_depth-check-for-XRC.patch
|
Patch11: 0011-Perftest-Fix-rx_depth-check-for-XRC.patch
|
||||||
Patch12: 0012-Perftest-Add-support-for-TD-lock-free-mode.patch
|
Patch12: 0012-Perftest-Add-support-for-TD-lock-free-mode.patch
|
||||||
Patch13: 0013-Perftest-Fix-TD-lock-free-mode-not-working-for-QP.patch
|
Patch13: 0013-Perftest-Fix-TD-lock-free-mode-not-working-for-QP.patch
|
||||||
|
Patch14: 0014-Perftest-Fix-failure-in-creating-cq-when-create-cq-e.patch
|
||||||
|
|
||||||
BuildRequires: automake gcc libibverbs-devel >= 1.2.0 librdmacm-devel >= 1.0.21 libibumad-devel >= 1.3.10.2
|
BuildRequires: automake gcc libibverbs-devel >= 1.2.0 librdmacm-devel >= 1.0.21 libibumad-devel >= 1.3.10.2
|
||||||
BuildRequires: pciutils-devel libibverbs librdmacm libibumad
|
BuildRequires: pciutils-devel libibverbs librdmacm libibumad
|
||||||
@ -46,6 +47,12 @@ done
|
|||||||
%_bindir/*
|
%_bindir/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Sep 2 2024 Xinghai Cen <cenxinghai@h-partners.com> - 4.5-11
|
||||||
|
- Type: bugfix
|
||||||
|
- ID: NA
|
||||||
|
- SUG: NA
|
||||||
|
- DESC: Fix failure in creating cq when create cq ex is not
|
||||||
|
|
||||||
* Wed Aug 21 2024 Xinghai Cen <cenxinghai@h-partners.com> - 4.5-10
|
* Wed Aug 21 2024 Xinghai Cen <cenxinghai@h-partners.com> - 4.5-10
|
||||||
- Type: feature
|
- Type: feature
|
||||||
- ID: NA
|
- ID: NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user