Skip to contentSkip to conversation

libata: Add ATA_HORKAGE_NO_NCQ_ON_AMD for Samsung 860 and 870 SSD.

PATCH [email protected] 4 participants 10 messages Sep 1, 2021 – Sep 2, 2021 libata

lore
Share & tools
lore
#0 lore raw

(Sorry for not doing a proper reply)

Hello,
Noob here.
I have a Samsung 860 Pro connected to a AMD X570 chipset mainboard and it just works flawlessly on 5.13 and 5.14.
Are you sure that *every* 860/870 is concerned by this problem on *every* AMD controller? Isn't this too restrictive?
Or am I simply missing something?

Thanks,
Tor

#1 lore raw
Quoted 9 lines · On 2021/09/01 16:38, [email protected] wrote:

(Sorry for not doing a proper reply)

Hello,
Noob here.
I have a Samsung 860 Pro connected to a AMD X570 chipset mainboard and it just works flawlessly on 5.13 and 5.14.
Are you sure that *every* 860/870 is concerned by this problem on *every* AMD controller? Isn't this too restrictive?
Or am I simply missing something?

Is you drive being initialized with NCQ enabled ?

cat /sys/block/sdX/device/queue_depth ?

Quoted 4 lines

Thanks,
Tor

Signature · 2 lines
Damien Le Moal
Western Digital Research
author
#2 lore raw
Quoted 11 lines · Damien Le Moal
Quoted 9 lines · On 2021/09/01 16:38, [email protected] wrote:

(Sorry for not doing a proper reply)

Hello,
Noob here.
I have a Samsung 860 Pro connected to a AMD X570 chipset mainboard and it just works flawlessly on 5.13 and 5.14.
Are you sure that *every* 860/870 is concerned by this problem on *every* AMD controller? Isn't this too restrictive?
Or am I simply missing something?

Quoted 3 lines

Is you drive being initialized with NCQ enabled ?

cat /sys/block/sdX/device/queue_depth ?

Samsung 860 Pro:

$ cat /sys/block/sda/device/queue_depth

32

Samsung 860 Evo:

$ cat /sys/block/sdb/device/queue_depth

32

Quoted 7 lines
Quoted 5 lines

Thanks,
Tor

#3 lore raw

Tor,

Quoted 9 lines

Samsung 860 Pro:

$ cat /sys/block/sda/device/queue_depth

32

Samsung 860 Evo:

$ cat /sys/block/sdb/device/queue_depth

32

Please also provide the output of:

# grep . /sys/class/ata_device/dev*/trim
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#4 lore raw
Quoted 11 lines

Martin K. Petersen <[email protected]> hat am 01.09.2021 20:58 geschrieben:

Tor,

Quoted 5 lines

Samsung 860 Pro:

$ cat /sys/block/sda/device/queue_depth

32

Quoted 8 lines
Quoted 4 lines

Samsung 860 Evo:

$ cat /sys/block/sdb/device/queue_depth

32

Please also provide the output of:

# grep . /sys/class/ata_device/dev*/trim

/sys/class/ata_device/dev1.0/trim:unsupported
/sys/class/ata_device/dev2.0/trim:unsupported
/sys/class/ata_device/dev3.0/trim:queued
/sys/class/ata_device/dev4.0/trim:queued
/sys/class/ata_device/dev5.0/trim:unsupported

According to the symlinks in /dev/disk/by-path,
3.0 corresponds to /dev/sda (860 Pro) and
4.0 corresponds to /dev/sdb (860 Evo).

Quoted 3 lines
Signature · 2 lines
-- 
Martin K. Petersen	Oracle Linux Engineering
#5 lore raw

Tor,

Quoted 11 lines
Quoted 1 line
# grep . /sys/class/ata_device/dev*/trim

/sys/class/ata_device/dev1.0/trim:unsupported
/sys/class/ata_device/dev2.0/trim:unsupported
/sys/class/ata_device/dev3.0/trim:queued
/sys/class/ata_device/dev4.0/trim:queued
/sys/class/ata_device/dev5.0/trim:unsupported

According to the symlinks in /dev/disk/by-path,
3.0 corresponds to /dev/sda (860 Pro) and
4.0 corresponds to /dev/sdb (860 Evo).

Good data! Thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#6 lore raw
In reply to [email protected]

Hi Tor,

Quoted 8 lines · On 9/1/21 9:37 AM, [email protected] wrote:

(Sorry for not doing a proper reply)

Hello,
Noob here.
I have a Samsung 860 Pro connected to a AMD X570 chipset mainboard and it just works flawlessly on 5.13 and 5.14.
Are you sure that *every* 860/870 is concerned by this problem on *every* AMD controller?

I am pretty sure that every 860 / 870 EVO is affected, I am not sure if the PRO is also affected.

As for *every* AMD controller, chances are that more recent AMD controllers are fine.

We have been trying to resolve various issues with this combo for a long time now, see:

https://bugzilla.kernel.org/show_bug.cgi?id=201693
https://bugzilla.kernel.org/show_bug.cgi?id=203475

Quoted 2 lines

Isn't this too restrictive?
Or am I simply missing something?

The problem is that when users are hit by this they end up with a non functional system and even fs / data corruption. Where as OTOH disabling NCQ leads to a (significant) performance degradation but affected systems will still work fine.

So I believe that it is best to err on the safe side here and accept the performance degradation as a trade-of for fixing the fs / data corruption.

With that said, I do believe that we should allow re-enabling ncq on this combo through libata.force on the kernel cmdline by adding this extra bit to the patch:

drivers/ata/libata-core.c +2 -0
@@ -6136,6 +6136,8 @@ static int __init ata_parse_force_one(char **cur,
 		{ "ncq",	.horkage_off	= ATA_HORKAGE_NONCQ },
 		{ "noncqtrim",	.horkage_on	= ATA_HORKAGE_NO_NCQ_TRIM },
 		{ "ncqtrim",	.horkage_off	= ATA_HORKAGE_NO_NCQ_TRIM },
+		{ "noncqamd",	.horkage_on	= ATA_HORKAGE_NO_NCQ_ON_AMD },
+		{ "ncqamd",	.horkage_off	= ATA_HORKAGE_NO_NCQ_ON_AMD },
 		{ "dump_id",	.horkage_on	= ATA_HORKAGE_DUMP_ID },
 		{ "pio0",	.xfer_mask	= 1 << (ATA_SHIFT_PIO + 0) },
 		{ "pio1",	.xfer_mask	= 1 << (ATA_SHIFT_PIO + 1) },

And I will also add a comment to both linked bugs to see if we can maybe exclude the pro models from this quirk and if we can maybe narrow it down to a subset of the AMD SATA controllers.

But that narrowing down is probably best done as a follow up fix, while just going with this "err on the safe side" approach for now.

Regards,

Hans

#7 lore raw

Hi,

Quoted 12 lines · Hans de Goede

Hi Tor,

Quoted 8 lines · On 9/1/21 9:37 AM, [email protected] wrote:

(Sorry for not doing a proper reply)

Hello,
Noob here.
I have a Samsung 860 Pro connected to a AMD X570 chipset mainboard and it just works flawlessly on 5.13 and 5.14.
Are you sure that *every* 860/870 is concerned by this problem on *every* AMD controller?

Quoted 2 lines

I am pretty sure that every 860 / 870 EVO is affected, I am not sure if the PRO is also affected.

So while reading https://bugzilla.kernel.org/show_bug.cgi?id=201693
again to add a comment asking if anyone was seeing this on a pro to I found existing comments of both queued-trims being an issue on the 860 pro, as well as the 860 pro having issues with some AMD sata controllers.

So it seems safe to say that the 860 pro has the same issues as the 860 and 870 evo models. Chances are you don't have discard support enabled causing you to not see the queued-trim issues (which means you also won't see any difference from disabling support for queued-trim commands).

So this just leaves your question of:

"concerned by this problem on *every* AMD controller?"

Where "this problem" is needing to completely disable NCQ and I guess the answer is no, not every AMD controller is affected. Still the plan is to err on the safe side for now, allowing overriding this from the kernel cmdline with:

libata.force=ncqamd

I will add a comment to:

https://bugzilla.kernel.org/show_bug.cgi?id=201693

Asking for PCI-ids of the controllers where people are seeing this and then maybe we can narrow down the "AMD" check in a future follow up patch.

Regards,

Hans

#8 lore raw
Quoted 28 lines

Hans de Goede <[email protected]> hat am 01.09.2021 11:38 geschrieben:

Hi,

Quoted 12 lines · Hans de Goede

Hi Tor,

Quoted 8 lines · On 9/1/21 9:37 AM, [email protected] wrote:

(Sorry for not doing a proper reply)

Hello,
Noob here.
I have a Samsung 860 Pro connected to a AMD X570 chipset mainboard and it just works flawlessly on 5.13 and 5.14.
Are you sure that *every* 860/870 is concerned by this problem on *every* AMD controller?

Quoted 2 lines

I am pretty sure that every 860 / 870 EVO is affected, I am not sure if the PRO is also affected.

So while reading https://bugzilla.kernel.org/show_bug.cgi?id=201693
again to add a comment asking if anyone was seeing this on a pro to I found existing comments of both queued-trims being an issue on the 860 pro, as well as the 860 pro having issues with some AMD sata controllers.

Quoted 5 lines

So it seems safe to say that the 860 pro has the same issues as the 860 and 870 evo models. Chances are you don't have discard support enabled causing you to not see the queued-trim issues (which means you also won't see any difference from disabling support for queued-trim commands).

Thanks for your answer, Hans.

If you mean the "discard" mount option, then yes, you're correct, I don't use this because some (apparently) knowledgeable people recommended against using it especially on LUKS partitions. I don't know whether that's true though, it might be outdated. I do however do manual TRIMs with "fstrim".

Quoted 11 lines

So this just leaves your question of:

"concerned by this problem on *every* AMD controller?"

Where "this problem" is needing to completely disable NCQ and I guess the answer is no, not every AMD controller is affected. Still the plan is to err on the safe side for now, allowing overriding this from the kernel cmdline with:

libata.force=ncqamd

I agree to do it in a safe way, that sounds like a good solution.

Quoted 8 lines

I will add a comment to:

https://bugzilla.kernel.org/show_bug.cgi?id=201693

Asking for PCI-ids of the controllers where people are seeing this and then maybe we can narrow down the "AMD" check in a future follow up patch.

I can send you PCI and device IDs later if it helps.

Quoted 4 lines

Regards,

Hans

author
#9 lore raw
In reply to Hans de Goede
Quoted 41 lines · Hans de Goede

Hi,

Quoted 12 lines · Hans de Goede

Hi Tor,

Quoted 8 lines · On 9/1/21 9:37 AM, [email protected] wrote:

(Sorry for not doing a proper reply)

Hello,
Noob here.
I have a Samsung 860 Pro connected to a AMD X570 chipset mainboard and it just works flawlessly on 5.13 and 5.14.
Are you sure that *every* 860/870 is concerned by this problem on *every* AMD controller?

Quoted 2 lines

I am pretty sure that every 860 / 870 EVO is affected, I am not sure if the PRO is also affected.

So while reading https://bugzilla.kernel.org/show_bug.cgi?id=201693
again to add a comment asking if anyone was seeing this on a pro to I found existing comments of both queued-trims being an issue on the 860 pro, as well as the 860 pro having issues with some AMD sata controllers.

So it seems safe to say that the 860 pro has the same issues as the 860 and 870 evo models. Chances are you don't have discard support enabled causing you to not see the queued-trim issues (which means you also won't see any difference from disabling support for queued-trim commands).

So this just leaves your question of:

"concerned by this problem on *every* AMD controller?"

Where "this problem" is needing to completely disable NCQ and I guess the answer is no, not every AMD controller is affected. Still the plan is to err on the safe side for now, allowing overriding this from the kernel cmdline with:

libata.force=ncqamd

Quoted 7 lines

I will add a comment to:

https://bugzilla.kernel.org/show_bug.cgi?id=201693

Asking for PCI-ids of the controllers where people are seeing this and then maybe we can narrow down the "AMD" check in a future follow up patch.

$ lspci -nn | grep -i sata

06:00.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7901] (rev 51)
07:00.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7901] (rev 51)

Both Samsung 860 Pro and 860 Evo are connected to these.

Quoted 5 lines

Regards,

Hans