Skip to contentSkip to conversation

ufs: core: only suspend clock scaling if scale down

PATCH In review [email protected] 2 participants 3 messages Aug 1, 2023 – Aug 23, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ufs: core: only suspend clock scaling if scale down

From: Peter Wang <[email protected]>

If clock scale up and suspend clock scaling, ufs will keep high performance/power mode but no read/write requests on going. It is logic wrong and have power concern.

Fixes 401f1e4490ee ("scsi: ufs: don't suspend clock scaling during clock gating")
---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +1 -1
index 129446775796..e3672e55efae 100644
@@ -1458,7 +1458,7 @@ static int ufshcd_devfreq_target(struct device *dev,
 		ktime_to_us(ktime_sub(ktime_get(), start)), ret);
 
 out:
-	if (sched_clk_scaling_suspend_work)
+	if (sched_clk_scaling_suspend_work && !scale_up)
 		queue_work(hba->clk_scaling.workq,
 			   &hba->clk_scaling.suspend_work);
 
Signature · 1 line
2.18.0
#1 lore raw

Hi all,

Gentle ping for this bug fix review.

Thanks.

Quoted 28 lines · On Tue, 2023-08-01 at 21:34 +0800, [email protected] wrote:

From: Peter Wang <[email protected]>

If clock scale up and suspend clock scaling, ufs will keep high performance/power mode but no read/write requests on going. It is logic wrong and have power concern.

Fixes 401f1e4490ee ("scsi: ufs: don't suspend clock scaling during

clock gating")

---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +1 -1
index 129446775796..e3672e55efae 100644
@@ -1458,7 +1458,7 @@ static int ufshcd_devfreq_target(struct device
 *dev,
 		ktime_to_us(ktime_sub(ktime_get(), start)), ret);
 
 out:
-	if (sched_clk_scaling_suspend_work)
+	if (sched_clk_scaling_suspend_work && !scale_up)
 		queue_work(hba->clk_scaling.workq,
 			   &hba->clk_scaling.suspend_work);
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 18 lines · On 8/1/23 06:34, [email protected] wrote:

From: Peter Wang <[email protected]>

If clock scale up and suspend clock scaling, ufs will keep high performance/power mode but no read/write requests on going. It is logic wrong and have power concern.

Fixes 401f1e4490ee ("scsi: ufs: don't suspend clock scaling during clock gating")
---
  drivers/ufs/core/ufshcd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +0 -0
index 129446775796..e3672e55efae 100644

drivers/ufs/core/ufshcd.c static int ufshcd_devfreq_target(struct device *dev, · line 1463

Quoted 7 lines
drivers/ufs/core/ufshcd.c +1 -1
@@ -1458,7 +1458,7 @@ static int ufshcd_devfreq_target(struct device *dev,
  		ktime_to_us(ktime_sub(ktime_get(), start)), ret);
 
  out:
-	if (sched_clk_scaling_suspend_work)
+	if (sched_clk_scaling_suspend_work && !scale_up)
  		queue_work(hba->clk_scaling.workq,
  			   &hba->clk_scaling.suspend_work);