nvme APST quirk updates, take two
v2 cover nvme APST quirk updates, take two
Hi Jens-
These are just the quirk updates, split out. The patches are unchanged.
I think that, even if we want to apply a broader quirk for 4.11, we should still apply these so that we can cleanly revert the broader quirk later. IOW, let's get the known regressions fixed before we get too excited about the unknown regressions.
Andy Lutomirski (2):
nvme: Adjust the Samsung APST quirk
nvme: Quirk APST off on "THNSF5256GPUK TOSHIBA"
drivers/nvme/host/core.c | 28 ++++++++++++++++++++-------- drivers/nvme/host/nvme.h | 5 +++++ drivers/nvme/host/pci.c | 26 +++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 9 deletions(-)
Signature · 1 line
2.9.3
PATCH v2 1/2 nvme: Adjust the Samsung APST quirk
I got a couple more reports: the Samsung APST issues appears to affect multiple 950-series devices in Dell XPS 15 9550 and Precision 5510 laptops. Change the quirk: rather than blacklisting the firmware on the first problematic SSD that was reported, disable APST on all 144d:a802 devices if they're installed in the two affected Dell models. While we're at it, disable only the deepest sleep state instead of all of them -- the reporters say that this is sufficient to fix the problem.
(I have a device that appears to be entirely identical to one of the affected devices, but I have a different Dell laptop, so it's not the case that all Samsung devices with firmware BXW75D0Q are broken under all circumstances.)
Samsung engineers have an affected system, and hopefully they'll give us a better workaround some time soon. In the mean time, this should minimize regressions.
See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1678184
--- drivers/nvme/host/core.c | 23 +++++++++++++---------- drivers/nvme/host/nvme.h | 5 +++++ drivers/nvme/host/pci.c | 26 +++++++++++++++++++++++++- 3 files changed, 43 insertions(+), 11 deletions(-)
drivers/nvme/host/core.c +13 -10
@@ -1316,6 +1316,14 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl) table->entries[state] = target;/* +* Don't allow transitions to the deepest state +* if it's quirked off. +*/ +if (state == ctrl->npss && + (ctrl->quirks &NVME_QUIRK_NO_DEEPEST_PS )) +continue ; + +/* * Is this state a useful non-operational state for * higher-power states to autonomously transition to? */
@@ -1387,16 +1395,6 @@ struct nvme_core_quirk_entry { };static const struct nvme_core_quirk_entry core_quirks[] = { -/* -* Seen on a Samsung "SM951 NVMe SAMSUNG 256GB": using APST causes -* the controller to go out to lunch. It dies when the watchdog -* timer reads CSTS and gets 0xffffffff. -*/ - { - .vid =0x144d , - .fr ="BXW75D0Q" , - .quirks =NVME_QUIRK_NO_APST , - }, };/* match is null-terminated but idstr is space-padded. */
@@ -1481,6 +1479,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);
drivers/nvme/host/nvme.h +5 -0
@@ -83,6 +83,11 @@ enum nvme_quirks {* APST should not be used. */ NVME_QUIRK_NO_APST = (1 <<4 ), + +/* +* The deepest sleep state should not be used. +*/ + NVME_QUIRK_NO_DEEPEST_PS = (1 << 5), };/*
drivers/nvme/host/pci.c +25 -1
@@ -19,6 +19,7 @@#include <linux/blk-mq-pci.h> #include <linux/cpu.h> #include <linux/delay.h> +#include <linux/dmi.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/genhd.h>
@@ -1943,10 +1944,31 @@ static int nvme_dev_map(struct nvme_dev *dev)return -ENODEV ; } +static unsigned long check_dell_samsung_bug (struct pci_dev *pdev) +{ +if (pdev->vendor ==0x144d && pdev->device ==0xa802 ) { +/* +* Several Samsung devices seem to drop off the PCIe bus +* randomly when APST is on and uses the deepest sleep state. +* This has been observed on a Samsung "SM951 NVMe SAMSUNG +* 256GB", a "PM951 NVMe SAMSUNG 512GB", and a "Samsung SSD +* 950 PRO 256GB", but it seems to be restricted to two Dell +* laptops. +*/ +if (dmi_match (DMI_SYS_VENDOR ,"Dell Inc." ) && + (dmi_match (DMI_PRODUCT_NAME ,"XPS 15 9550" ) || +dmi_match (DMI_PRODUCT_NAME ,"Precision 5510" ))) +return NVME_QUIRK_NO_DEEPEST_PS ; + } + +return 0 ; +} +static int nvme_probe (struct pci_dev *pdev,const struct pci_device_id *id) {int node, result = -ENOMEM ;struct nvme_dev *dev; +unsigned long quirks = id->driver_data; node =dev_to_node (&pdev->dev);if (node ==NUMA_NO_NODE )
@@ -1978,8 +2000,10 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (result) goto put_pci; + quirks |=check_dell_samsung_bug (pdev); + result =nvme_init_ctrl (&dev->ctrl, &pdev->dev, &nvme_pci_ctrl_ops, - id->driver_data); + quirks);if (result) goto release_pools;
Signature · 1 line
2.9.3
PATCH v2 2/2 nvme: Quirk APST off on "THNSF5256GPUK TOSHIBA"
In reply to Andy LutomirskiThere's a report that it malfunctions with APST on.
See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1678184
--- drivers/nvme/host/core.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/nvme/host/core.c +9 -0
@@ -1395,6 +1395,15 @@ struct nvme_core_quirk_entry { };static const struct nvme_core_quirk_entry core_quirks[] = { + { +/* +* This Toshiba device seems to die using any APST states. See: +* https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1678184/comments/11 +*/ + .vid =0x1179 , + .mn ="THNSF5256GPUK TOSHIBA" , + .quirks =NVME_QUIRK_NO_APST , + } };/* match is null-terminated but idstr is space-padded. */
Signature · 1 line
2.9.3
Jens Axboe
maintainerQuoted 9 lines · Andy Lutomirski
Hi Jens-
These are just the quirk updates, split out. The patches are unchanged.
I think that, even if we want to apply a broader quirk for 4.11, we should still apply these so that we can cleanly revert the broader quirk later. IOW, let's get the known regressions fixed before we get too excited about the unknown regressions.
This looks good to me, and 4.11 appropriate. I'll expedite this through the block tree, if Keith/Sagi/Christoph agrees on this being the right approach for 4.11.
Signature · 1 line
Jens Axboe
Sagi Grimberg
maintainerQuoted 6 lines
Quoted 6 lines
Hi Jens-
These are just the quirk updates, split out. The patches are unchanged.
Quoted 8 lines
Quoted 4 lines
I think that, even if we want to apply a broader quirk for 4.11, we should still apply these so that we can cleanly revert the broader quirk later. IOW, let's get the known regressions fixed before we get too excited about the unknown regressions.
This looks good to me, and 4.11 appropriate. I'll expedite this through the block tree, if Keith/Sagi/Christoph agrees on this being the right approach for 4.11.
I'm perfectly fine with this going to 4.11
Keith Busch
Reviewed-byQuoted 11 lines · Sagi Grimberg
Quoted 11 lines
Quoted 10 lines
Hi Jens-
These are just the quirk updates, split out. The patches are unchanged.
I think that, even if we want to apply a broader quirk for 4.11, we should still apply these so that we can cleanly revert the broader quirk later. IOW, let's get the known regressions fixed before we get too excited about the unknown regressions.
Quoted 5 lines
Quoted 3 lines
This looks good to me, and 4.11 appropriate. I'll expedite this through the block tree, if Keith/Sagi/Christoph agrees on this being the right approach for 4.11.
I'm perfectly fine with this going to 4.11
All good with me as well.
Jens Axboe
maintainerQuoted 16 lines · Keith Busch
Quoted 15 lines · Sagi Grimberg
Quoted 14 lines
Quoted 10 lines
Hi Jens-
These are just the quirk updates, split out. The patches are unchanged.
I think that, even if we want to apply a broader quirk for 4.11, we should still apply these so that we can cleanly revert the broader quirk later. IOW, let's get the known regressions fixed before we get too excited about the unknown regressions.
This looks good to me, and 4.11 appropriate. I'll expedite this through the block tree, if Keith/Sagi/Christoph agrees on this being the right approach for 4.11.
Quoted 5 lines
Quoted 1 line
I'm perfectly fine with this going to 4.11
All good with me as well.
Reviewed-by Keith Busch <keith.busch at intel.com>
Great, I have queued it up.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 17 lines · Jens Axboe
Quoted 16 lines · Keith Busch
Quoted 15 lines · Sagi Grimberg
Quoted 14 lines
Quoted 10 lines
Hi Jens-
These are just the quirk updates, split out. The patches are unchanged.
I think that, even if we want to apply a broader quirk for 4.11, we should still apply these so that we can cleanly revert the broader quirk later. IOW, let's get the known regressions fixed before we get too excited about the unknown regressions.
This looks good to me, and 4.11 appropriate. I'll expedite this through the block tree, if Keith/Sagi/Christoph agrees on this being the right approach for 4.11.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
I'm perfectly fine with this going to 4.11
All good with me as well.
Reviewed-by Keith Busch <keith.busch at intel.com>Great, I have queued it up.
Spoke too soon. Andy, did you compile this?
drivers/nvme/host/core.c: In function ?nvme_init_identify?:drivers/nvme/host/core.c:1524:6: error: ?force_apst? undeclared (first use in this function)
if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) {
^~~~~~~~~~drivers/nvme/host/core.c:1524:6: note: each undeclared identifier is reported only once for each function it appears in
No, you did not.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 38 lines · Andy Lutomirski
On Apr 20, 2017 9:38 AM, "Jens Axboe" <[email protected] <mailto:[email protected]>> wrote:
On 04/20/2017 10:30 AM, Jens Axboe wrote:
> On 04/20/2017 10:29 AM, Keith Busch wrote:
>> On Thu, Apr 20, 2017@07:15:15PM +0300, Sagi Grimberg wrote:
>>>
>>>>> Hi Jens-
>>>>>
>>>>> These are just the quirk updates, split out. The patches are
>>>>> unchanged.
>>>>>
>>>>> I think that, even if we want to apply a broader quirk for 4.11, we >>>>> should still apply these so that we can cleanly revert the broader >>>>> quirk later. IOW, let's get the known regressions fixed before we >>>>> get too excited about the unknown regressions.
>>>>
>>>> This looks good to me, and 4.11 appropriate. I'll expedite this
>>>> through the block tree, if Keith/Sagi/Christoph agrees on this
>>>> being the right approach for 4.11.
>>>
>>> I'm perfectly fine with this going to 4.11
>>
>> All good with me as well.
>>
>> Reviewed-by: Keith Busch <keith.busch at intel.com <mailto:keith.busch at intel.com>> >
> Great, I have queued it up.Spoke too soon. Andy, did you compile this?
drivers/nvme/host/core.c: In function ?nvme_init_identify?:
drivers/nvme/host/core.c:1524:6: error: ?force_apst? undeclared (first use in this function)
if (force_apst&& (ctrl->quirks&NVME_QUIRK_NO_DEEPEST_PS)) {
^~~~~~~~~~
drivers/nvme/host/core.c:1524:6: note: each undeclared identifier is reported only once for each function it appears in
Quoted 4 lines
No, you did not.
I compiled the end result but not the middle. D'oh. Better version coming in an hour or two.
This is from the end-result. I think you compiled the previous series, but not the revised v2 one you sent out. Because none of those patches add force_apst.
Signature · 1 line
Jens Axboe
Quoted 39 lines · Jens Axboe
Quoted 38 lines · Andy Lutomirski
On Apr 20, 2017 9:38 AM, "Jens Axboe" <[email protected] <mailto:[email protected]>> wrote:
On 04/20/2017 10:30 AM, Jens Axboe wrote:
> On 04/20/2017 10:29 AM, Keith Busch wrote:
>> On Thu, Apr 20, 2017@07:15:15PM +0300, Sagi Grimberg wrote:
>>>
>>>>> Hi Jens-
>>>>>
>>>>> These are just the quirk updates, split out. The patches are
>>>>> unchanged.
>>>>>
>>>>> I think that, even if we want to apply a broader quirk for 4.11, we >>>>> should still apply these so that we can cleanly revert the broader >>>>> quirk later. IOW, let's get the known regressions fixed before we >>>>> get too excited about the unknown regressions.
>>>>
>>>> This looks good to me, and 4.11 appropriate. I'll expedite this
>>>> through the block tree, if Keith/Sagi/Christoph agrees on this
>>>> being the right approach for 4.11.
>>>
>>> I'm perfectly fine with this going to 4.11
>>
>> All good with me as well.
>>
>> Reviewed-by: Keith Busch <keith.busch at intel.com <mailto:keith.busch at intel.com>> >
> Great, I have queued it up.Spoke too soon. Andy, did you compile this?
drivers/nvme/host/core.c: In function ?nvme_init_identify?:
drivers/nvme/host/core.c:1524:6: error: ?force_apst? undeclared (first use in this function)
if (force_apst&& (ctrl->quirks&NVME_QUIRK_NO_DEEPEST_PS)) {
^~~~~~~~~~
drivers/nvme/host/core.c:1524:6: note: each undeclared identifier is reported only once for each function it appears in
Quoted 8 lines
Quoted 4 lines
No, you did not.
I compiled the end result but not the middle. D'oh. Better version coming in an hour or two.
This is from the end-result. I think you compiled the previous series, but not the revised v2 one you sent out. Because none of those patches add
force_apst.
I was differently dumb. I did git rebase -i and rearranged everything, but I did git rebase --continue before running make, so I tested the buggy patch with the patch that added force_apst on top.
Anyway, this time I'm going to compile, boot, and play with the exact patches I send before I send them. (Sadly, removing the debug patch from the series has made this type of testing harder. Oh well.)
--Andy