public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-scsi@vger.kernel.org
Cc: dave.jiang@intel.com, lukasz.dorau@intel.com,
	stable@vger.kernel.org, artur.paszkiewicz@intel.com,
	JBottomley@Parallels.com, Xun Ni <xun.ni@intel.com>,
	Nelson Cheng <nelson.cheng@intel.com>
Subject: [PATCH 3/4] isci: fix needless ata reset escalations
Date: Thu, 06 Feb 2014 12:23:15 -0800	[thread overview]
Message-ID: <20140206202315.5227.86986.stgit@viggo.jf.intel.com> (raw)
In-Reply-To: <20140206202151.5227.12582.stgit@viggo.jf.intel.com>

isci is needlessly tying libata's hands by returning
SAM_STAT_CHECK_CONDITION to some ata errors.  Instead, prefer
SAS_PROTO_RESPONSE to let libata (via sas_ata_task_done()) disposition
the device-to-host fis.

For example isci is triggering an HSM Violation where AHCI is showing a
simple media error for the same bus condition:

isci:
ata7.00: failed command: READ VERIFY SECTOR(S)
ata7.00: cmd 40/00:01:00:00:00/00:00:00:00:00/e0 tag 0
         res 01/04:00:00:00:00/00:00:00:00:00/e0 Emask 0x3 (HSM violation)

ahci:
ata6.00: failed command: READ VERIFY SECTOR(S)
ata6.00: cmd 40/00:01:00:00:00/00:00:00:00:00/e0 tag 0
         res 51/40:01:00:00:00/00:00:00:00:00/e0 Emask 0x9 (media error)

Note that the isci response matches this from sas_ata_task_done():
	/* We saw a SAS error. Send a vague error. */
	[..]
	dev->sata_dev.fis[3] = 0x04; /* status err */
	dev->sata_dev.fis[2] = ATA_ERR;

The end effect is that isci is needlessly triggering hard resets when
they are not necessary.

Cc: <stable@vger.kernel.org>
Reported-by: Xun Ni <xun.ni@intel.com>
Tested-by: Nelson Cheng <nelson.cheng@intel.com>
Acked-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/isci/request.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 99d2930b18c8..56e38096f0c4 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -2723,13 +2723,9 @@ static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_
 	memcpy(resp->ending_fis, fis, sizeof(*fis));
 	ts->buf_valid_size = sizeof(*resp);
 
-	/* If the device fault bit is set in the status register, then
-	 * set the sense data and return.
-	 */
-	if (fis->status & ATA_DF)
+	/* If an error is flagged let libata decode the fis */
+	if (ac_err_mask(fis->status))
 		ts->stat = SAS_PROTO_RESPONSE;
-	else if (fis->status & ATA_ERR)
-		ts->stat = SAM_STAT_CHECK_CONDITION;
 	else
 		ts->stat = SAM_STAT_GOOD;
 

  parent reply	other threads:[~2014-02-06 20:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 20:22 [PATCH 0/4] isci, libsas fixes for 3.4-rc2 Dan Williams
2014-02-06 20:23 ` [PATCH 1/4] isci: fix reset timeout handling Dan Williams
2014-02-06 20:23 ` [PATCH 2/4] scsi, libsas: introduce scmd_dbg() to quiet false positive "timeout" messages Dan Williams
2014-02-06 20:23 ` Dan Williams [this message]
2014-02-06 20:23 ` [PATCH 4/4] isci: correct erroneous for_each_isci_host macro Dan Williams
2014-02-23 20:12 ` [PATCH 0/4] isci, libsas fixes for 3.4-rc2 James Bottomley
2014-02-24 20:03   ` Dan Williams

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=20140206202315.5227.86986.stgit@viggo.jf.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=JBottomley@Parallels.com \
    --cc=artur.paszkiewicz@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lukasz.dorau@intel.com \
    --cc=nelson.cheng@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=xun.ni@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox