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: Wed, 01 Aug 2007 17:27:39 +0900 [thread overview]
Message-ID: <46B043FB.5090005@gmail.com> (raw)
In-Reply-To: <20070705130530.5873afeb.kristen.c.accardi@intel.com>
Kristen Carlson Accardi wrote:
> libata drivers can define a function (enable_pm) that will
> perform hardware specific actions to enable whatever power
> management policy the user set up from the scsi sysfs
> interface if the driver supports it. This power management
> policy will be activated after all disks have been
> enumerated and intialized. Drivers should also define
> disable_pm, which will turn off link power management, but
> not change link power management policy.
>
> Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Please update the patch against the current libata-dev#upstream and
there are several lines where tab follows space and git-applymbox isn't
happy about it. Those lines are in other patches too.
> +int ata_scsi_set_link_pm_policy(struct Scsi_Host *shost,
> + enum scsi_host_link_pm policy)
> +{
> + struct ata_port *ap = ata_shost_to_port(shost);
> + int rc = -EINVAL;
> + int i;
> +
> + /*
> + * make sure no broken devices are on this port,
> + * and that all devices support interface power
> + * management
> + */
> + for (i = 0; i < ATA_MAX_DEVICES; i++) {
> + struct ata_device *dev = &ap->device[i];
> +
> + /* only check drives which exist */
> + if (!ata_dev_enabled(dev))
> + continue;
> +
> + /*
> + * do we need to handle the case where we've hotplugged
> + * a broken drive (since hotplug and ALPM are mutually
> + * exclusive) ?
> + *
> + * If so, if we detect a broken drive on a port with
> + * alpm already enabled, then we should reset the policy
> + * to off for the entire port.
> + */
> + if ((dev->horkage & ATA_HORKAGE_ALPM) ||
> + !(dev->flags & ATA_DFLAG_IPM)) {
> + ata_dev_printk(dev, KERN_ERR,
> + "Unable to set Link PM policy\n");
> + ap->pm_policy = SHOST_MAX_PERFORMANCE;
> + }
> + }
> +
> + if (ap->ops->enable_pm)
> + rc = ap->ops->enable_pm(ap, policy);
> +
> + if (!rc)
> + shost->shost_link_pm_policy = ap->pm_policy;
> + return rc;
> +}
> +EXPORT_SYMBOL_GPL(ata_scsi_set_link_pm_policy);
This function is directly called from SCSI sysfs write, right? You
can't do this without synchronizing with EH. The best way is to define
an EH action and ask EH to transit between powersave states.
> @@ -2021,6 +2021,9 @@ int ata_dev_configure(struct ata_device
> if (dev->flags & ATA_DFLAG_LBA48)
> dev->max_sectors = ATA_MAX_SECTORS_LBA48;
>
> + if (ata_id_has_hipm(dev->id) || ata_id_has_dipm(dev->id))
> + dev->flags |= ATA_DFLAG_IPM;
Is it safe to use ALPM on a device which only claims to support DIPM?
> @@ -2046,6 +2049,13 @@ int ata_dev_configure(struct ata_device
> dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
> dev->max_sectors);
>
> + if (ata_device_blacklisted(dev) & ATA_HORKAGE_ALPM) {
> + dev->horkage |= ATA_HORKAGE_ALPM;
I think this should be ATA_HORKAGE_IPM.
> @@ -6385,6 +6426,8 @@ int ata_host_register(struct ata_host *h
> struct ata_port *ap = host->ports[i];
>
> ata_scsi_scan_host(ap);
> + ata_scsi_set_link_pm_policy(ap->scsi_host,
> + ap->pm_policy);
Again, this should be done from EH.
> @@ -321,6 +321,8 @@ struct ata_taskfile {
> ((u64) (id)[(n) + 0]) )
>
> #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
> +#define ata_id_has_hipm(id) ((id)[76] & (1 << 9))
> +#define ata_id_has_dipm(id) ((id)[78] & (1 << 3))
We probably need !0xffff test here.
--
tejun
next prev parent reply other threads:[~2007-08-01 8:27 UTC|newest]
Thread overview: 46+ 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 [this message]
2007-08-01 9:45 ` edwintorok
2007-08-01 21:11 ` Kristen Carlson Accardi
2007-08-02 5:27 ` Tejun Heo
2007-07-05 20:05 ` [patch 4/4] Enable Aggressive Link Power management for AHCI controllers Kristen Carlson Accardi
[not found] <20070809211800.022150464@intel.com>
2007-08-09 21:24 ` [patch 3/4] Enable link power management for ata drivers Kristen Carlson Accardi
2007-08-11 4:58 ` Valdis.Kletnieks
2007-08-13 17:26 ` 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=46B043FB.5090005@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).