Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c89a516 authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi
Browse files

drivers: cpu_cooling: Remove cooling list lock during post suspend handling



There is a possible deadlock scenario in cpu cooling device when
thermal core isolation condition, core hotplug and resume contexts
are running concurrently. Core hotplug context takes hotplug framework
lock and waiting for cpu cooling list lock and the same time the post
suspend context is holding cpu cooling list lock and waiting for
hotplug framework lock to isolate core due to thermal condition.

Since cpu cooling device list addition and deletion are not a frequent
call and addition is done once during boot. So it is not expected to
mutate cpu cooling device list on post boot. Remove cooling list lock
safely from post suspend path to avoid this dead lock scenario.

Change-Id: Iec02a3050082ad28826989062e9f3717d50cd3fd
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent 24af5c26
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_cdev,
static int cpufreq_cooling_pm_notify(struct notifier_block *nb,
				unsigned long mode, void *_unused)
{
	struct cpufreq_cooling_device *cpufreq_cdev;
	struct cpufreq_cooling_device *cpufreq_cdev, *next;
	unsigned int cpu;

	switch (mode) {
@@ -168,8 +168,8 @@ static int cpufreq_cooling_pm_notify(struct notifier_block *nb,
	case PM_POST_HIBERNATION:
	case PM_POST_RESTORE:
	case PM_POST_SUSPEND:
		mutex_lock(&cooling_list_lock);
		list_for_each_entry(cpufreq_cdev, &cpufreq_cdev_list, node) {
		list_for_each_entry_safe(cpufreq_cdev, next, &cpufreq_cdev_list,
						node) {
			if (cpufreq_cdev->cpu_id == -1)
				continue;
			mutex_lock(&core_isolate_lock);
@@ -193,7 +193,6 @@ static int cpufreq_cooling_pm_notify(struct notifier_block *nb,
			}
			mutex_unlock(&core_isolate_lock);
		}
		mutex_unlock(&cooling_list_lock);

		atomic_set(&in_suspend, 0);
		break;