linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@kernel.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Kai-Heng Feng <kai.heng.feng@canonical.com>,
	linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <keith.busch@intel.com>,
	Andy Lutomirski <luto@kernel.org>
Subject: [PATCH 3/5] nvme: Add nvme_core.force_apst to ignore the NO_APST quirk
Date: Wed, 19 Apr 2017 20:02:16 -0700	[thread overview]
Message-ID: <e23c0d571f48cefbdbfd2e7308a41d8e8cf583c1.1492656278.git.luto@kernel.org> (raw)
In-Reply-To: <cover.1492656278.git.luto@kernel.org>
In-Reply-To: <cover.1492656278.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 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 52b4e52b85a2..b422996f88ed 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);
 
@@ -1519,7 +1523,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

  parent reply	other threads:[~2017-04-20  3:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20  3:02 [PATCH 0/5] nvme APST fixes/improvements for 4.11 Andy Lutomirski
2017-04-20  3:02 ` [PATCH 1/5] nvme: Fix APST comment Andy Lutomirski
2017-04-20  3:02 ` [PATCH 2/5] nvme: Display raw APST configuration via DYNAMIC_DEBUG Andy Lutomirski
2017-04-20  3:02 ` Andy Lutomirski [this message]
2017-04-20  3:02 ` [PATCH 4/5] nvme: Adjust the Samsung APST quirk Andy Lutomirski
2017-04-20  3:07   ` Jens Axboe
2017-04-20  3:51     ` Andy Lutomirski
     [not found]       ` <CGME20170420043337uscas1p1614437f255a643cdb08e44c4fd43424f@uscas1p1.samsung.com>
2017-04-20  4:33         ` Judy Brock
2017-04-20  3:02 ` [PATCH 5/5] nvme: Quirk APST off on "THNSF5256GPUK TOSHIBA" Andy Lutomirski
2017-04-20  3:10 ` [PATCH 0/5] nvme APST fixes/improvements for 4.11 Jens Axboe
2017-04-20  3:55   ` Andy Lutomirski
2017-04-20  4:52     ` Andy Lutomirski
2017-04-20  5:19       ` Christoph Hellwig
2017-04-20 16:01         ` Andy Lutomirski

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=e23c0d571f48cefbdbfd2e7308a41d8e8cf583c1.1492656278.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;
as well as URLs for NNTP newsgroup(s).