Skip to content

Commit eb73060

Browse files
committed
RDMA/cm: Make the local_id_table xarray non-irq
The xarray is never mutated from an IRQ handler, only from work queues under a spinlock_irq. Thus there is no reason for it be an IRQ type xarray. This was copied over from the original IDR code, but the recent rework put the xarray inside another spinlock_irq which will unbalance the unlocking. Fixes: c206f8b ("RDMA/cm: Make it clearer how concurrency works in cm_req_handler()") Link: https://lore.kernel.org/r/0-v1-808b6da3bd3f+1857-cm_xarray_no_irq_jgg@nvidia.com Reported-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent f8394f2 commit eb73060

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • drivers/infiniband/core

drivers/infiniband/core/cm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,8 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device,
859859
atomic_set(&cm_id_priv->work_count, -1);
860860
refcount_set(&cm_id_priv->refcount, 1);
861861

862-
ret = xa_alloc_cyclic_irq(&cm.local_id_table, &id, NULL, xa_limit_32b,
863-
&cm.local_id_next, GFP_KERNEL);
862+
ret = xa_alloc_cyclic(&cm.local_id_table, &id, NULL, xa_limit_32b,
863+
&cm.local_id_next, GFP_KERNEL);
864864
if (ret < 0)
865865
goto error;
866866
cm_id_priv->id.local_id = (__force __be32)id ^ cm.random_id_operand;
@@ -878,8 +878,8 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device,
878878
*/
879879
static void cm_finalize_id(struct cm_id_private *cm_id_priv)
880880
{
881-
xa_store_irq(&cm.local_id_table, cm_local_id(cm_id_priv->id.local_id),
882-
cm_id_priv, GFP_KERNEL);
881+
xa_store(&cm.local_id_table, cm_local_id(cm_id_priv->id.local_id),
882+
cm_id_priv, GFP_ATOMIC);
883883
}
884884

885885
struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
@@ -1169,7 +1169,7 @@ static void cm_destroy_id(struct ib_cm_id *cm_id, int err)
11691169
spin_unlock(&cm.lock);
11701170
spin_unlock_irq(&cm_id_priv->lock);
11711171

1172-
xa_erase_irq(&cm.local_id_table, cm_local_id(cm_id->local_id));
1172+
xa_erase(&cm.local_id_table, cm_local_id(cm_id->local_id));
11731173
cm_deref_id(cm_id_priv);
11741174
wait_for_completion(&cm_id_priv->comp);
11751175
while ((work = cm_dequeue_work(cm_id_priv)) != NULL)
@@ -4482,7 +4482,7 @@ static int __init ib_cm_init(void)
44824482
cm.remote_id_table = RB_ROOT;
44834483
cm.remote_qp_table = RB_ROOT;
44844484
cm.remote_sidr_table = RB_ROOT;
4485-
xa_init_flags(&cm.local_id_table, XA_FLAGS_ALLOC | XA_FLAGS_LOCK_IRQ);
4485+
xa_init_flags(&cm.local_id_table, XA_FLAGS_ALLOC);
44864486
get_random_bytes(&cm.random_id_operand, sizeof cm.random_id_operand);
44874487
INIT_LIST_HEAD(&cm.timewait_list);
44884488

0 commit comments

Comments
 (0)