From: Balbir Singh <sblbir@amzn.com>
To: <linux-nvme@lists.infradead.org>
Cc: kbusch@kernel.org, axboe@fb.com, Balbir Singh <sblbir@amzn.com>,
hch@lst.de, sagi@grimberg.me
Subject: [PATCH] nvme/host/core: Allow overriding of wait_ready timeout
Date: Tue, 17 Sep 2019 22:41:05 +0000 [thread overview]
Message-ID: <20190917224105.6758-2-sblbir@amzn.com> (raw)
In-Reply-To: <20190917224105.6758-1-sblbir@amzn.com>
Largely for debugging purposes where controllers with large
timeouts get stuck during reset. In my case I have a simple
mirroring raid configuration on top of nvme using mdadm.
If one of the controller has IO timeouts and takes very long
(128 seconds worst case) during IO, I am happy to
use this debug option to drop that controller quickly and
let the system run.
Signed-off-by: Balbir Singh <sblbir@amzn.com>
---
Changelog:
Implement simplifications suggested in the review
NOTE:
I am still sending this out for larger review because I think
this is helpful, there is some concern that the values might
be mis-used, a quirk does not meet my requirments and the
value of the timeout is global (as in it applies to all
controllers). I think it is still useful to have this for
my use case for the lack of a better solution
drivers/nvme/host/core.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 6ad1f1df9e44..798edc609d6a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -40,6 +40,10 @@ module_param_named(io_timeout, nvme_io_timeout, uint, 0644);
MODULE_PARM_DESC(io_timeout, "timeout in seconds for I/O");
EXPORT_SYMBOL_GPL(nvme_io_timeout);
+static unsigned int nvme_wait_ready_timeout = 0;
+module_param_named(wait_ready_timeout, nvme_wait_ready_timeout, uint, 0644);
+MODULE_PARM_DESC(wait_ready_timeout, "timeout in seconds for ready on reset");
+
static unsigned char shutdown_timeout = 5;
module_param(shutdown_timeout, byte, 0644);
MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller shutdown");
@@ -1930,11 +1934,15 @@ const struct block_device_operations nvme_ns_head_ops = {
static int nvme_wait_ready(struct nvme_ctrl *ctrl, u64 cap, bool enabled)
{
- unsigned long timeout =
- ((NVME_CAP_TIMEOUT(cap) + 1) * HZ / 2) + jiffies;
+ unsigned long timeout;
u32 csts, bit = enabled ? NVME_CSTS_RDY : 0;
int ret;
+ if (unlikely(nvme_wait_ready_timeout))
+ timeout = (nvme_wait_ready_timeout * HZ) + jiffies;
+ else
+ timeout = ((NVME_CAP_TIMEOUT(cap) + 1) * HZ / 2) + jiffies;
+
while ((ret = ctrl->ops->reg_read32(ctrl, NVME_REG_CSTS, &csts)) == 0) {
if (csts == ~0)
return -ENODEV;
--
2.16.5
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2019-09-17 22:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 22:41 [PATCH v3 1/2] nvme/host/pci: Fix a race in controller removal Balbir Singh
2019-09-17 22:41 ` Balbir Singh [this message]
2019-09-17 23:45 ` Keith Busch
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=20190917224105.6758-2-sblbir@amzn.com \
--to=sblbir@amzn.com \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox