linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Russell King <rmk+kernel@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Juri Lelli <juri.lelli@arm.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH v2 02/10] cpufreq: provide data for frequency-invariant load-tracking support
Date: Fri, 7 Jul 2017 18:18:15 +0200	[thread overview]
Message-ID: <CAJZ5v0gBPNDBYWbuHVaB7deNHSZKziaAeybSw3mg+S8V_roO-Q@mail.gmail.com> (raw)
In-Reply-To: <c92f1bd0-6611-8eec-51d7-f6d7754a5870@arm.com>

On Fri, Jul 7, 2017 at 6:01 PM, Dietmar Eggemann
<dietmar.eggemann@arm.com> wrote:
> On 06/07/17 11:40, Viresh Kumar wrote:
>> On 06-07-17, 10:49, Dietmar Eggemann wrote:
>
> [...]
>
>>> In case arch_set_freq_scale() is not defined (and because of the
>>> pr_debug() drivers/cpufreq/cpufreq.c is not compiled with -DDEBUG)
>>
>> The line within () needs to be improved to convey a clear message.
>
> Probably not needed anymore. See below.
>
> [...]
>
>>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>>> index 9bf97a366029..a04c5886a5ce 100644
>>> --- a/drivers/cpufreq/cpufreq.c
>>> +++ b/drivers/cpufreq/cpufreq.c
>>> @@ -347,6 +347,28 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy,
>>>      }
>>>  }
>>>
>>> +/*********************************************************************
>>> + *           FREQUENCY INVARIANT CPU CAPACITY SUPPORT                *
>>> + *********************************************************************/
>>> +
>>> +#ifndef arch_set_freq_scale
>>> +static void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
>>> +                            unsigned long max_freq)
>>> +{}
>>> +#endif
>>> +
>>> +static void cpufreq_set_freq_scale(struct cpufreq_policy *policy,
>>> +                               struct cpufreq_freqs *freqs)
>>> +{
>>> +    unsigned long cur_freq = freqs ? freqs->new : policy->cur;
>>> +    unsigned long max_freq = policy->cpuinfo.max_freq;
>>> +
>>> +    pr_debug("cpus %*pbl cur/cur max freq %lu/%lu kHz\n",
>>> +             cpumask_pr_args(policy->related_cpus), cur_freq, max_freq);
>>> +
>>> +    arch_set_freq_scale(policy->related_cpus, cur_freq, max_freq);
>>
>> I am not sure why all these are required to be sent here and will come back to
>> it later on after going through other patches.
>
> See below.
>
>>> +}
>>> +
>>>  /**
>>>   * cpufreq_notify_transition - call notifier chain and adjust_jiffies
>>>   * on frequency transition.
>>> @@ -405,6 +427,8 @@ void cpufreq_freq_transition_begin(struct cpufreq_policy *policy,
>>>
>>>      spin_unlock(&policy->transition_lock);
>>>
>>> +    cpufreq_set_freq_scale(policy, freqs);
>>> +
>>
>> Why do this before even changing the frequency ? We may fail while changing it.
>>
>> IMHO, you should call this routine whenever we update policy->cur and that
>> happens regularly in __cpufreq_notify_transition() and few other places..
>
> See below.
>
>>>      cpufreq_notify_transition(policy, freqs, CPUFREQ_PRECHANGE);
>>>  }
>>>  EXPORT_SYMBOL_GPL(cpufreq_freq_transition_begin);
>>> @@ -2203,6 +2227,8 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
>>>      blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
>>>                      CPUFREQ_NOTIFY, new_policy);
>>>
>>> +    cpufreq_set_freq_scale(new_policy, NULL);
>>
>> Why added it here ? To get it initialized ? If yes, then we should do that in
>> cpufreq_online() where we first initialize policy->cur.
>
> I agree. This can go away. Initialization is not really needed here. We initialize
> the scale values to SCHED_CAPACITY_SCALE at boot-time.
>
>> Apart from this, you also need to update this in the schedutil governor (if you
>> haven't done that in this series later) as that also updates policy->cur in the
>> fast path.
>
> So what about I call arch_set_freq_scale() in __cpufreq_notify_transition() in the
> CPUFREQ_POSTCHANGE case for slow-switching and in cpufreq_driver_fast_switch() for
> fast-switching?

Why don't you do this in drivers instead of in the core?

Ultimately, the driver knows what frequency it has requested, so why
can't it call arch_set_freq_scale()?

Thanks,
Rafael

  reply	other threads:[~2017-07-07 16:19 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06  9:49 [PATCH v2 00/10] arm, arm64: frequency- and cpu-invariant accounting support for task scheduler Dietmar Eggemann
2017-07-06  9:49 ` [PATCH v2 01/10] drivers base/arch_topology: free cpumask cpus_to_visit Dietmar Eggemann
2017-07-06 10:22   ` Viresh Kumar
2017-07-06 10:59     ` Juri Lelli
2017-07-06 11:15       ` Viresh Kumar
2017-07-07 15:50         ` Dietmar Eggemann
2017-07-06  9:49 ` [PATCH v2 02/10] cpufreq: provide data for frequency-invariant load-tracking support Dietmar Eggemann
2017-07-06 10:40   ` Viresh Kumar
2017-07-06 22:38     ` Rafael J. Wysocki
2017-07-07 16:01     ` Dietmar Eggemann
2017-07-07 16:18       ` Rafael J. Wysocki [this message]
2017-07-07 17:06         ` Dietmar Eggemann
2017-07-08 12:09           ` Rafael J. Wysocki
2017-07-10  6:54             ` Viresh Kumar
2017-07-10 12:46               ` Rafael J. Wysocki
2017-07-11  6:39                 ` Viresh Kumar
2017-07-11 15:21                   ` Dietmar Eggemann
2017-07-13 12:40                     ` Sudeep Holla
2017-07-13 13:08                       ` Dietmar Eggemann
2017-07-13 14:06                         ` Sudeep Holla
2017-07-10  9:30             ` Peter Zijlstra
2017-07-10  9:42               ` Viresh Kumar
2017-07-10 10:31                 ` Dietmar Eggemann
2017-07-10 12:02             ` Dietmar Eggemann
2017-07-11  6:01               ` Viresh Kumar
2017-07-11 15:06                 ` Dietmar Eggemann
2017-07-11 14:59                   ` Rafael J. Wysocki
2017-07-11 15:12                     ` Dietmar Eggemann
2017-07-12  4:09                   ` Viresh Kumar
2017-07-12  8:31                     ` Peter Zijlstra
2017-07-12  9:27                       ` Viresh Kumar
2017-07-12 11:14                         ` Peter Zijlstra
2017-07-12 23:13                           ` Rafael J. Wysocki
2017-07-13  7:49                             ` Peter Zijlstra
2017-07-13  8:48                             ` Viresh Kumar
2017-07-13 11:15                               ` Peter Zijlstra
2017-07-13 14:04                           ` Sudeep Holla
2017-07-13 14:42                             ` Peter Zijlstra
2017-07-13 15:00                               ` Sudeep Holla
2017-07-13 12:54                         ` Sudeep Holla
2017-07-13 12:49                     ` Sudeep Holla
2017-07-10  6:40       ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 03/10] drivers base/arch_topology: " Dietmar Eggemann
2017-07-06 10:45   ` Viresh Kumar
2017-07-07 16:51     ` Dietmar Eggemann
2017-07-06  9:49 ` [PATCH v2 04/10] arm: wire cpufreq input data for frequency-invariant accounting up to the arch Dietmar Eggemann
2017-07-06 10:42   ` Viresh Kumar
2017-07-10 15:13     ` Dietmar Eggemann
2017-07-11  6:32       ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 05/10] arm: wire frequency-invariant accounting support up to the task scheduler Dietmar Eggemann
2017-07-06 10:46   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 06/10] arm: wire cpu-invariant " Dietmar Eggemann
2017-07-06 10:47   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 07/10] arm64: wire cpufreq input data for frequency-invariant accounting up to the arch Dietmar Eggemann
2017-07-06 10:48   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 08/10] arm64: wire frequency-invariant accounting support up to the task scheduler Dietmar Eggemann
2017-07-06 10:48   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 09/10] arm64: wire cpu-invariant " Dietmar Eggemann
2017-07-06 10:49   ` Viresh Kumar
2017-07-06  9:49 ` [PATCH v2 10/10] drivers base/arch_topology: inline cpu- and frequency-invariant accounting Dietmar Eggemann
2017-07-06 10:57   ` Viresh Kumar
2017-07-10 15:17     ` Dietmar Eggemann

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=CAJZ5v0gBPNDBYWbuHVaB7deNHSZKziaAeybSw3mg+S8V_roO-Q@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=juri.lelli@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=will.deacon@arm.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).