Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Aug 2019 17:56:17 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r350767 - in stable/11/sys/cam: ata scsi
Message-ID:  <201908081756.x78HuHJR091677@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Aug  8 17:56:17 2019
New Revision: 350767
URL: https://svnweb.freebsd.org/changeset/base/350767

Log:
  MFC r343814 (by imp): Add quirk for Sansisk X400 drives
  
  Certain versions of Sandisk x400 firmware can hang under extremely
  heavly load of large I/Os for prolonged periods of time. Newer /
  current versions work fine, and should be used where possible. Where
  not possible, this quirk ensures that I/O requests are limited to 128k
  to avoids the bug, even under extreme load. Since MAXPHYS is 128k,
  only users with custom kernels are at risk on the older firmware.
  Once all known users of the older firmware have upgraded, this quirk
  will be removed.

Modified:
  stable/11/sys/cam/ata/ata_da.c
  stable/11/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ata/ata_da.c
==============================================================================
--- stable/11/sys/cam/ata/ata_da.c	Thu Aug  8 17:55:19 2019	(r350766)
+++ stable/11/sys/cam/ata/ata_da.c	Thu Aug  8 17:56:17 2019	(r350767)
@@ -117,7 +117,8 @@ typedef enum {
 	ADA_Q_NCQ_TRIM_BROKEN	= 0x02,
 	ADA_Q_LOG_BROKEN	= 0x04,
 	ADA_Q_SMR_DM		= 0x08,
-	ADA_Q_NO_TRIM		= 0x10
+	ADA_Q_NO_TRIM		= 0x10,
+	ADA_Q_128KB		= 0x20
 } ada_quirks;
 
 #define ADA_Q_BIT_STRING	\
@@ -126,7 +127,8 @@ typedef enum {
 	"\002NCQ_TRIM_BROKEN"	\
 	"\003LOG_BROKEN"	\
 	"\004SMR_DM"		\
-	"\005NO_TRIM"
+	"\005NO_TRIM"		\
+	"\006128KB"
 
 typedef enum {
 	ADA_CCB_RAHEAD		= 0x01,
@@ -268,6 +270,11 @@ struct ada_quirk_entry {
 static struct ada_quirk_entry ada_quirk_table[] =
 {
 	{
+		/* Sandisk X400 */
+		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "SanDisk?SD8SB8U1T00*", "X4162000*" },
+		/*quirks*/ADA_Q_128KB
+	},
+	{
 		/* Hitachi Advanced Format (4k) drives */
 		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "Hitachi H??????????E3*", "*" },
 		/*quirks*/ADA_Q_4K
@@ -1808,6 +1815,8 @@ adaregister(struct cam_periph *periph, void *arg)
 		maxio = min(maxio, 65536 * softc->params.secsize);
 	else					/* 28bit ATA command limit */
 		maxio = min(maxio, 256 * softc->params.secsize);
+	if (softc->quirks & ADA_Q_128KB)
+		maxio = min(maxio, 128 * 1024);
 	softc->disk->d_maxsize = maxio;
 	softc->disk->d_unit = periph->unit_number;
 	softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;

Modified: stable/11/sys/cam/scsi/scsi_da.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_da.c	Thu Aug  8 17:55:19 2019	(r350766)
+++ stable/11/sys/cam/scsi/scsi_da.c	Thu Aug  8 17:56:17 2019	(r350767)
@@ -125,7 +125,8 @@ typedef enum {
 	DA_Q_NO_UNMAP		= 0x20,
 	DA_Q_RETRY_BUSY		= 0x40,
 	DA_Q_SMR_DM		= 0x80,
-	DA_Q_STRICT_UNMAP	= 0x100
+	DA_Q_STRICT_UNMAP	= 0x100,
+	DA_Q_128KB		= 0x200
 } da_quirks;
 
 #define DA_Q_BIT_STRING		\
@@ -138,7 +139,8 @@ typedef enum {
 	"\006NO_UNMAP"		\
 	"\007RETRY_BUSY"	\
 	"\010SMR_DM"		\
-	"\011STRICT_UNMAP"
+	"\011STRICT_UNMAP"	\
+	"\012128KB"
 
 typedef enum {
 	DA_CCB_PROBE_RC		= 0x01,
@@ -847,6 +849,11 @@ static struct da_quirk_entry da_quirk_table[] =
        },
 	/* ATA/SATA devices over SAS/USB/... */
 	{
+		/* Sandisk X400 */
+		{ T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SanDisk SD8SB8U1*", "*" },
+		/*quirks*/DA_Q_128KB
+	},
+	{
 		/* Hitachi Advanced Format (4k) drives */
 		{ T_DIRECT, SIP_MEDIA_FIXED, "Hitachi", "H??????????E3*", "*" },
 		/*quirks*/DA_Q_4K
@@ -2612,6 +2619,8 @@ daregister(struct cam_periph *periph, void *arg)
 		softc->maxio = MAXPHYS;		/* for safety */
 	else
 		softc->maxio = cpi.maxio;
+	if (softc->quirks & DA_Q_128KB)
+		softc->maxio = min(softc->maxio, 128 * 1024);
 	softc->disk->d_maxsize = softc->maxio;
 	softc->disk->d_unit = periph->unit_number;
 	softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908081756.x78HuHJR091677>