From: Stanley Jhu <stanleyjhu@google.com>
To: linux-scsi@vger.kernel.org, "Martin K. Petersen" <mkp@kernel.org>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
Bart Van Assche <bvanassche@acm.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@sandisk.com>,
Bean Huo <beanhuo@micron.com>,
Peter Wang <peter.wang@mediatek.com>,
Stanley Chu <stanley.chu@mediatek.com>,
Can Guo <quic_cang@quicinc.com>,
"Bao D. Nguyen" <quic_nguyenb@quicinc.com>,
Asutosh Das <quic_asutoshd@quicinc.com>,
Hongjie Fang <hongjiefang@asrmicro.com>,
Praveen Talari <praveen.talari@oss.qualcomm.com>,
HOYOUNG SEO <hy50.seo@samsung.com>,
Brian Kao <powenkao@google.com>, Jens Axboe <axboe@kernel.dk>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/9] scsi: ufs: core: Fix device management and PM recovery
Date: Thu, 12 Nov 2026 13:15:33 +0800 [thread overview]
Message-ID: <20261112051542.1539779-1-stanleyjhu@google.com> (raw)
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@google.com
[3] https://lore.kernel.org/r/20261105071518.1458428-1-stanleyjhu@google.com
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
next reply other threads:[~2026-11-12 5:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 5:15 Stanley Jhu [this message]
2026-11-12 5:15 ` [PATCH 1/9] scsi: ufs: core: Do not poll unconfigured MCQ queues in the error handler Stanley Jhu
2026-11-12 5:15 ` [PATCH 2/9] scsi: ufs: core: Defer link recovery on reserved PM command timeout Stanley Jhu
2026-11-12 5:15 ` [PATCH 3/9] scsi: ufs: core: Wait for the reserved tag in ufshcd_get_dev_mgmt_cmd() Stanley Jhu
2026-11-12 5:15 ` [PATCH 4/9] scsi: ufs: core: Fail PM commands fast when fatal recovery is scheduled Stanley Jhu
2026-11-12 5:15 ` [PATCH 5/9] scsi: ufs: core: Disable W-LUN runtime PM in ufshcd_err_handling_prepare() Stanley Jhu
2026-11-12 5:15 ` [PATCH 6/9] block: Keep RPM_ACTIVE in blk_pre_runtime_resume() when already active Stanley Jhu
2026-11-12 5:15 ` [PATCH 7/9] scsi: ufs: core: Unwind variant resume in EH when reset fails Stanley Jhu
2026-11-12 5:15 ` [PATCH 8/9] scsi: ufs: core: Wake suspended consumer queues after host reset Stanley Jhu
2026-11-12 5:15 ` [PATCH 9/9] scsi: ufs: core: Do not recover the link concurrently with a PM callback Stanley Jhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261112051542.1539779-1-stanleyjhu@google.com \
--to=stanleyjhu@google.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@sandisk.com \
--cc=axboe@kernel.dk \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=hongjiefang@asrmicro.com \
--cc=hy50.seo@samsung.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mkp@kernel.org \
--cc=peter.wang@mediatek.com \
--cc=powenkao@google.com \
--cc=praveen.talari@oss.qualcomm.com \
--cc=quic_asutoshd@quicinc.com \
--cc=quic_cang@quicinc.com \
--cc=quic_nguyenb@quicinc.com \
--cc=rafael.j.wysocki@intel.com \
--cc=stanley.chu@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®