linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Anssi Hannula <anssi.hannula@iki.fi>
Cc: linux-ide@vger.kernel.org
Subject: Re: ahci port hangs while hard resetting link
Date: Tue, 24 Aug 2010 18:27:15 +0200	[thread overview]
Message-ID: <4C73F2E3.6030909@kernel.org> (raw)
In-Reply-To: <201008231811.59828.anssi.hannula@iki.fi>

On 08/23/2010 05:11 PM, Anssi Hannula wrote:
> On Monday 23 August 2010 12:31:32 Tejun Heo wrote:
>> Hello,
>>
>> On 08/22/2010 11:10 PM, Anssi Hannula wrote:
>>> 22:52:18 : ata6: exception Emask 0x10 SAct 0x0 SErr 0x4050002 action 0xe
>>> frozen
>>> 22:52:18 : ata6: irq_stat 0x00400040, connection status changed
>>> 22:52:18 : ata6: SError: { RecovComm PHYRdyChg CommWake DevExch }
>>> 22:52:18 : ata6: hard resetting link
>>> 22:52:28 : ata6: softreset failed (device not ready)
>>> 22:52:28 : ata6: hard resetting link
>>> 22:52:38 : ata6: softreset failed (device not ready)
>>> 22:52:38 : ata6: hard resetting link
>>> 22:52:49 : ata6: link is slow to respond, please be patient (ready=0)
>>> 22:53:13 : ata6: softreset failed (device not ready)
>>> 22:53:13 : ata6: limiting SATA link speed to 1.5 Gbps
>>> 22:53:13 : ata6: hard resetting link
>>> =====================
>>> I disconnect the drive for a few moments, but nothing is output by
>>> kernel. I reconnect it again, but again, nothing is output by the
>>> kernel. I run: echo "- - -" >
>>> /sys/devices/pci0000:00/0000:00:1f.2/host5/scsi_host/host5/scan
>>> However, it appeared stuck and still no messages in the kernel log, so
>>> I disconnected the device again. Still nothing is output, and the
>>> following messages started to be output, indicating that the process
>>
>>> had become stuck:
>> Looks like EH got stuck somehow.  Maybe the timeout calculation is
>> wrong?  Can you please trigger sysrq-t while the system is stuck and
>> post the result?
> 
> Ok, here's the output. And the system is not stuck, just the bash process that 
> is writing to 'scan' file.
> 
> In this occasion, the hard reset had been stuck for some 16 hours, and it is 
> on ata5 (scsi4):

Does the following patch fix the problem?

Thanks.

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 666850d..68dc678 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1326,7 +1326,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
 	/* issue the first D2H Register FIS */
 	msecs = 0;
 	now = jiffies;
-	if (time_after(now, deadline))
+	if (time_after(deadline, now))
 		msecs = jiffies_to_msecs(deadline - now);

 	tf.ctl |= ATA_SRST;


  reply	other threads:[~2010-08-24 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-22 21:10 ahci port hangs while hard resetting link Anssi Hannula
2010-08-23  9:31 ` Tejun Heo
2010-08-23 15:11   ` Anssi Hannula
2010-08-24 16:27     ` Tejun Heo [this message]
2010-08-24 20:03       ` Anssi Hannula
2010-08-27  8:09       ` Gwendal Grignou
2010-08-27  9:01         ` Tejun Heo

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=4C73F2E3.6030909@kernel.org \
    --to=tj@kernel.org \
    --cc=anssi.hannula@iki.fi \
    --cc=linux-ide@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).