Skip to content

Commit 197a2d3

Browse files
committed
soc: rockchip: opp_select: add missing rcu lock
=============================== [ INFO: suspicious RCU usage. ] 4.4.120 #194 Not tainted ------------------------------- drivers/base/power/opp/core.c:453 Missing rcu_read_lock() or opp_table_lock protection! other info that might help us debug this: rcu_scheduler_active = 1, debug_locks = 1 3 locks held by swapper/0/1: #0: (&dev->mutex){......}, at: [<ffffff80082bf1e0>] __device_attach+0x28/0x104 #1: (cpu_hotplug.lock){++++++}, at: [<ffffff800809aac0>] get_online_cpus+0x38/0x9c #2: (subsys mutex#6){+.+.+.}, at: [<ffffff80082be46c>] subsys_interface_register+0x38/0xc4 stack backtrace: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.120 #194 Hardware name: Rockchip RK3308 evb digital-pdm mic board (DT) Call trace: [<ffffff8008087f08>] dump_backtrace+0x0/0x1b8 [<ffffff80080880d4>] show_stack+0x14/0x1c [<ffffff800820ac14>] dump_stack+0xa8/0xe8 [<ffffff80080d82d8>] lockdep_rcu_suspicious+0xe4/0x10c [<ffffff80082ce72c>] dev_pm_opp_find_freq_ceil+0x6c/0x108 [<ffffff800824d84c>] rockchip_adjust_opp_by_irdrop+0xf4/0x1e8 [<ffffff80083a66fc>] cpufreq_init+0x134/0x414 [<ffffff80083a0eec>] cpufreq_online+0x1b4/0x68c [<ffffff80083a1464>] cpufreq_add_dev+0x3c/0x94 [<ffffff80082be4dc>] subsys_interface_register+0xa8/0xc4 [<ffffff80083a1700>] cpufreq_register_driver+0x10c/0x1a8 [<ffffff80083a6aa8>] dt_cpufreq_probe+0xcc/0xe8 [<ffffff80082c0db4>] platform_drv_probe+0x54/0xa8 [<ffffff80082bf478>] driver_probe_device+0x188/0x26c [<ffffff80082bf694>] __device_attach_driver+0x60/0x9c [<ffffff80082bda4c>] bus_for_each_drv+0x84/0x94 [<ffffff80082bf264>] __device_attach+0xac/0x104 [<ffffff80082bf80c>] device_initial_probe+0x10/0x18 [<ffffff80082be8e4>] bus_probe_device+0x2c/0x90 [<ffffff80082bcd48>] device_add+0x434/0x4dc [<ffffff80082c0ad0>] platform_device_add+0xa0/0x1e4 [<ffffff80082c1520>] platform_device_register_full+0xa0/0xe0 [<ffffff800882512c>] rockchip_cpufreq_driver_init+0xb4/0x360 [<ffffff800808312c>] do_one_initcall+0xe8/0x194 [<ffffff8008810cec>] kernel_init_freeable+0x1d0/0x1d4 [<ffffff80085b8fa4>] kernel_init+0x14/0x148 [<ffffff8008082ee0>] ret_from_fork+0x10/0x30 Note: we should use dev_pm_opp_put on new kernel. Change-Id: I39e85892f6e7994bbe4816d09e4446de5cd25cad Signed-off-by: Tao Huang <huangtao@rock-chips.com>
1 parent dcda0fb commit 197a2d3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/soc/rockchip/rockchip_opp_select.c

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/soc/rockchip/pvtm.h>
1111
#include <linux/thermal.h>
1212
#include <linux/pm_opp.h>
13+
#include <linux/version.h>
1314
#include <soc/rockchip/rockchip_opp_select.h>
1415

1516
#include "../../clk/rockchip/clk.h"
@@ -384,6 +385,9 @@ int rockchip_adjust_opp_by_irdrop(struct device *dev)
384385
of_property_read_u32_index(np, "rockchip,max-volt", 0, &max_volt);
385386
of_property_read_u32_index(np, "rockchip,evb-irdrop", 0, &evb_irdrop);
386387

388+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
389+
rcu_read_lock();
390+
#endif
387391
count = dev_pm_opp_get_opp_count(dev);
388392
if (count <= 0) {
389393
ret = count ? count : -ENODATA;
@@ -427,6 +431,9 @@ int rockchip_adjust_opp_by_irdrop(struct device *dev)
427431
}
428432
}
429433
out:
434+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
435+
rcu_read_unlock();
436+
#endif
430437
of_node_put(np);
431438
return ret;
432439
}

0 commit comments

Comments
 (0)