Patchwork sata_mv port lockup on hotplug (kernel 2.6.38.2)

login
register
mail settings
Submitter Tejun Heo
Date April 30, 2011, 2:01 p.m.
Message ID <20110430140109.GJ29280@htj.dyndns.org>
Download mbox | patch
Permalink /patch/93503/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Tejun Heo - April 30, 2011, 2:01 p.m.
Hello,

On Tue, Apr 26, 2011 at 05:05:45PM +0100, Bruce Stenning wrote:
> > Yeah, it makes sense.  Hmm... it seems I wasn't thinking straight when
> > I added that work around.  Not sure how to fix it properly at this
> > moment.  I'll think about it.  Can you please keep me posted if you
> > find something while testing?
> 
> I'm away for two and a bit weeks so I'm not sure what progress (if any)
> I will make during that time.  But yes, I shall certainly keep you posted
> as soon as I find anything else.  Thank you very much for your inputs.

So, here's the patch which should fix the problem you're seeing and
doesn't break the controllers which generate spurious hotplug events
during reset.  Please test this when you come back and let me know the
result.

Thank you.

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bruce Stenning - May 17, 2011, 3:30 p.m.
Hi Tejun,

> So, here's the patch which should fix the problem you're seeing and
> doesn't break the controllers which generate spurious hotplug events
> during reset.  Please test this when you come back and let me know the
> result.

I have tested this patch out a fair amount, and it seemed to make things
much more reliable, but I have managed to lock up the port again this
afternoon. Below is some tracing showing ata4 being frozen and not thawed:

__ata_port_freeze: ata4 port frozen
ata4: hard resetting link
sata_link_hardreset: ENTER
ata4: COMRESET failed (errno=-32)
sata_link_hardreset: EXIT, rc=-32
ata4: reset failed (errno=-32), retrying in 33 secs
__ata_port_freeze: ata4 port frozen
ata4: hard resetting link
sata_link_hardreset: ENTER
ata4: COMRESET failed (errno=-32)
sata_link_hardreset: EXIT, rc=-32
ata4: reset failed, giving up
ata_eh_recover: EXIT, rc=-32
ata4.00: disabled
ata4: EH complete
ata_scsi_error: EXIT

The IRQ for that port is masked off afterwards.


Bruce.


Latest News at: http://www.indigovision.com/index.php/en/news.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index f26f2fe..a57845d 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2802,10 +2802,11 @@  int ata_eh_reset(struct ata_link *link, int classify,
 	}
 
 	/*
-	 * Some controllers can't be frozen very well and may set
-	 * spuruious error conditions during reset.  Clear accumulated
-	 * error information.  As reset is the final recovery action,
-	 * nothing is lost by doing this.
+	 * Some controllers can't be frozen very well and may set spuruious
+	 * error conditions during reset.  Clear accumulated error
+	 * information and re-thaw the port if frozen.  As reset is the
+	 * final recovery action and we cross check link onlineness against
+	 * device classification later, no hotplug event is lost by this.
 	 */
 	spin_lock_irqsave(link->ap->lock, flags);
 	memset(&link->eh_info, 0, sizeof(link->eh_info));
@@ -2814,6 +2815,9 @@  int ata_eh_reset(struct ata_link *link, int classify,
 	ap->pflags &= ~ATA_PFLAG_EH_PENDING;
 	spin_unlock_irqrestore(link->ap->lock, flags);
 
+	if (ap->pflags & ATA_PFLAG_FROZEN)
+		ata_eh_thaw_port(ap);
+
 	/*
 	 * Make sure onlineness and classification result correspond.
 	 * Hotplug could have happened during reset and some