Hello list, I recently updated the firmware on my Samsung 850 Pro from EXM01B6Q to EXM02B6Q. Now "fstrim -v /" causes SATA command timeouts related to TRIM with NCQ. This used to work before the firmware update and seems to be a regression with the newer firmware. I patched libata to allow me to specify a force option to enable the NO_NCQ_TRIM horkage. With such an option set on the command line, fstrim and normal operation work just fine. Attached is a syslog excerpt showing the timeouts. Also my small patch for libata force parameters. I suggest to blacklist NCQ TRIM for this Samsung SSD and firmware: Device Model: Samsung SSD 850 PRO 1TB Firmware Version: EXM02B6Q Other SSD sizes are probably also affected. Also, I would suggest to add a patch similar to the one attached to allow a user to quickly disable NCQ TRIM and also enable it for a blacklisted one (may be useful for testing, new firmware versions etc.). Best regards, Stefan -- Stefan Keller <linux-list@xxxxxxxxxxxxxxxx>
Feb 22 18:54:43 arch-imedes kernel: ata1.00: exception Emask 0x0 SAct 0x7800003f SErr 0x0 action 0x6 frozen Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/98:00:68:fd:66/00:00:2a:00:00/40 tag 0 ncq 77824 out res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/00:08:28:c1:67/02:00:2a:00:00/40 tag 1 ncq 262144 out res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/08:10:f8:4b:52/00:00:2a:00:00/40 tag 2 ncq 4096 out res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/18:18:98:65:52/00:00:2a:00:00/40 tag 3 ncq 12288 out res 40/00:00:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: SEND FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 64/01:20:00:00:00/00:00:00:00:00/a0 tag 4 ncq 512 out res 40/00:01:00:00:00/00:00:00:00:00/40 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/00:28:28:c3:67/02:00:2a:00:00/40 tag 5 ncq 262144 out res 40/00:01:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/00:d8:d0:ae:67/04:00:2a:00:00/40 tag 27 ncq 524288 out res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/00:e0:d0:b2:67/02:00:2a:00:00/40 tag 28 ncq 262144 out res 40/00:00:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/18:e8:e0:4b:52/00:00:2a:00:00/40 tag 29 ncq 12288 out res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/00:f0:10:3b:67/02:00:2a:00:00/40 tag 30 ncq 262144 out res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1: hard resetting link Feb 22 18:55:14 arch-imedes kernel: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out Feb 22 18:55:14 arch-imedes kernel: ata1.00: supports DRM functions and may not be fully accessible Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out Feb 22 18:55:14 arch-imedes kernel: ata1.00: supports DRM functions and may not be fully accessible Feb 22 18:55:14 arch-imedes kernel: ata1.00: configured for UDMA/133 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1: EH complete Feb 22 18:55:14 arch-imedes kernel: ata1.00: exception Emask 0x0 SAct 0x400 SErr 0x0 action 0x6 frozen Feb 22 18:55:14 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:55:14 arch-imedes kernel: ata1.00: cmd 61/00:50:28:c3:67/02:00:2a:00:00/40 tag 10 ncq 262144 out res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:55:14 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:55:14 arch-imedes kernel: ata1: hard resetting link Feb 22 18:55:14 arch-imedes kernel: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out Feb 22 18:55:14 arch-imedes kernel: ata1.00: supports DRM functions and may not be fully accessible Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out Feb 22 18:55:14 arch-imedes kernel: ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out Feb 22 18:55:14 arch-imedes kernel: ata1.00: supports DRM functions and may not be fully accessible Feb 22 18:55:14 arch-imedes kernel: ata1.00: configured for UDMA/133 Feb 22 18:55:14 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:55:14 arch-imedes kernel: ata1: EH complete Feb 22 18:56:15 arch-imedes kernel: ata1.00: exception Emask 0x0 SAct 0x14 SErr 0x0 action 0x6 frozen Feb 22 18:56:15 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:56:15 arch-imedes kernel: ata1.00: cmd 61/f8:10:f0:2c:68/00:00:2a:00:00/40 tag 2 ncq 126976 out res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:56:15 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:56:15 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:56:15 arch-imedes kernel: ata1.00: cmd 61/b8:20:d0:4d:68/01:00:2a:00:00/40 tag 4 ncq 225280 out res 40/00:ff:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:56:15 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:56:15 arch-imedes kernel: ata1: hard resetting link Feb 22 18:56:15 arch-imedes kernel: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) Feb 22 18:56:15 arch-imedes kernel: ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded Feb 22 18:56:15 arch-imedes kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out Feb 22 18:56:15 arch-imedes kernel: ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out Feb 22 18:56:15 arch-imedes kernel: ata1.00: supports DRM functions and may not be fully accessible Feb 22 18:56:15 arch-imedes kernel: ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded Feb 22 18:56:15 arch-imedes kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out Feb 22 18:56:15 arch-imedes kernel: ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out Feb 22 18:56:15 arch-imedes kernel: ata1.00: supports DRM functions and may not be fully accessible Feb 22 18:56:15 arch-imedes kernel: ata1.00: configured for UDMA/133 Feb 22 18:56:15 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:56:15 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:56:15 arch-imedes kernel: ata1: EH complete Feb 22 18:56:46 arch-imedes kernel: ata1.00: NCQ disabled due to excessive errors Feb 22 18:56:46 arch-imedes kernel: ata1.00: exception Emask 0x0 SAct 0x10 SErr 0x0 action 0x6 frozen Feb 22 18:56:46 arch-imedes kernel: ata1.00: failed command: WRITE FPDMA QUEUED Feb 22 18:56:46 arch-imedes kernel: ata1.00: cmd 61/08:20:80:e0:07/00:00:00:00:00/40 tag 4 ncq 4096 out res 40/00:ff:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) Feb 22 18:56:46 arch-imedes kernel: ata1.00: status: { DRDY } Feb 22 18:56:46 arch-imedes kernel: ata1: hard resetting link Feb 22 18:56:46 arch-imedes kernel: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) Feb 22 18:56:46 arch-imedes kernel: ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded Feb 22 18:56:46 arch-imedes kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out Feb 22 18:56:46 arch-imedes kernel: ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out Feb 22 18:56:46 arch-imedes kernel: ata1.00: supports DRM functions and may not be fully accessible Feb 22 18:56:46 arch-imedes kernel: ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded Feb 22 18:56:46 arch-imedes kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out Feb 22 18:56:46 arch-imedes kernel: ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out Feb 22 18:56:46 arch-imedes kernel: ata1.00: supports DRM functions and may not be fully accessible Feb 22 18:56:46 arch-imedes kernel: ata1.00: configured for UDMA/133 Feb 22 18:56:46 arch-imedes kernel: ata1.00: device reported invalid CHS sector 0 Feb 22 18:56:46 arch-imedes kernel: ata1: EH complete
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 485f7ea..1167bc9 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -6508,6 +6508,8 @@ static int __init ata_parse_force_one(char **cur, { "rstonce", .lflags = ATA_LFLAG_RST_ONCE }, { "atapi_dmadir", .horkage_on = ATA_HORKAGE_ATAPI_DMADIR }, { "disable", .horkage_on = ATA_HORKAGE_DISABLE }, + { "noqtrim", .horkage_on = ATA_HORKAGE_NO_NCQ_TRIM }, + { "qtrim", .horkage_off = ATA_HORKAGE_NO_NCQ_TRIM }, }; char *start = *cur, *p = *cur; char *id, *val, *endp;