* [PATCH v2 1/2] RDMA/rxe: Fix inaccurate constants in rxe_type_info
@ 2022-12-19 5:46 Daisuke Matsuda
2022-12-19 5:46 ` [PATCH v2 2/2] RDMA/rxe: Prevent faulty rkey generation Daisuke Matsuda
2022-12-20 6:28 ` [PATCH v2 1/2] RDMA/rxe: Fix inaccurate constants in rxe_type_info lizhijian
0 siblings, 2 replies; 4+ messages in thread
From: Daisuke Matsuda @ 2022-12-19 5:46 UTC (permalink / raw)
To: linux-rdma, leonro, jgg, zyjzyj2000
Cc: rpearsonhpe, Rao.Shoaib, lizhijian, Daisuke Matsuda
ibv_query_device() has reported incorrect device attributes, which are
actually not used by the device. Make the constants correspond with the
attributes shown to users.
Fixes: 3ccffe8abf2f ("RDMA/rxe: Move max_elem into rxe_type_info")
Fixes: 3225717f6dfa ("RDMA/rxe: Replace red-black trees by xarrays")
Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
---
drivers/infiniband/sw/rxe/rxe_pool.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
index f50620f5a0a1..1151c0b5ccea 100644
--- a/drivers/infiniband/sw/rxe/rxe_pool.c
+++ b/drivers/infiniband/sw/rxe/rxe_pool.c
@@ -23,16 +23,16 @@ static const struct rxe_type_info {
.size = sizeof(struct rxe_ucontext),
.elem_offset = offsetof(struct rxe_ucontext, elem),
.min_index = 1,
- .max_index = UINT_MAX,
- .max_elem = UINT_MAX,
+ .max_index = RXE_MAX_UCONTEXT,
+ .max_elem = RXE_MAX_UCONTEXT,
},
[RXE_TYPE_PD] = {
.name = "pd",
.size = sizeof(struct rxe_pd),
.elem_offset = offsetof(struct rxe_pd, elem),
.min_index = 1,
- .max_index = UINT_MAX,
- .max_elem = UINT_MAX,
+ .max_index = RXE_MAX_PD,
+ .max_elem = RXE_MAX_PD,
},
[RXE_TYPE_AH] = {
.name = "ah",
@@ -40,7 +40,7 @@ static const struct rxe_type_info {
.elem_offset = offsetof(struct rxe_ah, elem),
.min_index = RXE_MIN_AH_INDEX,
.max_index = RXE_MAX_AH_INDEX,
- .max_elem = RXE_MAX_AH_INDEX - RXE_MIN_AH_INDEX + 1,
+ .max_elem = RXE_MAX_AH,
},
[RXE_TYPE_SRQ] = {
.name = "srq",
@@ -49,7 +49,7 @@ static const struct rxe_type_info {
.cleanup = rxe_srq_cleanup,
.min_index = RXE_MIN_SRQ_INDEX,
.max_index = RXE_MAX_SRQ_INDEX,
- .max_elem = RXE_MAX_SRQ_INDEX - RXE_MIN_SRQ_INDEX + 1,
+ .max_elem = RXE_MAX_SRQ,
},
[RXE_TYPE_QP] = {
.name = "qp",
@@ -58,7 +58,7 @@ static const struct rxe_type_info {
.cleanup = rxe_qp_cleanup,
.min_index = RXE_MIN_QP_INDEX,
.max_index = RXE_MAX_QP_INDEX,
- .max_elem = RXE_MAX_QP_INDEX - RXE_MIN_QP_INDEX + 1,
+ .max_elem = RXE_MAX_QP,
},
[RXE_TYPE_CQ] = {
.name = "cq",
@@ -66,8 +66,8 @@ static const struct rxe_type_info {
.elem_offset = offsetof(struct rxe_cq, elem),
.cleanup = rxe_cq_cleanup,
.min_index = 1,
- .max_index = UINT_MAX,
- .max_elem = UINT_MAX,
+ .max_index = RXE_MAX_CQ,
+ .max_elem = RXE_MAX_CQ,
},
[RXE_TYPE_MR] = {
.name = "mr",
@@ -76,7 +76,7 @@ static const struct rxe_type_info {
.cleanup = rxe_mr_cleanup,
.min_index = RXE_MIN_MR_INDEX,
.max_index = RXE_MAX_MR_INDEX,
- .max_elem = RXE_MAX_MR_INDEX - RXE_MIN_MR_INDEX + 1,
+ .max_elem = RXE_MAX_MR,
},
[RXE_TYPE_MW] = {
.name = "mw",
@@ -85,7 +85,7 @@ static const struct rxe_type_info {
.cleanup = rxe_mw_cleanup,
.min_index = RXE_MIN_MW_INDEX,
.max_index = RXE_MAX_MW_INDEX,
- .max_elem = RXE_MAX_MW_INDEX - RXE_MIN_MW_INDEX + 1,
+ .max_elem = RXE_MAX_MW,
},
};
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] RDMA/rxe: Prevent faulty rkey generation
2022-12-19 5:46 [PATCH v2 1/2] RDMA/rxe: Fix inaccurate constants in rxe_type_info Daisuke Matsuda
@ 2022-12-19 5:46 ` Daisuke Matsuda
2022-12-20 6:27 ` lizhijian
2022-12-20 6:28 ` [PATCH v2 1/2] RDMA/rxe: Fix inaccurate constants in rxe_type_info lizhijian
1 sibling, 1 reply; 4+ messages in thread
From: Daisuke Matsuda @ 2022-12-19 5:46 UTC (permalink / raw)
To: linux-rdma, leonro, jgg, zyjzyj2000
Cc: rpearsonhpe, Rao.Shoaib, lizhijian, Daisuke Matsuda
If you create MRs more than 0x10000 times after loading the module,
responder starts to reply NAKs for RDMA/Atomic operations because of rkey
violation detected in check_rkey(). The root cause is that rkeys are
incremented each time a new MR is created and the value overflows into the
range reserved for MWs.
This commit also increases the value of RXE_MAX_MW that has been limited
unlike other parameters.
Fixes: 0994a1bcd5f7 ("RDMA/rxe: Bump up default maximum values used via uverbs")
Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
---
v1->v2:
Fixed the value of RXE_MAX_MR as suggested by Li.
Increased the value of RXE_MAX_MW.
drivers/infiniband/sw/rxe/rxe_param.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h
index a754fc902e3d..9c9b5f0d929b 100644
--- a/drivers/infiniband/sw/rxe/rxe_param.h
+++ b/drivers/infiniband/sw/rxe/rxe_param.h
@@ -98,11 +98,11 @@ enum rxe_device_param {
RXE_MAX_SRQ = DEFAULT_MAX_VALUE - RXE_MIN_SRQ_INDEX,
RXE_MIN_MR_INDEX = 0x00000001,
- RXE_MAX_MR_INDEX = DEFAULT_MAX_VALUE,
- RXE_MAX_MR = DEFAULT_MAX_VALUE - RXE_MIN_MR_INDEX,
- RXE_MIN_MW_INDEX = 0x00010001,
- RXE_MAX_MW_INDEX = 0x00020000,
- RXE_MAX_MW = 0x00001000,
+ RXE_MAX_MR_INDEX = DEFAULT_MAX_VALUE >> 1,
+ RXE_MAX_MR = RXE_MAX_MR_INDEX - RXE_MIN_MR_INDEX,
+ RXE_MIN_MW_INDEX = (DEFAULT_MAX_VALUE >> 1) + 1,
+ RXE_MAX_MW_INDEX = DEFAULT_MAX_VALUE,
+ RXE_MAX_MW = RXE_MAX_MW_INDEX - RXE_MIN_MW_INDEX,
RXE_MAX_PKT_PER_ACK = 64,
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 2/2] RDMA/rxe: Prevent faulty rkey generation
2022-12-19 5:46 ` [PATCH v2 2/2] RDMA/rxe: Prevent faulty rkey generation Daisuke Matsuda
@ 2022-12-20 6:27 ` lizhijian
0 siblings, 0 replies; 4+ messages in thread
From: lizhijian @ 2022-12-20 6:27 UTC (permalink / raw)
To: Daisuke Matsuda (Fujitsu), linux-rdma, leonro, jgg, zyjzyj2000
Cc: rpearsonhpe, Rao.Shoaib
On 19/12/2022 13:46, Daisuke Matsuda wrote:
> If you create MRs more than 0x10000 times after loading the module,
> responder starts to reply NAKs for RDMA/Atomic operations because of rkey
> violation detected in check_rkey(). The root cause is that rkeys are
> incremented each time a new MR is created and the value overflows into the
> range reserved for MWs.
>
> This commit also increases the value of RXE_MAX_MW that has been limited
> unlike other parameters.
>
> Fixes: 0994a1bcd5f7 ("RDMA/rxe: Bump up default maximum values used via uverbs")
> Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
> ---
> v1->v2:
> Fixed the value of RXE_MAX_MR as suggested by Li.
> Increased the value of RXE_MAX_MW.
>
> drivers/infiniband/sw/rxe/rxe_param.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h
> index a754fc902e3d..9c9b5f0d929b 100644
> --- a/drivers/infiniband/sw/rxe/rxe_param.h
> +++ b/drivers/infiniband/sw/rxe/rxe_param.h
> @@ -98,11 +98,11 @@ enum rxe_device_param {
> RXE_MAX_SRQ = DEFAULT_MAX_VALUE - RXE_MIN_SRQ_INDEX,
>
> RXE_MIN_MR_INDEX = 0x00000001,
> - RXE_MAX_MR_INDEX = DEFAULT_MAX_VALUE,
> - RXE_MAX_MR = DEFAULT_MAX_VALUE - RXE_MIN_MR_INDEX,
> - RXE_MIN_MW_INDEX = 0x00010001,
> - RXE_MAX_MW_INDEX = 0x00020000,
> - RXE_MAX_MW = 0x00001000,
> + RXE_MAX_MR_INDEX = DEFAULT_MAX_VALUE >> 1,
> + RXE_MAX_MR = RXE_MAX_MR_INDEX - RXE_MIN_MR_INDEX,
> + RXE_MIN_MW_INDEX = (DEFAULT_MAX_VALUE >> 1) + 1,
Please change to:
RXE_MIN_MW_INDEX = RXE_MAX_MR_INDEX + 1
Otherwise, LGTM
Tested-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
> + RXE_MAX_MW_INDEX = DEFAULT_MAX_VALUE,
> + RXE_MAX_MW = RXE_MAX_MW_INDEX - RXE_MIN_MW_INDEX,
>
> RXE_MAX_PKT_PER_ACK = 64,
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] RDMA/rxe: Fix inaccurate constants in rxe_type_info
2022-12-19 5:46 [PATCH v2 1/2] RDMA/rxe: Fix inaccurate constants in rxe_type_info Daisuke Matsuda
2022-12-19 5:46 ` [PATCH v2 2/2] RDMA/rxe: Prevent faulty rkey generation Daisuke Matsuda
@ 2022-12-20 6:28 ` lizhijian
1 sibling, 0 replies; 4+ messages in thread
From: lizhijian @ 2022-12-20 6:28 UTC (permalink / raw)
To: Daisuke Matsuda (Fujitsu), linux-rdma, leonro, jgg, zyjzyj2000
Cc: rpearsonhpe, Rao.Shoaib
LGTM,
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
Thanks
Zhijian
On 19/12/2022 13:46, Daisuke Matsuda wrote:
> ibv_query_device() has reported incorrect device attributes, which are
> actually not used by the device. Make the constants correspond with the
> attributes shown to users.
>
> Fixes: 3ccffe8abf2f ("RDMA/rxe: Move max_elem into rxe_type_info")
> Fixes: 3225717f6dfa ("RDMA/rxe: Replace red-black trees by xarrays")
> Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
> ---
> drivers/infiniband/sw/rxe/rxe_pool.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
> index f50620f5a0a1..1151c0b5ccea 100644
> --- a/drivers/infiniband/sw/rxe/rxe_pool.c
> +++ b/drivers/infiniband/sw/rxe/rxe_pool.c
> @@ -23,16 +23,16 @@ static const struct rxe_type_info {
> .size = sizeof(struct rxe_ucontext),
> .elem_offset = offsetof(struct rxe_ucontext, elem),
> .min_index = 1,
> - .max_index = UINT_MAX,
> - .max_elem = UINT_MAX,
> + .max_index = RXE_MAX_UCONTEXT,
> + .max_elem = RXE_MAX_UCONTEXT,
> },
> [RXE_TYPE_PD] = {
> .name = "pd",
> .size = sizeof(struct rxe_pd),
> .elem_offset = offsetof(struct rxe_pd, elem),
> .min_index = 1,
> - .max_index = UINT_MAX,
> - .max_elem = UINT_MAX,
> + .max_index = RXE_MAX_PD,
> + .max_elem = RXE_MAX_PD,
> },
> [RXE_TYPE_AH] = {
> .name = "ah",
> @@ -40,7 +40,7 @@ static const struct rxe_type_info {
> .elem_offset = offsetof(struct rxe_ah, elem),
> .min_index = RXE_MIN_AH_INDEX,
> .max_index = RXE_MAX_AH_INDEX,
> - .max_elem = RXE_MAX_AH_INDEX - RXE_MIN_AH_INDEX + 1,
> + .max_elem = RXE_MAX_AH,
> },
> [RXE_TYPE_SRQ] = {
> .name = "srq",
> @@ -49,7 +49,7 @@ static const struct rxe_type_info {
> .cleanup = rxe_srq_cleanup,
> .min_index = RXE_MIN_SRQ_INDEX,
> .max_index = RXE_MAX_SRQ_INDEX,
> - .max_elem = RXE_MAX_SRQ_INDEX - RXE_MIN_SRQ_INDEX + 1,
> + .max_elem = RXE_MAX_SRQ,
> },
> [RXE_TYPE_QP] = {
> .name = "qp",
> @@ -58,7 +58,7 @@ static const struct rxe_type_info {
> .cleanup = rxe_qp_cleanup,
> .min_index = RXE_MIN_QP_INDEX,
> .max_index = RXE_MAX_QP_INDEX,
> - .max_elem = RXE_MAX_QP_INDEX - RXE_MIN_QP_INDEX + 1,
> + .max_elem = RXE_MAX_QP,
> },
> [RXE_TYPE_CQ] = {
> .name = "cq",
> @@ -66,8 +66,8 @@ static const struct rxe_type_info {
> .elem_offset = offsetof(struct rxe_cq, elem),
> .cleanup = rxe_cq_cleanup,
> .min_index = 1,
> - .max_index = UINT_MAX,
> - .max_elem = UINT_MAX,
> + .max_index = RXE_MAX_CQ,
> + .max_elem = RXE_MAX_CQ,
> },
> [RXE_TYPE_MR] = {
> .name = "mr",
> @@ -76,7 +76,7 @@ static const struct rxe_type_info {
> .cleanup = rxe_mr_cleanup,
> .min_index = RXE_MIN_MR_INDEX,
> .max_index = RXE_MAX_MR_INDEX,
> - .max_elem = RXE_MAX_MR_INDEX - RXE_MIN_MR_INDEX + 1,
> + .max_elem = RXE_MAX_MR,
> },
> [RXE_TYPE_MW] = {
> .name = "mw",
> @@ -85,7 +85,7 @@ static const struct rxe_type_info {
> .cleanup = rxe_mw_cleanup,
> .min_index = RXE_MIN_MW_INDEX,
> .max_index = RXE_MAX_MW_INDEX,
> - .max_elem = RXE_MAX_MW_INDEX - RXE_MIN_MW_INDEX + 1,
> + .max_elem = RXE_MAX_MW,
> },
> };
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-20 6:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 5:46 [PATCH v2 1/2] RDMA/rxe: Fix inaccurate constants in rxe_type_info Daisuke Matsuda
2022-12-19 5:46 ` [PATCH v2 2/2] RDMA/rxe: Prevent faulty rkey generation Daisuke Matsuda
2022-12-20 6:27 ` lizhijian
2022-12-20 6:28 ` [PATCH v2 1/2] RDMA/rxe: Fix inaccurate constants in rxe_type_info lizhijian
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.