Skip to contentSkip to conversation

ata: disable LPM on some WDC drives

PATCH Applied Niklas Cassel 3 participants 5 messages Jul 28 – Jul 29 libata

lore
Share & tools
lore

Niklas Cassel

author maintainer
#0 lore raw

cover ata: disable LPM on some WDC drives

Hello there,

This disables LPM on some WDC drives, which, according to user reports, have issues with LPM.

Kind regards,
Niklas

Niklas Cassel (2):
ata: libata-core: Disable LPM on some WD drives
ata: libata-core: Disable LPM on WD Green 2.5 480GB

 drivers/ata/libata-core.c | 9 +++++++++
 1 file changed, 9 insertions(+)
Signature · 1 line
2.55.0
author maintainer
#1 lore raw

PATCH 1/2 ata: libata-core: Disable LPM on some WD drives

According to a user report WDC WD100EFGX-68CPLN0 and WDC WD102KFBX-68M95N0 have problems with LPM.

---
 drivers/ata/libata-core.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/ata/libata-core.c +8 -0
index c43bd28b20b1..15781b4f0489 100644
@@ -4413,6 +4413,14 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
 	{ "WDC WD3000JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
 	{ "WDC WD3200JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
 
+	/*
+	 * WD drives with LPM issues (irrespective of supported SATA speeds).
+	 * (Unlike ATA_QUIRK_WD_BROKEN_LPM, which is only applied if the drive
+	 * exposes SATA Gen1 speed support, and SATA Gen1 speed support only.)
+	 */
+	{ "WDC WD100EFGX-68CPLN0",	NULL,	ATA_QUIRK_NOLPM },
+	{ "WDC WD102KFBX-68M95N0",	NULL,	ATA_QUIRK_NOLPM },
+
 	/*
 	 * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY
 	 * log page is accessed. Ensure we never ask for this log page with
Signature · 1 line
2.55.0
#2 lore raw

Re: [PATCH 1/2] ata: libata-core: Disable LPM on some WD drives

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Incorrect loop iteration in ata_scsi_lpm_supported completely ignores ATA_QUIRK_NOLPM for devices attached via a Port Multiplier. --

--- Patch [1]: [PATCH 1/2] ata: libata-core: Disable LPM on some WD drives --- commit ddcafc7d1d056ed46964475cc9dcb5abcb0d3b87
Author: Niklas Cassel <[email protected]>

ata: libata-core: Disable LPM on some WD drives

This commit adds the ATA_QUIRK_NOLPM quirk for specific WD drives that have problems with Link Power Management (LPM).

Quoted 5 lines
drivers/ata/libata-core.c +0 -0
index c43bd28b20b1a..15781b4f04897 100644

drivers/ata/libata-core.c static const struct ata_dev_quirks_entry __ata_dev_quirks[] = { · line 4422

Quoted 10 lines
drivers/ata/libata-core.c +7 -0
@@ -4413,6 +4413,14 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
 	{ "WDC WD3000JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
 	{ "WDC WD3200JD-*",		NULL,	ATA_QUIRK_WD_BROKEN_LPM },
 
+	/*
+	 * WD drives with LPM issues (irrespective of supported SATA speeds).
+	 * (Unlike ATA_QUIRK_WD_BROKEN_LPM, which is only applied if the drive
+	 * exposes SATA Gen1 speed support, and SATA Gen1 speed support only.)
+	 */
+	{ "WDC WD100EFGX-68CPLN0",	NULL,	ATA_QUIRK_NOLPM },
+	{ "WDC WD102KFBX-68M95N0",	NULL,	ATA_QUIRK_NOLPM },

[Severity: High]
This is a pre-existing issue, but will these devices still experience LPM issues if they are attached via a Port Multiplier?

Looking at ata_scsi_lpm_supported() in drivers/ata/libata-sata.c:

static bool ata_scsi_lpm_supported(struct ata_port *ap)

{
	struct ata_link *link;
	struct ata_device *dev;

	if ((ap->flags & ATA_FLAG_NO_LPM) || !ap->ops->set_lpm)
		return false;

	ata_for_each_link(link, ap, EDGE) {
		ata_for_each_dev(dev, &ap->link, ENABLED) {
			if (dev->quirks & ATA_QUIRK_NOLPM)
				return false;
		}
	}

	return true;
}

The outer loop correctly iterates over all links, including PMP links, but the inner loop iterates over &ap->link instead of the current link being evaluated.

Could this cause the code to repeatedly check the host link's devices while entirely ignoring devices on PMP links? If so, the ATA_QUIRK_NOLPM quirk might be bypassed for these buggy drives when they are attached via a Port Multiplier and power management is configured.

Quoted 4 lines
drivers/ata/libata-core.c +1 -0
+
 	/*
 	 * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY
 	 * log page is accessed. Ensure we never ask for this log page with
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author maintainer
#3 lore raw

PATCH 2/2 ata: libata-core: Disable LPM on WD Green 2.5 480GB

In reply to Niklas Cassel

According to a user report, the WD Green 2.5 480GB has problems with LPM.

---
 drivers/ata/libata-core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/ata/libata-core.c +1 -0
index 15781b4f0489..961d03fbc4d9 100644
@@ -4420,6 +4420,7 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
 	 */
 	{ "WDC WD100EFGX-68CPLN0",	NULL,	ATA_QUIRK_NOLPM },
 	{ "WDC WD102KFBX-68M95N0",	NULL,	ATA_QUIRK_NOLPM },
+	{ "WD Green 2.5 480GB",		NULL,	ATA_QUIRK_NOLPM },
 
 	/*
 	 * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY
Signature · 1 line
2.55.0
maintainer Applied
#4 lore raw
In reply to Niklas Cassel
Quoted 5 lines · Niklas Cassel

Hello there,

This disables LPM on some WDC drives, which, according to user reports, have issues with LPM.

Quoted 7 lines

Kind regards,
Niklas

Niklas Cassel (2):
ata: libata-core: Disable LPM on some WD drives
ata: libata-core: Disable LPM on WD Green 2.5 480GB

Applied to for-7.2-fixes. Thanks!

Signature · 2 lines
Damien Le Moal
Western Digital Research