[PATCH 3/3] Fix device detection issues with mvsas driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  I am using the Marvell SAS HBA (MV64460/64461/64462 System Controller,
Revision B (rev 01)), on a system running Ubuntu 12.04 stock kernel. And
i am seeing some drive detection issues with SATA drives, mostly during
hotplugging the drives; the issue gets exaggerated when we keep removing
and plugging in drives. 

From dmesg, after starting the LibATA debugs, it looks like the
ata_eh_revalidate_and_attach fails because ata_dev_read_id fails to get
the IDENTIFY command response. I see "both IDENTIFYs aborted, assuming
NODEV" for all these drives that go undetected. At this point, if I
unload and reload the mvsas driver, these drives detect fine. So, I
hooked up a SATA analyzer between the HBA and one of the drives, and
restarted the test. From what I can see, even though the drive responds
to the IDENTIFY command, the upper layer detects an error and discards
the response. On further debugging it was evident that the error was
being detected in the FIS. 

 After going thru the mvsas driver, I see that the driver allocates a
DMA area for an FIS pool (for as many as 33 FIS's) and initializes it to
0. And each ATA command is allocated a FIS area from this pool during
the command prep; but its never cleared. 

This change initializes the FIS area before using it and it fixes the
drive detection issue. I have tested it with kernel 3.2.0. 

---
 drivers/scsi/mvsas/mv_sas.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index a4884a5..31bfd4e 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -21,6 +21,16 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
+ *
+ * Changelog:
+ *	Praveen Murali <pmurali@xxxxxxxxxxxx>	May 15, 2012
+ *		Cleanup and prepare the FIS index before issuing the
+ *		ATA command (during prep: mvs_task_prep_ata). This is
+ *		to overcome the drive detection issue where the SATA drives
+ *		fail to get detected during hotplug since the ATA module
+ *		(libATA) detects errors set in the FIS eventhough the SATA
+ *		analyzer shows that the IDENTIFY command was successfull.
+ *
 */
 
 #include "mv_sas.h"
@@ -458,6 +468,10 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
 			mvi_dev->device_id);
 		return -EBUSY;
 	}
+
+	/* cleanup and prepare the aloocated FIS index */
+	memset( SATA_RECEIVED_D2H_FIS(mvi_dev->taskfileset), 0, sizeof(struct
dev_to_host_fis) );
+
 	slot = &mvi->slot_info[tag];
 	slot->tx = mvi->tx_prod;
 	del_q = TXQ_MODE_I | tag |
-- 
1.7.10

From 0ac1c61dca4ce303c7233c3ed65c03eb2bfff28c Mon Sep 17 00:00:00 2001
From: Praveen Murali <pmurali@xxxxxxxxxxxx>
Date: Thu, 14 Jun 2012 18:30:01 -0700
Subject: [PATCH 3/3] Fix device detection issues with mvsas driver

This change fixes the drive detection issue where the SATA drives fail to
get detected during hotplug since the ATA module (libATA) detects errors set
in the FIS eventhough the SATA analyzer shows that the IDENTIFY command was
successfull.
---
 drivers/scsi/mvsas/mv_sas.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index a4884a5..31bfd4e 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -21,6 +21,16 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
+ *
+ * Changelog:
+ *	Praveen Murali <pmurali@xxxxxxxxxxxx>	May 15, 2012
+ *		Cleanup and prepare the FIS index before issuing the
+ *		ATA command (during prep: mvs_task_prep_ata). This is
+ *		to overcome the drive detection issue where the SATA drives
+ *		fail to get detected during hotplug since the ATA module
+ *		(libATA) detects errors set in the FIS eventhough the SATA
+ *		analyzer shows that the IDENTIFY command was successfull.
+ *
 */
 
 #include "mv_sas.h"
@@ -458,6 +468,10 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
 			mvi_dev->device_id);
 		return -EBUSY;
 	}
+
+	/* cleanup and prepare the aloocated FIS index */
+	memset( SATA_RECEIVED_D2H_FIS(mvi_dev->taskfileset), 0, sizeof(struct dev_to_host_fis) );
+
 	slot = &mvi->slot_info[tag];
 	slot->tx = mvi->tx_prod;
 	del_q = TXQ_MODE_I | tag |
-- 
1.7.10


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux