* [PATCH V3 1/3] RDMA/siw: Balance the reference of cep->kref in the error path
2023-08-21 13:32 [PATCH V3 0/3] Misc changes for siw Guoqing Jiang
@ 2023-08-21 13:32 ` Guoqing Jiang
2023-08-21 13:32 ` [PATCH V3 2/3] RDMA/siw: Correct wrong debug message Guoqing Jiang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Guoqing Jiang @ 2023-08-21 13:32 UTC (permalink / raw)
To: bmt, jgg, leon; +Cc: linux-rdma
The siw_connect can go to err in below after cep is allocated successfully:
1. If siw_cm_alloc_work returns failure. In this case socket is not
assoicated with cep so siw_cep_put can't be called by siw_socket_disassoc.
We need to call siw_cep_put twice since cep->kref is increased once after
it was initialized.
2. If siw_cm_queue_work can't find a work, which means siw_cep_get is not
called in siw_cm_queue_work, so cep->kref is increased twice by siw_cep_get
and when associate socket with cep after it was initialized. So we need to
call siw_cep_put three times (one in siw_socket_disassoc).
3. siw_send_mpareqrep returns error, this scenario is similar as 2.
So we need to remove one siw_cep_put in the error path.
Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
---
drivers/infiniband/sw/siw/siw_cm.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index da530c0404da..a2605178f4ed 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -1501,7 +1501,6 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params)
cep->cm_id = NULL;
id->rem_ref(id);
- siw_cep_put(cep);
qp->cep = NULL;
siw_cep_put(cep);
--
2.35.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH V3 2/3] RDMA/siw: Correct wrong debug message
2023-08-21 13:32 [PATCH V3 0/3] Misc changes for siw Guoqing Jiang
2023-08-21 13:32 ` [PATCH V3 1/3] RDMA/siw: Balance the reference of cep->kref in the error path Guoqing Jiang
@ 2023-08-21 13:32 ` Guoqing Jiang
2023-08-21 13:32 ` [PATCH V3 3/3] RDMA/siw: Call llist_reverse_order in siw_run_sq Guoqing Jiang
2023-08-22 14:05 ` [PATCH V3 0/3] Misc changes for siw Leon Romanovsky
3 siblings, 0 replies; 5+ messages in thread
From: Guoqing Jiang @ 2023-08-21 13:32 UTC (permalink / raw)
To: bmt, jgg, leon; +Cc: linux-rdma
We need to print num_sle first then pbl->max_buf per the condition.
Also replace mem->pbl with pbl while at it.
Fixes: 303ae1cdfdf7 ("rdma/siw: application interface")
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
---
drivers/infiniband/sw/siw/siw_verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index fadfa70853f3..fdbef3254e30 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -1494,7 +1494,7 @@ int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle,
if (pbl->max_buf < num_sle) {
siw_dbg_mem(mem, "too many SGE's: %d > %d\n",
- mem->pbl->max_buf, num_sle);
+ num_sle, pbl->max_buf);
return -ENOMEM;
}
for_each_sg(sl, slp, num_sle, i) {
--
2.35.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH V3 3/3] RDMA/siw: Call llist_reverse_order in siw_run_sq
2023-08-21 13:32 [PATCH V3 0/3] Misc changes for siw Guoqing Jiang
2023-08-21 13:32 ` [PATCH V3 1/3] RDMA/siw: Balance the reference of cep->kref in the error path Guoqing Jiang
2023-08-21 13:32 ` [PATCH V3 2/3] RDMA/siw: Correct wrong debug message Guoqing Jiang
@ 2023-08-21 13:32 ` Guoqing Jiang
2023-08-22 14:05 ` [PATCH V3 0/3] Misc changes for siw Leon Romanovsky
3 siblings, 0 replies; 5+ messages in thread
From: Guoqing Jiang @ 2023-08-21 13:32 UTC (permalink / raw)
To: bmt, jgg, leon; +Cc: linux-rdma
We can call the function to get fifo list.
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
---
drivers/infiniband/sw/siw/siw_qp_tx.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c
index 3ff339eceec3..60b6a4135961 100644
--- a/drivers/infiniband/sw/siw/siw_qp_tx.c
+++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
@@ -1271,13 +1271,7 @@ int siw_run_sq(void *data)
* llist_del_all returns a list with newest entry first.
* Re-order list for fairness among QP's.
*/
- while (active) {
- struct llist_node *tmp = active;
-
- active = llist_next(active);
- tmp->next = fifo_list;
- fifo_list = tmp;
- }
+ fifo_list = llist_reverse_order(active);
while (fifo_list) {
qp = container_of(fifo_list, struct siw_qp, tx_list);
fifo_list = llist_next(fifo_list);
--
2.35.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH V3 0/3] Misc changes for siw
2023-08-21 13:32 [PATCH V3 0/3] Misc changes for siw Guoqing Jiang
` (2 preceding siblings ...)
2023-08-21 13:32 ` [PATCH V3 3/3] RDMA/siw: Call llist_reverse_order in siw_run_sq Guoqing Jiang
@ 2023-08-22 14:05 ` Leon Romanovsky
3 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2023-08-22 14:05 UTC (permalink / raw)
To: bmt, jgg, Guoqing Jiang; +Cc: linux-rdma
On Mon, 21 Aug 2023 21:32:52 +0800, Guoqing Jiang wrote:
> V3 changes:
> 1. collect tags from Bernard, thanks!
> 2. add comment back to the last patch.
>
> V2 changes:
> 1. add Fixes lines for the first two patches per Leon
>
> [...]
Applied, thanks!
[1/3] RDMA/siw: Balance the reference of cep->kref in the error path
https://git.kernel.org/rdma/rdma/c/b056327bee09e6
[2/3] RDMA/siw: Correct wrong debug message
https://git.kernel.org/rdma/rdma/c/bee024d20451e4
[3/3] RDMA/siw: Call llist_reverse_order in siw_run_sq
https://git.kernel.org/rdma/rdma/c/9dfccb6d0d3d13
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread