public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "hoyoung seo" <hy50.seo@samsung.com>
To: "'Bart Van Assche'" <bvanassche@acm.org>,
	<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 v2] scsi: ufs: core: fix racing issue during ufshcd_mcq_abort
Date: Wed, 15 Nov 2023 14:27:00 +0900	[thread overview]
Message-ID: <000001da1784$5c2520f0$146f62d0$@samsung.com> (raw)
In-Reply-To: <dca06fd3-d4ad-4e41-a0a3-61d52c85ef9c@acm.org>

> -----Original Message-----
> From: Bart Van Assche <bvanassche@acm.org>
> Sent: Wednesday, November 15, 2023 2:55 AM
> 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 v2] scsi: ufs: core: fix racing issue during
> ufshcd_mcq_abort
> 
> On 11/13/23 20:37, SEO HOYOUNG wrote:
> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > index 9a730a794b66..55f4c0eeda7b 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -7574,6 +7574,10 @@ int ufshcd_try_to_abort_task(struct ufs_hba *hba,
> int tag)
> >   		goto out;
> >   	}
> >
> > +	if (!ufshcd_cmd_inflight(lrbp->cmd) ||
> > +	    test_bit(SCMD_STATE_COMPLETE, &lrbp->cmd->state))
> > +		goto out;
> > +
> >   	err = ufshcd_clear_cmd(hba, tag);
> >   	if (err)
> >   		dev_err(hba->dev, "%s: Failed clearing cmd at tag %d,
> err %d\n",
> 
> The UFS driver must not set SCMD_STATE_COMPLETE itself. Only the SCSI core
> is allowed to set that bit.
> 
> Thanks,
> 
> Bart.

Hi,

The test_bit() function just check SCMD_STATE_COMPLETE bit state.
Do not set SCMD_STATE_COMPLETE field. 
This function is also used in ufshcd_mcq_compl_pending_transfer() 
to check the status of cmd.

Thanks.
BRs SEO.


  reply	other threads:[~2023-11-15  5:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20231114043431epcas2p4a8d452e18fff192c03fb6066e81514ea@epcas2p4.samsung.com>
2023-11-14  4:37 ` [PATCH v2] scsi: ufs: core: fix racing issue during ufshcd_mcq_abort SEO HOYOUNG
2023-11-14 17:54   ` Bart Van Assche
2023-11-15  5:27     ` hoyoung seo [this message]
2023-11-15 18:22       ` Bart Van Assche
2023-11-16  1:56         ` hoyoung seo
2023-11-16 21:34   ` Bart Van Assche

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='000001da1784$5c2520f0$146f62d0$@samsung.com' \
    --to=hy50.seo@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cpgs@samsung.com \
    --cc=grant.jung@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