From patchwork Thu Jul 16 03:47:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 29840 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by bilbo.ozlabs.org (Postfix) with ESMTP id 860AAB7B6D for ; Thu, 16 Jul 2009 13:48:18 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757345AbZGPDsQ (ORCPT ); Wed, 15 Jul 2009 23:48:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757352AbZGPDsQ (ORCPT ); Wed, 15 Jul 2009 23:48:16 -0400 Received: from hera.kernel.org ([140.211.167.34]:37718 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757345AbZGPDsP (ORCPT ); Wed, 15 Jul 2009 23:48:15 -0400 Received: from htj.dyndns.org (IDENT:U2FsdGVkX19XaZJ2xr20Z519qoWqfDoKg6FhIAa6zZk@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n6G3lfCG006069 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 16 Jul 2009 03:47:43 GMT Received: from [127.0.0.2] (htj.dyndns.org [127.0.0.2]) by htj.dyndns.org (Postfix) with ESMTPSA id 69CC841F61937; Thu, 16 Jul 2009 12:47:41 +0900 (KST) Message-ID: <4A5EA2DD.7000905@kernel.org> Date: Thu, 16 Jul 2009 12:47:41 +0900 From: Tejun Heo User-Agent: Thunderbird 2.0.0.19 (X11/20081227) MIME-Version: 1.0 To: Zdenek Kaspar CC: linux-ide@vger.kernel.org Subject: Re: AHCI: connection status changed + hard resetting link with 2.6.30+ References: <4A4FD162.30604@gmail.com> <4A552185.7090301@kernel.org> <4A5546AA.8000404@gmail.com> <4A5D981F.9020404@kernel.org> <4A5DAD7E.8050309@gmail.com> In-Reply-To: <4A5DAD7E.8050309@gmail.com> X-Enigmail-Version: 0.95.7 X-Virus-Scanned: ClamAV 0.93.3/9571/Wed Jul 15 21:01:09 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Thu, 16 Jul 2009 03:47:43 +0000 (UTC) Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Zdenek Kaspar wrote: > Tejun Heo napsal(a): >> Zdenek Kaspar wrote: >>> Hello Tejun, thanks for your reply. Attaching logs from my testing machine.. >>> >>> I see this behavior on ICH7R with i3000 chipset too: >>> 00:1f.2 RAID bus controller [0104]: Intel Corporation 82801GR/GH (ICH7 >>> Family) SATA RAID Controller [8086:27c3] (rev 01) >> Can you please apply the attached patch and report the resulting boot >> log? Thanks. Can you please try the attached patch? Thanks. diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 336eb1e..54c9c6d 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1667,6 +1667,7 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, DPRINTK("ENTER\n"); /* prepare for SRST (AHCI-1.1 10.4.1) */ + ata_link_printk(link, KERN_INFO, "XXX softresetting link, kicking engine\n"); rc = ahci_kick_engine(ap, 1); if (rc && rc != -EOPNOTSUPP) ata_link_printk(link, KERN_WARNING, @@ -1680,6 +1681,7 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, if (time_after(now, deadline)) msecs = jiffies_to_msecs(deadline - now); + ata_link_printk(link, KERN_INFO, "XXX setting SRST\n"); tf.ctl |= ATA_SRST; if (ahci_exec_polled_cmd(ap, pmp, &tf, 0, AHCI_CMD_RESET | AHCI_CMD_CLR_BUSY, msecs)) { @@ -1692,10 +1694,12 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, msleep(1); /* issue the second D2H Register FIS */ + ata_link_printk(link, KERN_INFO, "XXX clearing SRST\n"); tf.ctl &= ~ATA_SRST; ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); /* wait for link to become ready */ + ata_link_printk(link, KERN_INFO, "XXX waiting for DRDY\n"); rc = ata_wait_after_reset(link, deadline, check_ready); /* link occupied, -ENODEV too is an error */ if (rc) { @@ -1704,6 +1708,7 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, } *class = ahci_dev_classify(ap); + ata_link_printk(link, KERN_INFO, "XXX rc=%d, class=%u\n", rc, *class); DPRINTK("EXIT, class=%u\n", *class); return 0; @@ -1791,6 +1796,7 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class, DPRINTK("ENTER\n"); + ata_link_printk(link, KERN_INFO, "XXX hardresetting link, stopping engine\n"); ahci_stop_engine(ap); /* clear D2H reception area to properly wait for D2H FIS */ @@ -1798,14 +1804,17 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class, tf.command = 0x80; ata_tf_to_fis(&tf, 0, 0, d2h_fis); + ata_link_printk(link, KERN_INFO, "XXX flipping SControl\n"); rc = sata_link_hardreset(link, timing, deadline, &online, ahci_check_ready); + ata_link_printk(link, KERN_INFO, "XXX starting engine\n"); ahci_start_engine(ap); if (online) *class = ahci_dev_classify(ap); + ata_link_printk(link, KERN_INFO, "XXX rc=%d, class=%u\n", rc, *class); DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class); return rc; } @@ -2035,6 +2044,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) } if (irq_stat & (PORT_IRQ_CONNECT | PORT_IRQ_PHYRDY)) { + ata_port_printk(ap, KERN_INFO, "XXX irq_stat=%x CONN|PHY\n", irq_stat); ata_ehi_hotplugged(host_ehi); ata_ehi_push_desc(host_ehi, "%s", irq_stat & PORT_IRQ_CONNECT ? @@ -2217,6 +2227,7 @@ static void ahci_freeze(struct ata_port *ap) { void __iomem *port_mmio = ahci_port_base(ap); + ata_port_printk(ap, KERN_INFO, "XXX port freeze\n"); /* turn IRQ off */ writel(0, port_mmio + PORT_IRQ_MASK); } @@ -2229,12 +2240,14 @@ static void ahci_thaw(struct ata_port *ap) struct ahci_port_priv *pp = ap->private_data; /* clear IRQ */ + ata_port_printk(ap, KERN_INFO, "XXX clearing IRQs for thawing\n"); tmp = readl(port_mmio + PORT_IRQ_STAT); writel(tmp, port_mmio + PORT_IRQ_STAT); writel(1 << ap->port_no, mmio + HOST_IRQ_STAT); /* turn IRQ back on */ writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); + ata_port_printk(ap, KERN_INFO, "XXX port thawed\n"); } static void ahci_error_handler(struct ata_port *ap) diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 1a07c06..655442c 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -2625,8 +2625,17 @@ int ata_eh_reset(struct ata_link *link, int classify, if (slave) sehc->i.flags &= ~ATA_EHI_HOTPLUGGED; + /* + * Reset complete. Ignore all exceptions happened before and + * during reset and clear RESETTING flag. There is a race + * window between the actual reset and here but such window is + * inevitable anyway as the window between reset and thawing + * always exists. Following identification or revalidation is + * enough to protect against problems arising from this. + */ spin_lock_irqsave(ap->lock, flags); - ap->pflags &= ~ATA_PFLAG_RESETTING; + memset(&link->eh_info, 0, sizeof(link->eh_info)); + ap->pflags &= ~(ATA_PFLAG_RESETTING | ATA_PFLAG_EH_PENDING); spin_unlock_irqrestore(ap->lock, flags); return rc;