mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
devfreq: govener_memlat: fix cpu_hotplug_lock recursive lock warning
Possible unsafe locking scenario:
CPU0
----
lock(cpu_hotplug_lock.rw_sem);
lock(cpu_hotplug_lock.rw_sem);
*** DEADLOCK ***
Below code under start_hwmon may cause this recursive locking.
get_online_cpus();
for_each_cpu(cpu, cpu_possible_mask) {
if (!cpumask_test_cpu(cpu, cpu_online_mask))
per_cpu(cpu_is_hp, cpu) = true;
}
ret = memlat_event_cpu_hp_init();
put_online_cpus();
get_online_cpus() acquires cpu_hotplug_lock.rw_sem lock.
Then memlat_event_cpu_hp_init() -> __cpuhp_setup_state() tries
to acquire the same lock again.
Use cpuslocked version of __cpuhp_setup_state() to avoid this warning.
Change-Id: Ied9fe53d02c74816f38c1efe954cea91f9831cc7
Signed-off-by: Abhishek Shah <abhshah@codeaurora.org>
This commit is contained in:
parent
63898d5378
commit
d8ea382c8a
1 changed files with 5 additions and 1 deletions
|
|
@ -519,11 +519,15 @@ static int memlat_event_hotplug_going_down(unsigned int cpu)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: We must be holding cpus_read_lock() before calling this function
|
||||
* since we are using cpuslocked version of function inside it
|
||||
*/
|
||||
static int memlat_event_cpu_hp_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
|
||||
ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN,
|
||||
"MEMLAT_EVENT",
|
||||
memlat_event_hotplug_coming_up,
|
||||
memlat_event_hotplug_going_down);
|
||||
|
|
|
|||
Loading…
Reference in a new issue