* [PATCH v2 0/1] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
@ 2026-12-02 10:46 Manish Pandey
2026-12-02 10:46 ` [PATCH v2] " Manish Pandey
0 siblings, 1 reply; 3+ messages in thread
From: Manish Pandey @ 2026-12-02 10:46 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen,
AngeloGioacchino Del Regno, Naveen Kumar Goud Arepalli,
Bart Van Assche, Maramaina Naresh
Cc: Alim Akhtar, Bean Huo, Stanley Jhu, Nitin Rawat, Peter Wang,
linux-scsi
ufshcd_setup_clocks() applied the PM QoS vote only when clock scaling was
not supported, relying on ufshcd_scale_clks() otherwise. Since that path
only updates the vote while scaling up or down, and devfreq scaling never
toggles the clocks, a scale-down drops the vote while the clocks stay on.
The vote is not reference counted and nothing restores it, so the CPUs can
enter deep idle while a request (e.g. a Query request) is still
outstanding, which delays the completion interrupt and can lead to command
timeouts.
This series applies the PM QoS vote whenever the clocks are on and releases
it when they are gated off, so the vote is managed solely by the clock
on/off state in ufshcd_setup_clocks().
Changes in v2:
- Also drop the ufshcd_pm_qos_update() call from ufshcd_scale_clks(). In v1
it was left in place, which would still reset the vote to
PM_QOS_DEFAULT_VALUE on a scale-down while the clocks remained on,
reintroducing the same window the patch aims to close.
- Expand the commit message to describe the scale-down path and note that
the vote is now held for the whole clocks-on window instead of being
relaxed at lower gears.
Manish Pandey (1):
scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
drivers/ufs/core/ufshcd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
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 ` Manish Pandey
2026-12-02 11:02 ` sashiko-bot
0 siblings, 1 reply; 3+ messages in thread
From: Manish Pandey @ 2026-12-02 10:46 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen,
AngeloGioacchino Del Regno, Naveen Kumar Goud Arepalli,
Bart Van Assche, Maramaina Naresh
Cc: Alim Akhtar, Bean Huo, Stanley Jhu, Nitin Rawat, Peter Wang,
linux-scsi
ufshcd_setup_clocks() applied the PM QoS vote only when clock scaling
was not supported, relying on ufshcd_scale_clks() otherwise. But that
only updates the vote while scaling up or down, and a scale-down drops
it while the clocks stay on. The CPUs can then enter deep idle while a
request (e.g. a Query request) is still outstanding, delaying the
completion interrupt and causing command timeouts.
Apply the vote in ufshcd_setup_clocks() unconditionally and drop the
ufshcd_pm_qos_update() call from ufshcd_scale_clks(), so the vote
tracks only the clock on/off state: held whenever the clocks are on,
released when they are gated off.
Fixes: 2777e73fc154 ("scsi: ufs: core: Add CPU latency QoS support for UFS driver")
Signed-off-by: Manish Pandey <manish.pandey@oss.qualcomm.com>
---
drivers/ufs/core/ufshcd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 00a7637a1487..cf13a1ae1730 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) {
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
2026-12-02 10:46 ` [PATCH v2] " Manish Pandey
@ 2026-12-02 11:02 ` sashiko-bot
0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-12-02 11:02 UTC (permalink / raw)
To: Manish Pandey; +Cc: linux-scsi
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-02 11:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.