[PATCH 0/9] scsi: ufs: core: Fix device management and PM recovery

From: Stanley Jhu

Date: Thu Nov 12 2026 - 00:17:43 EST


A UFS PM callback holds hba->dev_cmd.lock and the only reserved tag
while it sends device management and START STOP UNIT commands. When
one of these commands times out, ufshcd_eh_timed_out() resets the host
inline, but the reset path needs the same lock and tag, so it
deadlocks or fails. The error handler can also reset the host while
the PM callback is still using it.

This series:
- skips the MCQ completion queue poll when error handling preparation
left the queues unconfigured (patch 1/9).
- hands PM command timeouts to ufshcd_err_handler() instead of
resetting the host inline, and fails later PM commands fast
(patches 2/9 to 4/9).
- disables W-LUN runtime PM during error handling instead of calling
ufshcd_rpm_get_sync(), so the error handler powers up the host
itself (patches 5/9 and 6/9).
- keeps the host variant power state balanced across error handling,
resumes the UFS device W-LUN and wakes suspended logical units after
a successful reset, and makes the error handler wait for a running
PM callback (patches 7/9 to 9/9).

Based on mkp/scsi 7.4/scsi-fixes (e550f2b2b4aa) plus Hoyoung Seo's v10
series [1]. On this base, its patch 4/4 needs a context fixup in
__ufshcd_wl_resume() because of commit 6da1bc55c060 ("scsi: ufs: core:
Keep clock-gating hold on failed W-LUN runtime resume").

This series folds in [2] and supersedes [3].

[1] https://lore.kernel.org/r/2052256418.81794387787276.JavaMail.epsvc@epcpadp2new
[2] https://lore.kernel.org/r/20261104112744.1630864-1-stanleyjhu@xxxxxxxxxx
[3] https://lore.kernel.org/r/20261105071518.1458428-1-stanleyjhu@xxxxxxxxxx

Brian Kao (1):
scsi: ufs: core: Do not recover the link concurrently with a PM
callback

Stanley Jhu (8):
scsi: ufs: core: Do not poll unconfigured MCQ queues in the error
handler
scsi: ufs: core: Defer link recovery on reserved PM command timeout
scsi: ufs: core: Wait for the reserved tag in
ufshcd_get_dev_mgmt_cmd()
scsi: ufs: core: Fail PM commands fast when fatal recovery is
scheduled
scsi: ufs: core: Disable W-LUN runtime PM in
ufshcd_err_handling_prepare()
block: Keep RPM_ACTIVE in blk_pre_runtime_resume() when already active
scsi: ufs: core: Unwind variant resume in EH when reset fails
scsi: ufs: core: Wake suspended consumer queues after host reset

block/blk-pm.c | 13 +-
drivers/ufs/core/ufshcd-priv.h | 19 ++-
drivers/ufs/core/ufshcd.c | 244 ++++++++++++++++++++++-----------
include/ufs/ufshcd.h | 3 +
4 files changed, 189 insertions(+), 90 deletions(-)


base-commit: e550f2b2b4aab4c5f12db89d04d8978ce4ed7b4e
prerequisite-patch-id: 0c2cfc48bd97246e47ce689a3a8a364c18a56621
prerequisite-patch-id: 9a413c053d618cedfc6a1a439469bc49a51e060a
prerequisite-patch-id: 961b8b65ac8c9fd1b95d0901347cf504632531e4
prerequisite-patch-id: 9f5c103bac288c258b541cff3742a69fd07892f1
--
2.56.0.506.g506a7eabc5-goog