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

Commit 323c1d0e authored by Rama Aparna Mallavarapu's avatar Rama Aparna Mallavarapu
Browse files

Revert "devfreq: bwmon: Serialize update_devfreq with governor start/stop()"



The commit 'e42d9b00' causes a deadlock
as it introduces reverse lock ordering between df->lock and mon_lock.
Below is the sequence for the deadlock.

       gov_stop					update_bw_hwmon
mutex_lock(&df->lock)			mutex_lock(&node->mon_lock);
........					........
stop_monitor(df,true)			mutex_lock(&df->lock);
	mutex_lock(&node->mon_lock);		update_devfreq();
        ....
	mutex_unlock(&node->mon_lock);		mutex_unlock(&df->lock);
...						.........
mutex_unlock(&df->lock)			mutex_unlock(&node->mon_lock);

Hence revert this commit to fix the deadlock. This reverts commit
e42d9b00.

Change-Id: I1c4bd52ac462b4f1fdec4b494b6fb74e00fd72f8
Signed-off-by: default avatarRama Aparna Mallavarapu <aparnam@codeaurora.org>
parent b39b9019
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -590,11 +590,9 @@ static int gov_start(struct devfreq *df)
	struct bw_hwmon *hw;
	struct bw_hwmon *hw;
	struct devfreq_dev_status stat;
	struct devfreq_dev_status stat;


	mutex_lock(&df->lock);
	node = find_hwmon_node(df);
	node = find_hwmon_node(df);
	if (!node) {
	if (!node) {
		dev_err(dev, "Unable to find HW monitor!\n");
		dev_err(dev, "Unable to find HW monitor!\n");
		mutex_unlock(&df->lock);
		return -ENODEV;
		return -ENODEV;
	}
	}
	hw = node->hw;
	hw = node->hw;
@@ -619,7 +617,6 @@ static int gov_start(struct devfreq *df)
	if (ret)
	if (ret)
		goto err_sysfs;
		goto err_sysfs;


	mutex_unlock(&df->lock);
	return 0;
	return 0;


err_sysfs:
err_sysfs:
@@ -629,7 +626,6 @@ static int gov_start(struct devfreq *df)
	node->orig_data = NULL;
	node->orig_data = NULL;
	hw->df = NULL;
	hw->df = NULL;
	node->dev_ab = NULL;
	node->dev_ab = NULL;
	mutex_unlock(&df->lock);
	return ret;
	return ret;
}
}


@@ -638,7 +634,6 @@ static void gov_stop(struct devfreq *df)
	struct hwmon_node *node = df->data;
	struct hwmon_node *node = df->data;
	struct bw_hwmon *hw = node->hw;
	struct bw_hwmon *hw = node->hw;


	mutex_lock(&df->lock);
	sysfs_remove_group(&df->dev.kobj, node->attr_grp);
	sysfs_remove_group(&df->dev.kobj, node->attr_grp);
	stop_monitor(df, true);
	stop_monitor(df, true);
	df->data = node->orig_data;
	df->data = node->orig_data;
@@ -653,7 +648,6 @@ static void gov_stop(struct devfreq *df)
	if (node->dev_ab)
	if (node->dev_ab)
		*node->dev_ab = 0;
		*node->dev_ab = 0;
	node->dev_ab = NULL;
	node->dev_ab = NULL;
	mutex_unlock(&df->lock);
}
}


static int gov_suspend(struct devfreq *df)
static int gov_suspend(struct devfreq *df)