* [PATCH] scsi: ufs: core: Keep clock-gating hold on failed W-LUN runtime resume
@ 2026-10-29 7:08 Stanley Jhu
0 siblings, 0 replies; only message in thread
From: Stanley Jhu @ 2026-10-29 7:08 UTC (permalink / raw)
To: Martin K . Petersen, James E . J . Bottomley, Alim Akhtar,
Bart Van Assche, Bean Huo
Cc: Rafael J . Wysocki, Praveen Talari, Peter Wang, Can Guo,
John Garry, linux-scsi, linux-pm, linux-kernel, Stanley Jhu,
stable
1. __ufshcd_wl_suspend() takes one ufshcd_hold() reference and sets
hba->clk_gating.is_suspended while the UFS device W-LUN enters
RPM_SUSPENDED.
2. Since commit eef1d74bf88f ("PM: runtime: Only set runtime_error on
suspend callback failures"), a failed runtime resume (for example
START STOP UNIT completing with an error) leaves the W-LUN in
RPM_SUSPENDED with power.runtime_error == 0, while
__ufshcd_wl_resume() already clears hba->clk_gating.is_suspended and
calls ufshcd_release().
3. The next W-LUN runtime resume runs __ufshcd_wl_resume() again without
an intervening suspend and calls ufshcd_release() a second time,
dropping a reference it does not own and underflowing
hba->clk_gating.active_reqs on UFSHCD_CAP_CLK_GATING hosts.
Keep hba->clk_gating.is_suspended and the suspend hold across a failed
W-LUN runtime resume, so the hold stays paired with the W-LUN
RPM_SUSPENDED state and the next successful resume releases it.
Fixes: eef1d74bf88f ("PM: runtime: Only set runtime_error on suspend callback failures")
Cc: stable@vger.kernel.org # v7.3+
Signed-off-by: Stanley Jhu <stanleyjhu@google.com>
---
drivers/ufs/core/ufshcd.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index cc75384c6502..9be370cea52a 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10626,8 +10626,14 @@ static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
out:
if (ret)
ufshcd_update_evt_hist(hba, UFS_EVT_WL_RES_ERR, (u32)ret);
- hba->clk_gating.is_suspended = false;
- ufshcd_release(hba);
+ /*
+ * A failed runtime resume leaves the W-LUN RPM_SUSPENDED, so keep
+ * is_suspended and the suspend hold for the next resume.
+ */
+ if (!ret || pm_op != UFS_RUNTIME_PM) {
+ hba->clk_gating.is_suspended = false;
+ ufshcd_release(hba);
+ }
hba->pm_op_in_progress = false;
return ret;
}
--
2.56.0.313.g2479322e68-goog
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-29 7:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 7:08 [PATCH] scsi: ufs: core: Keep clock-gating hold on failed W-LUN runtime resume Stanley Jhu
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®