public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: "Ortwin Glück" <odi@odi.ch>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: ata link not reset properly
Date: Fri, 25 Jun 2010 17:19:31 +0200	[thread overview]
Message-ID: <4C24C903.1070705@kernel.org> (raw)
In-Reply-To: <4C2305A8.4070708@odi.ch>

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]

Hello,

Patch attached, but please see below.

On 06/24/2010 09:13 AM, Ortwin Glück wrote:
> On 23.06.2010 19:31, Tejun Heo wrote:
>> Meh, it won't work.  It's failing softreset so we should be checking
>> reset try counts.  I'll try to write up something tomorrow.
> 
> I am happy to try patches. The problem shows up maybe once a month
> only, however. Interestingly it only occurs on ata2 with a IBM hdd,
> never on the first channel with a maxtor. I can also try and attach
> the dvd on the first channel and see if that makes any difference.

Problems like this definitely can depend on the specific drive.

> ata1.00: ATA-5: MAXTOR 6L020J1, A93.0500, max UDMA/133
> ata2.00: ATA-5: IC25N030ATCS04-0, CA3OA71A, max UDMA/100
> ata2.01: ATAPI: Pioneer DVD-ROM ATAPIModel DVD-115  0127, E1.27, max UDMA/33

Is it PATA?  Why do you have 2.01?  Can you please attach full boot
log?

Thanks.

-- 
tejun

[-- Attachment #2: nv-last-reset.patch --]
[-- Type: text/x-patch, Size: 2112 bytes --]

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index f77a673..5b30776 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2486,6 +2486,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
 	 */
 	while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX)
 		max_tries++;
+	if (max_tries > 1)
+		ehc->i.flags &= ~ATA_EHI_LAST_RESET;
+	else
+		ehc->i.flags |= ATA_EHI_LAST_RESET;
+
 	if (link->flags & ATA_LFLAG_NO_HRST)
 		hardreset = NULL;
 	if (link->flags & ATA_LFLAG_NO_SRST)
@@ -2814,6 +2819,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
 	}
 
 	if (try == max_tries - 1) {
+		ehc->i.flags |= ATA_EHI_LAST_RESET;
 		sata_down_spd_limit(link, 0);
 		if (slave)
 			sata_down_spd_limit(slave, 0);
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 2116113..5c22f02 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1583,11 +1583,14 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class,
 {
 	struct ata_eh_context *ehc = &link->eh_context;
 
-	/* Do hardreset iff it's post-boot probing, please read the
-	 * comment above port ops for details.
+	/*
+	 * Do hardreset iff it's the last reset attempt or post-boot
+	 * probing, please read the comment above port ops for
+	 * details.
 	 */
-	if (!(link->ap->pflags & ATA_PFLAG_LOADING) &&
-	    !ata_dev_enabled(link->device))
+	if (ehc->i.flags & ATA_EHI_LAST_RESET ||
+	    (!(link->ap->pflags & ATA_PFLAG_LOADING) &&
+	     !ata_dev_enabled(link->device)))
 		sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
 				    NULL, NULL);
 	else {
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b85f3ff..de61cc3 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -341,6 +341,7 @@ enum {
 	ATA_EHI_PRINTINFO	= (1 << 18), /* print configuration info */
 	ATA_EHI_SETMODE		= (1 << 19), /* configure transfer mode */
 	ATA_EHI_POST_SETMODE	= (1 << 20), /* revaildating after setmode */
+	ATA_EHI_LAST_RESET	= (1 << 21), /* last reset attempt hint */
 
 	ATA_EHI_DID_RESET	= ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
 

  reply	other threads:[~2010-06-25 15:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23 17:08 ata link not reset properly Ortwin Glück
2010-06-23 17:28 ` Tejun Heo
2010-06-23 17:31   ` Tejun Heo
2010-06-24  7:13     ` Ortwin Glück
2010-06-25 15:19       ` Tejun Heo [this message]
2010-06-25 18:00         ` Ortwin Glück
2010-06-26  4:07           ` Robert Hancock
2010-06-26  8:03             ` Tejun Heo
2010-06-26  9:00             ` Ortwin Glück
2010-06-27 18:27             ` Sergei Shtylyov

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=4C24C903.1070705@kernel.org \
    --to=tj@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=odi@odi.ch \
    /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