FROMGIT: scsi: ufs: core: Suspend clk scaling on no request

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.

The change takes advantage of the hole in 'struct ufs_clk_scaling' before ANDROID_KABI_RESERVE and does not change the size of the struct.
Use __GENKSYMS__ marker to preserve the abi correctly.

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>

Bug: 351099319
(cherry picked from commit 50183ac2cfb54e027dd36fb22ea1bd1e91e3a08b
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 6.11/scsi-staging)
Change-Id: I6e11beab7bc56746e7e1ae1ea25f9ab205394ef7
Signed-off-by: Manish Pandey <quic_mapa@quicinc.com>
(cherry picked from commit 78931ac60273825b4141796eb8631424b3690712)
This commit is contained in:
Manish Pandey
2024-07-15 13:50:22 +05:30
committed by Todd Kjos
parent f858f0ff4e
commit 6d6afa9d3f
3 changed files with 14 additions and 1 deletions

View File

@@ -189224,6 +189224,12 @@ member {
type_id: 0x351ca0f0
offset: 64
}
member {
id: 0x0489a9d9
name: "suspend_on_no_request"
type_id: 0x6d7f5ff6
offset: 1672
}
member {
id: 0x0b4c6d3f
name: "suspend_opp"
@@ -266594,6 +266600,7 @@ struct_union {
member_id: 0xbbefba04
member_id: 0xb768ef54
member_id: 0x2061f6ba
member_id: 0x0489a9d9
member_id: 0x2d081217
}
}

View File

@@ -1503,7 +1503,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);

View File

@@ -425,6 +425,7 @@ struct ufs_saved_pwr_info {
* @is_initialized: Indicates whether clock scaling is initialized or not
* @is_busy_started: tracks if busy period has started or not
* @is_suspended: tracks if devfreq is suspended or not
* @suspend_on_no_request: Flag to suspend clk scaling when there is no request
*/
struct ufs_clk_scaling {
int active_reqs;
@@ -442,6 +443,10 @@ struct ufs_clk_scaling {
bool is_initialized;
bool is_busy_started;
bool is_suspended;
/* using hole here would not alter the overall size of the structure. */
#ifndef __GENKSYMS__
bool suspend_on_no_request;
#endif
ANDROID_KABI_RESERVE(1);
};