]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/rxe: Remove qp reference counting in tasks
authorBob Pearson <rpearsonhpe@gmail.com>
Sat, 4 Mar 2023 17:45:31 +0000 (11:45 -0600)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 24 Mar 2023 14:21:36 +0000 (11:21 -0300)
Currently each of the three tasklets requester, completer and responder in
the rxe driver take and release a reference to the qp argument at the
beginning and end of the subroutines. The caller passing in the qp
argument should be responsible for holding a reference to qp so these are
not required. Further doing so breaks the qp cleanup code in
rxe_qp_do_cleanup which calls these routines after all the references have
been dropped so they cannot drain the packet and work request queues as
intended.

In fact if these routines are deferred by calling tasklet_schedule there
is no guarantee that the calling code does have a qp reference.  That is a
bug in rxe_task.c which will be fixed later in this series.

Link: https://lore.kernel.org/r/20230304174533.11296-6-rpearsonhpe@gmail.com
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_comp.c
drivers/infiniband/sw/rxe/rxe_req.c
drivers/infiniband/sw/rxe/rxe_resp.c

index f7ab0dfe10341b4437f13eceb16a98aa0920430e..7aa8e90bdfe47eae5318d0830067793d303554e7 100644 (file)
@@ -619,9 +619,6 @@ int rxe_completer(struct rxe_qp *qp)
        enum comp_state state;
        int ret;
 
-       if (!rxe_get(qp))
-               return -EAGAIN;
-
        if (!qp->valid || qp->comp.state == QP_STATE_ERROR ||
            qp->comp.state == QP_STATE_RESET) {
                bool notify = qp->valid &&
@@ -824,7 +821,5 @@ exit:
 out:
        if (pkt)
                free_pkt(pkt);
-       rxe_put(qp);
-
        return ret;
 }
index f2dc2d191e16f3ef96b84b4d116bdc9cb34622c7..abc65c54bfd6ffd5452e7f75d311f2bf167b8237 100644 (file)
@@ -653,9 +653,6 @@ int rxe_requester(struct rxe_qp *qp)
        struct rxe_ah *ah;
        struct rxe_av *av;
 
-       if (!rxe_get(qp))
-               return -EAGAIN;
-
        if (unlikely(!qp->valid))
                goto exit;
 
@@ -844,7 +841,5 @@ err:
 exit:
        ret = -EAGAIN;
 out:
-       rxe_put(qp);
-
        return ret;
 }
index 2f71183449f96a04e108ba4a4125ee84f18a34be..01e3cbea8445c4c6fac021cc5e42a7f08c929a9e 100644 (file)
@@ -1464,9 +1464,6 @@ int rxe_responder(struct rxe_qp *qp)
        struct rxe_pkt_info *pkt = NULL;
        int ret;
 
-       if (!rxe_get(qp))
-               return -EAGAIN;
-
        if (!qp->valid || qp->resp.state == QP_STATE_ERROR ||
            qp->resp.state == QP_STATE_RESET) {
                bool notify = qp->valid &&
@@ -1658,6 +1655,5 @@ done:
 exit:
        ret = -EAGAIN;
 out:
-       rxe_put(qp);
        return ret;
 }