]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: ufs: core: Suspend clk scaling on no request
authorRam Prakash Gupta <quic_rampraka@quicinc.com>
Thu, 27 Jun 2024 08:37:55 +0000 (14:07 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 5 Jul 2024 02:48:33 +0000 (22:48 -0400)
Currently UFS clk scaling is getting suspended only when the clks are
scaled down. When high load is generated, a huge amount of latency is added
due to scaling up the clk and completing the request post that.

Suspending the scaling in its existing state when high load is generated
improves the random performance KPI by 28%. So suspending the scaling when
there are no requests. And the clk would be put in low scaled state when
the actual request load is low.

Make this change optional by having the check enabled using vops since for
some devices suspending without bringing the clk in low scaled state might
have impact on power consumption of the SoC.

Signed-off-by: Ram Prakash Gupta <quic_rampraka@quicinc.com>
Link: https://lore.kernel.org/r/20240627083756.25340-2-quic_rampraka@quicinc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c
include/ufs/ufshcd.h

index 41bf2e249c83813763eb5d2751dcf5255b668e14..7892c46c97ff2cc07eb7fe71430f1ec3a880d17a 100644 (file)
@@ -1563,7 +1563,8 @@ static int ufshcd_devfreq_target(struct device *dev,
                ktime_to_us(ktime_sub(ktime_get(), start)), ret);
 
 out:
-       if (sched_clk_scaling_suspend_work && !scale_up)
+       if (sched_clk_scaling_suspend_work &&
+                       (!scale_up || hba->clk_scaling.suspend_on_no_request))
                queue_work(hba->clk_scaling.workq,
                           &hba->clk_scaling.suspend_work);
 
index 9e0581115b3441c3bdb6168dbae764a059803b54..049520bcc6c08b84fec43abb892075731a65d6b8 100644 (file)
@@ -459,6 +459,7 @@ struct ufs_clk_scaling {
        bool is_initialized;
        bool is_busy_started;
        bool is_suspended;
+       bool suspend_on_no_request;
 };
 
 #define UFS_EVENT_HIST_LENGTH 8