[RESEND. PATCH] nvme/pci: Add APST quirk for Lenovo N60z laptop

WangYuli posted 1 patch 1 year, 5 months ago
There is a newer version of this series
drivers/nvme/host/pci.c | 7 +++++++
1 file changed, 7 insertions(+)
[RESEND. PATCH] nvme/pci: Add APST quirk for Lenovo N60z laptop
Posted by WangYuli 1 year, 5 months ago
There is a hardware power-saving problem with the Lenovo N60z
board. When turn it on and leave it for 30 minutes, there is a
20% chance that a nvme disk will not wake up until reboot.

Signed-off-by: hmy <huanglin@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
---
 drivers/nvme/host/pci.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 282d808400c5..1e0991667453 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2903,6 +2903,13 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
 			return NVME_QUIRK_SIMPLE_SUSPEND;
 	}
 
+	/*
+	 * NVMe SSD drops off the PCIe bus after system idle
+	 * for 30 minuites on a Lenovo N60z board.
+	 */
+	if (dmi_match(DMI_BOARD_NAME, "LXKT-ZXEG-N6"))
+		return NVME_QUIRK_NO_APST;
+
 	return 0;
 }
 
-- 
2.45.2
Re: [RESEND. PATCH] nvme/pci: Add APST quirk for Lenovo N60z laptop
Posted by Keith Busch 1 year, 5 months ago
On Sat, Jun 22, 2024 at 12:21:08PM +0800, WangYuli wrote:
> There is a hardware power-saving problem with the Lenovo N60z
> board. When turn it on and leave it for 30 minutes, there is a
> 20% chance that a nvme disk will not wake up until reboot.
> 
> Signed-off-by: hmy <huanglin@uniontech.com>
> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
> Signed-off-by: WangYuli <wangyuli@uniontech.com>
> ---
>  drivers/nvme/host/pci.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 282d808400c5..1e0991667453 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2903,6 +2903,13 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
>  			return NVME_QUIRK_SIMPLE_SUSPEND;
>  	}
>  
> +	/*
> +	 * NVMe SSD drops off the PCIe bus after system idle
> +	 * for 30 minuites on a Lenovo N60z board.
> +	 */
> +	if (dmi_match(DMI_BOARD_NAME, "LXKT-ZXEG-N6"))
> +		return NVME_QUIRK_NO_APST;

Based on your commit message, it sounds like the platform works the
majority of the time. Is it possible that NVME_QUIRK_NO_DEEPEST_PS is
sufficient for this? Or do you really need to disable it entirely? The
power usage differences can be meaningful.

Also, 30 minutes of idle is an eternity for APST to kick in, so I'm
curious if there's something else going on here or if the breakage
occurs earlier than that.
Re: [RESEND. PATCH] nvme/pci: Add APST quirk for Lenovo N60z laptop
Posted by WangYuli 1 year, 5 months ago
On 2024/6/25 05:49, Keith Busch wrote:
> Based on your commit message, it sounds like the platform works the
> majority of the time. Is it possible that NVME_QUIRK_NO_DEEPEST_PS is
> sufficient for this? Or do you really need to disable it entirely? The
> power usage differences can be meaningful.
>
> Also, 30 minutes of idle is an eternity for APST to kick in, so I'm
> curious if there's something else going on here or if the breakage
> occurs earlier than that.
>
When we "quiesce" a machine, some applications may not stop disk I/O 
promptly,
so the 30 minutes include the time to wait for these background 
processes to quiet down.

Thanks for the reminder. I've tested it and 'NVME_QUIRK_NO_DEEPEST_PS' 
is effective and
more appropriate than 'NVME_QUIRK_NO_APST'. I'll send a patch v2 to 
update my code.

-- 
WangYuli <wangyuli@uniontech.com>