[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190225085847.yvrtmxtwvk725b7v@e107158-lin.cambridge.arm.com>
Date: Mon, 25 Feb 2019 08:58:47 +0000
From: Qais Yousef <qais.yousef@....com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Rafael Wysocki <rjw@...ysocki.net>, linux-pm@...r.kernel.org,
Vincent Guittot <vincent.guittot@...aro.org>, mka@...omium.org,
juri.lelli@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 4/5] cpufreq: Register notifiers with the PM QoS
framework
On 02/25/19 10:01, Viresh Kumar wrote:
> On 22-02-19, 11:44, Qais Yousef wrote:
> > Hi Verish
> >
> > On 02/21/19 16:59, Viresh Kumar wrote:
> >
> > [...]
> >
> > > @@ -2239,6 +2314,8 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
> > > struct cpufreq_policy *new_policy)
> > > {
> > > struct cpufreq_governor *old_gov;
> > > + struct device *cpu_dev = get_cpu_device(policy->cpu);
> > > + unsigned long min, max;
> > > int ret;
> > >
> > > pr_debug("setting new policy for CPU %u: %u - %u kHz\n",
> > > @@ -2253,11 +2330,23 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
> > > if (new_policy->min > new_policy->max)
> > > return -EINVAL;
> > >
> > > + min = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MIN_FREQUENCY);
> > > + max = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MAX_FREQUENCY);
> > > +
> > > + if (min > new_policy->min)
> > > + new_policy->min = min;
> > > + if (max < new_policy->max)
> > > + new_policy->max = max;
> > > +
> >
> > Assuming for example min and max range from 1-10, and thermal throttles max to
> > 5 using pm_qos to deal with temporary thermal pressure. But shortly after
> > a driver thinks that max shouldn't be greater than 7 for one reason or another.
> >
> > What will happen after thermal pressure removes its constraint? Will we still
> > remember the driver's request and apply it so max is set to 7 instead of 10?
>
> Once everything comes via PM QoS, it will remember all the presently available
> requests and choose a target min/max frequency based on that.
OK I can see the logic now in kernel/power/qos.c now. Sorry I missed it and it
was easier to ask :-)
>
> But even with this patchset, with half stuff done with PM QoS and half done with
> cpufreq notifiers, it should still work that way only.
And this is why we need to check here if the PM QoS value doesn't conflict with
the current min/max, right? Until the current notifier code is removed they
could trip over each others.
It would be nice to add a comment here about PM QoS managing and remembering
values and that we need to be careful that both mechanisms don't trip over
each others until this transient period is over.
I have a nit too. It would be nice to explicitly state this is
CPU_{MIN,MAX}_FREQUENCY. I can see someone else adding {MIN,MAX}_FREQUENCY for
something elsee (memory maybe?)
Although I looked at the previous series briefly, but this one looks more
compact and easier to follow, so +1 for that.
--
Qais Yousef
Powered by blists - more mailing lists