[PATCH v2 0/2] scsi: ufs: core: Fix device management and PM recovery
From: Stanley Jhu
Date: Fri Nov 13 2026 - 07:30:56 EST
A UFS power management callback holds hba->dev_cmd.lock and the only
reserved tag while it sends device management commands. When one of
these commands times out, ufshcd_eh_timed_out() calls
ufshcd_link_recovery() inline, which needs the same lock and reserved
tag. ufshcd_err_handler() also calls ufshcd_link_recovery()
concurrently with an active power management callback when
pm_op_in_progress is set.
Patch 1 stops the host controller in ufshcd_eh_timed_out() instead of
running link recovery inline, recovers the link in
ufshcd_set_dev_pwr_mode() for START STOP UNIT, and forces
ufshcd_err_handler() for timed-out reserved requests.
Patch 2 removes the pm_op_in_progress shortcut from
ufshcd_err_handler() so error handling waits for the callback, and
recovers the link in __ufshcd_wl_resume() when START STOP UNIT fails
while a fatal error is scheduled.
Based on mkp/scsi 7.4/scsi-fixes.
Differences from v1 [1]:
- Replace patches 1/9 to 8/9 with patch 1/2 per Bart Van Assche [2]
and drop the external series dependency.
- Rebase v1 patch 9/9 onto patch 1/2 as patch 2/2 and recover the
link in __ufshcd_wl_resume() on UFSHCD_STATE_EH_SCHEDULED_FATAL.
[1] https://lore.kernel.org/r/20261112051542.1539779-1-stanleyjhu@xxxxxxxxxx
[2] https://lore.kernel.org/r/59c577b6-4749-4edc-9dd9-a83f2a124adb@xxxxxxx
Brian Kao (1):
scsi: ufs: core: Do not recover the link concurrently with a PM
callback
Stanley Jhu (1):
scsi: ufs: core: Recover link in ufshcd_set_dev_pwr_mode() on timeout
drivers/ufs/core/ufshcd.c | 62 +++++++++++++++++++++------------------
1 file changed, 33 insertions(+), 29 deletions(-)
base-commit: e550f2b2b4aab4c5f12db89d04d8978ce4ed7b4e
--
2.56.0.611.g1030f0b940-goog