All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antti P Miettinen <amiettinen@nvidia.com>
To: davej@redhat.com, cpufreq@vger.kernel.org, pavel@ucw.cz,
	rjw@sisk.pl, len.brown@intel.com, linux-pm@vger.kernel.org
Cc: mgross@linux.intel.com
Subject: [PATCH v2 8/8] cpufreq: Enforce PM QoS maximum frequency
Date: Fri, 13 Jan 2012 14:59:19 +0200	[thread overview]
Message-ID: <1326459559-5436-9-git-send-email-amiettinen@nvidia.com> (raw)
In-Reply-To: <1326459559-5436-1-git-send-email-amiettinen@nvidia.com>

Observe PM QoS CPU frequency maximum in addition to
policy settings.

Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
---
 drivers/cpufreq/cpufreq.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index c2c1c62..d233a8b 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1638,12 +1638,15 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
 	unsigned int pmax = policy->max;
 	unsigned int qmin = min(pm_qos_request(PM_QOS_CPU_FREQ_MIN),
 				data->max);
+	unsigned int qmax = max(pm_qos_request(PM_QOS_CPU_FREQ_MAX),
+				data->min);
 
-	pr_debug("setting new policy for CPU %u: %u/%u - %u kHz\n",
-		 policy->cpu, pmin, qmin, pmax);
+	pr_debug("setting new policy for CPU %u: %u/%u - %u/%u kHz\n",
+		 policy->cpu, pmin, qmin, pmax, qmax);
 
 	/* clamp the new policy to PM QoS limits */
 	policy->min = max(pmin, qmin);
+	policy->max = min(pmax, qmax);
 
 	memcpy(&policy->cpuinfo, &data->cpuinfo,
 				sizeof(struct cpufreq_cpuinfo));
@@ -1920,12 +1923,16 @@ static int cpu_freq_notify(struct notifier_block *b,
 static struct notifier_block min_freq_notifier = {
 	.notifier_call = cpu_freq_notify,
 };
+static struct notifier_block max_freq_notifier = {
+	.notifier_call = cpu_freq_notify,
+};
 
 static int cpu_freq_notify(struct notifier_block *b,
 			   unsigned long l, void *v)
 {
 	int cpu;
-	pr_debug("PM QoS min %lu\n", l);
+	pr_debug("PM QoS %s %lu\n",
+		 b == &min_freq_notifier ? "min" : "max", l);
 	for_each_online_cpu(cpu) {
 		struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
 		if (policy) {
@@ -1952,6 +1959,9 @@ static int __init cpufreq_core_init(void)
 	rc = pm_qos_add_notifier(PM_QOS_CPU_FREQ_MIN,
 				 &min_freq_notifier);
 	BUG_ON(rc);
+	rc = pm_qos_add_notifier(PM_QOS_CPU_FREQ_MAX,
+				 &max_freq_notifier);
+	BUG_ON(rc);
 
 	return 0;
 }
-- 
1.7.4.1


  parent reply	other threads:[~2012-01-13 12:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13 12:59 [PATCH v2 0/8] RFC: CPU frequency min/max as PM QoS params Antti P Miettinen
2012-01-13 12:59 ` [PATCH v2 1/8] PM QoS: Simplify PM QoS expansion/merge Antti P Miettinen
2012-01-15  4:37   ` mark gross
2012-01-13 12:59 ` [PATCH v2 2/8] PM QoS: Add CPU frequency minimum as PM QoS param Antti P Miettinen
2012-01-15  4:46   ` mark gross
2012-01-13 12:59 ` [PATCH v2 3/8] cpufreq: Export user_policy min/max Antti P Miettinen
2012-01-13 12:59 ` [PATCH v2 4/8] cpufreq: Preserve sysfs min/max request Antti P Miettinen
2012-01-13 12:59 ` [PATCH v2 5/8] cpufreq: Enforce PM QoS minimum limit Antti P Miettinen
2012-01-15  4:51   ` mark gross
2012-01-13 12:59 ` [PATCH v2 6/8] input: CPU frequency booster Antti P Miettinen
2012-01-13 12:59 ` [PATCH v2 7/8] PM QoS: Add CPU frequency maximum as PM QoS param Antti P Miettinen
2012-01-15  4:51   ` mark gross
2012-01-13 12:59 ` Antti P Miettinen [this message]
2012-01-13 15:24 ` [PATCH v2 0/8] RFC: CPU frequency min/max as PM QoS params mark gross
2012-01-13 16:17   ` Antti P Miettinen
2012-01-16  6:59 Antti P Miettinen
2012-01-16  7:00 ` [PATCH v2 8/8] cpufreq: Enforce PM QoS maximum frequency Antti P Miettinen

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=1326459559-5436-9-git-send-email-amiettinen@nvidia.com \
    --to=amiettinen@nvidia.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=davej@redhat.com \
    --cc=len.brown@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    /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.