2019-06-04 10:11:33 +02:00
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-12 15:53:21 +03:00
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2017-01-23 10:11:46 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2017-01-23 10:11:49 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2016-02-09 10:30:38 +05:30
|
|
|
|
2016-02-09 10:30:33 +05:30
|
|
|
|
|
|
|
|
|
PM / OPP: Protect updates to list_dev with mutex
dev_opp_list_lock is used everywhere to protect device and OPP lists,
but dev_pm_opp_set_sharing_cpus() is missed somehow. And instead we used
rcu-lock, which wouldn't help here as we are adding a new list_dev.
This also fixes a problem where we have called kzalloc(..., GFP_KERNEL)
from within rcu-lock, which isn't allowed as kzalloc can sleep when
called with GFP_KERNEL.
With CONFIG_DEBUG_ATOMIC_SLEEP set, we get following lockdep-splat:
include/linux/rcupdate.h:578 Illegal context switch in RCU read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
5 locks held by swapper/0/1:
#0: (&dev->mutex){......}, at: [<c02f68f4>] __driver_attach+0x48/0x98
#1: (&dev->mutex){......}, at: [<c02f6904>] __driver_attach+0x58/0x98
#2: (cpu_hotplug.lock){++++++}, at: [<c00249d0>] get_online_cpus+0x40/0xb0
#3: (subsys mutex#5){+.+.+.}, at: [<c02f4f8c>] subsys_interface_register+0x44/0xdc
#4: (rcu_read_lock){......}, at: [<c0305c80>] dev_pm_opp_set_sharing_cpus+0x0/0x1e4
stack backtrace:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.3.0-rc7-00047-g81f5932958a8 #59
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c0016874>] (unwind_backtrace) from [<c001355c>] (show_stack+0x10/0x14)
[<c001355c>] (show_stack) from [<c022553c>] (dump_stack+0x94/0xbc)
[<c022553c>] (dump_stack) from [<c004904c>] (___might_sleep+0x24c/0x298)
[<c004904c>] (___might_sleep) from [<c00f07e4>] (kmem_cache_alloc+0xe8/0x164)
[<c00f07e4>] (kmem_cache_alloc) from [<c0305354>] (_add_list_dev+0x30/0x58)
[<c0305354>] (_add_list_dev) from [<c0305d50>] (dev_pm_opp_set_sharing_cpus+0xd0/0x1e4)
[<c0305d50>] (dev_pm_opp_set_sharing_cpus) from [<c040eda4>] (cpufreq_init+0x4cc/0x62c)
[<c040eda4>] (cpufreq_init) from [<c040a964>] (cpufreq_online+0xbc/0x73c)
[<c040a964>] (cpufreq_online) from [<c02f4fe0>] (subsys_interface_register+0x98/0xdc)
[<c02f4fe0>] (subsys_interface_register) from [<c040a640>] (cpufreq_register_driver+0x110/0x17c)
[<c040a640>] (cpufreq_register_driver) from [<c040ef64>] (dt_cpufreq_probe+0x60/0x8c)
[<c040ef64>] (dt_cpufreq_probe) from [<c02f8084>] (platform_drv_probe+0x44/0xa4)
[<c02f8084>] (platform_drv_probe) from [<c02f67c0>] (driver_probe_device+0x208/0x2f4)
[<c02f67c0>] (driver_probe_device) from [<c02f6940>] (__driver_attach+0x94/0x98)
[<c02f6940>] (__driver_attach) from [<c02f4c1c>] (bus_for_each_dev+0x68/0x9c)
Reported-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 4.3 <stable@vger.kernel.org> # 4.3
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-11-05 14:21:19 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
PM / OPP: Protect updates to list_dev with mutex
dev_opp_list_lock is used everywhere to protect device and OPP lists,
but dev_pm_opp_set_sharing_cpus() is missed somehow. And instead we used
rcu-lock, which wouldn't help here as we are adding a new list_dev.
This also fixes a problem where we have called kzalloc(..., GFP_KERNEL)
from within rcu-lock, which isn't allowed as kzalloc can sleep when
called with GFP_KERNEL.
With CONFIG_DEBUG_ATOMIC_SLEEP set, we get following lockdep-splat:
include/linux/rcupdate.h:578 Illegal context switch in RCU read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
5 locks held by swapper/0/1:
#0: (&dev->mutex){......}, at: [<c02f68f4>] __driver_attach+0x48/0x98
#1: (&dev->mutex){......}, at: [<c02f6904>] __driver_attach+0x58/0x98
#2: (cpu_hotplug.lock){++++++}, at: [<c00249d0>] get_online_cpus+0x40/0xb0
#3: (subsys mutex#5){+.+.+.}, at: [<c02f4f8c>] subsys_interface_register+0x44/0xdc
#4: (rcu_read_lock){......}, at: [<c0305c80>] dev_pm_opp_set_sharing_cpus+0x0/0x1e4
stack backtrace:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.3.0-rc7-00047-g81f5932958a8 #59
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c0016874>] (unwind_backtrace) from [<c001355c>] (show_stack+0x10/0x14)
[<c001355c>] (show_stack) from [<c022553c>] (dump_stack+0x94/0xbc)
[<c022553c>] (dump_stack) from [<c004904c>] (___might_sleep+0x24c/0x298)
[<c004904c>] (___might_sleep) from [<c00f07e4>] (kmem_cache_alloc+0xe8/0x164)
[<c00f07e4>] (kmem_cache_alloc) from [<c0305354>] (_add_list_dev+0x30/0x58)
[<c0305354>] (_add_list_dev) from [<c0305d50>] (dev_pm_opp_set_sharing_cpus+0xd0/0x1e4)
[<c0305d50>] (dev_pm_opp_set_sharing_cpus) from [<c040eda4>] (cpufreq_init+0x4cc/0x62c)
[<c040eda4>] (cpufreq_init) from [<c040a964>] (cpufreq_online+0xbc/0x73c)
[<c040a964>] (cpufreq_online) from [<c02f4fe0>] (subsys_interface_register+0x98/0xdc)
[<c02f4fe0>] (subsys_interface_register) from [<c040a640>] (cpufreq_register_driver+0x110/0x17c)
[<c040a640>] (cpufreq_register_driver) from [<c040ef64>] (dt_cpufreq_probe+0x60/0x8c)
[<c040ef64>] (dt_cpufreq_probe) from [<c02f8084>] (platform_drv_probe+0x44/0xa4)
[<c02f8084>] (platform_drv_probe) from [<c02f67c0>] (driver_probe_device+0x208/0x2f4)
[<c02f67c0>] (driver_probe_device) from [<c02f6940>] (__driver_attach+0x94/0x98)
[<c02f6940>] (__driver_attach) from [<c02f4c1c>] (bus_for_each_dev+0x68/0x9c)
Reported-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 4.3 <stable@vger.kernel.org> # 4.3
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-11-05 14:21:19 +05:30
|
|
|
|
2023-06-08 12:55:07 +05:30
|
|
|
|
2016-05-05 16:20:33 +05:30
|
|
|
|
2022-05-25 15:23:16 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-02 14:22:32 +02:00
|
|
|
|
2022-05-25 15:23:16 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-02 14:22:24 +02:00
|
|
|
|
2022-05-25 15:23:16 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-02 14:22:24 +02:00
|
|
|
|
2022-05-25 15:23:16 +05:30
|
|
|
|
|
|
|
|
|
2023-12-28 13:04:41 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-23 10:11:46 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2015-11-19 09:13:56 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
2021-03-04 15:07:34 +00:00
|
|
|
|
2022-06-10 12:02:04 +05:30
|
|
|
|
2019-01-10 09:32:02 +05:30
|
|
|
|
2016-12-01 16:28:19 +05:30
|
|
|
|
2020-05-12 15:53:21 +03:00
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
2018-06-07 14:50:43 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-23 10:11:46 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
2021-03-04 15:07:34 +00:00
|
|
|
|
2022-06-10 12:02:04 +05:30
|
|
|
|
2019-01-10 09:32:02 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2016-12-01 16:28:19 +05:30
|
|
|
|
2020-05-12 15:53:21 +03:00
|
|
|
|
2016-12-01 16:28:17 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
2018-06-07 14:50:43 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-10 14:37:53 +05:30
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
|
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
2016-06-16 19:03:11 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
|
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2017-01-23 10:11:49 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2017-01-23 10:11:42 +05:30
|
|
|
|
2018-08-03 07:05:21 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2015-11-19 09:13:56 +05:30
|
|
|
|
2019-11-11 16:35:03 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2024-01-05 15:39:52 +05:30
|
|
|
|
2021-01-20 16:16:48 +05:30
|
|
|
|
2015-11-19 09:13:56 +05:30
|
|
|
|
2018-06-07 14:50:43 +05:30
|
|
|
|
|
|
|
|
|
OPP: Call dev_pm_opp_set_opp() for required OPPs
Configuring the required OPP was never properly implemented, we just
took an exception for genpds and configured them directly, while leaving
out all other required OPP types.
Now that a standard call to dev_pm_opp_set_opp() takes care of
configuring the opp->level too, the special handling for genpds can be
avoided by simply calling dev_pm_opp_set_opp() for the required OPPs,
which shall eventually configure the corresponding level for genpds.
This also makes it possible for us to configure other type of required
OPPs (no concrete users yet though), via the same path. This is how
other frameworks take care of parent nodes, like clock, regulators, etc,
where we recursively call the same helper.
In order to call dev_pm_opp_set_opp() for the virtual genpd devices,
they must share the OPP table of the genpd. Call _add_opp_dev() for them
to get that done.
This commit also extends the struct dev_pm_opp_config to pass required
devices, for non-genpd cases, which can be used to call
dev_pm_opp_set_opp() for the non-genpd required devices.
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2023-10-27 14:17:48 +05:30
|
|
|
|
2018-06-07 14:50:43 +05:30
|
|
|
|
2015-12-09 08:01:46 +05:30
|
|
|
|
|
|
|
|
|
2015-12-09 08:01:47 +05:30
|
|
|
|
2022-06-10 12:02:04 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-04 13:45:08 +05:30
|
|
|
|
2016-12-01 16:28:19 +05:30
|
|
|
|
2018-12-11 16:39:36 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-12 15:53:21 +03:00
|
|
|
|
|
|
|
|
|
2020-08-13 08:38:37 +05:30
|
|
|
|
2018-06-13 16:00:11 +05:30
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
|
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2016-02-09 10:30:37 +05:30
|
|
|
|
|
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2019-11-25 13:57:58 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2017-01-23 10:11:49 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
2017-01-23 10:11:42 +05:30
|
|
|
|
2017-01-23 10:11:41 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-09 10:30:37 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-11-11 16:35:03 +05:30
|
|
|
|
2016-06-16 19:03:11 +05:30
|
|
|
|
2024-01-05 15:39:52 +05:30
|
|
|
|
2021-01-20 16:16:48 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
2018-06-07 14:50:43 +05:30
|
|
|
|
OPP: Call dev_pm_opp_set_opp() for required OPPs
Configuring the required OPP was never properly implemented, we just
took an exception for genpds and configured them directly, while leaving
out all other required OPP types.
Now that a standard call to dev_pm_opp_set_opp() takes care of
configuring the opp->level too, the special handling for genpds can be
avoided by simply calling dev_pm_opp_set_opp() for the required OPPs,
which shall eventually configure the corresponding level for genpds.
This also makes it possible for us to configure other type of required
OPPs (no concrete users yet though), via the same path. This is how
other frameworks take care of parent nodes, like clock, regulators, etc,
where we recursively call the same helper.
In order to call dev_pm_opp_set_opp() for the virtual genpd devices,
they must share the OPP table of the genpd. Call _add_opp_dev() for them
to get that done.
This commit also extends the struct dev_pm_opp_config to pass required
devices, for non-genpd cases, which can be used to call
dev_pm_opp_set_opp() for the non-genpd required devices.
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2023-10-27 14:17:48 +05:30
|
|
|
|
2018-06-07 14:50:43 +05:30
|
|
|
|
|
|
|
|
|
2015-12-09 08:01:46 +05:30
|
|
|
|
|
|
|
|
|
2015-12-09 08:01:47 +05:30
|
|
|
|
2022-06-10 12:02:04 +05:30
|
|
|
|
|
|
|
|
|
2016-02-09 10:30:38 +05:30
|
|
|
|
2022-06-10 12:02:04 +05:30
|
|
|
|
2022-07-04 13:45:08 +05:30
|
|
|
|
2016-12-01 16:28:19 +05:30
|
|
|
|
2018-12-11 16:39:36 +05:30
|
|
|
|
2020-05-12 15:53:21 +03:00
|
|
|
|
|
|
|
|
|
2020-08-13 08:38:37 +05:30
|
|
|
|
2018-06-13 16:00:11 +05:30
|
|
|
|
2015-12-09 08:01:46 +05:30
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-31 13:03:06 +05:30
|
|
|
|
2018-04-06 14:35:45 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
|
|
|
|
|
2017-01-02 14:41:01 +05:30
|
|
|
|
|
|
|
|
|
2022-06-10 12:02:04 +05:30
|
|
|
|
2022-06-08 11:57:24 +05:30
|
|
|
|
2023-09-25 15:17:09 +02:00
|
|
|
|
2018-09-13 13:14:36 +05:30
|
|
|
|
2021-01-28 12:05:22 +05:30
|
|
|
|
2019-11-25 13:57:58 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-05 16:20:33 +05:30
|
|
|
|
|
|
|
|
|
2018-09-05 16:17:14 +05:30
|
|
|
|
2018-06-07 14:50:43 +05:30
|
|
|
|
2018-09-07 09:01:54 +05:30
|
|
|
|
2022-07-18 21:36:32 +08:00
|
|
|
|
2016-05-05 16:20:33 +05:30
|
|
|
|
2018-09-05 16:17:14 +05:30
|
|
|
|
2018-06-07 14:50:43 +05:30
|
|
|
|
2018-09-07 09:01:54 +05:30
|
|
|
|
2022-07-18 21:36:32 +08:00
|
|
|
|
2016-05-05 16:20:33 +05:30
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
|
|
|
|
|
2019-01-22 16:21:17 +01:00
|
|
|
|
|
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-22 16:21:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
2016-02-16 14:17:53 +05:30
|
|
|
|
|
|
|
|
|
2015-11-11 07:59:01 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-04 13:47:26 +05:30
|
|
|
|