From: sashiko-bot@kernel.org
To: "Bart Van Assche" <bvanassche@acm.org>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 3/3] ufs: core: Do not forcibly complete SCSI commands
Date: Wed, 12 Aug 2026 18:38:18 +0000 [thread overview]
Message-ID: <20260812183819.51C711F000E9@smtp.kernel.org> (raw)
In-Reply-To: <182ad9c472505abc7958d85c772d56e8a40e3b69.1786558726.git.bvanassche@acm.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] Polling the MCQ Completion Queue by reading hardware registers while the host controller is disabled (HCE=0) causes a hard CPU lockup due to an infinite loop.
--
--- Patch [3]: [PATCH 3/3] ufs: core: Do not forcibly complete SCSI commands ---
commit af070348e9f00f73ade393f3d9421e41e0afb4fb
Author: Bart Van Assche <bvanassche@acm.org>
ufs: core: Do not forcibly complete SCSI commands
This patch removes the forced completion of SCSI commands from the UFS error
handler for MCQ mode, delegating abort and requeue decisions to the SCSI core.
It makes MCQ behavior consistent with legacy mode by removing
ufshcd_mcq_compl_all_cqes_lock and the force_compl flag.
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index cdfcd3d4c4c97..26bc2b0c08124 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
[ ... ]
> @@ -8197,7 +8163,7 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba)
> */
> ufshcd_hba_stop(hba);
> hba->silence_err_logs = true;
> - ufshcd_complete_requests(hba, true);
> + ufshcd_complete_requests(hba);
[Severity: Critical]
Can this lead to an infinite loop and hard lockup during error recovery?
After ufshcd_hba_stop() disables the host controller,
ufshcd_complete_requests() now eventually calls ufshcd_mcq_poll_cqe_lock():
ufshcd_host_reset_and_restore()
ufshcd_hba_stop()
ufshcd_complete_requests()
ufshcd_mcq_compl_pending_transfer()
blk_mq_tagset_busy_iter(..., ufshcd_mcq_compl_one, ...)
ufshcd_mcq_compl_one()
ufshcd_mcq_poll_cqe_lock()
In ufshcd_mcq_poll_cqe_lock():
ufshcd_mcq_update_cq_tail_slot(hwq);
while (!ufshcd_mcq_is_cq_empty(hwq)) {
...
ufshcd_mcq_inc_cq_head_slot(hwq);
}
If reading the disabled MMIO register in ufshcd_mcq_update_cq_tail_slot()
returns 0xFFFFFFFF, the tail slot becomes out-of-bounds. Since the head slot
wraps around at hwq->max_entries, ufshcd_mcq_is_cq_empty() will never evaluate
to true.
Because this loop runs with the hwq->cq_lock spinlock held and interrupts
disabled, will this permanently hang the CPU?
> hba->silence_err_logs = false;
>
> /* scale up clocks to max frequency before full reinitialization */
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1786558726.git.bvanassche@acm.org?part=3
prev parent reply other threads:[~2026-08-12 18:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 18:22 [PATCH 0/3] ufs: core: Improve error handling Bart Van Assche
2026-08-12 18:22 ` [PATCH 1/3] ufs: core: Simplify timeout handling for START STOP UNIT commands Bart Van Assche
2026-08-12 18:40 ` sashiko-bot
2026-08-12 18:22 ` [PATCH 2/3] ufs: core: Fix a race condition triggered by ufshcd_eh_timed_out() Bart Van Assche
2026-08-12 18:42 ` sashiko-bot
2026-08-12 18:22 ` [PATCH 3/3] ufs: core: Do not forcibly complete SCSI commands Bart Van Assche
2026-08-12 18:38 ` sashiko-bot [this message]
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=20260812183819.51C711F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bvanassche@acm.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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