linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Cc: jeff@garzik.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	James.Bottomley@steeleye.com, edwintorok@gmail.com,
	axboe@kernel.dk, linux-scsi@vger.kernel.org
Subject: Re: [patch 3/4] Enable link power management for ata drivers
Date: Thu, 02 Aug 2007 14:27:34 +0900	[thread overview]
Message-ID: <46B16B46.4020108@gmail.com> (raw)
In-Reply-To: <20070801141154.3246a20d.kristen.c.accardi@intel.com>

Kristen Carlson Accardi wrote:
> On Wed, 01 Aug 2007 17:27:39 +0900
> Tejun Heo <htejun@gmail.com> wrote:
> 
>> Kristen Carlson Accardi wrote:
> <snippy>
>> Is it safe to use ALPM on a device which only claims to support DIPM?
> 
> Yes - I doubled checked this with the AHCI people - and of course you
> have Edvin's testing to prove it does fine.

Alright.

> As far as moving the enable/disable_pm calls to EH - can you take
> a look at the other patch I sent which implements the shost_attrs
> to see if I still need to do this?  I really don't know much about
> the EH stuff - can you explain why we need to use it to set the
> link pm?

Unfortunately, yes, you still need to.  Only two threads of execution
(one is not a real thread tho) are allowed to access a libata port -
command execution and EH, and the two are mutually exclusive.  Invoking
something from the outside is done by doing the following.

1. recording what to do in ehi->[dev_]action, ap->pflags or dev->flags

2. schedule EH by calling either ata_port_schedule_eh(),
ata_port_abort() or ata_port_freeze().  The first one waits for the
currently in-flight commands to finish before entering EH.  The second
one aborts all in-flight commands and enters EH.  The third one aborts
all commands and freezes the port and enters EH.

3. wait for EH to finish by calling ata_port_wait_eh().

This achieves correct synchronization and other EH functionalities can
be easily used.  e.g. Resuming requires resetting the bus and
revalidating the attached devices, so the resume handler can just
request such actions together.  For link PS, I think it would probably
be a good idea to revalidate after mode change to make sure the device
works in the new mode.  If revalidation fails, it can reset and back off.

EH is done in three large steps - autopsy, report and recover.  To
implement an action, the 'recover' stage needs to be extended.  It
basically comes down to hooking the enable/disable functions into the
right places in ata_eh_recover().  Unconditionally disabling link PS
prior to reset and enabling it back again before revalidation would be a
pretty good choice, but haven't thought about it too hard so take it
with a grain of salt.

I'm not sure whether it would be necessary now but it would be nice to
have a proper recovery logic later.  e.g. If more than certain number of
ATA bus occurs in certain mount of time, disable link PS.  This kind of
logic is used during autopsy to determine whether stepping down
link/transfer speed is needed.  Please take a look at
ata_eh_speed_down().  It might be enough to piggy back on
ata_eh_speed_down() tho such that the first step of speeding down is
turning off link PS.

Hope the brief introduction to libata-EH-hacking helps.

-- 
tejun

  reply	other threads:[~2007-08-02  5:27 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070705194909.337398431@intel.com>
2007-07-05 20:05 ` [patch 1/4] Store interrupt value Kristen Carlson Accardi
2007-08-01  8:18   ` Tejun Heo
2007-08-01 14:01   ` Jeff Garzik
2007-08-01 21:18     ` Kristen Carlson Accardi
2007-07-05 20:05 ` [patch 2/4] Expose Power Management Policy option to users Kristen Carlson Accardi
2007-07-09 19:36   ` Pavel Machek
2007-07-11 16:51     ` Kristen Carlson Accardi
2007-07-30 16:32   ` Jeff Garzik
2007-07-31  6:27     ` Tejun Heo
2007-07-31 14:16       ` Arjan van de Ven
2007-07-31 14:45         ` Tejun Heo
2007-07-31 16:15           ` Arjan van de Ven
2007-07-31 18:29             ` Tejun Heo
2007-08-01  9:23               ` Tejun Heo
2007-08-01 16:31                 ` Kristen Carlson Accardi
2007-08-01 21:16                 ` Kristen Carlson Accardi
2007-08-09 16:10                   ` Kristen Carlson Accardi
2007-07-31 16:18           ` Kristen Carlson Accardi
2007-07-31 17:48             ` Tejun Heo
2007-07-31 20:24               ` Kristen Carlson Accardi
2007-08-01  3:20                 ` Tejun Heo
2007-07-31 14:58         ` Tejun Heo
2007-07-31 14:18       ` James Bottomley
2007-08-01 16:53         ` Matthew Wilcox
2007-08-01 17:06           ` James Bottomley
2007-07-31 16:30       ` Kristen Carlson Accardi
2007-07-31 18:02         ` Tejun Heo
2007-07-31 19:58           ` Kristen Carlson Accardi
2007-08-01  3:24             ` Tejun Heo
2007-08-01 15:52               ` Kristen Carlson Accardi
2007-08-01 21:07               ` Kristen Carlson Accardi
2007-07-05 20:05 ` [patch 3/4] Enable link power management for ata drivers Kristen Carlson Accardi
2007-07-05 22:33   ` Andrew Morton
2007-07-05 22:37     ` Andrew Morton
2007-07-06  0:01       ` Jeff Garzik
2007-07-06  0:02       ` Jeff Garzik
2007-07-06  0:17         ` Andrew Morton
2007-07-06  0:00     ` Jeff Garzik
2007-08-01  8:27   ` Tejun Heo
2007-08-01  9:45     ` edwintorok
2007-08-01 21:11     ` Kristen Carlson Accardi
2007-08-02  5:27       ` Tejun Heo [this message]
2007-07-05 20:05 ` [patch 4/4] Enable Aggressive Link Power management for AHCI controllers Kristen Carlson Accardi

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=46B16B46.4020108@gmail.com \
    --to=htejun@gmail.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=edwintorok@gmail.com \
    --cc=jeff@garzik.org \
    --cc=kristen.c.accardi@intel.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@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 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).