Skip to content

Commit 5d46b28

Browse files
Leon Romanovskyjgunthorpe
authored andcommitted
RDMA/core: Stop DIM before destroying CQ
HW destroy operation should be last operation after all possible CQ users completed their work, so move DIM work cancellation before such destroy call. Fixes: da66297 ("RDMA/core: Provide RDMA DIM support for ULPs") Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Max Gurtovoy <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 7fa84b5 commit 5d46b28

File tree

1 file changed

+10
-3
lines changed
  • drivers/infiniband/core

1 file changed

+10
-3
lines changed

drivers/infiniband/core/cq.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ static void rdma_dim_init(struct ib_cq *cq)
7272
INIT_WORK(&dim->work, ib_cq_rdma_dim_work);
7373
}
7474

75+
static void rdma_dim_destroy(struct ib_cq *cq)
76+
{
77+
if (!cq->dim)
78+
return;
79+
80+
cancel_work_sync(&cq->dim->work);
81+
kfree(cq->dim);
82+
}
83+
7584
static int __poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc)
7685
{
7786
int rc;
@@ -331,12 +340,10 @@ void ib_free_cq_user(struct ib_cq *cq, struct ib_udata *udata)
331340
WARN_ON_ONCE(1);
332341
}
333342

343+
rdma_dim_destroy(cq);
334344
trace_cq_free(cq);
335345
rdma_restrack_del(&cq->res);
336346
cq->device->ops.destroy_cq(cq, udata);
337-
if (cq->dim)
338-
cancel_work_sync(&cq->dim->work);
339-
kfree(cq->dim);
340347
kfree(cq->wc);
341348
kfree(cq);
342349
}

0 commit comments

Comments
 (0)