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:
Rama Aparna Mallavarapu <aparnam@codeaurora.org>
Loading
Please register or sign in to comment