[kernel/f20] Add patch to avoid using queued trim on M500 SSD (rhbz 1024002)
Josh Boyer
jwboyer at fedoraproject.org
Tue Dec 17 18:52:47 UTC 2013
commit 697a9f6954f39b502f606b2d8b522c7aa1a99763
Author: Josh Boyer <jwboyer at fedoraproject.org>
Date: Tue Dec 17 13:52:51 2013 -0500
Add patch to avoid using queued trim on M500 SSD (rhbz 1024002)
kernel.spec | 9 +++
..._NCQ_TRIM-and-apply-it-to-Micro-M500-SSDs.patch | 71 ++++++++++++++++++++
2 files changed, 80 insertions(+), 0 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 6ca9689..e314245 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -760,6 +760,9 @@ Patch25175: KVM-Improve-create-VCPU-parameter.patch
#rhbz 1025770
Patch25176: br-fix-use-of-rx_handler_data-in-code-executed-on-no.patch
+#rhbz 1024002
+Patch25177: libata-implement-ATA_HORKAGE_NO_NCQ_TRIM-and-apply-it-to-Micro-M500-SSDs.patch
+
# END OF PATCH DEFINITIONS
%endif
@@ -1475,6 +1478,9 @@ ApplyPatch KVM-Improve-create-VCPU-parameter.patch
#rhbz 1025770
ApplyPatch br-fix-use-of-rx_handler_data-in-code-executed-on-no.patch
+#rhbz 1024002
+ApplyPatch libata-implement-ATA_HORKAGE_NO_NCQ_TRIM-and-apply-it-to-Micro-M500-SSDs.patch
+
# END OF PATCH APPLICATIONS
%endif
@@ -2277,6 +2283,9 @@ fi
# ||----w |
# || ||
%changelog
+* Tue Dec 17 2013 Josh Boyer <jwboyer at fedoraproject.org>
+- Add patch to avoid using queued trim on M500 SSD (rhbz 1024002)
+
* Mon Dec 16 2013 Josh Boyer <jwboyer at fedoraproject.org>
- Fix host lockup in bridge code when starting from virt guest (rhbz 1025770)
diff --git a/libata-implement-ATA_HORKAGE_NO_NCQ_TRIM-and-apply-it-to-Micro-M500-SSDs.patch b/libata-implement-ATA_HORKAGE_NO_NCQ_TRIM-and-apply-it-to-Micro-M500-SSDs.patch
new file mode 100644
index 0000000..6d2c504
--- /dev/null
+++ b/libata-implement-ATA_HORKAGE_NO_NCQ_TRIM-and-apply-it-to-Micro-M500-SSDs.patch
@@ -0,0 +1,71 @@
+Bugzilla: 1024002
+Upstream-status: Should hit 3.13 and CC'd to 3.12 stable
+
+From f78dea064c5f7de07de4912a6e5136dbc443d614 Mon Sep 17 00:00:00 2001
+From: Marc Carino <marc.ceeeee at gmail.com>
+Date: Tue, 17 Dec 2013 02:15:53 +0000
+Subject: libata: implement ATA_HORKAGE_NO_NCQ_TRIM and apply it to Micro M500 SSDs
+
+Certain drives cannot handle queued TRIM commands properly, even
+though support is indicated in the IDENTIFY DEVICE buffer. This patch
+allows for disabling the commands for the affected drives and apply it
+to the Micron/Crucial M500 SSDs which exhibit incorrect protocol
+behavior when issued queued TRIM commands, which could lead to silent
+data corruption.
+
+tj: Merged two unnecessarily split patches and made minor edits
+ including shortening horkage name.
+
+Signed-off-by: Marc Carino <marc.ceeeee at gmail.com>
+Signed-off-by: Tejun Heo <tj at kernel.org>
+Link: http://lkml.kernel.org/g/1387246554-7311-1-git-send-email-marc.ceeeee@gmail.com
+Cc: stable at vger.kernel.org # 3.12+
+---
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
+index ff01584..1393a58 100644
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -2149,9 +2149,16 @@ static int ata_dev_config_ncq(struct ata_device *dev,
+ "failed to get NCQ Send/Recv Log Emask 0x%x\n",
+ err_mask);
+ } else {
++ u8 *cmds = dev->ncq_send_recv_cmds;
++
+ dev->flags |= ATA_DFLAG_NCQ_SEND_RECV;
+- memcpy(dev->ncq_send_recv_cmds, ap->sector_buf,
+- ATA_LOG_NCQ_SEND_RECV_SIZE);
++ memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_SEND_RECV_SIZE);
++
++ if (dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) {
++ ata_dev_dbg(dev, "disabling queued TRIM support\n");
++ cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &=
++ ~ATA_LOG_NCQ_SEND_RECV_DSM_TRIM;
++ }
+ }
+ }
+
+@@ -4205,6 +4212,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
+ { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER },
+ { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
+
++ /* devices that don't properly handle queued TRIM commands */
++ { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
++ { "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
++
+ /* End Marker */
+ { }
+ };
+diff --git a/include/linux/libata.h b/include/linux/libata.h
+index 0e23c26..9b50337 100644
+--- a/include/linux/libata.h
++++ b/include/linux/libata.h
+@@ -418,6 +418,7 @@ enum {
+ ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */
+ ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */
+ ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */
++ ATA_HORKAGE_NO_NCQ_TRIM = (1 << 19), /* don't use queued TRIM */
+
+ /* DMA mask for user DMA control: User visible values; DO NOT
+ renumber */
+--
+cgit v0.9.2
More information about the scm-commits
mailing list