Commit b6422bc0 authored by Sebastian Sanchez's avatar Sebastian Sanchez Committed by Doug Ledford

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: 626c077c ("IB/hfi1: Prevent link down request double queuing")
Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarSebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 028e0a67
...@@ -7810,16 +7810,22 @@ static void handle_8051_interrupt(struct hfi1_devdata *dd, u32 unused, u64 reg) ...@@ -7810,16 +7810,22 @@ static void handle_8051_interrupt(struct hfi1_devdata *dd, u32 unused, u64 reg)
if (queue_link_down) { if (queue_link_down) {
/* /*
* if the link is already going down or disabled, do not * 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 & if ((ppd->host_link_state &
(HLS_GOING_OFFLINE | HLS_LINK_COOLDOWN)) || (HLS_GOING_OFFLINE | HLS_LINK_COOLDOWN)) ||
ppd->link_enabled == 0 || ppd->is_link_down_queued) { ppd->link_enabled == 0) {
dd_dev_info(dd, "%s: not queuing link down\n", dd_dev_info(dd, "%s: not queuing link down. host_link_state %x, link_enabled %x\n",
__func__); __func__, ppd->host_link_state,
ppd->link_enabled);
} else { } else {
xchg(&ppd->is_link_down_queued, 1); if (xchg(&ppd->is_link_down_queued, 1) == 1)
queue_work(ppd->link_wq, &ppd->link_down_work); dd_dev_info(dd,
"%s: link down request already queued\n",
__func__);
else
queue_work(ppd->link_wq, &ppd->link_down_work);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment