[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160113055917.GG6050@ubuntu>
Date: Wed, 13 Jan 2016 11:29:17 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Juri Lelli <juri.lelli@....com>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
peterz@...radead.org, rjw@...ysocki.net, mturquette@...libre.com,
steve.muckle@...aro.org, vincent.guittot@...aro.org,
morten.rasmussen@....com, dietmar.eggemann@....com
Subject: Re: [RFC PATCH 05/19] cpufreq: assert locking when accessing
cpufreq_policy_list
On 12-01-16, 11:44, Juri Lelli wrote:
> But next_policy is called multiple times as part of
> for_each_suitable_policy(). What if someone thinks she/he can release
> cpufreq_driver_lock inside for_each_(in)active_policy() loop? Not that
> it makes sense, but don't you think it could happen?
Okay, I don't have strong opinion about using that only in the first
routine. No issues.
> > > /* No policies in the list */
> > > if (list_empty(&cpufreq_policy_list))
> > > return NULL;
> > > @@ -2430,6 +2432,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
> > > if (ret)
> > > goto err_boost_unreg;
> > >
> > > + lockdep_assert_held(&cpufreq_driver_lock);
> >
> > Why do you need a cpufreq_driver_lock here? And the above change
> > should generate a lockdep here as the lock isn't taken right now.
> >
>
> Because you are checking cpufreq_policy_list to see if it's empty. And
> it generates a lockdep warning, yes; fixed by next patch. Maybe putting
> fixes before warnings, as you are suggesting, is better.
Well, locking isn't required because we think we need to protect every
access of a variable (like cpufreq_policy_list here). But we need to
protect its access from possible races.
What I am saying is, we can't have a race here. And so no need to lock
it down.
--
viresh
Powered by blists - more mailing lists