Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Manish Pandey" <manish.pandey@oss.qualcomm.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
Date: Wed, 02 Dec 2026 11:02:26 +0000	[thread overview]
Message-ID: <sashiko-outbox-245551@kernel.org> (raw)
In-Reply-To: <20261202104637.1339868-2-manish.pandey@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] scsi: ufs: core: PM QoS vote unapplied when clocks turn on
  before init
--

commit 682ec1c599258d663f87f8a96559aec268c4cbaa
Author: Manish Pandey <manish.pandey@oss.qualcomm.com>

scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on

This commit moves the CPU latency PM QoS vote management out of
ufshcd_scale_clks() and applies it unconditionally in
ufshcd_setup_clocks() so the vote tracks the UFS clock on/off state.

> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 7d0e60e073029..51620320c7a53 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -1204,8 +1204,6 @@ int ufshcd_scale_clks(struct ufs_hba *hba, unsigned long freq, bool scale_up)
>  		goto out;
>  	}
>  
> -	ufshcd_pm_qos_update(hba, scale_up);
> -
>  out:
>  	trace_ufshcd_profile_clk_scaling(hba,
>  			(scale_up ? "up" : "down"),
> @@ -9964,8 +9962,8 @@ static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on)
>  	if (ret)
>  		return ret;
>  
> -	if (!ufshcd_is_clkscaling_supported(hba))
> -		ufshcd_pm_qos_update(hba, on);
> +	/* Hold the PM QoS vote while the controller is active to keep CPUs out of deep idle. */
> +	ufshcd_pm_qos_update(hba, on);
>  out:
>  	if (ret) {
>  		list_for_each_entry(clki, head, list) {

[Severity: Medium]
Does this leave hba->pm_qos_req at PM_QOS_DEFAULT_VALUE when the clocks
are turned on before ufshcd_pm_qos_init() runs?

During ufshcd_init(), ufshcd_hba_init() enables the clocks via
ufshcd_setup_clocks(hba, true) before ufshcd_pm_qos_init() is called at
the end of ufshcd_init().  At that point hba->pm_qos_enabled is still
false, so ufshcd_pm_qos_update(hba, true) returns early without voting.
When ufshcd_pm_qos_init() then registers the request (or when PM QoS is
re-enabled at runtime via pm_qos_enable_store() while clocks are already
on), it initializes the request to PM_QOS_DEFAULT_VALUE:

drivers/ufs/core/ufshcd.c:ufshcd_pm_qos_init() {
	if (hba->pm_qos_enabled)
		return;

	cpu_latency_qos_add_request(&hba->pm_qos_req, PM_QOS_DEFAULT_VALUE);

	if (cpu_latency_qos_request_active(&hba->pm_qos_req))
		hba->pm_qos_enabled = true;
}

With ufshcd_pm_qos_update() removed from ufshcd_scale_clks(), nothing
applies the vote after ufshcd_pm_qos_init() until the clocks are gated off
and ungated again, or until a suspend/resume cycle if clock gating is
disabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202104637.1339868-1-manish.pandey@oss.qualcomm.com?part=1

      reply	other threads:[~2026-12-02 11:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 10:46 [PATCH v2 0/1] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on Manish Pandey
2026-12-02 10:46 ` [PATCH v2] " Manish Pandey
2026-12-02 11:02   ` sashiko-bot [this message]

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=sashiko-outbox-245551@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=manish.pandey@oss.qualcomm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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