Skip to content

Commit ea663ab

Browse files
Mike Marciniszyngregkh
authored andcommitted
IB/hfi1: Close PSM sdma_progress sleep window
commit da9de5f upstream. The call to sdma_progress() is called outside the wait lock. In this case, there is a race condition where sdma_progress() can return false and the sdma_engine can idle. If that happens, there will be no more sdma interrupts to cause the wakeup and the user_sdma xmit will hang. Fix by moving the lock to enclose the sdma_progress() call. Also, delete busycount. The need for this was removed by: commit bcad291 ("IB/hfi1: Serve the most starved iowait entry first") Cc: <[email protected]> Fixes: 7724105 ("IB/hfi1: add driver files") Reviewed-by: Gary Leshner <[email protected]> Signed-off-by: Mike Marciniszyn <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 997ef64 commit ea663ab

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/infiniband/hw/hfi1/user_sdma.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ struct user_sdma_txreq {
260260
struct list_head list;
261261
struct user_sdma_request *req;
262262
u16 flags;
263-
unsigned busycount;
264263
u64 seqnum;
265264
};
266265

@@ -323,25 +322,22 @@ static int defer_packet_queue(
323322
struct hfi1_user_sdma_pkt_q *pq =
324323
container_of(wait, struct hfi1_user_sdma_pkt_q, busy);
325324
struct hfi1_ibdev *dev = &pq->dd->verbs_dev;
326-
struct user_sdma_txreq *tx =
327-
container_of(txreq, struct user_sdma_txreq, txreq);
328325

329-
if (sdma_progress(sde, seq, txreq)) {
330-
if (tx->busycount++ < MAX_DEFER_RETRY_COUNT)
331-
goto eagain;
332-
}
326+
write_seqlock(&dev->iowait_lock);
327+
if (sdma_progress(sde, seq, txreq))
328+
goto eagain;
333329
/*
334330
* We are assuming that if the list is enqueued somewhere, it
335331
* is to the dmawait list since that is the only place where
336332
* it is supposed to be enqueued.
337333
*/
338334
xchg(&pq->state, SDMA_PKT_Q_DEFERRED);
339-
write_seqlock(&dev->iowait_lock);
340335
if (list_empty(&pq->busy.list))
341336
list_add_tail(&pq->busy.list, &sde->dmawait);
342337
write_sequnlock(&dev->iowait_lock);
343338
return -EBUSY;
344339
eagain:
340+
write_sequnlock(&dev->iowait_lock);
345341
return -EAGAIN;
346342
}
347343

@@ -925,7 +921,6 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
925921

926922
tx->flags = 0;
927923
tx->req = req;
928-
tx->busycount = 0;
929924
INIT_LIST_HEAD(&tx->list);
930925

931926
if (req->seqnum == req->info.npkts - 1)

0 commit comments

Comments
 (0)