Skip to content

Commit e20ec78

Browse files
Mike Marciniszyngregkh
authored andcommitted
IB/hfi1: Avoid hardlockup with flushlist_lock
commit cf131a8 upstream. Heavy contention of the sde flushlist_lock can cause hard lockups at extreme scale when the flushing logic is under stress. Mitigate by replacing the item at a time copy to the local list with an O(1) list_splice_init() and using the high priority work queue to do the flushes. Ported to linux-4.9.y. Fixes: 7724105 ("IB/hfi1: add driver files") Cc: <[email protected]> Reviewed-by: Dennis Dalessandro <[email protected]> Signed-off-by: Mike Marciniszyn <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Doug Ledford <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent c1707c5 commit e20ec78

File tree

1 file changed

+3
-6
lines changed
  • drivers/infiniband/hw/hfi1

1 file changed

+3
-6
lines changed

drivers/infiniband/hw/hfi1/sdma.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,7 @@ static void sdma_flush(struct sdma_engine *sde)
410410
sdma_flush_descq(sde);
411411
spin_lock_irqsave(&sde->flushlist_lock, flags);
412412
/* copy flush list */
413-
list_for_each_entry_safe(txp, txp_next, &sde->flushlist, list) {
414-
list_del_init(&txp->list);
415-
list_add_tail(&txp->list, &flushlist);
416-
}
413+
list_splice_init(&sde->flushlist, &flushlist);
417414
spin_unlock_irqrestore(&sde->flushlist_lock, flags);
418415
/* flush from flush list */
419416
list_for_each_entry_safe(txp, txp_next, &flushlist, list)
@@ -2406,7 +2403,7 @@ int sdma_send_txreq(struct sdma_engine *sde,
24062403
wait->tx_count++;
24072404
wait->count += tx->num_desc;
24082405
}
2409-
schedule_work(&sde->flush_worker);
2406+
queue_work_on(sde->cpu, system_highpri_wq, &sde->flush_worker);
24102407
ret = -ECOMM;
24112408
goto unlock;
24122409
nodesc:
@@ -2504,7 +2501,7 @@ int sdma_send_txlist(struct sdma_engine *sde, struct iowait *wait,
25042501
}
25052502
}
25062503
spin_unlock(&sde->flushlist_lock);
2507-
schedule_work(&sde->flush_worker);
2504+
queue_work_on(sde->cpu, system_highpri_wq, &sde->flush_worker);
25082505
ret = -ECOMM;
25092506
goto update_tail;
25102507
nodesc:

0 commit comments

Comments
 (0)