[v1,1/1] scsi: ufs: mcq: Use active_reqs to check busy in clock scaling

Message ID e8d303eff0713a3e5f3c3725cdf6e5c5d3de2b01.1678244386.git.quic_asutoshd@quicinc.com
State New
Headers
Series [v1,1/1] scsi: ufs: mcq: Use active_reqs to check busy in clock scaling |

Commit Message

Asutosh Das March 8, 2023, 3 a.m. UTC
  Multi Circular Queue doesn't use outstanding_reqs.
But the ufs clock scaling functions use outstanding_reqs to
determine if there're requests pending. When MCQ is enabled
this check always returns false.

Hence use active_reqs to check if there're pending requests.

Signed-off-by: Asutosh Das <quic_asutoshd@quicinc.com>
---
 drivers/ufs/core/ufshcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Manivannan Sadhasivam March 8, 2023, 5:42 a.m. UTC | #1
On Tue, Mar 07, 2023 at 07:00:09PM -0800, Asutosh Das wrote:
> Multi Circular Queue doesn't use outstanding_reqs.
> But the ufs clock scaling functions use outstanding_reqs to
> determine if there're requests pending. When MCQ is enabled
> this check always returns false.
> 
> Hence use active_reqs to check if there're pending requests.
> 
> Signed-off-by: Asutosh Das <quic_asutoshd@quicinc.com>

This looks like a fix to me. Hence there should be a fixes tag. With that,

Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>

Thanks,
Mani

> ---
>  drivers/ufs/core/ufshcd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 172d25fef740..c6b35123c83b 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -1500,7 +1500,7 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev,
>  	scaling->window_start_t = curr_t;
>  	scaling->tot_busy_t = 0;
>  
> -	if (hba->outstanding_reqs) {
> +	if (scaling->active_reqs) {
>  		scaling->busy_start_t = curr_t;
>  		scaling->is_busy_started = true;
>  	} else {
> @@ -2118,7 +2118,7 @@ static void ufshcd_clk_scaling_update_busy(struct ufs_hba *hba)
>  
>  	spin_lock_irqsave(hba->host->host_lock, flags);
>  	hba->clk_scaling.active_reqs--;
> -	if (!hba->outstanding_reqs && scaling->is_busy_started) {
> +	if (!scaling->active_reqs && scaling->is_busy_started) {
>  		scaling->tot_busy_t += ktime_to_us(ktime_sub(ktime_get(),
>  					scaling->busy_start_t));
>  		scaling->busy_start_t = 0;
> -- 
> 2.7.4
>
  

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 172d25fef740..c6b35123c83b 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -1500,7 +1500,7 @@  static int ufshcd_devfreq_get_dev_status(struct device *dev,
 	scaling->window_start_t = curr_t;
 	scaling->tot_busy_t = 0;
 
-	if (hba->outstanding_reqs) {
+	if (scaling->active_reqs) {
 		scaling->busy_start_t = curr_t;
 		scaling->is_busy_started = true;
 	} else {
@@ -2118,7 +2118,7 @@  static void ufshcd_clk_scaling_update_busy(struct ufs_hba *hba)
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
 	hba->clk_scaling.active_reqs--;
-	if (!hba->outstanding_reqs && scaling->is_busy_started) {
+	if (!scaling->active_reqs && scaling->is_busy_started) {
 		scaling->tot_busy_t += ktime_to_us(ktime_sub(ktime_get(),
 					scaling->busy_start_t));
 		scaling->busy_start_t = 0;