Re: [PATCH] cpufreq, store_scaling_governor requires policy->rwsem to be held for duration of changing governors [v2]
From: Prarit Bhargava
Date: Mon Aug 04 2014 - 08:25:55 EST
On 08/04/2014 06:36 AM, Viresh Kumar wrote:
> Sorry for the delay guys, was away :(
>
>>
>> Possible unsafe locking scenario:
>>
>> CPU0 CPU1
>> ---- ----
>> lock(&policy->rwsem);
>> lock(s_active#9);
>> lock(&policy->rwsem);
>> lock(s_active#9);
>>
>
> Thanks for coming to my rescue Stephen :), I was quite sure I got this
> with ondemand
> as well..
Yeah, I'm confused by it a bit because I wasn't able to reproduce it. But I've
got some pretty clear instructions on how to do it.
>
> I will be looking very closely at the code now to see what's going wrong.
> And btw, does anybody here has the exact understanding of why this
> lockdep does happen? I mean what was the real problem for which we
The issue is the collision between the setup & teardown of the policy's governor
sysfs files.
On creation the kernel does:
down_write(&policy->rwsem)
mutex_lock(kernfs_mutex) <- note this is similar to the "old" sysfs_mutex.
The opposite happens on a governor switch, specifically the existing governor's
exit, and then we get a lockdep warning.
I tried to reproduce with the instructions but was unable to ... ut that was on
Friday ;) and I'm going to try again this morning. I've also ping'd some of the
engineers here in the office who are working on ARM to get access to a system to
do further analysis and testing.
I'll ping back later in the day with some results.
Sorry I don't have a better answer or solution yet, Viresh.
P.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/