All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Carino <marc.ceeeee@gmail.com>
To: linux-ide@vger.kernel.org, tj@kernel.org
Cc: marc.ceeeee@gmail.com, mykola.dvornik@gmail.com
Subject: [PATCH 2/2] libata: disable queued TRIMs for Micron M500 SSDs
Date: Mon, 16 Dec 2013 18:15:54 -0800	[thread overview]
Message-ID: <1387246554-7311-3-git-send-email-marc.ceeeee@gmail.com> (raw)
In-Reply-To: <1387246554-7311-1-git-send-email-marc.ceeeee@gmail.com>

The Micron/Crucial M500 SSDs exhibit incorrect protocol behavior when
issuing queued TRIM commands, which could lead to silent data corruption.

Disable issuance of queued TRIM commands for the affected drives.

Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
---
 drivers/ata/libata-core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index ff01584..715ba06 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2152,6 +2152,13 @@ static int ata_dev_config_ncq(struct ata_device *dev,
 			dev->flags |= ATA_DFLAG_NCQ_SEND_RECV;
 			memcpy(dev->ncq_send_recv_cmds, ap->sector_buf,
 				ATA_LOG_NCQ_SEND_RECV_SIZE);
+
+			if (dev->horkage & ATA_HORKAGE_BROKEN_QUEUED_TRIM) {
+				ata_dev_dbg(dev,
+					    "disabling queued TRIM support\n");
+				dev->ncq_send_recv_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_BROKEN_QUEUED_TRIM, },
+	{ "Crucial_CT???M500SSD1",	NULL,	ATA_HORKAGE_BROKEN_QUEUED_TRIM, },
+
 	/* End Marker */
 	{ }
 };
-- 
1.8.1.3


  parent reply	other threads:[~2013-12-17  2:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17  2:15 [PATCH 0/2] libata: disable queued trim for Micron M500 SSDs Marc Carino
2013-12-17  2:15 ` [PATCH 1/2] libata: add horkage flag to disable issuance of queued TRIM commands Marc Carino
2013-12-17  2:15 ` Marc Carino [this message]
2013-12-17 12:06 ` [PATCH] libata: implement ATA_HORKAGE_NO_NCQ_TRIM and apply it to Micro M500 SSDs Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1387246554-7311-3-git-send-email-marc.ceeeee@gmail.com \
    --to=marc.ceeeee@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=mykola.dvornik@gmail.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.