* [PATCH 0/1] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
@ 2026-12-02 9:46 Manish Pandey
2026-12-02 9:46 ` [PATCH 1/1] " Manish Pandey
0 siblings, 1 reply; 3+ messages in thread
From: Manish Pandey @ 2026-12-02 9:46 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen
Cc: Alim Akhtar, Bart Van Assche, Bean Huo, Stanley Jhu, linux-scsi,
quic_nitirawa
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, on clock-scaling capable
controllers the vote is not held for the whole time the controller is
active. The CPUs can then enter deep idle while a request is still
outstanding, which delays the completion interrupt and can lead to command
timeouts.
This patch applies the PM QoS vote whenever the clocks are on and releases
it when they are gated off, regardless of clock scaling support.
Manish Pandey (1):
scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
drivers/ufs/core/ufshcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
2026-12-02 9:46 [PATCH 0/1] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on Manish Pandey
@ 2026-12-02 9:46 ` Manish Pandey
2026-12-02 10:01 ` sashiko-bot
0 siblings, 1 reply; 3+ messages in thread
From: Manish Pandey @ 2026-12-02 9:46 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen
Cc: Alim Akhtar, Bart Van Assche, Bean Huo, Stanley Jhu, linux-scsi,
quic_nitirawa
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, so on clock-scaling capable
controllers the vote is not held across the whole time the controller is
active.
Without the vote, the CPUs can enter deep idle while a request (e.g. a
Query request) is still outstanding, delaying the completion interrupt and
causing command timeouts.
Drop the ufshcd_is_clkscaling_supported() check so the PM QoS vote is
applied whenever the clocks are on and released when they are gated off,
regardless of clock scaling support.
Signed-off-by: Manish Pandey <manish.pandey@oss.qualcomm.com>
---
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 00a7637a1487..f08bc129692f 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9964,8 +9964,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 1/1] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
2026-12-02 9:46 ` [PATCH 1/1] " Manish Pandey
@ 2026-12-02 10:01 ` sashiko-bot
0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-12-02 10:01 UTC (permalink / raw)
To: Manish Pandey; +Cc: linux-scsi
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] scsi: ufs: core: ufshcd_scale_clks() drops PM QoS vote while
clocks are on
- [Low] scsi: ufs: core: missing Fixes trailer for commit 2777e73fc154
--
commit 57c74ecf3e797dd602e3162e1e7c9e94eaccbdc9
Author: Manish Pandey <manish.pandey@oss.qualcomm.com>
> scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on
>
> 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, so on clock-scaling capable
> controllers the vote is not held across the whole time the controller is
> active.
>
> Without the vote, the CPUs can enter deep idle while a request (e.g. a
> Query request) is still outstanding, delaying the completion interrupt and
> causing command timeouts.
>
> Drop the ufshcd_is_clkscaling_supported() check so the PM QoS vote is
> applied whenever the clocks are on and released when they are gated off,
> regardless of clock scaling support.
>
> Signed-off-by: Manish Pandey <manish.pandey@oss.qualcomm.com>
[Severity: Low]
Should this include a Fixes: tag for the commit that gated the PM QoS vote
on !ufshcd_is_clkscaling_supported(hba):
Fixes: 2777e73fc154 ("scsi: ufs: core: Add CPU latency QoS support for UFS driver")
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 7d0e60e073029..881de0dac4eff 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -9964,8 +9964,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);
[Severity: Medium]
Does ufshcd_scale_clks() still drop hba->pm_qos_req while the clocks are
on?
ufshcd_scale_clks() still calls ufshcd_pm_qos_update(hba, scale_up), and
ufshcd_pm_qos_update() is not reference-counted. When devfreq scales the
clocks down (scale_up == false), it sets hba->pm_qos_req back to
PM_QOS_DEFAULT_VALUE while the clocks remain enabled.
Requests issued while the clocks are already in CLKS_ON (or when
ufshcd_hold() cancels gate_work in REQ_CLKS_OFF) do not call
ufshcd_setup_clocks(hba, true) to restore the vote, and Query requests
(such as the WriteBooster toggle in ufshcd_clock_scaling_unprepare() right
after scaling down) do not call ufshcd_clk_scaling_start_busy() to trigger
a scale-up, leaving CPUs able to enter deep idle while requests are
outstanding. Should the ufshcd_pm_qos_update() call in
ufshcd_scale_clks() be removed so the vote is managed solely by
ufshcd_setup_clocks()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202094649.1287449-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 10:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 9:46 [PATCH 0/1] scsi: ufs: core: Apply PM QoS vote whenever the UFS clocks are on Manish Pandey
2026-12-02 9:46 ` [PATCH 1/1] " Manish Pandey
2026-12-02 10:01 ` 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.