linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Morten Rasmussen <morten.rasmussen@arm.com>
To: peterz@infradead.org, mingo@redhat.com
Cc: dietmar.eggemann@arm.com, vincent.guittot@linaro.org,
	pjt@google.com, bsegall@google.com, mturquette@linaro.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	Morten Rasmussen <Morten.Rasmussen@arm.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Morten Rasmussen <morten.rasmussen@arm.com>
Subject: [RFC PATCH 03/10] cpufreq: Architecture specific callback for frequency changes
Date: Tue,  2 Dec 2014 14:06:25 +0000	[thread overview]
Message-ID: <1417529192-11579-4-git-send-email-morten.rasmussen@arm.com> (raw)
In-Reply-To: <1417529192-11579-1-git-send-email-morten.rasmussen@arm.com>

From: Morten Rasmussen <Morten.Rasmussen@arm.com>

Architectures that don't have any other means for tracking cpu frequency
changes need a callback from cpufreq to implement a scaling factor to
enable scale-invariant per-entity load-tracking in the scheduler.

To compute the scale invariance correction factor the architecture would
need to know both the max frequency and the current frequency. This
patch defines weak functions for setting both from cpufreq.

Related architecture specific functions use weak function definitions.
The same approach is followed here.

These callbacks can be used to implement frequency scaling of cpu
capacity later.

Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
---
 drivers/cpufreq/cpufreq.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 644b54e..1b17608 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -278,6 +278,10 @@ static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
 }
 #endif
 
+void __weak arch_scale_set_curr_freq(int cpu, unsigned long freq) {}
+
+void __weak arch_scale_set_max_freq(int cpu, unsigned long freq) {}
+
 static void __cpufreq_notify_transition(struct cpufreq_policy *policy,
 		struct cpufreq_freqs *freqs, unsigned int state)
 {
@@ -315,6 +319,7 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy,
 		pr_debug("FREQ: %lu - CPU: %lu\n",
 			 (unsigned long)freqs->new, (unsigned long)freqs->cpu);
 		trace_cpu_frequency(freqs->new, freqs->cpu);
+		arch_scale_set_curr_freq(freqs->cpu, freqs->new);
 		srcu_notifier_call_chain(&cpufreq_transition_notifier_list,
 				CPUFREQ_POSTCHANGE, freqs);
 		if (likely(policy) && likely(policy->cpu == freqs->cpu))
@@ -2164,7 +2169,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
 				struct cpufreq_policy *new_policy)
 {
 	struct cpufreq_governor *old_gov;
-	int ret;
+	int ret, cpu;
 
 	pr_debug("setting new policy for CPU %u: %u - %u kHz\n",
 		 new_policy->cpu, new_policy->min, new_policy->max);
@@ -2202,6 +2207,9 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
 	policy->min = new_policy->min;
 	policy->max = new_policy->max;
 
+	for_each_cpu(cpu, policy->cpus)
+		arch_scale_set_max_freq(cpu, policy->max);
+
 	pr_debug("new min and max freqs are %u - %u kHz\n",
 		 policy->min, policy->max);
 
-- 
1.9.1



  parent reply	other threads:[~2014-12-02 14:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 14:06 [RFC PATCH 00/10] sched: frequency and cpu invariant per-entity load-tracking and other load-tracking bits Morten Rasmussen
2014-12-02 14:06 ` [RFC PATCH 01/10] sched: Make load tracking frequency scale-invariant Morten Rasmussen
2014-12-17  8:28   ` Vincent Guittot
2014-12-02 14:06 ` [RFC PATCH 02/10] sched: Make usage and load tracking cpu scale-invariant Morten Rasmussen
2014-12-18  9:41   ` Vincent Guittot
2014-12-30 15:05     ` Morten Rasmussen
2014-12-02 14:06 ` Morten Rasmussen [this message]
2014-12-17  7:56   ` [RFC PATCH 03/10] cpufreq: Architecture specific callback for frequency changes Vincent Guittot
2014-12-02 14:06 ` [RFC PATCH 04/10] arm: Frequency invariant scheduler load-tracking support Morten Rasmussen
2014-12-02 14:06 ` [RFC PATCH 05/10] ARM: vexpress: Add CPU clock-frequencies to TC2 device-tree Morten Rasmussen
2014-12-02 14:06 ` [RFC PATCH 06/10] arm: Cpu invariant scheduler load-tracking support Morten Rasmussen
2014-12-02 14:06 ` [RFC PATCH 07/10] sched: Get rid of scaling usage by cpu_capacity_orig Morten Rasmussen
2014-12-02 14:06 ` [RFC PATCH 08/10] sched: Track blocked utilization contributions Morten Rasmussen
2014-12-17  8:12   ` Vincent Guittot
2014-12-22  9:43     ` Du, Yuyang
2014-12-02 14:06 ` [RFC PATCH 09/10] sched: Include blocked utilization in usage tracking Morten Rasmussen
2014-12-17  8:22   ` Vincent Guittot
2014-12-02 14:06 ` [RFC PATCH 10/10] sched: Include blocked load in weighted_cpuload Morten Rasmussen

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=1417529192-11579-4-git-send-email-morten.rasmussen@arm.com \
    --to=morten.rasmussen@arm.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mturquette@linaro.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=rjw@rjwysocki.net \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.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).