Skip to content

Commit 97b2512

Browse files
Nigel Kirklandaxboe
authored andcommitted
nvme: prevent warning triggered by nvme_stop_keep_alive
Delayed keep alive work is queued on system workqueue and may be cancelled via nvme_stop_keep_alive from nvme_reset_wq, nvme_fc_wq or nvme_wq. Check_flush_dependency detects mismatched attributes between the work-queue context used to cancel the keep alive work and system-wq. Specifically system-wq does not have the WQ_MEM_RECLAIM flag, whereas the contexts used to cancel keep alive work have WQ_MEM_RECLAIM flag. Example warning: workqueue: WQ_MEM_RECLAIM nvme-reset-wq:nvme_fc_reset_ctrl_work [nvme_fc] is flushing !WQ_MEM_RECLAIM events:nvme_keep_alive_work [nvme_core] To avoid the flags mismatch, delayed keep alive work is queued on nvme_wq. However this creates a secondary concern where work and a request to cancel that work may be in the same work queue - namely err_work in the rdma and tcp transports, which will want to flush/cancel the keep alive work which will now be on nvme_wq. After reviewing the transports, it looks like err_work can be moved to nvme_reset_wq. In fact that aligns them better with transition into RESETTING and performing related reset work in nvme_reset_wq. Change nvme-rdma and nvme-tcp to perform err_work in nvme_reset_wq. Signed-off-by: Nigel Kirkland <[email protected]> Signed-off-by: James Smart <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 2d570a7 commit 97b2512

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

drivers/nvme/host/core.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ MODULE_PARM_DESC(streams, "turn on support for Streams write directives");
6666
* nvme_reset_wq - hosts nvme reset works
6767
* nvme_delete_wq - hosts nvme delete works
6868
*
69-
* nvme_wq will host works such are scan, aen handling, fw activation,
70-
* keep-alive error recovery, periodic reconnects etc. nvme_reset_wq
69+
* nvme_wq will host works such as scan, aen handling, fw activation,
70+
* keep-alive, periodic reconnects etc. nvme_reset_wq
7171
* runs reset works which also flush works hosted on nvme_wq for
7272
* serialization purposes. nvme_delete_wq host controller deletion
7373
* works which flush reset works for serialization.
@@ -976,7 +976,7 @@ static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status)
976976
startka = true;
977977
spin_unlock_irqrestore(&ctrl->lock, flags);
978978
if (startka)
979-
schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
979+
queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
980980
}
981981

982982
static int nvme_keep_alive(struct nvme_ctrl *ctrl)
@@ -1006,7 +1006,7 @@ static void nvme_keep_alive_work(struct work_struct *work)
10061006
dev_dbg(ctrl->device,
10071007
"reschedule traffic based keep-alive timer\n");
10081008
ctrl->comp_seen = false;
1009-
schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
1009+
queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
10101010
return;
10111011
}
10121012

@@ -1023,7 +1023,7 @@ static void nvme_start_keep_alive(struct nvme_ctrl *ctrl)
10231023
if (unlikely(ctrl->kato == 0))
10241024
return;
10251025

1026-
schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
1026+
queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
10271027
}
10281028

10291029
void nvme_stop_keep_alive(struct nvme_ctrl *ctrl)

drivers/nvme/host/rdma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl)
10881088
if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))
10891089
return;
10901090

1091-
queue_work(nvme_wq, &ctrl->err_work);
1091+
queue_work(nvme_reset_wq, &ctrl->err_work);
10921092
}
10931093

10941094
static void nvme_rdma_wr_error(struct ib_cq *cq, struct ib_wc *wc,

drivers/nvme/host/tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl)
422422
if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
423423
return;
424424

425-
queue_work(nvme_wq, &to_tcp_ctrl(ctrl)->err_work);
425+
queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work);
426426
}
427427

428428
static int nvme_tcp_process_nvme_cqe(struct nvme_tcp_queue *queue,

0 commit comments

Comments
 (0)