]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
IB/rdmavt: Don't wait for resources in QP reset
authorAlex Estrin <alex.estrin@intel.com>
Mon, 9 Oct 2017 19:38:33 +0000 (12:38 -0700)
committerDoug Ledford <dledford@redhat.com>
Wed, 18 Oct 2017 14:13:00 +0000 (10:13 -0400)
Per the IBTA spec, QP destroy shall fail if the QP is attached
to multicast groups, although the spec is silent on modify_qp
to reset state. It implies that ULP must deregister QP from
all mcast groups for destroy to succeed.
The faulty patch "IB/ipoib: Update broadcast object if PKey value
was changed in index 0" exposed two issues in rdmavt:
1. Rvt QP reset waits for qp references to go to zero.
This will hang if QP is attached to multicast groups.
2. The mcast group detach will fail for a QP in reset state
therefore preventing ULP from correcting the issue.
This patch moves the reference count wait to the the destroy QP
path and allows a QP mcast detach to work in the reset state.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/rdmavt/mcast.c
drivers/infiniband/sw/rdmavt/qp.c

index 1f12b69a0d075c5e20ed78b49b1f50f5948f9fa2..b3a38c5e4cade8ea57b714bbbc79ff161b81a15a 100644 (file)
@@ -351,7 +351,7 @@ int rvt_detach_mcast(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
        int last = 0;
        int ret = 0;
 
-       if (ibqp->qp_num <= 1 || qp->state == IB_QPS_RESET)
+       if (ibqp->qp_num <= 1)
                return -EINVAL;
 
        spin_lock_irq(&ibp->lock);
index 22df09ae809e42553e865a2152539b88bd5d79ae..367c78618019b691cc1a0d9bfb5dab25d60f4197 100644 (file)
@@ -717,7 +717,6 @@ static void rvt_reset_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp,
 
                /* take qp out the hash and wait for it to be unused */
                rvt_remove_qp(rdi, qp);
-               wait_event(qp->wait, !atomic_read(&qp->refcount));
 
                /* grab the lock b/c it was locked at call time */
                spin_lock_irq(&qp->r_lock);
@@ -1443,6 +1442,7 @@ int rvt_destroy_qp(struct ib_qp *ibqp)
        spin_unlock(&qp->s_hlock);
        spin_unlock_irq(&qp->r_lock);
 
+       wait_event(qp->wait, !atomic_read(&qp->refcount));
        /* qpn is now available for use again */
        rvt_free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num);