cpufreq: interactive: fix deadlock on touchboost

Call trace:
__switch_to+0xe4/0x138
__schedule+0x2f4/0x930
schedule+0x38/0xa0
rwsem_down_write_failed+0x12c/0x248
down_write+0x48/0x60 ------lock(&policy->rwsem)
cpufreq_update_policy+0x40/0xf8
cpufreq_interactive_speedchange_task+0x3a8/0x408 ------lock(&icpu->enable_sem)
kthread+0x12c/0x158
ret_from_fork+0x10/0x18

Call trace:
__switch_to+0xe4/0x138
__schedule+0x2f4/0x930
schedule+0x38/0xa0
rwsem_down_write_failed+0x12c/0x248
down_write+0x48/0x60 ------lock(&icpu->enable_sem)
cpufreq_interactive_stop+0x8c/0xe8
cpufreq_stop_governor.part.2+0x1c/0x30
cpufreq_set_policy+0x250/0x290
store_scaling_governor+0x84/0xe0
store+0xa8/0xc8 ------lock(&policy->rwsem)
sysfs_kf_write+0x48/0x58
kernfs_fop_write+0xf4/0x220
__vfs_write+0x34/0x158
vfs_write+0xb0/0x1d0
ksys_write+0x64/0xe0
__arm64_sys_write+0x14/0x20
el0_svc_common.constprop.0+0x64/0x178
el0_svc_handler+0x28/0x78
el0_svc+0x8/0xc

Fixes: f54f7a44b2 ("cpufreq: interactive: set rockchip system monitor boosted when touchboost")
Signed-off-by: Liang Chen <cl@rock-chips.com>
Change-Id: Ie4a6c3cdc41493d868aed32fca4de7da8815c778
This commit is contained in:
Liang Chen
2023-01-07 06:23:19 +08:00
committed by Tao Huang
parent 8cc88e234c
commit 171f4d6320

View File

@ -610,6 +610,7 @@ again:
struct cpufreq_policy *policy;
#ifdef CONFIG_ARCH_ROCKCHIP
struct interactive_tunables *tunables;
bool update_policy = false;
u64 now;
now = ktime_to_us(ktime_get());
@ -631,17 +632,19 @@ again:
now > tunables->touchboostpulse_endtime) {
tunables->touchboost = false;
rockchip_monitor_clear_boosted();
cpufreq_update_policy(cpu);
update_policy = true;
}
if (!tunables->is_touchboosted && tunables->touchboost) {
rockchip_monitor_set_boosted();
cpufreq_update_policy(cpu);
update_policy = true;
}
tunables->is_touchboosted = tunables->touchboost;
up_read(&icpu->enable_sem);
if (update_policy)
cpufreq_update_policy(cpu);
#endif
policy = cpufreq_cpu_get(cpu);
if (!policy)