Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1306565 > unrolled thread
| Started by | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| First post | 2016-01-11 18:50 +0100 |
| Last post | 2016-01-12 16:40 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC PATCH 07/19] cpufreq: assert locking when accessing cpufreq_governor_list Juri Lelli <juri.lelli@arm.com> - 2016-01-11 18:50 +0100
Re: [RFC PATCH 07/19] cpufreq: assert locking when accessing cpufreq_governor_list Viresh Kumar <viresh.kumar@linaro.org> - 2016-01-12 11:10 +0100
Re: [RFC PATCH 07/19] cpufreq: assert locking when accessing cpufreq_governor_list Juri Lelli <juri.lelli@arm.com> - 2016-01-12 16:40 +0100
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2016-01-11 18:50 +0100 |
| Subject | [RFC PATCH 07/19] cpufreq: assert locking when accessing cpufreq_governor_list |
| Message-ID | <qPOLp-5E8-19@gated-at.bofh.it> |
cpufreq_governor_list is guarded by cpufreq_governor_mutex. Add
appropriate locking assertions to check that we always access the list
while holding the lock protecting it.
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
---
drivers/cpufreq/cpufreq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 98adbc2..7dae7f3 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -506,6 +506,7 @@ static struct cpufreq_governor *find_governor(const char *str_governor)
{
struct cpufreq_governor *t;
+ lockdep_assert_held(&cpufreq_governor_mutex);
for_each_governor(t)
if (!strncasecmp(str_governor, t->name, CPUFREQ_NAME_LEN))
return t;
@@ -693,6 +694,7 @@ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy,
goto out;
}
+ lockdep_assert_held(&cpufreq_governor_mutex);
for_each_governor(t) {
if (i >= (ssize_t) ((PAGE_SIZE / sizeof(char))
- (CPUFREQ_NAME_LEN + 2)))
@@ -2025,6 +2027,7 @@ int cpufreq_register_governor(struct cpufreq_governor *governor)
err = -EBUSY;
if (!find_governor(governor->name)) {
err = 0;
+ lockdep_assert_held(&cpufreq_governor_mutex);
list_add(&governor->governor_list, &cpufreq_governor_list);
}
--
2.2.2
[toc] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-01-12 11:10 +0100 |
| Subject | Re: [RFC PATCH 07/19] cpufreq: assert locking when accessing cpufreq_governor_list |
| Message-ID | <qQ43M-7TO-41@gated-at.bofh.it> |
| In reply to | #1306565 |
On 11-01-16, 17:35, Juri Lelli wrote:
> @@ -2025,6 +2027,7 @@ int cpufreq_register_governor(struct cpufreq_governor *governor)
> err = -EBUSY;
> if (!find_governor(governor->name)) {
> err = 0;
> + lockdep_assert_held(&cpufreq_governor_mutex);
> list_add(&governor->governor_list, &cpufreq_governor_list);
> }
Why here? This is how the routine looks like:
int cpufreq_register_governor(struct cpufreq_governor *governor)
{
int err;
if (!governor)
return -EINVAL;
if (cpufreq_disabled())
return -ENODEV;
mutex_lock(&cpufreq_governor_mutex);
governor->initialized = 0;
err = -EBUSY;
if (!find_governor(governor->name)) {
err = 0;
list_add(&governor->governor_list, &cpufreq_governor_list);
}
mutex_unlock(&cpufreq_governor_mutex);
return err;
}
--
viresh
[toc] | [prev] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2016-01-12 16:40 +0100 |
| Subject | Re: [RFC PATCH 07/19] cpufreq: assert locking when accessing cpufreq_governor_list |
| Message-ID | <qQ9d9-2Sx-33@gated-at.bofh.it> |
| In reply to | #1307195 |
Hi,
On 12/01/16 15:31, Viresh Kumar wrote:
> On 11-01-16, 17:35, Juri Lelli wrote:
> > @@ -2025,6 +2027,7 @@ int cpufreq_register_governor(struct cpufreq_governor *governor)
> > err = -EBUSY;
> > if (!find_governor(governor->name)) {
> > err = 0;
> > + lockdep_assert_held(&cpufreq_governor_mutex);
> > list_add(&governor->governor_list, &cpufreq_governor_list);
> > }
>
> Why here? This is how the routine looks like:
>
I guess I was simply over-paranoid. We can drop this assertion.
Thanks,
- Juri
> int cpufreq_register_governor(struct cpufreq_governor *governor)
> {
> int err;
>
> if (!governor)
> return -EINVAL;
>
> if (cpufreq_disabled())
> return -ENODEV;
>
> mutex_lock(&cpufreq_governor_mutex);
>
> governor->initialized = 0;
> err = -EBUSY;
> if (!find_governor(governor->name)) {
> err = 0;
> list_add(&governor->governor_list, &cpufreq_governor_list);
> }
>
> mutex_unlock(&cpufreq_governor_mutex);
> return err;
> }
>
>
> --
> viresh
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web