From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: Linux PM <linux-pm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Rafael Wysocki <rafael.j.wysocki@intel.com>,
Len Brown <len.brown@intel.com>,
Arjan van de Ven <arjan@linux.intel.com>,
Zhang Rui <rui.zhang@intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Subject: [PATCH 2/3] cpuidle: check for pm qos constraint override
Date: Tue, 26 Nov 2013 15:20:10 -0800 [thread overview]
Message-ID: <1385508011-26914-3-git-send-email-jacob.jun.pan@linux.intel.com> (raw)
In-Reply-To: <1385508011-26914-1-git-send-email-jacob.jun.pan@linux.intel.com>
If a QOS class is disabled due to platform thermal or power capping
needs, idle governor shall pick the deepest idle state to conserve power.
Power saving should be prioritized over QOS in this case in that
hardware based catastrophic measure is more intrusive than
managed idle.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
drivers/cpuidle/governors/ladder.c | 4 ++++
| 13 +++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
index 9f08e8c..40161d3 100644
--- a/drivers/cpuidle/governors/ladder.c
+++ b/drivers/cpuidle/governors/ladder.c
@@ -71,6 +71,10 @@ static int ladder_select_state(struct cpuidle_driver *drv,
int last_residency, last_idx = ldev->last_state_idx;
int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
+ /* qos ignored, pick the deepest idle state */
+ if (unlikely(latency_req == PM_QOS_DEFAULT_VALUE))
+ return drv->state_count - 1;
+
/* Special case when user has set very strict latency requirement */
if (unlikely(latency_req == 0)) {
ladder_do_selection(ldev, last_idx, 0);
--git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index cf7f2f0..afa0088 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -297,12 +297,21 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
data->needs_update = 0;
}
+ /* qos ignored, pick the deepest idle state */
+ if (unlikely(latency_req == PM_QOS_DEFAULT_VALUE)) {
+ struct cpuidle_state *s = &drv->states[drv->state_count - 1];
+
+ data->last_state_idx = drv->state_count - 1;
+ data->exit_us = s->exit_latency;
+ goto exit_done;
+ }
+
data->last_state_idx = 0;
data->exit_us = 0;
/* Special case when user has set very strict latency requirement */
if (unlikely(latency_req == 0))
- return 0;
+ goto exit_done;
/* determine the expected residency time, round up */
t = ktime_to_timespec(tick_nohz_get_sleep_length());
@@ -361,7 +370,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
data->last_state_idx = i;
data->exit_us = s->exit_latency;
}
-
+exit_done:
return data->last_state_idx;
}
--
1.8.1.2
next prev parent reply other threads:[~2013-11-26 23:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-26 23:20 [PATCH 0/3] Hook up powerclamp with PM QOS and cpuidle Jacob Pan
2013-11-26 23:20 ` [PATCH 1/3] pm/qos: allow state control of qos class Jacob Pan
2013-11-26 23:28 ` Rafael J. Wysocki
2014-01-16 1:17 ` Rafael J. Wysocki
2014-01-21 22:10 ` Jacob Pan
2014-01-21 23:15 ` Rafael J. Wysocki
2014-01-21 23:47 ` Jacob Pan
2013-11-26 23:20 ` Jacob Pan [this message]
2013-11-26 23:20 ` [PATCH 3/3] thermal/powerclamp: communicate with pm qos when injecting idle Jacob Pan
2013-11-27 11:56 ` [PATCH 0/3] Hook up powerclamp with PM QOS and cpuidle Peter Zijlstra
2013-11-27 16:47 ` jacob pan
2013-11-27 20:47 ` Rafael J. Wysocki
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=1385508011-26914-3-git-send-email-jacob.jun.pan@linux.intel.com \
--to=jacob.jun.pan@linux.intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=arjan@linux.intel.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rui.zhang@intel.com \
/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).