From owner-svn-src-all@freebsd.org Thu Aug 8 00:27:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC1D2BCA6E; Thu, 8 Aug 2019 00:27:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 463q2R5Ml2z4XD3; Thu, 8 Aug 2019 00:27:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9389C1CD7D; Thu, 8 Aug 2019 00:27:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x780RR7p066470; Thu, 8 Aug 2019 00:27:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x780RRmQ066469; Thu, 8 Aug 2019 00:27:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908080027.x780RRmQ066469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 8 Aug 2019 00:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350708 - in stable/12/sys/cam: ata scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/cam: ata scsi X-SVN-Commit-Revision: 350708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2019 00:27:27 -0000 Author: mav Date: Thu Aug 8 00:27:26 2019 New Revision: 350708 URL: https://svnweb.freebsd.org/changeset/base/350708 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/12/sys/cam/ata/ata_da.c stable/12/sys/cam/scsi/scsi_da.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/ata/ata_da.c ============================================================================== --- stable/12/sys/cam/ata/ata_da.c Thu Aug 8 00:23:11 2019 (r350707) +++ stable/12/sys/cam/ata/ata_da.c Thu Aug 8 00:27:26 2019 (r350708) @@ -119,7 +119,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 \ @@ -128,7 +129,8 @@ typedef enum { "\002NCQ_TRIM_BROKEN" \ "\003LOG_BROKEN" \ "\004SMR_DM" \ - "\005NO_TRIM" + "\005NO_TRIM" \ + "\006128KB" typedef enum { ADA_CCB_RAHEAD = 0x01, @@ -274,6 +276,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 @@ -1800,6 +1807,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/12/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_da.c Thu Aug 8 00:23:11 2019 (r350707) +++ stable/12/sys/cam/scsi/scsi_da.c Thu Aug 8 00:27:26 2019 (r350708) @@ -130,7 +130,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 \ @@ -143,7 +144,8 @@ typedef enum { "\006NO_UNMAP" \ "\007RETRY_BUSY" \ "\010SMR_DM" \ - "\011STRICT_UNMAP" + "\011STRICT_UNMAP" \ + "\012128KB" typedef enum { DA_CCB_PROBE_RC = 0x01, @@ -870,6 +872,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 @@ -2821,6 +2828,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;