diff mbox series

[v1] ufs: core: remove dev cmd clock scaling busy

Message ID 20231004062454.29165-1-peter.wang@mediatek.com
State New
Headers show
Series [v1] ufs: core: remove dev cmd clock scaling busy | expand

Commit Message

Peter Wang (王信友) Oct. 4, 2023, 6:24 a.m. UTC
From: Peter Wang <peter.wang@mediatek.com>

If dev command timeout, clk_scaling.active_reqs is not decrease
and cause clock scaling framework abnormal. But it is complicated to
handle different dev command timeout case in legacy mode or mcq mode.
Besides, dev cmd is rare used and busy time is short.
So remove clock scaling busy window for dev cmd is properly.
Same as uic or tm cmd which doesn't update busy window too.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
---
 drivers/ufs/core/ufshcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stanley Jhu Oct. 4, 2023, 6:37 a.m. UTC | #1
On Wed, Oct 4, 2023 at 2:25 PM <peter.wang@mediatek.com> wrote:
>
> From: Peter Wang <peter.wang@mediatek.com>
>
> If dev command timeout, clk_scaling.active_reqs is not decrease
> and cause clock scaling framework abnormal. But it is complicated to
> handle different dev command timeout case in legacy mode or mcq mode.
> Besides, dev cmd is rare used and busy time is short.
> So remove clock scaling busy window for dev cmd is properly.
> Same as uic or tm cmd which doesn't update busy window too.
>
> Signed-off-by: Peter Wang <peter.wang@mediatek.com>

It makes sense to me since clock scaling is aimed at balancing
performance and power consumption for different workloads, which
should be data workloads rather than device commands.

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Martin K. Petersen Oct. 10, 2023, 1:37 a.m. UTC | #2
Peter,

> If dev command timeout, clk_scaling.active_reqs is not decrease and
> cause clock scaling framework abnormal. But it is complicated to
> handle different dev command timeout case in legacy mode or mcq mode.
> Besides, dev cmd is rare used and busy time is short. So remove clock
> scaling busy window for dev cmd is properly. Same as uic or tm cmd
> which doesn't update busy window too.

Applied to 6.7/scsi-staging, thanks!
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index c2df07545f96..474d5dded7ed 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2165,7 +2165,8 @@  void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag,
 	lrbp->compl_time_stamp = ktime_set(0, 0);
 	lrbp->compl_time_stamp_local_clock = 0;
 	ufshcd_add_command_trace(hba, task_tag, UFS_CMD_SEND);
-	ufshcd_clk_scaling_start_busy(hba);
+	if (lrbp->cmd)
+		ufshcd_clk_scaling_start_busy(hba);
 	if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
 		ufshcd_start_monitor(hba, lrbp);
 
@@ -5405,7 +5406,6 @@  void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag,
 				lrbp->utr_descriptor_ptr->header.ocs = ocs;
 			}
 			complete(hba->dev_cmd.complete);
-			ufshcd_clk_scaling_update_busy(hba);
 		}
 	}
 }