[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c9910c74-ab47-0c78-a1c7-4f3978e1dd09@arm.com>
Date: Tue, 21 Jan 2020 10:10:16 +0100
From: Dietmar Eggemann <dietmar.eggemann@....com>
To: Lukasz Luba <lukasz.luba@....com>,
Quentin Perret <qperret@...gle.com>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
dri-devel@...ts.freedesktop.org, linux-omap@...r.kernel.org,
linux-mediatek@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
linux-imx@....com, Morten.Rasmussen@....com, Chris.Redpath@....com,
ionela.voinescu@....com, javi.merino@....com,
cw00.choi@...sung.com, b.zolnierkie@...sung.com, rjw@...ysocki.net,
sudeep.holla@....com, viresh.kumar@...aro.org, nm@...com,
sboyd@...nel.org, rui.zhang@...el.com, amit.kucheria@...durent.com,
daniel.lezcano@...aro.org, mingo@...hat.com, peterz@...radead.org,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
shawnguo@...nel.org, s.hauer@...gutronix.de, festevam@...il.com,
kernel@...gutronix.de, khilman@...nel.org, agross@...nel.org,
bjorn.andersson@...aro.org, robh@...nel.org,
matthias.bgg@...il.com, steven.price@....com,
tomeu.vizoso@...labora.com, alyssa.rosenzweig@...labora.com,
airlied@...ux.ie, daniel@...ll.ch, kernel-team@...roid.com
Subject: Re: [PATCH 1/4] PM / EM: and devices to Energy Model
On 20/01/2020 19:38, Lukasz Luba wrote:
>
>
> On 1/20/20 6:27 PM, Dietmar Eggemann wrote:
>> On 20/01/2020 16:09, Quentin Perret wrote:
>>> Hey Lukasz,
>>>
>>> On Monday 20 Jan 2020 at 14:52:07 (+0000), Lukasz Luba wrote:
>>>> On 1/17/20 10:54 AM, Quentin Perret wrote:
[...]
>> It's true that we need the policy->cpus cpumask only for cpu devices and
>> we have it available when we call em_register_perf_domain()
>> [scmi-cpufreq.c driver] or the OPP wrapper dev_pm_opp_of_register_em()
>> [e.g. cpufreq-dt.c driver].
>>
>> And we shouldn't make EM code dependent on OPP.
>>
>> But can't we add 'struct cpumask *mask' as an additional argument to
>> both which can be set to NULL for (devfreq) devices?
>>
>> We can check in em_register_perf_domain() that we got a valid cpumask
>> for a cpu device and ignore it for (devfreq) devices.
>>
>
> I think we could avoid this additional argument 'cpumask'. I have
> checked the cpufreq_cpu_get function, which should do be good for this:
>
> ---------->8-------------------------
> static int _get_sharing_cpus(struct device *cpu_dev, struct cpumask *span)
> {
> struct cpufreq_policy *policy;
>
> policy = cpufreq_cpu_get(cpu_dev->id);
> if (policy) {
> cpumask_copy(span, policy->cpus);
> cpufreq_cpu_put(policy);
> return 0;
> } else {
> return -EINVAL;
> }
> }
> --------------------------8<-------------------------------
>
> It would be a replacement for:
> ret = dev_pm_opp_get_sharing_cpus(dev, span);
True. But then we hard-code that a CPU device performance domain can
only be a frequency domain (which is true today).
The task scheduler (build_perf_domains()) and thermal are already using
cpufreq_cpu_get() to access the cpufreq policy. Now the EM framework
would too for CPU devices. I assume that could work with a couple of
adaptations in Documentation/power/energy-model.rst.
BTW, there is a similar interface cpufreq_get_policy() in cpufreq.c
which is used less often?
Powered by blists - more mailing lists