All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD
@ 2024-01-13 21:30 Saúl Valdelvira
  2024-01-15  8:57 ` Sagi Grimberg
  2024-01-15 12:48 ` Sagi Grimberg
  0 siblings, 2 replies; 9+ messages in thread
From: Saúl Valdelvira @ 2024-01-13 21:30 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg; +Cc: linux-nvme

The WDC PC SN520 SSD hangs on boot when APST is enabled, unless the
nvme_core.default_ps_max_latency_us kernel parameter is set to a lower
value. Add an entry for this drive to the 'core_quirks' table with the
NO_DEEPEST_PS quirk to fix that.

Signed-off-by: Saúl Valdelvira <saul@saulv.es>
---
This patch fixes an issue I've always had when running Linux on my
Acer Extensa 215-22 laptop. I think it might be useful to other people
with the same hardware as mine.
This is the first time I submit a patch to the kernel, so I hope I did
everything correctly and that I'm not wasting your time.

 drivers/nvme/host/core.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 0af612387083..496563704c63 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2626,7 +2626,17 @@ static const struct nvme_core_quirk_entry core_quirks[] = {
 		.quirks = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
 			  NVME_QUIRK_NO_DEEPEST_PS |
 			  NVME_QUIRK_IGNORE_DEV_SUBNQN,
-	}
+	},
+	{
+		/*
+		 * This SanDisk SSD hangs on boot unless the
+		 * nvme_core.default_ps_max_latency_us kernel parameter is
+		 * set to a lower value.
+		 */
+		.vid = 0x15b7,
+		.mn = "WDC PC SN520 SDAPNUW-512G-1014",
+		.quirks = NVME_QUIRK_NO_DEEPEST_PS,
+	},
 };

 /* match is null-terminated but idstr is space-padded. */
--
2.43.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD
  2024-01-13 21:30 [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD Saúl Valdelvira
@ 2024-01-15  8:57 ` Sagi Grimberg
  2024-01-15 12:24   ` Saúl Valdelvira
  2024-01-15 12:48 ` Sagi Grimberg
  1 sibling, 1 reply; 9+ messages in thread
From: Sagi Grimberg @ 2024-01-15  8:57 UTC (permalink / raw)
  To: Saúl Valdelvira, Keith Busch, Jens Axboe, Christoph Hellwig
  Cc: linux-nvme


> The WDC PC SN520 SSD hangs on boot when APST is enabled, unless the
> nvme_core.default_ps_max_latency_us kernel parameter is set to a lower
> value. Add an entry for this drive to the 'core_quirks' table with the
> NO_DEEPEST_PS quirk to fix that.
> 
> Signed-off-by: Saúl Valdelvira <saul@saulv.es>
> ---
> This patch fixes an issue I've always had when running Linux on my
> Acer Extensa 215-22 laptop. I think it might be useful to other people
> with the same hardware as mine.
> This is the first time I submit a patch to the kernel, so I hope I did
> everything correctly and that I'm not wasting your time.

Does this issue have a bugzilla link?

> 
>   drivers/nvme/host/core.c | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 0af612387083..496563704c63 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2626,7 +2626,17 @@ static const struct nvme_core_quirk_entry core_quirks[] = {
>   		.quirks = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
>   			  NVME_QUIRK_NO_DEEPEST_PS |
>   			  NVME_QUIRK_IGNORE_DEV_SUBNQN,
> -	}
> +	},
> +	{
> +		/*
> +		 * This SanDisk SSD hangs on boot unless the
> +		 * nvme_core.default_ps_max_latency_us kernel parameter is
> +		 * set to a lower value.
> +		 */
> +		.vid = 0x15b7,
> +		.mn = "WDC PC SN520 SDAPNUW-512G-1014",
> +		.quirks = NVME_QUIRK_NO_DEEPEST_PS,
> +	},
>   };
> 
>   /* match is null-terminated but idstr is space-padded. */
> --
> 2.43.0
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD
  2024-01-15  8:57 ` Sagi Grimberg
@ 2024-01-15 12:24   ` Saúl Valdelvira
  0 siblings, 0 replies; 9+ messages in thread
From: Saúl Valdelvira @ 2024-01-15 12:24 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Keith Busch, Jens Axboe, Christoph Hellwig, linux-nvme

On Mon, Jan 15, 2024 at 10:57:50AM +0200, Sagi Grimberg wrote:
> > This patch fixes an issue I've always had when running Linux on my
> > Acer Extensa 215-22 laptop. I think it might be useful to other people
> > with the same hardware as mine.
> > This is the first time I submit a patch to the kernel, so I hope I did
> > everything correctly and that I'm not wasting your time.
>
> Does this issue have a bugzilla link?
>
As far as I know, it doesn't.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD
  2024-01-13 21:30 [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD Saúl Valdelvira
  2024-01-15  8:57 ` Sagi Grimberg
@ 2024-01-15 12:48 ` Sagi Grimberg
  2024-01-15 13:44   ` Saúl Valdelvira
  1 sibling, 1 reply; 9+ messages in thread
From: Sagi Grimberg @ 2024-01-15 12:48 UTC (permalink / raw)
  To: Saúl Valdelvira, Keith Busch, Jens Axboe, Christoph Hellwig
  Cc: linux-nvme


> The WDC PC SN520 SSD hangs on boot when APST is enabled, unless the
> nvme_core.default_ps_max_latency_us kernel parameter is set to a lower
> value. Add an entry for this drive to the 'core_quirks' table with the
> NO_DEEPEST_PS quirk to fix that.

Is this specific to a certain fw version? otherwise this should perhaps
live in the device ids table in pci.c ?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD
  2024-01-15 12:48 ` Sagi Grimberg
@ 2024-01-15 13:44   ` Saúl Valdelvira
  2024-01-15 14:28     ` Sagi Grimberg
  0 siblings, 1 reply; 9+ messages in thread
From: Saúl Valdelvira @ 2024-01-15 13:44 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Keith Busch, Jens Axboe, Christoph Hellwig, linux-nvme

On Mon, Jan 15, 2024 at 02:48:11PM +0200, Sagi Grimberg wrote:
> Is this specific to a certain fw version? otherwise this should perhaps
> live in the device ids table in pci.c ?

I'm not sure. I'm trying to check if there's a newer firmware version
for this drive, but the manufacturer's page [1] says "Firmware updates
are automatically handled by the Western Digital SSD Dashboard app and
apply to Windows exclusive systems", so I don't know if I'll be able to
update the firmware to check that.

About pci.c, I also tried adding an entry there like this:
    { PCI_DEVICE(0x15b7,0x5003),
              .driver_data = NVME_QUIRK_NO_DEEPEST_PS },

However, it didn't fix the problem. The only way I've managed it to work is
by adding the entry to the core_quirks table in core.c

[1] https://support-es.wd.com/app/answers/detailweb/a_id/47188/~/p%C3%A1gina-de-soporte-e-informaci%C3%B3n-de-western-digital-pc-sn520-nvme-ssd


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD
  2024-01-15 13:44   ` Saúl Valdelvira
@ 2024-01-15 14:28     ` Sagi Grimberg
  2024-01-15 14:35       ` Saúl Valdelvira
  0 siblings, 1 reply; 9+ messages in thread
From: Sagi Grimberg @ 2024-01-15 14:28 UTC (permalink / raw)
  To: Saúl Valdelvira
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, linux-nvme


>> Is this specific to a certain fw version? otherwise this should perhaps
>> live in the device ids table in pci.c ?
> 
> I'm not sure. I'm trying to check if there's a newer firmware version
> for this drive, but the manufacturer's page [1] says "Firmware updates
> are automatically handled by the Western Digital SSD Dashboard app and
> apply to Windows exclusive systems", so I don't know if I'll be able to
> update the firmware to check that.
> 
> About pci.c, I also tried adding an entry there like this:
>      { PCI_DEVICE(0x15b7,0x5003),
>                .driver_data = NVME_QUIRK_NO_DEEPEST_PS },
> 
> However, it didn't fix the problem. The only way I've managed it to work is
> by adding the entry to the core_quirks table in core.c

Strange. Not sure why it wouldn't work unless the vendor/device numbers
are off...

> 
> [1] https://support-es.wd.com/app/answers/detailweb/a_id/47188/~/p%C3%A1gina-de-soporte-e-informaci%C3%B3n-de-western-digital-pc-sn520-nvme-ssd


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD
  2024-01-15 14:28     ` Sagi Grimberg
@ 2024-01-15 14:35       ` Saúl Valdelvira
  2024-01-16  8:09         ` Sagi Grimberg
  0 siblings, 1 reply; 9+ messages in thread
From: Saúl Valdelvira @ 2024-01-15 14:35 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Keith Busch, Jens Axboe, Christoph Hellwig, linux-nvme

On Mon, Jan 15, 2024 at 04:28:36PM +0200, Sagi Grimberg wrote:
>
> Strange. Not sure why it wouldn't work unless the vendor/device numbers
> are off...
>
I got the numbers from the this command "lspci -nn | grep -i nvme"
The output was :
"04:00.0 Non-Volatile memory controller [0108]: Sandisk Corp WD Blue
    SN500 / PC SN520 [15b7:5003] (rev 01)"

So vendor id is 15b7 and device id is 5003, am I right?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD
  2024-01-15 14:35       ` Saúl Valdelvira
@ 2024-01-16  8:09         ` Sagi Grimberg
  2024-01-16  8:37           ` Saúl Valdelvira
  0 siblings, 1 reply; 9+ messages in thread
From: Sagi Grimberg @ 2024-01-16  8:09 UTC (permalink / raw)
  To: Saúl Valdelvira
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, linux-nvme


>> Strange. Not sure why it wouldn't work unless the vendor/device numbers
>> are off...
>>
> I got the numbers from the this command "lspci -nn | grep -i nvme"
> The output was :
> "04:00.0 Non-Volatile memory controller [0108]: Sandisk Corp WD Blue
>      SN500 / PC SN520 [15b7:5003] (rev 01)"
> 
> So vendor id is 15b7 and device id is 5003, am I right?
> 

Seems so, but it doesn't makes sense to me why it doesn't work.

Do you have force_apst enabled?
What is the ctrl npss value?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD
  2024-01-16  8:09         ` Sagi Grimberg
@ 2024-01-16  8:37           ` Saúl Valdelvira
  0 siblings, 0 replies; 9+ messages in thread
From: Saúl Valdelvira @ 2024-01-16  8:37 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Keith Busch, Jens Axboe, Christoph Hellwig, linux-nvme

On Tue, Jan 16, 2024 at 10:09:47AM +0200, Sagi Grimberg wrote:
>
> Seems so, but it doesn't makes sense to me why it doesn't work.
>
> Do you have force_apst enabled?
I think I don't. At least I haven't manually set it.

> What is the ctrl npss value?
npss: 4
Got the value with "nvme id-ctrl /dev/nvme0n1"


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-01-16  8:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-13 21:30 [PATCH] nvme: Add quirk to fix hang issue on SanDisk SSD Saúl Valdelvira
2024-01-15  8:57 ` Sagi Grimberg
2024-01-15 12:24   ` Saúl Valdelvira
2024-01-15 12:48 ` Sagi Grimberg
2024-01-15 13:44   ` Saúl Valdelvira
2024-01-15 14:28     ` Sagi Grimberg
2024-01-15 14:35       ` Saúl Valdelvira
2024-01-16  8:09         ` Sagi Grimberg
2024-01-16  8:37           ` Saúl Valdelvira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.