[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160118052336.GB30762@vireshk>
Date: Mon, 18 Jan 2016 10:53:36 +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 08/19] cpufreq: fix warning for cpufreq_init_policy
unlocked access to cpufreq_governor_list
On 14-01-16, 16:35, Juri Lelli wrote:
> But, don't we have to guarantee consinstency between multiple operations
> on cpufreq_governor_list?
>
> In cpufreq_register_governor() we have:
>
> 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);
>
> IIUC, find_governor and list_add have to be atomic. Couldn't someone
> slip in right after find_governor and add the same governor to the list?
Yeah, I was wrong that cpufreq_register_governor() doesn't need a
lock. We already have that in place ..
But most of the other places are really useless and shows that we
haven't implemented it well.
I would suggest that we move the lock within find_governor() and
create another find_governor_unlocked() or __find_governor() that will
be used only from cpufreq_register_governor(), with an outer lock.
Looks reasonable ?
--
viresh
Powered by blists - more mailing lists