Blob Blame History Raw
From: Steve Wise <swise@opengridcomputing.com>
Date: Wed, 26 May 2021 13:25:00 +0200
Subject: RDMA/addr: create addr_wq with WQ_MEM_RECLAIM flag
Patch-mainline: Never, no fix yet availabe upstream revert offending change
References: bsc#1183346

While running NVMe/oF wire unplug tests, we hit this warning in
kernel/workqueue.c:check_flush_dependency():

WARN_ONCE(worker && ((worker->current_pwq->wq->flags &
		      (WQ_MEM_RECLAIM | __WQ_LEGACY)) == WQ_MEM_RECLAIM),
	  "workqueue: WQ_MEM_RECLAIM %s:%pf is flushing !WQ_MEM_RECLAIM %s:%pf",
	  worker->current_pwq->wq->name, worker->current_func,
	  target_wq->name, target_func);

Which I think means we're flushing a workq that doesn't have
WQ_MEM_RECLAIM set, from workqueue context that does have it set.

Looking at rdma_addr_cancel() which is doing the flushing, it flushes
the addr_wq which doesn't have MEM_RECLAIM set.  Yet rdma_addr_cancel()
is being called by the nvme host connection timeout/reconnect workqueue
thread that does have WQ_MEM_RECLAIM set.

So set WQ_MEM_RECLAIM on the addr_req workqueue.

This is to silence the warning and not fixing the problem at
all. Upstream is aware of this problem but there is no fix yet. To
avoid a lot of support requests undo the offending commit.

Link: https://patchwork.kernel.org/project/linux-rdma/patch/5f5a1e4e90f3625cea57ffa79fc0e5bcb7efe09d.1548963371.git.swise@opengridcomputing.com/
Fixes: 39baf10310e6 ("IB/core: Fix use workqueue without WQ_MEM_RECLAIM")
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
[dwagner: Updated commit message]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/infiniband/core/addr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 0abce004a959..c92d25c97ba1 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -871,7 +871,7 @@ static struct notifier_block nb = {
 
 int addr_init(void)
 {
-	addr_wq = alloc_ordered_workqueue("ib_addr", 0);
+	addr_wq = alloc_ordered_workqueue("ib_addr", WQ_MEM_RECLAIM);
 	if (!addr_wq)
 		return -ENOMEM;
 
-- 
2.29.2