From: Juri Lelli <juri.lelli@arm.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
Rafael Wysocki <rjw@rjwysocki.net>,
Lists linaro-kernel <linaro-kernel@lists.linaro.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
Saravana Kannan <skannan@codeaurora.org>,
Peter Zijlstra <peterz@infradead.org>,
Michael Turquette <mturquette@baylibre.com>,
Steve Muckle <steve.muckle@linaro.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Morten Rasmussen <morten.rasmussen@arm.com>,
dietmar.eggemann@arm.com,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/5] cpufreq: governor: Create separate sysfs-ops
Date: Tue, 2 Feb 2016 17:01:44 +0000 [thread overview]
Message-ID: <20160202170144.GL3947@e106622-lin> (raw)
In-Reply-To: <CAJZ5v0h3k_CVDkmc8QKczr0MxCuGd+Rm_wSMXO=UHBvOjae0Uw@mail.gmail.com>
Hi Rafael,
On 02/02/16 17:35, Rafael J. Wysocki wrote:
> On Tue, Feb 2, 2016 at 4:47 PM, Juri Lelli <juri.lelli@arm.com> wrote:
> > Hi Viresh,
> >
> > On 02/02/16 16:27, Viresh Kumar wrote:
> >> Until now, governors (ondemand/conservative) were using the
> >> 'global-attr' or 'freq-attr', depending on the sysfs location where we
> >> want to create governor's directory.
> >>
> >> The problem is that, in case of 'freq-attr', we are forced to use
> >> show()/store() present in cpufreq.c, which always take policy->rwsem.
> >>
> >> And because of that we were facing some ABBA lockups during governor
> >> callback event CPUFREQ_GOV_POLICY_EXIT. And so we were dropping the
> >> rwsem right before calling governor callback for CPUFREQ_GOV_POLICY_EXIT
> >> event.
> >>
> >> That caused further problems and it never worked perfectly.
> >>
> >> This patch attempts to fix that by creating separate sysfs-ops for
> >> cpufreq governors.
> >>
> >> Because things got much simplified now, we don't need separate
> >> show/store callbacks for governor-for-system and governor-per-policy
> >> cases.
> >>
> >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> >
> > This patch cleans things up a lot, that's good.
> >
> > One thing I'm still concerned about, though: don't we need some locking
> > in place for some of the store operations on governors attributes? Are
> > store_{ignore_nice_load, sampling_down_fact, etc} safe without locking?
>
> That would require some investigation I suppose.
>
> > It seems that we can call them from different cpus concurrently.
>
> Yes, we can.
>
> One quick-and-dirty way of dealing with that might be to introduce a
> "sysfs lock" into struct dbs_data and hold that around the invocation
> of gattr->store() in the sysfs_ops's ->store callback.
>
There is value in trying to solve this issue by using some of the
existing locks, IMHO.
Can't we actually try to use the policy->rwsem (or one of the core
locks) + wait_for_completion approach as we do in cpufreq core?
> BTW, you could have dropped the stuff below this line from your reply
> message. That at least would have prevented tools like Patchwork from
> storing useless garbage.
>
Right. Sorry for the garbage; I'll check twice that I trim my replies in
the future.
Best,
- Juri
next prev parent reply other threads:[~2016-02-02 17:01 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 10:57 [PATCH 0/5] cpufreq: governors: Solve the ABBA lockups Viresh Kumar
2016-02-02 10:57 ` [PATCH 1/5] cpufreq: governor: Kill declare_show_sampling_rate_min() Viresh Kumar
2016-02-02 20:23 ` Rafael J. Wysocki
2016-02-03 2:29 ` Viresh Kumar
2016-02-02 10:57 ` [PATCH 2/5] cpufreq: governor: Create separate sysfs-ops Viresh Kumar
2016-02-02 15:47 ` Juri Lelli
2016-02-02 16:35 ` Rafael J. Wysocki
2016-02-02 17:01 ` Juri Lelli [this message]
2016-02-02 19:40 ` Rafael J. Wysocki
2016-02-02 22:21 ` Saravana Kannan
2016-02-02 23:42 ` Rafael J. Wysocki
2016-02-03 1:07 ` Rafael J. Wysocki
2016-02-03 1:32 ` Saravana Kannan
2016-02-03 1:52 ` Rafael J. Wysocki
2016-02-03 4:03 ` Saravana Kannan
2016-02-03 6:57 ` Viresh Kumar
2016-02-03 20:07 ` Saravana Kannan
2016-02-03 6:54 ` Viresh Kumar
2016-02-03 10:51 ` Juri Lelli
2016-02-03 10:55 ` Viresh Kumar
2016-02-03 20:14 ` Saravana Kannan
2016-02-03 6:51 ` Viresh Kumar
2016-02-03 6:33 ` Viresh Kumar
2016-02-02 21:23 ` Rafael J. Wysocki
2016-02-03 6:58 ` Viresh Kumar
2016-02-03 12:42 ` Rafael J. Wysocki
2016-02-03 13:21 ` Viresh Kumar
2016-02-03 13:38 ` Rafael J. Wysocki
2016-02-02 10:57 ` [PATCH 3/5] cpufreq: governor: Remove unused sysfs attribute macros Viresh Kumar
2016-02-02 21:34 ` Rafael J. Wysocki
2016-02-02 10:57 ` [PATCH 4/5] cpufreq: Don't drop rwsem before calling CPUFREQ_GOV_POLICY_EXIT Viresh Kumar
2016-02-02 21:53 ` Rafael J. Wysocki
2016-02-03 5:51 ` Viresh Kumar
2016-02-03 12:24 ` Rafael J. Wysocki
2016-02-03 13:09 ` Viresh Kumar
2016-02-02 10:57 ` [PATCH 5/5] cpufreq: Get rid of ->governor_enabled and its lock Viresh Kumar
2016-02-02 16:49 ` Juri Lelli
2016-02-03 6:05 ` Viresh Kumar
2016-02-03 11:05 ` Juri Lelli
2016-02-03 11:08 ` Viresh Kumar
2016-02-02 21:57 ` Rafael J. Wysocki
2016-02-02 11:25 ` [PATCH 0/5] cpufreq: governors: Solve the ABBA lockups Juri Lelli
2016-02-02 20:04 ` Rafael J. Wysocki
2016-02-03 2:22 ` Viresh Kumar
2016-02-03 11:37 ` 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=20160202170144.GL3947@e106622-lin \
--to=juri.lelli@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=morten.rasmussen@arm.com \
--cc=mturquette@baylibre.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=skannan@codeaurora.org \
--cc=steve.muckle@linaro.org \
--cc=vincent.guittot@linaro.org \
--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