* [PATCH v3] scsi: ufs: core: Keep internal commands dispatchable during error handling
@ 2026-09-12 13:16 Stanley Jhu
2026-09-14 20:34 ` Bart Van Assche
2026-09-17 2:28 ` Martin K. Petersen (Oracle)
0 siblings, 2 replies; 3+ messages in thread
From: Stanley Jhu @ 2026-09-12 13:16 UTC (permalink / raw)
To: Martin K. Petersen, linux-scsi
Cc: Bart Van Assche, Alim Akhtar, Avri Altman, Peter Wang, Brian Kao,
stable, linux-kernel, Stanley Jhu
Commit 08b12cda6c44 ("scsi: ufs: core: Switch to scsi_get_internal_cmd()")
switched UFS internal commands to allocate requests on
hba->host->pseudo_sdev->request_queue, which shares the host tagset with
regular LUNs.
During error recovery, ufshcd_err_handling_prepare() calls
blk_mq_quiesce_tagset(&hba->host->tag_set), marking all queues in the
tagset as quiesced, including pseudo_sdev->request_queue. When
ufshcd_verify_dev_init() subsequently issues internal commands (e.g. NOP
OUT UPIU) via blk_execute_rq(), blk_mq_run_hw_queue() skips running the
quiesced queue, resulting in an unrecoverable circular wait deadlock.
Keep quiescing the tagset and unquiesce the pseudo SCSI device on top of
that, so internal commands stay dispatchable while the logical units
remain quiesced. Re-quiesce the pseudo device before unquiescing the
tagset so that quiesce_depth stays balanced.
Clock scaling and ufshcd_pause_command_processing() are unaffected: they
keep quiescing the whole tagset, internal commands included.
Fixes: 08b12cda6c44 ("scsi: ufs: core: Switch to scsi_get_internal_cmd()")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/6f78c4bd-a70b-402d-abfd-599091b67674@acm.org/
Signed-off-by: Stanley Jhu <stanleyjhu@google.com>
---
Changes since v2:
- Keep blk_mq_quiesce_tagset() and unquiesce only the pseudo SCSI device,
instead of iterating over SCSI devices, which skipped devices already
being removed and left their request queues quiesced.
- Dropped Bart's Reviewed-by since the implementation changed.
drivers/ufs/core/ufshcd.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index a25b6a0cb5c6..91270f8e45a2 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -6817,11 +6817,17 @@ static void ufshcd_err_handling_prepare(struct ufs_hba *hba)
}
/* Wait for ongoing ufshcd_queuecommand() calls to finish. */
blk_mq_quiesce_tagset(&hba->host->tag_set);
+ /*
+ * Internal commands are submitted on the pseudo SCSI device. Let them
+ * through so that the error handler can recover the link.
+ */
+ blk_mq_unquiesce_queue(hba->host->pseudo_sdev->request_queue);
cancel_work_sync(&hba->eeh_work);
}
static void ufshcd_err_handling_unprepare(struct ufs_hba *hba)
{
+ blk_mq_quiesce_queue_nowait(hba->host->pseudo_sdev->request_queue);
blk_mq_unquiesce_tagset(&hba->host->tag_set);
ufshcd_release(hba);
if (ufshcd_is_clkscaling_supported(hba))
--
2.55.0.1007.g17ff1f9808-goog
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v3] scsi: ufs: core: Keep internal commands dispatchable during error handling
2026-09-12 13:16 [PATCH v3] scsi: ufs: core: Keep internal commands dispatchable during error handling Stanley Jhu
@ 2026-09-14 20:34 ` Bart Van Assche
2026-09-17 2:28 ` Martin K. Petersen (Oracle)
1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2026-09-14 20:34 UTC (permalink / raw)
To: Stanley Jhu, Martin K. Petersen, linux-scsi
Cc: Alim Akhtar, Avri Altman, Peter Wang, Brian Kao, stable, linux-kernel
On 9/12/26 6:16 AM, Stanley Jhu wrote:
> Commit 08b12cda6c44 ("scsi: ufs: core: Switch to scsi_get_internal_cmd()")
> switched UFS internal commands to allocate requests on
> hba->host->pseudo_sdev->request_queue, which shares the host tagset with
> regular LUNs.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v3] scsi: ufs: core: Keep internal commands dispatchable during error handling
2026-09-12 13:16 [PATCH v3] scsi: ufs: core: Keep internal commands dispatchable during error handling Stanley Jhu
2026-09-14 20:34 ` Bart Van Assche
@ 2026-09-17 2:28 ` Martin K. Petersen (Oracle)
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen (Oracle) @ 2026-09-17 2:28 UTC (permalink / raw)
To: linux-scsi, Martin K. Petersen, Stanley Jhu
Cc: Bart Van Assche, Alim Akhtar, Avri Altman, Peter Wang, Brian Kao,
stable, linux-kernel
On Sat, 12 Sep 2026 21:16:25 +0800, Stanley Jhu wrote:
> Commit 08b12cda6c44 ("scsi: ufs: core: Switch to scsi_get_internal_cmd()")
> switched UFS internal commands to allocate requests on
> hba->host->pseudo_sdev->request_queue, which shares the host tagset with
> regular LUNs.
>
> During error recovery, ufshcd_err_handling_prepare() calls
> blk_mq_quiesce_tagset(&hba->host->tag_set), marking all queues in the
> tagset as quiesced, including pseudo_sdev->request_queue. When
> ufshcd_verify_dev_init() subsequently issues internal commands (e.g. NOP
> OUT UPIU) via blk_execute_rq(), blk_mq_run_hw_queue() skips running the
> quiesced queue, resulting in an unrecoverable circular wait deadlock.
>
> [...]
Applied to 7.3/scsi-fixes, thanks!
[1/1] scsi: ufs: core: Keep internal commands dispatchable during error handling
https://git.kernel.org/mkp/scsi/c/b52d695d0620
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-17 2:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-12 13:16 [PATCH v3] scsi: ufs: core: Keep internal commands dispatchable during error handling Stanley Jhu
2026-09-14 20:34 ` Bart Van Assche
2026-09-17 2:28 ` Martin K. Petersen (Oracle)
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®