All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gary Hade <garyhade@us.ibm.com>
To: Tejun Heo <htejun@gmail.com>
Cc: Gary Hade <garyhade@us.ibm.com>,
	Kovid Goyal <kovid@theory.caltech.edu>,
	linux-ide@vger.kernel.org, lcm@us.ibm.com,
	Jeff Garzik <jgarzik@pobox.com>,
	konradr@us.ibm.com
Subject: Re: [2.6.18,19] SATA boot problems (ICH6/ICH6W)
Date: Thu, 22 Feb 2007 16:32:00 -0800	[thread overview]
Message-ID: <20070223003200.GA11004@us.ibm.com> (raw)
In-Reply-To: <45DC3DAA.2080501@gmail.com>

On Wed, Feb 21, 2007 at 09:40:10PM +0900, Tejun Heo wrote:
> Hello, Gary.
> 
> Gary Hade wrote:
> > I instrumented the code and found that for the SATA hard drive BSY was set 
> > just before the call to ahci_init_port() from ahci_port_start() and clear 
> > after the return from ahci_init_port().  For the GoVault BSY was still set 
> > after the return from ahci_init_port() and remained set for almost 2 seconds.
> > 
> > The below patch which gives BSY some extra time to clear repairs the problem.  
> > Unlike the extra delay for ata-piix needed by GoVault I believe this delay 
> > will only be seen for attached devices that need it.  Please let me know 
> > what you think.
> 
> Can you post full dmesg without the patch?  And which controller are you
> using (lspci -nn please)?  How come it doesn't support CLO?
> 
> I don't think the patch is a good idea.  !BSY wait before reset is
> supposed to be done in ->prereset() if possible.  ahci skips that step
> because waiting for !BSY isn't reliable after hotplug and it often
> wastes 30secs for no good reason after an hotplug event.
> 
> Even if you need to add that specific shorter wait, the correct place
> would be ->prereset() not at the end of ->port_start().
> 
> I don't think fixing here and there for GoVault drive is a good idea.
> It's not gonna be tested widely and GoValut would end up working on some
> controllers while broken on others.  I think recently posted EH
> improvements and faster reset patches should help here.  The first reset
> will fail timely and all in all the drive should be detected in slightly
> over ten secs, which isn't that bad and actually is okay if parallel
> probing is implemented.
> 
> I dunno.  Maybe the correct thing to do is wait briefly for !BSY in
> std_prereset() when SKIP_D2H_BSY is set.

Tejun, I will be on vacation for a few days (returning 3/1) so I 
thought I would go ahead and provide the below patch before you have 
had a chance to review the information I sent you yesterday and actually 
confirm that it still looks like a viable solution.

Thanks,
Gary

-- 
Gary Hade
System x Enablement
IBM Linux Technology Center
503-578-4503  IBM T/L: 775-4503
garyhade@us.ibm.com
http://www.ibm.com/linux/ltc


We encountered a problem where the BSY status bit is still 
set on entry to the 'ahci' error handler during initialization
of the Quantum GoVault when attached to an ICH6R/ICH6RW controller.
This caused a software reset failure due to failed BSY/DRQ check
in ahci_softreset() forcing a hard reset with the following 
messages logged.
  ata1: softreset failed (port busy but CLO unavailable)
  ata1: softreset failed, retrying in 5 secs
  ata1: port is slow to respond, please be patient (Status 0x80)
  ata1: port failed to respond (30 secs, Status 0x80)
  ata1: COMRESET failed (device not ready)
  ata1: hardreset failed, retrying in 5 secs

It was taking almost 2 seconds for BSY to clear following the
return from ahci_init_port() in ahci_port_start() so this patch
gives BSY up to 3 seconds extra time to clear during prereset
eliminating the problem.

Signed-off-by: Gary Hade <garyhade@us.ibm.com>

--- linux-2.6.20-rc7/drivers/ata/libata-core.c.orig	2007-02-22 11:52:34.000000000 -0800
+++ linux-2.6.20-rc7/drivers/ata/libata-core.c	2007-02-22 14:59:44.000000000 -0800
@@ -2915,6 +2915,8 @@ int ata_std_prereset(struct ata_port *ap
 	struct ata_eh_context *ehc = &ap->eh_context;
 	const unsigned long *timing = sata_ehc_deb_timing(ehc);
 	int rc;
+	u8 status;
+	unsigned long timeout;
 
 	/* handle link resume & hotplug spinup */
 	if ((ehc->i.flags & ATA_EHI_RESUME_LINK) &&
@@ -2942,9 +2944,19 @@ int ata_std_prereset(struct ata_port *ap
 
 	/* Wait for !BSY if the controller can wait for the first D2H
 	 * Reg FIS and we don't know that no device is attached.
+	 * For other controllers a brief wait (up to 3 secs) may be
+	 * needed for some devices.
 	 */
 	if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap))
 		ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT);
+	else {
+		timeout = jiffies + 3*HZ;
+		status = ata_busy_wait(ap, ATA_BUSY, 300);
+		while ((status & ATA_BUSY) && time_before(jiffies, timeout)) {
+			msleep(50);
+			status = ata_busy_wait(ap, ATA_BUSY, 3);
+		}
+	}
 
 	return 0;
 }

  parent reply	other threads:[~2007-02-23  0:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-11 18:03 [2.6.18,19] SATA boot problems (ICH6/ICH6W) Kovid Goyal
2006-12-20  0:44 ` Tejun Heo
2006-12-20  2:00   ` Kovid Goyal
2006-12-20  2:13     ` Tejun Heo
2006-12-20  4:56       ` Kovid Goyal
2007-01-11 23:32       ` Kovid Goyal
2007-01-13  2:19         ` Tejun Heo
2006-12-20  3:29   ` Gary Hade
2006-12-20  3:53     ` Tejun Heo
2006-12-20  4:30       ` Tejun Heo
2006-12-21 17:10       ` Gary Hade
2007-01-30  1:55         ` Gary Hade
2007-01-30  7:32           ` Tejun Heo
2007-01-30 23:37             ` Gary Hade
2007-01-31  0:54               ` Jeff Garzik
2007-01-31 11:00                 ` Tejun Heo
2007-01-31 12:20                   ` Alan
2007-01-31 13:16                     ` Tejun Heo
2007-01-31 15:24                       ` Jeff Garzik
2007-01-31 15:30                         ` Mark Lord
2007-01-31 10:44               ` Tejun Heo
2007-01-31 10:47                 ` Jeff Garzik
2007-01-31 11:00                   ` Tejun Heo
2007-02-01  0:49                 ` Gary Hade
2007-02-17  0:34               ` Gary Hade
2007-02-21 12:40                 ` Tejun Heo
2007-02-22  0:41                   ` Gary Hade
2007-02-23  0:32                   ` Gary Hade [this message]
2007-01-23 21:49 ` danieljzhang

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=20070223003200.GA11004@us.ibm.com \
    --to=garyhade@us.ibm.com \
    --cc=htejun@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=konradr@us.ibm.com \
    --cc=kovid@theory.caltech.edu \
    --cc=lcm@us.ibm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.