[PATCH] NVMe: Add shutdown timeout as module parameter.
Alex Hung
alex.hung at canonical.com
Tue Jun 16 07:23:16 UTC 2015
From: Dan McLeran <daniel.mcleran at intel.com>
The current implementation hard-codes the shutdown timeout to 2 seconds.
Some devices take longer than this to complete a normal shutdown.
Changing the shutdown timeout to a module parameter with a default
timeout of 5 seconds.
BugLink: http://bugs.launchpad.net/bugs/1465136
Signed-off-by: Dan McLeran <daniel.mcleran at intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox at intel.com>
Signed-off-by: Jens Axboe <axboe at fb.com>
(cherry picked from commit 2484f40780b97df1b5eb09e78ce4efaa78b21875)
Conflicts:
drivers/block/nvme-core.c
Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
drivers/block/nvme-core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 53f0c5e..ce8087e 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -47,6 +47,11 @@
#define SQ_SIZE(depth) (depth * sizeof(struct nvme_command))
#define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion))
#define ADMIN_TIMEOUT (60 * HZ)
+#define SHUTDOWN_TIMEOUT (shutdown_timeout * HZ)
+
+static unsigned char shutdown_timeout = 5;
+module_param(shutdown_timeout, byte, 0644);
+MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller shutdown");
static int nvme_major;
module_param(nvme_major, int, 0);
@@ -1366,7 +1371,7 @@ static int nvme_shutdown_ctrl(struct nvme_dev *dev)
cc = (readl(&dev->bar->cc) & ~NVME_CC_SHN_MASK) | NVME_CC_SHN_NORMAL;
writel(cc, &dev->bar->cc);
- timeout = 2 * HZ + jiffies;
+ timeout = SHUTDOWN_TIMEOUT + jiffies;
while ((readl(&dev->bar->csts) & NVME_CSTS_SHST_MASK) !=
NVME_CSTS_SHST_CMPLT) {
msleep(100);
--
1.7.9.5
More information about the kernel-team
mailing list