summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/sw/rxe/rxe_mcast.c
diff options
context:
space:
mode:
authorBob Pearson <rpearsonhpe@gmail.com>2022-02-15 13:44:49 -0600
committerJason Gunthorpe <jgg@nvidia.com>2022-02-16 11:51:28 -0400
commita099b08599e6ae6b8e9faccee83760dab622c11e (patch)
tree7eb8cfe2ef11fc51cb2fe174422c8a6be06ac34d /drivers/infiniband/sw/rxe/rxe_mcast.c
parent3c8bc3954d771fc4889508ad5d16f084adc4d64d (diff)
downloadlinux-a099b08599e6ae6b8e9faccee83760dab622c11e.tar.bz2
RDMA/rxe: Revert changes from irqsave to bh locks
A previous patch replaced all irqsave locks in rxe with bh locks. This ran into problems because rdmacm has a bad habit of calling rdma verbs APIs while disabling irqs. This is not allowed during spin_unlock_bh() causing programs that use rdmacm to fail. This patch reverts the changes to locks that had this problem or got dragged into the same mess. After this patch blktests/check -q srp now runs correctly. Link: https://lore.kernel.org/r/20220215194448.44369-1-rpearsonhpe@gmail.com Fixes: 21adfa7a3c4e ("RDMA/rxe: Replace irqsave locks with bh locks") Reported-by: Guoqing Jiang <guoqing.jiang@linux.dev> Reported-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> Tested-by: Bart Van Assche <bvanassche@acm.org> Acked-by: Zhu Yanjun <zyjzyj2000@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/sw/rxe/rxe_mcast.c')
-rw-r--r--drivers/infiniband/sw/rxe/rxe_mcast.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_mcast.c b/drivers/infiniband/sw/rxe/rxe_mcast.c
index 9336295c4ee2..2878a56d9994 100644
--- a/drivers/infiniband/sw/rxe/rxe_mcast.c
+++ b/drivers/infiniband/sw/rxe/rxe_mcast.c
@@ -58,11 +58,12 @@ static int rxe_mcast_get_grp(struct rxe_dev *rxe, union ib_gid *mgid,
int err;
struct rxe_mcg *grp;
struct rxe_pool *pool = &rxe->mc_grp_pool;
+ unsigned long flags;
if (rxe->attr.max_mcast_qp_attach == 0)
return -EINVAL;
- write_lock_bh(&pool->pool_lock);
+ write_lock_irqsave(&pool->pool_lock, flags);
grp = rxe_pool_get_key_locked(pool, mgid);
if (grp)
@@ -70,13 +71,13 @@ static int rxe_mcast_get_grp(struct rxe_dev *rxe, union ib_gid *mgid,
grp = create_grp(rxe, pool, mgid);
if (IS_ERR(grp)) {
- write_unlock_bh(&pool->pool_lock);
+ write_unlock_irqrestore(&pool->pool_lock, flags);
err = PTR_ERR(grp);
return err;
}
done:
- write_unlock_bh(&pool->pool_lock);
+ write_unlock_irqrestore(&pool->pool_lock, flags);
*grp_p = grp;
return 0;
}
@@ -86,9 +87,10 @@ static int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
{
int err;
struct rxe_mca *elem;
+ unsigned long flags;
/* check to see of the qp is already a member of the group */
- spin_lock_bh(&grp->mcg_lock);
+ spin_lock_irqsave(&grp->mcg_lock, flags);
list_for_each_entry(elem, &grp->qp_list, qp_list) {
if (elem->qp == qp) {
err = 0;
@@ -118,7 +120,7 @@ static int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
err = 0;
out:
- spin_unlock_bh(&grp->mcg_lock);
+ spin_unlock_irqrestore(&grp->mcg_lock, flags);
return err;
}
@@ -127,12 +129,13 @@ static int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
{
struct rxe_mcg *grp;
struct rxe_mca *elem, *tmp;
+ unsigned long flags;
grp = rxe_pool_get_key(&rxe->mc_grp_pool, mgid);
if (!grp)
goto err1;
- spin_lock_bh(&grp->mcg_lock);
+ spin_lock_irqsave(&grp->mcg_lock, flags);
list_for_each_entry_safe(elem, tmp, &grp->qp_list, qp_list) {
if (elem->qp == qp) {
@@ -140,7 +143,7 @@ static int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
grp->num_qp--;
atomic_dec(&qp->mcg_num);
- spin_unlock_bh(&grp->mcg_lock);
+ spin_unlock_irqrestore(&grp->mcg_lock, flags);
rxe_drop_ref(elem);
rxe_drop_ref(grp); /* ref held by QP */
rxe_drop_ref(grp); /* ref from get_key */
@@ -148,7 +151,7 @@ static int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
}
}
- spin_unlock_bh(&grp->mcg_lock);
+ spin_unlock_irqrestore(&grp->mcg_lock, flags);
rxe_drop_ref(grp); /* ref from get_key */
err1:
return -EINVAL;