All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Cc: jeff@garzik.org, linux-ide@vger.kernel.org,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	htejun@gmail.com, arjan@linux.intel.com
Subject: Re: [patch 3/3] Enable Aggressive Link Power management for AHCI  controllers.
Date: Thu, 21 Jun 2007 15:08:32 +0200	[thread overview]
Message-ID: <20070621130831.GN18863@kernel.dk> (raw)
In-Reply-To: <20070620142342.404856fe.kristen.c.accardi@intel.com>

On Wed, Jun 20 2007, Kristen Carlson Accardi wrote:
> Enable Aggressive Link Power management for AHCI controllers.
> 
> This patch will set the correct bits to turn on Aggressive
> Link Power Management (ALPM) for the ahci driver.  This
> will cause the controller and disk to negotiate a lower
> power state for the link when there is no activity (see
> the AHCI 1.x spec for details).  This feature is mutually
> exclusive with Hot Plug, so when ALPM is enabled, Hot Plug
> is disabled.  ALPM will be enabled by default, but it is
> settable via the scsi host syfs interface.  Possible 
> settings for this feature are:
> 
> Setting		Effect
> ----------------------------------------------------------
> min_power	ALPM is enabled, and link set to enter 
> 		lowest power state (SLUMBER) when idle
> 		Hot plug not allowed.
> 
> max_performance	ALPM is disabled, Hot Plug is allowed
> 
> medium_power	ALPM is enabled, and link set to enter
> 		second lowest power state (PARTIAL) when
> 		idle.  Hot plug not allowed.
> 
> Signed-off-by:  Kristen Carlson Accardi <kristen.c.accardi@intel.com>

A suggestion (it comes with a patch!) - default to max_power/almp off,
not min_power. For two reasons:

- There's such a big performance difference between the two, you really
  want max_power when booting.

- It's a lot better to default to no change, than default to enabling
  something new.

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 841cf0a..e7a2072 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -786,8 +786,7 @@ static int ahci_disable_alpm(struct ata_port *ap)
 	return 0;
 }
 
-static int ahci_enable_alpm(struct ata_port *ap,
-	enum scsi_host_link_pm policy)
+static int ahci_enable_alpm(struct ata_port *ap, enum scsi_host_link_pm policy)
 {
 	struct ahci_host_priv *hpriv = ap->host->private_data;
 	void __iomem *port_mmio = ahci_port_base(ap);
@@ -808,19 +807,19 @@ static int ahci_enable_alpm(struct ata_port *ap,
 		return -EINVAL;
 	}
 
-	switch(policy) {
+	switch (policy) {
 	case SHOST_MAX_PERFORMANCE:
-		ahci_disable_alpm(ap);
-		ap->pm_policy = policy;
-		return 0;
 	case SHOST_NOT_AVAILABLE:
-	case SHOST_MIN_POWER:
 		/*
  		 * if we came here with SHOST_NOT_AVAILABLE,
  		 * it just means this is the first time we
- 		 * have tried to enable - so try to do
- 		 * min_power
+ 		 * have tried to enable - default to max performance,
+		 * and let the user go to lower power modes on request.
  		 */
+		ahci_disable_alpm(ap);
+		ap->pm_policy = SHOST_MAX_PERFORMANCE;
+		return 0;
+	case SHOST_MIN_POWER:
 		ap->pm_policy = SHOST_MIN_POWER;
 
 		/* configure HBA to enter SLUMBER */

-- 
Jens Axboe


  reply	other threads:[~2007-06-21 13:09 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070611184146.448266229@intel.com>
2007-06-11 18:48 ` [patch 1/3] Store interrupt value Kristen Carlson Accardi
2007-06-11 19:59   ` Jeff Garzik
2007-06-11 18:48 ` [patch 2/3] Expose Power Management Policy option to users Kristen Carlson Accardi
2007-06-11 20:00   ` Jeff Garzik
2007-06-12 17:46     ` [patch 2a/3] " Kristen Carlson Accardi
2007-06-13 15:26       ` James Bottomley
2007-06-13 20:48         ` Jeff Garzik
2007-06-14 16:39         ` Kristen Carlson Accardi
2007-06-14 17:44           ` Jeff Garzik
2007-06-12 17:47     ` [patch 2b/3] " Kristen Carlson Accardi
2007-06-20 21:22     ` Kristen Carlson Accardi
2007-06-11 18:48 ` [patch 3/3] Enable Aggressive Link Power management for AHCI controllers Kristen Carlson Accardi
2007-06-11 20:01   ` Jeff Garzik
2007-06-12  1:11   ` Henrique de Moraes Holschuh
2007-06-12  1:16     ` Arjan van de Ven
2007-06-12  1:54       ` Dagfinn Ilmari Mannsåker
2007-06-12  1:59         ` Jeff Garzik
2007-06-12  3:59           ` Henrique de Moraes Holschuh
2007-06-12  3:59             ` Arjan van de Ven
2007-06-12  9:09               ` Matthew Garrett
2007-06-12 12:18                 ` Henrique de Moraes Holschuh
2007-06-12 13:50                   ` Matthew Garrett
2007-06-12 14:17                     ` Henrique de Moraes Holschuh
2007-06-12 15:38                       ` Matthew Garrett
2007-06-12 15:45                         ` Tejun Heo
2007-06-12 15:56                           ` Matthew Garrett
2007-06-12 15:46                         ` Jeff Garzik
2007-06-12 15:58                           ` Matthew Garrett
2007-06-12 16:18                             ` Jeff Garzik
2007-06-12 16:27                           ` Kristen Carlson Accardi
2007-06-20 21:23 ` Kristen Carlson Accardi
2007-06-21 13:08   ` Jens Axboe [this message]
2007-06-22 17:15     ` Kristen Carlson Accardi
2007-06-22 17:15       ` Kristen Carlson Accardi
2007-06-22 19:00       ` Jens Axboe
2007-06-26 15:24         ` Kristen Carlson Accardi
     [not found] <20070801210713.809095009@intel.com>
2007-08-01 21:29 ` 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=20070621130831.GN18863@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=arjan@linux.intel.com \
    --cc=htejun@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 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.