mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Avri Altman <avri.altman@wdc.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bean Huo <beanhuo@micron.com>
Subject: Re: [PATCH v4 1/3] scsi: ufs: core: Prepare to introduce a new clock_gating lock
Date: Thu, 21 Nov 2024 12:28:45 -0800	[thread overview]
Message-ID: <2e5e888a-a7d8-4b10-a366-3cefd6685e69@acm.org> (raw)
In-Reply-To: <20241118144117.88483-2-avri.altman@wdc.com>

On 11/18/24 6:41 AM, Avri Altman wrote:
> Removed hba->clk_gating.active_reqs check from ufshcd_is_ufs_dev_busy
> function to separate clock gating logic from general device busy checks.
> 
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
> ---
>   drivers/ufs/core/ufshcd.c | 20 ++++++++++++++------
>   1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index e338867bc96c..be5fe2407382 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -258,10 +258,15 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state,
>   	return UFS_PM_LVL_0;
>   }
>   
> +static bool ufshcd_has_pending_tasks(struct ufs_hba *hba)
> +{
> +	return hba->outstanding_tasks || hba->active_uic_cmd ||
> +	       hba->uic_async_done;
> +}
> +
>   static bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba)
>   {
> -	return (hba->clk_gating.active_reqs || hba->outstanding_reqs || hba->outstanding_tasks ||
> -		hba->active_uic_cmd || hba->uic_async_done);
> +	return hba->outstanding_reqs || ufshcd_has_pending_tasks(hba);
>   }
>   
>   static const struct ufs_dev_quirk ufs_fixups[] = {
> @@ -1943,7 +1948,9 @@ static void ufshcd_gate_work(struct work_struct *work)
>   		goto rel_lock;
>   	}
>   
> -	if (ufshcd_is_ufs_dev_busy(hba) || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL)
> +	if (ufshcd_is_ufs_dev_busy(hba) ||
> +	    hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL ||
> +	    hba->clk_gating.active_reqs)
>   		goto rel_lock;
>   
>   	spin_unlock_irqrestore(hba->host->host_lock, flags);
> @@ -1999,8 +2006,7 @@ static void __ufshcd_release(struct ufs_hba *hba)
>   
>   	if (hba->clk_gating.active_reqs || hba->clk_gating.is_suspended ||
>   	    hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL ||
> -	    hba->outstanding_tasks || !hba->clk_gating.is_initialized ||
> -	    hba->active_uic_cmd || hba->uic_async_done ||
> +	    ufshcd_has_pending_tasks(hba) || !hba->clk_gating.is_initialized ||
>   	    hba->clk_gating.state == CLKS_OFF)
>   		return;
>   
> @@ -8221,7 +8227,9 @@ static void ufshcd_rtc_work(struct work_struct *work)
>   	hba = container_of(to_delayed_work(work), struct ufs_hba, ufs_rtc_update_work);
>   
>   	 /* Update RTC only when there are no requests in progress and UFSHCI is operational */
> -	if (!ufshcd_is_ufs_dev_busy(hba) && hba->ufshcd_state == UFSHCD_STATE_OPERATIONAL)
> +	if (!ufshcd_is_ufs_dev_busy(hba) &&
> +	    hba->ufshcd_state == UFSHCD_STATE_OPERATIONAL &&
> +	    !hba->clk_gating.active_reqs)
>   		ufshcd_update_rtc(hba);
>   
>   	if (ufshcd_is_ufs_dev_active(hba) && hba->dev_info.rtc_update_period)

Hi Avri,

I see two changes in this patch: introduction of the function
ufshcd_has_pending_tasks() and removal of hba->clk_gating.active_reqs
from ufshcd_is_ufs_dev_busy(). Shouldn't this patch be split into two
patches - one patch per change?

Thanks,

Bart.

  reply	other threads:[~2024-11-21 20:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18 14:41 [PATCH v4 0/3] Untie the host lock entanglement - part 2 Avri Altman
2024-11-18 14:41 ` [PATCH v4 1/3] scsi: ufs: core: Prepare to introduce a new clock_gating lock Avri Altman
2024-11-21 20:28   ` Bart Van Assche [this message]
2024-11-21 20:50     ` Avri Altman
2024-11-18 14:41 ` [PATCH v4 2/3] scsi: ufs: core: Introduce " Avri Altman
2024-11-21 20:44   ` Bart Van Assche
2024-11-21 21:06     ` Avri Altman
2024-11-21 21:14       ` Bart Van Assche
2024-11-21 21:39         ` Avri Altman
2024-11-18 14:41 ` [PATCH v4 3/3] scsi: ufs: core: Introduce a new clock_scaling lock Avri Altman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e5e888a-a7d8-4b10-a366-3cefd6685e69@acm.org \
    --to=bvanassche@acm.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®