Skip to contentSkip to conversation

RDMA/rxe: Complete the rxe_cleanup_task backport

PATCH Applied Vladislav Nikolaev 3 participants 3 messages Jun 3 – Jun 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/rxe: Complete the rxe_cleanup_task backport

No upstream commit exists for this patch.

The issue was introduced with backporting upstream commit b2b1ddc45745 ("RDMA/rxe: Fix the error "trying to register non-static key in rxe_cleanup_task"") to the 6.1 stable tree as commit 3236221bb8e4 ("RDMA/rxe: Fix the error "trying to register non-static key in rxe_cleanup_task"").

The 6.1 backport guarded qp->req.task and qp->comp.task before calling rxe_cleanup_task(), but left qp->resp.task unguarded. It also kept the responder task cleanup before deleting the RC timers, while upstream had already moved it after the timer shutdown by commit 960ebe97e523 ("RDMA/rxe: Remove __rxe_do_task()").

In the 6.1 tree, rxe_qp_from_init() calls rxe_qp_init_req() before rxe_qp_init_resp(). Therefore, if rxe_qp_init_req() fails, cleanup can run before qp->resp.task has been initialized by rxe_init_task(), and the unconditional rxe_cleanup_task(&qp->resp.task) can still hit the same uninitialized task lock problem that upstream commit b2b1ddc45745 fixed.

Move responder task cleanup after deleting the RC timers, matching the upstream cleanup order, and guard it with qp->resp.task.func like the requester and completer tasks.

Fixes 3236221bb8e4 ("RDMA/rxe: Fix the error "trying to register non-static key in rxe_cleanup_task"")
---
 drivers/infiniband/sw/rxe/rxe_qp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_qp.c +3 -1
index 709c63e9773c..171c0f4dcbec 100644
@@ -781,13 +781,15 @@ static void rxe_qp_do_cleanup(struct work_struct *work)
 
 	qp->valid = 0;
 	qp->qp_timeout_jiffies = 0;
-	rxe_cleanup_task(&qp->resp.task);
 
 	if (qp_type(qp) == IB_QPT_RC) {
 		del_timer_sync(&qp->retrans_timer);
 		del_timer_sync(&qp->rnr_nak_timer);
 	}
 
+	if (qp->resp.task.func)
+		rxe_cleanup_task(&qp->resp.task);
+
 	if (qp->req.task.func)
 		rxe_cleanup_task(&qp->req.task);
 
Signature · 1 line
2.39.5
#1 lore raw
Quoted 7 lines · Vladislav Nikolaev

No upstream commit exists for this patch.

The issue was introduced with backporting upstream commit b2b1ddc45745 ("RDMA/rxe: Fix the error "trying to register non-static key in rxe_cleanup_task"") to the 6.1 stable tree as commit 3236221bb8e4 ("RDMA/rxe: Fix the error "trying to register non-static key in rxe_cleanup_task"").

I may be wrong and then the stable kernel maintainers might correct me, but there's been some consensus established in at least recent stable patches workflow that if the backport version of the upstream commit is incorrect or, in this particular case, incomplete - the corresponding patches should be reverted from the affected stable branches and ported properly once again. That would make it easier to follow in future.

See [1] or [2] for reference.

[1]: https://lore.kernel.org/stable/20260402-tavern-keen-2b4fa6b9@mheyne-amazon/T/#u
[2]: https://lore.kernel.org/stable/[email protected]/

P.S: consider porting 1c7eec4d5f3b ("RDMA/rxe: Fix "trying to register non-static key in rxe_qp_do_cleanup" bug") as well to 6.1/6.6 and other relevant stables (if tinkering with this code anyway) ?

Thanks.