From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
Preeti U Murthy <preeti@linux.vnet.ibm.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V3 1/5] cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate()
Date: Wed, 28 Oct 2015 14:26:22 +0530 [thread overview]
Message-ID: <20151028085622.GI30039@ubuntu> (raw)
In-Reply-To: <1614479.PJ5OqJLPyG@vostro.rjw.lan>
On 28-10-15, 08:46, Rafael J. Wysocki wrote:
> On Wednesday, October 28, 2015 12:13:17 PM Viresh Kumar wrote:
> > Actually yeah, but then the fourth patch of this series uses the
> > timer_mutex to fix a long standing problem (which was fixed by hacking
> > the code earlier). And so we need to take the lock for the entire
> > dbs_timer() routine.
Well, there is another reason why the lock is taken for the complete
dbs_timer() routine. There are two parts of that routine:
- Checking if load evaluation is required or not + updating the
last-update time.
- The second is the load evaluation + freq change thing.
Lock around the first check makes sure that timer handlers of other
CPUs don't do load evaluation in parallel and that they don't do it
before the sampling period.
Lock around the second part makes sure there is only one thread which
is doing load evaluation + freq update. The other thread being
cpufreq_governor_limits(). And so the same lock taken across that part
as well.
> I don't actually think that that patch is correct and even if it is,
> we'll only need to do that *after* that patch, so at least it would be
> fair to say a word about it in the changelog, wouldn't it?
Hmm, If you agree about the above reasoning, then we may not require
an update to the changelog, otherwise I will mention that in the
changelog of this patch.
> > Yeah, we are calling dbs_check_cpu(dbs_data, cpu) from that path,
> > which will reevaluate the load.
>
> Which means that we should take the lock around dbs_check_cpu() everywhere
> in a consistent way.
We already do this from everywhere.
> Which in turn means that the lock actually does more
> than you said.
What I described towards the top is probably a better answer to the
earlier query.
> My point is basically that we seem to have a vague idea about what the lock
> is used for, while we need to know exactly why we need it.
I am totally with you on this, we have surely screwed up on locking
for a long time in cpufreq. And we should know exactly why we want to
change it now.
--
viresh
next prev parent reply other threads:[~2015-10-28 8:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 8:09 [PATCH V3 0/5] CPUFreq: governors: further cleanups Viresh Kumar
2015-10-13 8:09 ` [PATCH V3 1/5] cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate() Viresh Kumar
2015-10-28 4:05 ` Rafael J. Wysocki
2015-10-28 4:44 ` Viresh Kumar
2015-10-28 5:54 ` Rafael J. Wysocki
2015-10-28 6:43 ` Viresh Kumar
2015-10-28 7:46 ` Rafael J. Wysocki
2015-10-28 8:56 ` Viresh Kumar [this message]
2015-10-13 8:09 ` [PATCH V3 2/5] cpufreq: ondemand: update sampling rate immediately Viresh Kumar
2015-10-28 6:28 ` Rafael J. Wysocki
2015-10-28 9:31 ` Viresh Kumar
2015-10-28 15:31 ` Rafael J. Wysocki
2015-10-28 15:28 ` Viresh Kumar
2015-10-28 16:13 ` Rafael J. Wysocki
2015-10-28 15:47 ` Viresh Kumar
2015-10-13 8:09 ` [PATCH V3 3/5] cpufreq: ondemand: queue work for policy->cpus together Viresh Kumar
2015-10-28 6:38 ` Rafael J. Wysocki
2015-10-28 6:46 ` Viresh Kumar
2015-10-28 7:33 ` Rafael J. Wysocki
2015-10-28 8:34 ` Viresh Kumar
2015-10-13 8:09 ` [PATCH V3 4/5] cpufreq: governor: Quit work-handlers early if governor is stopped Viresh Kumar
2015-10-28 7:10 ` Rafael J. Wysocki
2015-10-28 8:25 ` Viresh Kumar
2015-10-28 15:12 ` Rafael J. Wysocki
2015-10-28 14:46 ` Viresh Kumar
2015-10-13 8:09 ` [PATCH V3 5/5] cpufreq: Get rid of ->governor_enabled and its lock Viresh Kumar
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=20151028085622.GI30039@ubuntu \
--to=viresh.kumar@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=preeti@linux.vnet.ibm.com \
--cc=rjw@rjwysocki.net \
/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).