Skip to content

Commit cc03155

Browse files
mustafakismailjgunthorpe
authored andcommitted
RDMA/irdma: Fix sleep from invalid context BUG
Taking the qos_mutex to process RoCEv2 QP's on netdev events causes a kernel splat. Fix this by removing the handling for RoCEv2 in irdma_cm_teardown_connections that uses the mutex. This handling is only needed for iWARP to avoid having connections established while the link is down or having connections remain functional after the IP address is removed. BUG: sleeping function called from invalid context at kernel/locking/mutex. Call Trace: kernel: dump_stack+0x66/0x90 kernel: ___might_sleep.cold.92+0x8d/0x9a kernel: mutex_lock+0x1c/0x40 kernel: irdma_cm_teardown_connections+0x28e/0x4d0 [irdma] kernel: ? check_preempt_curr+0x7a/0x90 kernel: ? select_idle_sibling+0x22/0x3c0 kernel: ? select_task_rq_fair+0x94c/0xc90 kernel: ? irdma_exec_cqp_cmd+0xc27/0x17c0 [irdma] kernel: ? __wake_up_common+0x7a/0x190 kernel: irdma_if_notify+0x3cc/0x450 [irdma] kernel: ? sched_clock_cpu+0xc/0xb0 kernel: irdma_inet6addr_event+0xc6/0x150 [irdma] Fixes: 146b975 ("RDMA/irdma: Add connection manager") Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 5e8afb8 commit cc03155

1 file changed

Lines changed: 0 additions & 50 deletions

File tree

  • drivers/infiniband/hw/irdma

drivers/infiniband/hw/irdma/cm.c

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4231,10 +4231,6 @@ void irdma_cm_teardown_connections(struct irdma_device *iwdev, u32 *ipaddr,
42314231
struct irdma_cm_node *cm_node;
42324232
struct list_head teardown_list;
42334233
struct ib_qp_attr attr;
4234-
struct irdma_sc_vsi *vsi = &iwdev->vsi;
4235-
struct irdma_sc_qp *sc_qp;
4236-
struct irdma_qp *qp;
4237-
int i;
42384234

42394235
INIT_LIST_HEAD(&teardown_list);
42404236

@@ -4251,52 +4247,6 @@ void irdma_cm_teardown_connections(struct irdma_device *iwdev, u32 *ipaddr,
42514247
irdma_cm_disconn(cm_node->iwqp);
42524248
irdma_rem_ref_cm_node(cm_node);
42534249
}
4254-
if (!iwdev->roce_mode)
4255-
return;
4256-
4257-
INIT_LIST_HEAD(&teardown_list);
4258-
for (i = 0; i < IRDMA_MAX_USER_PRIORITY; i++) {
4259-
mutex_lock(&vsi->qos[i].qos_mutex);
4260-
list_for_each_safe (list_node, list_core_temp,
4261-
&vsi->qos[i].qplist) {
4262-
u32 qp_ip[4];
4263-
4264-
sc_qp = container_of(list_node, struct irdma_sc_qp,
4265-
list);
4266-
if (sc_qp->qp_uk.qp_type != IRDMA_QP_TYPE_ROCE_RC)
4267-
continue;
4268-
4269-
qp = sc_qp->qp_uk.back_qp;
4270-
if (!disconnect_all) {
4271-
if (nfo->ipv4)
4272-
qp_ip[0] = qp->udp_info.local_ipaddr[3];
4273-
else
4274-
memcpy(qp_ip,
4275-
&qp->udp_info.local_ipaddr[0],
4276-
sizeof(qp_ip));
4277-
}
4278-
4279-
if (disconnect_all ||
4280-
(nfo->vlan_id == (qp->udp_info.vlan_tag & VLAN_VID_MASK) &&
4281-
!memcmp(qp_ip, ipaddr, nfo->ipv4 ? 4 : 16))) {
4282-
spin_lock(&iwdev->rf->qptable_lock);
4283-
if (iwdev->rf->qp_table[sc_qp->qp_uk.qp_id]) {
4284-
irdma_qp_add_ref(&qp->ibqp);
4285-
list_add(&qp->teardown_entry,
4286-
&teardown_list);
4287-
}
4288-
spin_unlock(&iwdev->rf->qptable_lock);
4289-
}
4290-
}
4291-
mutex_unlock(&vsi->qos[i].qos_mutex);
4292-
}
4293-
4294-
list_for_each_safe (list_node, list_core_temp, &teardown_list) {
4295-
qp = container_of(list_node, struct irdma_qp, teardown_entry);
4296-
attr.qp_state = IB_QPS_ERR;
4297-
irdma_modify_qp_roce(&qp->ibqp, &attr, IB_QP_STATE, NULL);
4298-
irdma_qp_rem_ref(&qp->ibqp);
4299-
}
43004250
}
43014251

43024252
/**

0 commit comments

Comments
 (0)