From: Radivoje Jovanovic <radivoje.jovanovic@linux.intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Punit Agrawal <punit.agrawal@arm.com>,
rjw@rjwysocki.net, LKML <linux-kernel@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Eduardo Valentin <edubezval@gmail.com>,
Radivoje Jovanovic <radivoje.jovanovic@intel.com>
Subject: Re: [PATCH] thermal/cpu_cooling: remove local cooling state variable
Date: Thu, 30 Jul 2015 13:21:30 -0700 [thread overview]
Message-ID: <20150730132130.3c957267@radivoje-desk2> (raw)
In-Reply-To: <20150730080541.GD31351@linux>
On Thu, 30 Jul 2015 13:35:41 +0530
Viresh Kumar <viresh.kumar@linaro.org> wrote:
Hi Viresh,
> Cc'ing Rafael as well..
>
> On 29-07-15, 17:46, Punit Agrawal wrote:
> > [ adding Viresh ]
>
> Thanks. That earned me few more patches ;)
>
> > Radivoje Jovanovic <radivoje.jovanovic@linux.intel.com> writes:
> >
> > > Hi Agarwal,
> > >
> > > On Fri, 24 Jul 2015 16:26:12 +0100
> > > Punit Agrawal <punit.agrawal@arm.com> wrote:
> > >
> > >> Radivoje Jovanovic <radivoje.jovanovic@linux.intel.com> writes:
> > >>
> > >> > From: Radivoje Jovanovic <radivoje.jovanovic@intel.com>
> > >> >
> > >> > there is no need to keep local state variable. if another
> > >> > driver changes the policy under our feet the cpu_cooling
> > >> > driver will have the wrong state. Get current state from the
> > >> > policy directly instead
> > >> >
> > >>
> > >> Although the patch below looks good, it does add additional
> > >> processing. I was wondering in what situation do you observe the
> > >> problem $SUBJECT solves?
> > >>
> > >> Presumably, the policy caps are tighter than those imposed by
> > >> the cpu cooling device (cpufreq_thermal_notifier should take
> > >> care of this).
> > >
> > > we are using this solution on the platfrom which has user space
> > > component control cpufreq throttling. However, user space
> > > component has its limitations so we are using cpu_cooling as a
> > > critical backup. Due to this cpu_cooling does not have correct
> > > state as a current state so when the change is needed cpu_cooling
> > > does not make the change since it believes it is in the "correct"
> > > state. I agree that there is slight increase in processing, but
> > > in the case when user space is changing the policy the notifier
> > > will not have access to the current state of the cpu_cooling to
> > > change it appropriately.
> > >
> >
> > Makes sense. Thanks for the explanation.
>
> Sorry, but with what I understood it doesn't make sense. And I can be
> wrong here, so please don't laugh at me :)
>
> So, we have two external suppliers to policy->max here:
> - user space: which decides the maximum frequency the policy can ever
> achieve.
> - thermal: which decides the maximum safe frequency the policy should
> ever be set to.
>
> We need to set policy->max based on what user requested, but keeping
> in mind the thermal limitations.
>
> So if the clipped-freq from thermal is higher than what user has
> requested, we don't need to do anything.
>
> But if the clipped-freq is lower than what user has requested, then
> we need to correct that to keep the system in safe range.
>
> That's what the code is doing as well.
>
> Now coming to the change you made. What you are saying is, we should
> report current state based on the value of policy->max. But why?
>
> policy->max can be lesser than clipped-freq (set by thermal), and the
> current state of thermal clipped-freq isn't what policy->max gives.
>
> Now, I didn't understood when you said "cpu_cooling doesn't change
> the state since it believes it is in correct state". Can you please
> explain that with some example?
>
In this case both userspace thermal solution and cpu_cooling are
changing policy->max and the userspace solution will let governor or HW
(depends on architecture) decide the clipped-freq. Now let us say that
cpu_cooling has 4 available states 0-3 and let us say that cpu_cooling
has set the state 1 as the last state. Now userspace component comes in
and changes the state of the system that matches cpu_cooling state 0.
cpu_cooling is unaware of this change and does not change the local
cur_state. Now the temperature changes and cpu_cooling should change
the system state to 1 (userspace component malfunctioned and is not
picking up this change) but since the cur_state is already at 1
cpu_cooling will not do anything since it believes it is in the correct
state. Hope this explains it better
next prev parent reply other threads:[~2015-07-30 20:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 22:13 [PATCH] thermal/cpu_cooling: remove local cooling state variable Radivoje Jovanovic
2015-07-24 15:26 ` Punit Agrawal
2015-07-24 17:09 ` Radivoje Jovanovic
2015-07-29 16:46 ` Punit Agrawal
2015-07-29 17:00 ` Radivoje Jovanovic
2015-07-30 8:05 ` Viresh Kumar
2015-07-30 20:21 ` Radivoje Jovanovic [this message]
2015-07-31 3:18 ` Viresh Kumar
2015-07-31 15:30 ` Radivoje Jovanovic
2015-08-01 11:34 ` Viresh Kumar
2015-08-03 3:13 ` Viresh Kumar
2015-08-03 19:28 ` Radivoje Jovanovic
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=20150730132130.3c957267@radivoje-desk2 \
--to=radivoje.jovanovic@linux.intel.com \
--cc=edubezval@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=punit.agrawal@arm.com \
--cc=radivoje.jovanovic@intel.com \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
--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