All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: "Huang, Shane" <Shane.Huang@amd.com>
Cc: jgarzik@pobox.com, linux-ide@vger.kernel.org
Subject: Re: [PATCH #upstream, v2] ahci: Implement SATA AHCI FIS-based switching support
Date: Thu, 03 Sep 2009 15:04:06 +0900	[thread overview]
Message-ID: <4A9F5C56.5010605@kernel.org> (raw)
In-Reply-To: <C8E4BD7D001E44499280E0884BD9DB30FC9C7F@sshaexmb1.amd.com>

Hello, Shane.

Huang, Shane wrote:
>>>> +		/* time to wait for DEC is not specified by AHCI spec,
>>>> +		 * add a retry loop for safety */
>>>> +		do {
>>>> +			writel(fbs | PORT_FBS_DEC, port_mmio + 
>>> PORT_FBS);
>>>> +			fbs = readl(port_mmio + PORT_FBS);
>>>> +			retries--;
>>>> +		} while ((fbs & PORT_FBS_DEC) && retries);
> 
> 
> At the 2nd thought, if (!pp->fbs_enabled) appears unfortunately
> (although it should not), replacement of if (pp->fbs_enabled) with
> BUG_ON() will lead to the execution of the followed DEC,

Nope, it will result in the executing task being stopped with a scary
stackdump.

> which
> might lead to indeterminate result, because of AHCI v1.2 3.3.16:
> 
> Device Error Clear (DEC): ....... Software shall only set this bit to
> '1' if
> PxFBS.EN is set to '1' and PxFBS.SDE is set to '1'.
> 
> So I would suggest to keep my original implementation in v2, or put
> BUG_ON to the else case, if you insist, to replace the original
> dev_printk(KERN_ERR).

Problem with the original loop is that it writes PORT_FBS_DEC multiple
times.  Assume there are two consecutive device errors, the code might
end up clearing the second one unintentionally.

Thanks.

-- 
tejun

  reply	other threads:[~2009-09-03  6:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18  4:45 [PATCH #upstream, v2] ahci: Implement SATA AHCI FIS-based switching support Shane Huang
2009-08-31  8:01 ` Tejun Heo
2009-09-01 12:22   ` Huang, Shane
2009-09-01 12:28     ` Tejun Heo
2009-09-01 13:08       ` Huang, Shane
2009-09-01 13:14         ` Tejun Heo
2009-09-02  1:55           ` Huang, Shane
2009-09-02  1:58             ` Tejun Heo
2009-09-02  2:32               ` Huang, Shane
2009-09-02  2:40                 ` Tejun Heo
2009-09-02  6:42                   ` Huang, Shane
2009-09-02  6:49                     ` Tejun Heo
2009-09-02  6:58                       ` Huang, Shane
2009-09-03  4:53     ` Huang, Shane
2009-09-03  6:04       ` Tejun Heo [this message]
2009-09-04  2:25         ` Huang, Shane

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=4A9F5C56.5010605@kernel.org \
    --to=tj@kernel.org \
    --cc=Shane.Huang@amd.com \
    --cc=jgarzik@pobox.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.