From: Bart Van Assche <bvanassche@acm.org>
To: SEO HOYOUNG <hy50.seo@samsung.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, beanhuo@micron.com,
kwangwon.min@samsung.com, kwmad.kim@samsung.com,
sh425.lee@samsung.com, sc.suh@samsung.com,
quic_nguyenb@quicinc.com, cpgs@samsung.com,
grant.jung@samsung.com, junwoo80.lee@samsung.com
Subject: Re: [PATCH v3] scsi: ufs: core: fix racing issue during ufshcd_mcq_abort
Date: Tue, 21 Nov 2023 09:57:29 -0800 [thread overview]
Message-ID: <f92655ec-96ab-4f3d-8f5b-a5b9780adc5a@acm.org> (raw)
In-Reply-To: <20231121071128.7743-1-hy50.seo@samsung.com>
On 11/20/23 23:11, SEO HOYOUNG wrote:
> Bart said that lrbp->cmd could be changed before ufshcd_clear_cmd() was
> called, so lrbp->cmd check was moved to ufshcd_clear_cmd().
> In the case of legacy mode, spin_lock is used to protect before clear cmd,
> but spin_lock cannot be used due to mcq mode, so it is necessary to check
> the status of lrbp->cmd.
Does this mean that the race that I mentioned has not been addressed at all?
ufshcd_mcq_sq_cleanup() is called by ufshcd_clear_cmd(). No locks are held by
ufshcd_eh_device_reset_handler() when it calls ufshcd_clear_cmd(). So I think
there is still a race between the code added by this patch and the completion
interrupt.
Thanks,
Bart.
> Change-Id: Id8412190e60286d00a30820591566835cefbf47e
No Change-Ids in patches that are posted on upstream mailing lists please.
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 2ba8ec254dce..deb6dac724c8 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -507,6 +507,10 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag)
> if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_RTC)
> return -ETIMEDOUT;
>
> + if (!ufshcd_cmd_inflight(cmd) ||
> + test_bit(SCMD_STATE_COMPLETE, &cmd->state))
> + return 0;
> +
> if (task_tag != hba->nutrs - UFSHCD_NUM_RESERVED) {
> if (!cmd)
> return -EINVAL;
Thanks,
Bart.
next prev parent reply other threads:[~2023-11-21 17:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20231121070851epcas2p2ba11977edde23d3dcb87581e410806c8@epcas2p2.samsung.com>
2023-11-21 7:11 ` SEO HOYOUNG
2023-11-21 17:57 ` Bart Van Assche [this message]
2023-11-22 9:23 ` Dan Carpenter
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=f92655ec-96ab-4f3d-8f5b-a5b9780adc5a@acm.org \
--to=bvanassche@acm.org \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=cpgs@samsung.com \
--cc=grant.jung@samsung.com \
--cc=hy50.seo@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=junwoo80.lee@samsung.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=quic_nguyenb@quicinc.com \
--cc=sc.suh@samsung.com \
--cc=sh425.lee@samsung.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®