linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Paul Check <paul@thechecks.ca>
Cc: linux-ide@vger.kernel.org
Subject: Re: Intermittent SATA link down SStatus 0
Date: Thu, 15 Jul 2010 11:29:06 +0200	[thread overview]
Message-ID: <4C3ED4E2.9080806@kernel.org> (raw)
In-Reply-To: <4C3ED2C3.9050907@kernel.org>

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

On 07/15/2010 11:20 AM, Tejun Heo wrote:
> Hmm... it looks like SStatus and SControl are swapped here.  Maybe
> there's a race condition in SIDPR code.  I'll look into it a bit more.

So, something like this.  Can you please apply the patch and see
whether the problem goes away?

Thanks.

-- 
tejun

[-- Attachment #2: ata_piix-sidpr-lock.patch --]
[-- Type: text/x-patch, Size: 1609 bytes --]

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 7409f98..3971bc0 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -158,6 +158,7 @@ struct piix_map_db {
 struct piix_host_priv {
 	const int *map;
 	u32 saved_iocfg;
+	spinlock_t sidpr_lock;	/* FIXME: remove once locking in EH is fixed */
 	void __iomem *sidpr;
 };
 
@@ -951,12 +952,15 @@ static int piix_sidpr_scr_read(struct ata_link *link,
 			       unsigned int reg, u32 *val)
 {
 	struct piix_host_priv *hpriv = link->ap->host->private_data;
+	unsigned long flags;
 
 	if (reg >= ARRAY_SIZE(piix_sidx_map))
 		return -EINVAL;
 
+	spin_lock_irqsave(&hpriv->sidpr_lock, flags);
 	piix_sidpr_sel(link, reg);
 	*val = ioread32(hpriv->sidpr + PIIX_SIDPR_DATA);
+	spin_unlock_irqrestore(&hpriv->sidpr_lock, flags);
 	return 0;
 }
 
@@ -964,12 +968,15 @@ static int piix_sidpr_scr_write(struct ata_link *link,
 				unsigned int reg, u32 val)
 {
 	struct piix_host_priv *hpriv = link->ap->host->private_data;
+	unsigned long flags;
 
 	if (reg >= ARRAY_SIZE(piix_sidx_map))
 		return -EINVAL;
 
+	spin_lock_irqsave(&hpriv->sidpr_lock, flags);
 	piix_sidpr_sel(link, reg);
 	iowrite32(val, hpriv->sidpr + PIIX_SIDPR_DATA);
+	spin_unlock_irqrestore(&hpriv->sidpr_lock, flags);
 	return 0;
 }
 
@@ -1566,6 +1573,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
 	hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
 	if (!hpriv)
 		return -ENOMEM;
+	spin_lock_init(&hpriv->sidpr_lock);
 
 	/* Save IOCFG, this will be used for cable detection, quirk
 	 * detection and restoration on detach.  This is necessary

  reply	other threads:[~2010-07-15  9:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 15:57 Intermittent SATA link down SStatus 0 Paul Check
2010-01-21 16:28 ` Paul Check
2010-01-21 16:35 ` Paul Check
2010-01-21 16:49 ` Jeff Garzik
2010-01-21 16:55   ` Paul Check
2010-01-21 17:11 ` Alan Cox
2010-01-21 17:24   ` Paul Check
2010-01-21 17:36     ` Paul Check
2010-01-21 19:24 ` Paul Check
2010-01-21 21:08   ` Paul Check
2010-01-25  5:06 ` Tejun Heo
2010-02-05  3:29   ` Tim
2010-02-09  5:32     ` Paul Check
2010-07-12 16:32       ` Paul Check
2010-07-12 16:36         ` Paul Check
2010-07-14 12:26           ` Tejun Heo
2010-07-14 17:58             ` Paul Check
2010-07-14 23:36               ` Tejun Heo
2010-07-15  0:43                 ` Paul Check
2010-07-15  9:20                   ` Tejun Heo
2010-07-15  9:29                     ` Tejun Heo [this message]
2010-07-15 17:06                       ` Paul Check

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=4C3ED4E2.9080806@kernel.org \
    --to=tj@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=paul@thechecks.ca \
    /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).