PM / devfreq: memlat: fix suspend/resume calls to devfreq_monitor

The memlat governor suspend/resume callbacks always call devfreq_monitor
suspend/resume functions. The devfreq_monitor suspend/resume functions
run with the assumption that we had started devfreq->work and do a sync
wait to cancel it. However, when should_ignore_df_monitor flag is set,
memlat relies on its own workqueue and devfreq->work is never started.
Cancelling a timer that was never started leads to a crash. Fix this by
only calling devfreq_monitor suspend/resume functions when the
should_ignore_df_monitor flag is not set.

Change-Id: Ie4aff96b6b845f4f5424652943405a572b91b8ca
Signed-off-by: Amir Vajid <avajid@codeaurora.org>
This commit is contained in:
Amir Vajid 2020-03-11 23:26:09 -07:00
commit 3de126898c

View file

@ -208,10 +208,12 @@ err_start:
static int gov_suspend(struct devfreq *df)
{
struct memlat_node *node = df->data;
struct memlat_hwmon *hw = node->hw;
unsigned long prev_freq = df->previous_freq;
node->mon_started = false;
devfreq_monitor_suspend(df);
if (!hw->should_ignore_df_monitor)
devfreq_monitor_suspend(df);
mutex_lock(&df->lock);
update_devfreq(df);
@ -225,6 +227,7 @@ static int gov_suspend(struct devfreq *df)
static int gov_resume(struct devfreq *df)
{
struct memlat_node *node = df->data;
struct memlat_hwmon *hw = node->hw;
mutex_lock(&df->lock);
update_devfreq(df);
@ -232,7 +235,8 @@ static int gov_resume(struct devfreq *df)
node->resume_freq = 0;
devfreq_monitor_resume(df);
if (!hw->should_ignore_df_monitor)
devfreq_monitor_resume(df);
node->mon_started = true;
return 0;