public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Turquette <mturquette@linaro.org>
To: Morten Rasmussen <morten.rasmussen@arm.com>,
	peterz@infradead.org, mingo@redhat.com
Cc: dietmar.eggemann@arm.com, pjt@google.com, bsegall@google.com,
	vincent.guittot@linaro.org, nicolas.pitre@linaro.org,
	rjw@rjwysocki.net, linux-kernel@vger.kernel.org,
	"Morten Rasmussen" <morten.rasmussen@arm.com>,
	tuukka.tikkanen@linaro.org
Subject: Re: [PATCH 2/7] cpufreq: Architecture specific callback for frequency changes
Date: Tue, 07 Oct 2014 23:07:12 -0700	[thread overview]
Message-ID: <20141008060712.4379.42509@quantum> (raw)
In-Reply-To: <1411403047-32010-3-git-send-email-morten.rasmussen@arm.com>

Quoting Morten Rasmussen (2014-09-22 09:24:02)
> 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.
> 
> 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 d9fdedd..e911f6b 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) {}

Hi Morten,

This approach assumes a single implementation for an architecture, which
probably will not scale across the myriad platforms we have merged in
mainline today. For ARM there could be any number of methods for
determining a cpus capacity, including use of CPUfreq or some other
platform-specific method.

I am vaguely aware of Intel-based platforms that do not implement ACPI,
so for that architecture I assume that an arch hook that assumes ACPI is
similarly restrictive.

I'll reply to this thread with a pair of patches that try to generalize
the functions you created in patches #2-4 of this series. I'm currently
hacking on a Chromebook 2 using the arm_big_little CPUfreq driver, so
you'll notice that is where I decided to implement the ops. Of course
those could be implemented in arch code, or some other driver.

Regards,
Mike

> +
>  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))
> @@ -2135,7 +2140,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);
> @@ -2173,6 +2178,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.7.9.5
> 
> 

  reply	other threads:[~2014-10-08  6:07 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-22 16:24 [PATCH 0/7] sched: Scale-invariant per-entity load-tracking Morten Rasmussen
2014-09-22 16:24 ` [PATCH 1/7] sched: Introduce scale-invariant load tracking Morten Rasmussen
2014-09-25 13:48   ` Vincent Guittot
2014-09-25 17:23     ` Morten Rasmussen
2014-09-26  7:36       ` Vincent Guittot
2014-09-26  9:38         ` Morten Rasmussen
2014-10-02 20:34       ` Peter Zijlstra
2014-10-08 11:00         ` Morten Rasmussen
2014-10-08 11:21           ` Vincent Guittot
2014-10-08 13:53             ` Morten Rasmussen
2014-10-08 14:08               ` Vincent Guittot
2014-10-08 14:16                 ` Morten Rasmussen
2014-10-08 11:38         ` Vincent Guittot
2014-10-08 14:05           ` Morten Rasmussen
2014-10-10  9:07           ` Peter Zijlstra
2014-10-08  0:50   ` Yuyang Du
2014-10-08 12:54     ` Dietmar Eggemann
2014-10-10  9:16       ` Peter Zijlstra
2014-10-10  9:14     ` Peter Zijlstra
2014-09-22 16:24 ` [PATCH 2/7] cpufreq: Architecture specific callback for frequency changes Morten Rasmussen
2014-10-08  6:07   ` Mike Turquette [this message]
2014-10-08  6:26     ` [PATCH RFC 0/2] introduce capacity_ops to CFS Mike Turquette
2014-10-08  6:26       ` [PATCH RFC 1/2] sched: cfs: introduce capacity_ops Mike Turquette
2014-10-08  8:37         ` Peter Zijlstra
     [not found]           ` <20141008232836.4379.3339@quantum>
2014-10-09  9:00             ` Peter Zijlstra
     [not found]               ` <20141009173433.4379.58492@quantum>
2014-10-09 19:00                 ` Peter Zijlstra
2014-10-08  6:26       ` [PATCH RFC 2/2] cpufreq: arm_big_little: provide cpu capacity Mike Turquette
2014-10-08 15:48         ` Morten Rasmussen
     [not found]           ` <20141008223732.4379.78047@quantum>
2014-10-09  9:02             ` Peter Zijlstra
     [not found]               ` <20141009172513.4379.56718@quantum>
2014-10-09 17:38                 ` Peter Zijlstra
2014-09-22 16:24 ` [PATCH 3/7] arm: Frequency invariant scheduler load-tracking support Morten Rasmussen
2014-09-22 16:24 ` [PATCH 4/7] arm: Micro-architecture invariant load tracking support Morten Rasmussen
2014-09-22 16:24 ` [PATCH 5/7] sched: Implement usage tracking Morten Rasmussen
2014-09-22 16:24 ` [PATCH 6/7] sched: Make sched entity usage tracking scale-invariant Morten Rasmussen
2014-09-22 17:13   ` bsegall
2014-09-23 13:35     ` Morten Rasmussen
2014-10-02 21:04       ` Peter Zijlstra
2014-09-22 16:24 ` [PATCH 7/7] sched: Track sched_entity usage contributions Morten Rasmussen
2014-09-22 17:09   ` bsegall
2014-09-23 13:59     ` 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=20141008060712.4379.42509@quantum \
    --to=mturquette@linaro.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=nicolas.pitre@linaro.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=rjw@rjwysocki.net \
    --cc=tuukka.tikkanen@linaro.org \
    --cc=vincent.guittot@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