Skip to content

Commit ca9033b

Browse files
kwan-intcjgunthorpe
authored andcommitted
IB/hfi1: Don't cancel unused work item
In the iowait structure, two iowait_work entries were included to queue a given object: one for normal IB operations, and the other for TID RDMA operations. For non-TID RDMA operations, the iowait_work structure for TID RDMA is initialized to contain a NULL function (not used). When the QP is reset, the function iowait_cancel_work will be called to cancel any pending work. The problem is that this function will call cancel_work_sync() for both iowait_work entries, even though the one for TID RDMA is not used at all. Eventually, the call cascades to __flush_work(), wherein a WARN_ON will be triggered due to the fact that work->func is NULL. The WARN_ON was introduced in commit 4d43d39 ("workqueue: Try to catch flush_work() without INIT_WORK().") This patch fixes the issue by making sure that a work function is present for TID RDMA before calling cancel_work_sync in iowait_cancel_work. Fixes: 4d43d39 ("workqueue: Try to catch flush_work() without INIT_WORK().") Fixes: 5da0fc9 ("IB/hfi1: Prepare resource waits for dual leg") Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Mike Marciniszyn <[email protected]> Signed-off-by: Kaike Wan <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent c527572 commit ca9033b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/infiniband/hw/hfi1/iowait.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ void iowait_init(struct iowait *wait, u32 tx_limit,
8181
void iowait_cancel_work(struct iowait *w)
8282
{
8383
cancel_work_sync(&iowait_get_ib_work(w)->iowork);
84-
cancel_work_sync(&iowait_get_tid_work(w)->iowork);
84+
/* Make sure that the iowork for TID RDMA is used */
85+
if (iowait_get_tid_work(w)->iowork.func)
86+
cancel_work_sync(&iowait_get_tid_work(w)->iowork);
8587
}
8688

8789
/**

0 commit comments

Comments
 (0)