From: keith.busch@intel.com (Keith Busch)
Subject: [PATCHv4 2/4] nvme: Start controller in own work queue
Date: Fri, 13 Jul 2018 14:56:07 -0600 [thread overview]
Message-ID: <20180713205609.19701-3-keith.busch@intel.com> (raw)
In-Reply-To: <20180713205609.19701-1-keith.busch@intel.com>
This moves the controller start from the reset_work to its own work.
This is preparing for the possibility of running IO when starting the
controller, which we shouldn't do from the reset_work since we need that
context to handle timeouts.
Signed-off-by: Keith Busch <keith.busch at intel.com>
---
drivers/nvme/host/core.c | 12 +++++++++++-
drivers/nvme/host/nvme.h | 1 +
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index eeb97dbef7ff..6fed8a454843 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3418,6 +3418,7 @@ EXPORT_SYMBOL_GPL(nvme_complete_async_event);
void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
{
nvme_stop_keep_alive(ctrl);
+ flush_work(&ctrl->start_work);
flush_work(&ctrl->async_event_work);
flush_work(&ctrl->scan_work);
cancel_work_sync(&ctrl->fw_act_work);
@@ -3426,8 +3427,11 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
}
EXPORT_SYMBOL_GPL(nvme_stop_ctrl);
-void nvme_start_ctrl(struct nvme_ctrl *ctrl)
+void nvme_start_work(struct work_struct *work)
{
+ struct nvme_ctrl *ctrl =
+ container_of(work, struct nvme_ctrl, start_work);
+
if (ctrl->kato)
nvme_start_keep_alive(ctrl);
@@ -3438,6 +3442,11 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
nvme_start_queues(ctrl);
}
}
+
+void nvme_start_ctrl(struct nvme_ctrl *ctrl)
+{
+ queue_work(nvme_wq, &ctrl->start_work);
+}
EXPORT_SYMBOL_GPL(nvme_start_ctrl);
void nvme_uninit_ctrl(struct nvme_ctrl *ctrl)
@@ -3485,6 +3494,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
ctrl->dev = dev;
ctrl->ops = ops;
ctrl->quirks = quirks;
+ INIT_WORK(&ctrl->start_work, nvme_start_work);
INIT_WORK(&ctrl->scan_work, nvme_scan_work);
INIT_WORK(&ctrl->async_event_work, nvme_async_event_work);
INIT_WORK(&ctrl->fw_act_work, nvme_fw_act_work);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 51cf44ad86fd..1dd26a9a1fdc 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -190,6 +190,7 @@ struct nvme_ctrl {
unsigned long quirks;
struct nvme_id_power_state psd[32];
struct nvme_effects_log *effects;
+ struct work_struct start_work;
struct work_struct scan_work;
struct work_struct async_event_work;
struct delayed_work ka_work;
--
2.14.3
next prev parent reply other threads:[~2018-07-13 20:56 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 20:56 [PATCHv4 0/4] nvme timeout updates Keith Busch
2018-07-13 20:56 ` [PATCHv4 1/4] nvme: Sync request queues on reset Keith Busch
2018-07-16 8:52 ` jianchao.wang
2018-07-16 10:39 ` Ming Lei
2018-07-16 13:30 ` Keith Busch
2018-07-17 5:37 ` jianchao.wang
2018-07-16 14:51 ` Sagi Grimberg
2018-07-16 15:37 ` Keith Busch
2018-07-16 16:36 ` Sagi Grimberg
2018-07-16 17:12 ` Keith Busch
2018-07-17 13:40 ` Christoph Hellwig
2018-07-17 14:54 ` Keith Busch
2018-07-18 11:46 ` Sagi Grimberg
2018-07-18 13:52 ` Keith Busch
2018-07-13 20:56 ` Keith Busch [this message]
2018-07-16 15:00 ` [PATCHv4 2/4] nvme: Start controller in own work queue Sagi Grimberg
2018-07-16 15:35 ` Keith Busch
2018-07-13 20:56 ` [PATCHv4 3/4] nvme: Introduce frozen controller state Keith Busch
2018-07-16 9:02 ` jianchao.wang
2018-07-16 11:09 ` Ming Lei
2018-07-16 13:36 ` Keith Busch
2018-07-17 1:23 ` Ming Lei
2018-07-17 5:49 ` jianchao.wang
2018-07-17 7:21 ` Ming Lei
2018-07-17 7:28 ` jianchao.wang
2018-07-17 14:32 ` Keith Busch
2018-07-18 2:57 ` jianchao.wang
2018-07-17 14:06 ` Keith Busch
2018-07-16 16:34 ` Sagi Grimberg
2018-07-17 16:05 ` James Smart
2018-07-17 16:17 ` Keith Busch
2018-07-18 12:20 ` Sagi Grimberg
2018-07-18 13:53 ` Keith Busch
2018-07-13 20:56 ` [PATCHv4 4/4] nvme-pci: Use controller start work to dispath IO Keith Busch
2018-07-19 19:48 ` [PATCHv4 0/4] nvme timeout updates Scott Bauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180713205609.19701-3-keith.busch@intel.com \
--to=keith.busch@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.