summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarish Chegondi <harish.chegondi@intel.com>2016-02-14 12:11:28 -0800
committerDoug Ledford <dledford@redhat.com>2016-03-10 20:38:11 -0500
commit21cfca33587d45ccdc5aaaedf97a909ccc4a0a27 (patch)
tree914ef578ecfb7ce95db17d0c535d9dcd74581882
parent79a225be38932b17707009767e85d6edf450e7cc (diff)
downloadlinux-21cfca33587d45ccdc5aaaedf97a909ccc4a0a27.tar.bz2
IB/qib: Destroy SMI AH before de-allocating the protection domain
If SMI AH is not destroyed before de-allocating the PD, it would result in non-zero PD use count when de-allocating the PD, triggering a WARN_ON() at drivers/infiniband/core/verbs.c:284 ib_dealloc_pd+0x69/0xb0 [ib_core]() when unloading the qib driver on systems with dual-port card. This problem has always been there in qib and was detected only after the commit 7dd78647a2c2 ("IB/core: Make ib_dealloc_pd return void") introduced a WARN_ON in ib_dealloc_pd() that triggers if a PD's use count is non-zero before de-allocating the PD. Below is the call trace from the dmesg log. [ 7264.966129] Call Trace: [ 7264.969652] [<ffffffff81338470>] dump_stack+0x44/0x64 [ 7264.976181] [<ffffffff81086bb6>] warn_slowpath_common+0x86/0xc0 [ 7264.983656] [<ffffffff81086cfa>] warn_slowpath_null+0x1a/0x20 [ 7264.990961] [<ffffffffa025c2d9>] ib_dealloc_pd+0x69/0xb0 [ib_core] [ 7264.998717] [<ffffffffa0044de8>] ib_mad_port_close+0xb8/0x120 [ib_mad] [ 7265.006866] [<ffffffffa0044ebf>] ib_mad_remove_device+0x6f/0xc0 [ib_mad] [ 7265.015224] [<ffffffffa025fc87>] ib_unregister_device+0xa7/0x140 [ib_core] [ 7265.023738] [<ffffffffa04b5b79>] rvt_unregister_device+0x29/0x80 [rdmavt] [ 7265.032181] [<ffffffffa088d2a2>] qib_unregister_ib_device+0x22/0x210 [ib_qib] [ 7265.040993] [<ffffffffa085f73f>] qib_remove_one+0x1f/0x250 [ib_qib] [ 7265.048823] [<ffffffff8137a319>] pci_device_remove+0x39/0xc0 [ 7265.055984] [<ffffffff81466a1a>] __device_release_driver+0x9a/0x140 [ 7265.063821] [<ffffffff81466bc8>] driver_detach+0xb8/0xc0 [ 7265.070579] [<ffffffff81465a15>] bus_remove_driver+0x55/0xd0 [ 7265.077717] [<ffffffff8146732c>] driver_unregister+0x2c/0x50 [ 7265.084849] [<ffffffff813789ba>] pci_unregister_driver+0x2a/0x80 [ 7265.092366] [<ffffffffa08921bd>] qib_ib_cleanup+0x37/0x65 [ib_qib] [ 7265.100068] [<ffffffff811096d0>] SyS_delete_module+0x190/0x220 [ 7265.107379] [<ffffffff816a7bae>] entry_SYSCALL_64_fastpath+0x12/0x71 Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Harish Chegondi <harish.chegondi@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/hw/qib/qib_iba7322.c2
-rw-r--r--drivers/infiniband/hw/qib/qib_mad.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
index ca28c19d9618..82d7c4bf5970 100644
--- a/drivers/infiniband/hw/qib/qib_iba7322.c
+++ b/drivers/infiniband/hw/qib/qib_iba7322.c
@@ -2910,8 +2910,6 @@ static void qib_setup_7322_cleanup(struct qib_devdata *dd)
spin_unlock_irqrestore(&dd->cspec->gpio_lock, flags);
qib_qsfp_deinit(&dd->pport[i].cpspec->qsfp_data);
}
- if (dd->pport[i].ibport_data.smi_ah)
- ib_destroy_ah(&dd->pport[i].ibport_data.smi_ah->ibah);
}
}
diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
index 73ca2c2a79a7..0bd18375d7df 100644
--- a/drivers/infiniband/hw/qib/qib_mad.c
+++ b/drivers/infiniband/hw/qib/qib_mad.c
@@ -2496,4 +2496,7 @@ void qib_notify_free_mad_agent(struct rvt_dev_info *rdi, int port_idx)
if (dd->pport[port_idx].cong_stats.timer.data)
del_timer_sync(&dd->pport[port_idx].cong_stats.timer);
+
+ if (dd->pport[port_idx].ibport_data.smi_ah)
+ ib_destroy_ah(&dd->pport[port_idx].ibport_data.smi_ah->ibah);
}