Message ID | 20230823092948.22734-4-peter.wang@mediatek.com |
---|---|
State | Superseded |
Headers | show |
Series | Fix abnormal clock scaling behaviors | expand |
On 8/23/23 02:29, peter.wang@mediatek.com wrote: > When no active_reqs, devfreq_monitor(Thread A) will suspend clock scaling. > But it may have racing with clk_scaling.suspend_work(Thread B) and > actually not suspend clock scaling(requue after suspend). > Next time after polling_ms, devfreq_monitor read > clk_scaling.window_start_t = 0 then scale up clock abnormal. Reviewed-by: Bart Van Assche <bvanassche@acm.org>
On 8/23/23 02:29, peter.wang@mediatek.com wrote: > When no active_reqs, devfreq_monitor(Thread A) will suspend clock scaling. > But it may have racing with clk_scaling.suspend_work(Thread B) and > actually not suspend clock scaling(requue after suspend). > Next time after polling_ms, devfreq_monitor read > clk_scaling.window_start_t = 0 then scale up clock abnormal. Reviewed-by: Bart Van Assche <bvanassche@acm.org>
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 017f32b3a789..d3b913d389f4 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1431,6 +1431,13 @@ static int ufshcd_devfreq_target(struct device *dev, return 0; } + /* Skip scaling clock when clock scaling is suspended */ + if (hba->clk_scaling.is_suspended) { + spin_unlock_irqrestore(hba->host->host_lock, irq_flags); + dev_warn(hba->dev, "clock scaling is suspended, skip"); + return 0; + } + if (!hba->clk_scaling.active_reqs) sched_clk_scaling_suspend_work = true;