On Mon, Sep 8, 2025 at 4:25 PM Leon Romanovsky <leon@xxxxxxxxxx> wrote: > > On Fri, Aug 22, 2025 at 10:19:41AM +0200, Philipp Reisner wrote: > > Allow the comp_handler callback implementation to call ib_poll_cq(). > > A call to ib_poll_cq() calls rxe_poll_cq() with the rdma_rxe driver. > > And rxe_poll_cq() locks cq->cq_lock. That leads to a spinlock deadlock. > > Can you please be more specific about the deadlock? > Please write call stack to describe it. > Instead of a call stack, I write it from top to bottom: The line numbers in the .c files are valid for Linux-6.16: 1 rxe_cq_post() [rxe_cq.c:85] 2 spin_lock_irqsave() [rxe_cq.c:93] 3 cq->ibcq.comp_handler() [rxe_cq.c:116] 4 some_comp_handler() 5 ib_poll_cq() 6 cq->device->ops.poll_cq() [ib_verbs.h:4037] 7 rxe_poll_cq() [rxe_verbs.c:1165] 8 spin_lock_irqsave() [rxe_verbs.c:1172] In line 8 of this call graph, it deadlocks because the spinlock was already acquired in line 2 of the call graph. This patch changes that call graph to: (Line numbers now valid with the patch in discussion applied) 1 rxe_cq_post() [rxe_cq.c:85] 2 spin_lock_irqsave() [rxe_cq.c:93] 3 spin_unlock_irqrestore() [rxe_cq.c:120] 4 cq->ibcq.comp_handler() [rxe_cq.c:123] 5 some_comp_handler() 6 ib_poll_cq() 7 cq->device->ops.poll_cq() [ib_verbs.h:4037] 8 rxe_poll_cq() [rxe_verbs.c:1165] 9 spin_lock_irqsave() [rxe_verbs.c:1172] With the patch, there is no deadlock in line 9 of the call graph, as the spinlock was released in line 3. I hope that helps. [...]