From: Andy Lutomirski <luto@kernel.org>
To: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
Keith Busch <keith.busch@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Kai-Heng Feng <kai.heng.feng@canonical.com>,
linux-nvme <linux-nvme@lists.infradead.org>,
Andy Lutomirski <luto@kernel.org>
Subject: [PATCH 3/3] nvme: Add nvme_core.force_apst to ignore the NO_APST quirk
Date: Fri, 21 Apr 2017 16:19:24 -0700 [thread overview]
Message-ID: <13c7ac4b73ad6773b2b71cc317a8af73108bff34.1492816561.git.luto@kernel.org> (raw)
In-Reply-To: <cover.1492816561.git.luto@kernel.org>
In-Reply-To: <cover.1492816561.git.luto@kernel.org>
We're probably going to be stuck quirking APST off on an over-broad
range of devices for 4.11. Let's make it easy to override the quirk
for testing.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
drivers/nvme/host/core.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 05ba4f8bb73b..5249027a76ca 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -62,6 +62,10 @@ module_param(default_ps_max_latency_us, ulong, 0644);
MODULE_PARM_DESC(default_ps_max_latency_us,
"max power saving latency for new devices; use PM QOS to change per device");
+static bool force_apst;
+module_param(force_apst, bool, 0644);
+MODULE_PARM_DESC(force_apst, "allow APST for newly enumerated devices even if quirked off");
+
static LIST_HEAD(nvme_ctrl_list);
static DEFINE_SPINLOCK(dev_list_lock);
@@ -1504,6 +1508,11 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
}
}
+ if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) {
+ dev_warn(ctrl->dev, "forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n");
+ ctrl->quirks &= ~NVME_QUIRK_NO_DEEPEST_PS;
+ }
+
ctrl->oacs = le16_to_cpu(id->oacs);
ctrl->vid = le16_to_cpu(id->vid);
ctrl->oncs = le16_to_cpup(&id->oncs);
@@ -1526,7 +1535,16 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
ctrl->npss = id->npss;
prev_apsta = ctrl->apsta;
- ctrl->apsta = (ctrl->quirks & NVME_QUIRK_NO_APST) ? 0 : id->apsta;
+ if (ctrl->quirks & NVME_QUIRK_NO_APST) {
+ if (force_apst && id->apsta) {
+ dev_warn(ctrl->dev, "forcibly allowing APST due to nvme_core.force_apst -- use at your own risk\n");
+ ctrl->apsta = 1;
+ } else {
+ ctrl->apsta = 0;
+ }
+ } else {
+ ctrl->apsta = id->apsta;
+ }
memcpy(ctrl->psd, id->psd, sizeof(ctrl->psd));
if (ctrl->ops->is_fabrics) {
--
2.9.3
next prev parent reply other threads:[~2017-04-21 23:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 23:19 [PATCH 0/3] nvme: APST improvements (for 4.12, perhaps) Andy Lutomirski
2017-04-21 23:19 ` [PATCH 1/3] nvme: Fix APST comment Andy Lutomirski
2017-04-23 8:12 ` Christoph Hellwig
2017-04-21 23:19 ` [PATCH 2/3] nvme: Display raw APST configuration via DYNAMIC_DEBUG Andy Lutomirski
2017-04-23 8:12 ` Christoph Hellwig
2017-04-21 23:19 ` Andy Lutomirski [this message]
2017-04-23 8:12 ` [PATCH 3/3] nvme: Add nvme_core.force_apst to ignore the NO_APST quirk Christoph Hellwig
2017-04-25 4:04 ` [PATCH 0/3] nvme: APST improvements (for 4.12, perhaps) Jens Axboe
2017-04-25 7:19 ` Christoph Hellwig
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=13c7ac4b73ad6773b2b71cc317a8af73108bff34.1492816561.git.luto@kernel.org \
--to=luto@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kai.heng.feng@canonical.com \
--cc=keith.busch@intel.com \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®