summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/hfi1
diff options
context:
space:
mode:
authorSebastian Sanchez <sebastian.sanchez@intel.com>2017-08-13 08:08:22 -0700
committerDoug Ledford <dledford@redhat.com>2017-08-22 14:22:37 -0400
commitb6422bc01259aea7e4e11f1cd052e80acdf1275b (patch)
treeeafcbe44eaa817b571e805429bcca9e5a9978280 /drivers/infiniband/hw/hfi1
parent028e0a67ea679ff958176eac97d1319a8d685fad (diff)
IB/hfi1: Check xchg returned value for queuing link down entry
Check xchg returned value for queuing link down entry to guarantee proper atomic value reads. Fixes: 626c077c025f ("IB/hfi1: Prevent link down request double queuing") Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1')
-rw-r--r--drivers/infiniband/hw/hfi1/chip.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index cbda37386982..bfb50a4e7e5f 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -7810,16 +7810,22 @@ static void handle_8051_interrupt(struct hfi1_devdata *dd, u32 unused, u64 reg)
if (queue_link_down) {
/*
* if the link is already going down or disabled, do not
- * queue another
+ * queue another. If there's a link down entry already
+ * queued, don't queue another one.
*/
if ((ppd->host_link_state &
(HLS_GOING_OFFLINE | HLS_LINK_COOLDOWN)) ||
- ppd->link_enabled == 0 || ppd->is_link_down_queued) {
- dd_dev_info(dd, "%s: not queuing link down\n",
- __func__);
+ ppd->link_enabled == 0) {
+ dd_dev_info(dd, "%s: not queuing link down. host_link_state %x, link_enabled %x\n",
+ __func__, ppd->host_link_state,
+ ppd->link_enabled);
} else {
- xchg(&ppd->is_link_down_queued, 1);
- queue_work(ppd->link_wq, &ppd->link_down_work);
+ if (xchg(&ppd->is_link_down_queued, 1) == 1)
+ dd_dev_info(dd,
+ "%s: link down request already queued\n",
+ __func__);
+ else
+ queue_work(ppd->link_wq, &ppd->link_down_work);
}
}
}