From: Bart Van Assche <bvanassche@acm.org>
To: Kiwoong Kim <kwmad.kim@samsung.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
alim.akhtar@samsung.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, kwangwon.min@samsung.com,
hy50.seo@samsung.com, cpgs@samsung.com, h10.kim@samsung.com
Cc: stable@vger.kernel.org, stanleyjhu@google.com
Subject: Re: [PATCH v4 2/2] ufs: mcq: poll OCS after sq cleanup for device management commands
Date: Tue, 3 Nov 2026 17:46:32 -0800 [thread overview]
Message-ID: <703c41b5-537f-4897-b852-fed4097a0193@acm.org> (raw)
In-Reply-To: <8c4bbbd746e7fc1d8c27b6b87b2d684abb74a3b3.1793598099.git.kwmad.kim@samsung.com>
On 11/1/26 9:52 PM, Kiwoong Kim wrote:
> +static enum utp_ocs ufshcd_mcq_read_ocs(struct ufs_hw_queue *hwq,
> + struct ufshcd_lrb *lrbp)
> +{
> + guard(spinlock_irqsave)(&hwq->cq_lock);
> + return READ_ONCE(lrbp->utr_descriptor_ptr->header.ocs);
> +}
READ_ONCE() is sufficient. I don't think that the spinlock helps here.
Additionally, if the spinlock operations are left out, the function
ufshcd_mcq_read_ocs() is no longer necessary and can be inlined in its
only caller.
> + /*
> + * For device management commands, there is no order guaranteed between
> + * OCS update and CUS update, which is why we need to wait here. SCSI
> + * commands are excluded because the OCS in their UTRD is not updated
> + * from the CQE.
> + */
> + if (!err && blk_mq_is_reserved_rq(rq)) {
> + enum utp_ocs ocs;
> +
> + err = read_poll_timeout(ufshcd_mcq_read_ocs, ocs,
> + ocs != OCS_INVALID_COMMAND_STATUS, 20,
> + MCQ_POLL_US, false, hwq, lrbp);
> + }
An error message should be reported if the above loop times out.
Thanks,
Bart.
prev parent reply other threads:[~2026-11-04 1:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20261102055313epcas2p236ca7854da996b968f37931db6e5258b@epcas2p2.samsung.com>
2026-11-02 5:52 ` [PATCH v4 0/2] ufs: fix the abort path of device management commands in MCQ mode Kiwoong Kim
[not found] ` <CGME20261102055315epcas2p4024322466144d1a59b4e8fdadfdbec2a@epcas2p4.samsung.com>
2026-11-02 5:52 ` [PATCH v4 1/2] ufs: core: skip ABORT TASK for device management commands Kiwoong Kim
2026-11-03 22:55 ` Bean Huo
2026-11-04 4:34 ` Bart Van Assche
[not found] ` <CGME20261102055317epcas2p48b638d0c25fd024ce01960afd1e6dee6@epcas2p4.samsung.com>
2026-11-02 5:52 ` [PATCH v4 2/2] ufs: mcq: poll OCS after sq cleanup " Kiwoong Kim
2026-11-04 1:46 ` Bart Van Assche [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=703c41b5-537f-4897-b852-fed4097a0193@acm.org \
--to=bvanassche@acm.org \
--cc=alim.akhtar@samsung.com \
--cc=cpgs@samsung.com \
--cc=h10.kim@samsung.com \
--cc=hy50.seo@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=kwangwon.min@samsung.com \
--cc=kwmad.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable@vger.kernel.org \
--cc=stanleyjhu@google.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®