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

Skip to content
Commit e42d9b00 authored by Rama Aparna Mallavarapu's avatar Rama Aparna Mallavarapu
Browse files

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



Currently gov start/stop could run in parallel when update_devfreq()
is in progress. start/stop could disable the clk which is necessary
for update_devfreq() to do its job.

The following is the race condition that could cause a crash.

T0:					T1:

					/* Governor switch from
					 * BWMON to Perf
					 */

update_devfreq()			governor_store()
devfreq_bw_hwmon_get_freq()		df->governor->event_handler(df,
						DEVFREQ_GOV_STOP, NULL);
get_bw_and_set_irq()			gov_stop()
....					hw->stop_hwmon(hw)
if (hw->set_hw_events) {		__stop_bw_hwmon()
    hw->down_cnt = node->down_count;	mon_clk_disable()
    hw->set_hw_events(hw, node->sample_ms);
}
.....
set_hw_events()
__set_hw_events()
mon_enable()

Ensure the two operations do not race by taking the devfreq->lock.

Change-Id: Ieff6d6d7feff98ede1e6673ee208a98a4f493cf9
Signed-off-by: default avatarRama Aparna Mallavarapu <aparnam@codeaurora.org>
parent 3b501c04
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment