From: Bart Van Assche <bvanassche@acm.org>
To: Mason Zhang <mason.zhang@mediatek.com>,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
"James E . J . Bottomley" <jejb@linux.ibm.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Bean Huo <beanhuo@micron.com>,
Stanley Chu <stanley.chu@mediatek.com>,
Jinyoung Choi <j-young.choi@samsung.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Peter Wang <peter.wang@mediatek.com>,
Peng Zhou <peng.zhou@mediatek.com>,
wsd_upstream@mediatek.com
Subject: Re: [PATCH v3 1/1] scsi: ufs: core: fix device management cmd timeout flow
Date: Fri, 9 Dec 2022 10:50:48 -0800 [thread overview]
Message-ID: <d53f0b3e-a831-ed1e-9a8e-3c6902a81fdf@acm.org> (raw)
In-Reply-To: <20221209101321.30671-1-mason.zhang@mediatek.com>
On 12/9/22 02:13, Mason Zhang wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index b1f59a5fe632..6fe51b8d41f9 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -2979,35 +2979,31 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
> err = -ETIMEDOUT;
> dev_dbg(hba->dev, "%s: dev_cmd request timedout, tag %d\n",
> __func__, lrbp->task_tag);
> - if (ufshcd_clear_cmds(hba, 1U << lrbp->task_tag) == 0) {
> + if (ufshcd_clear_cmds(hba, 1U << lrbp->task_tag) == 0)
> /* successfully cleared the command, retry if needed */
> err = -EAGAIN;
> + /*
> + * in case of an error, after clearing the doorbell,
> + * we also need to clear the task tag bit from the
> + * outstanding_reqs variable.
> + */
> + spin_lock_irqsave(&hba->outstanding_lock, flags);
> + pending = test_bit(lrbp->task_tag,
> + &hba->outstanding_reqs);
> + if (pending) {
> + hba->dev_cmd.complete = NULL;
> + __clear_bit(lrbp->task_tag,
> + &hba->outstanding_reqs);
> + }
> + spin_unlock_irqrestore(&hba->outstanding_lock, flags);
This patch causes the 'task_tag' bit to be cleared from outstanding_reqs
even if ufshcd_clear_cmds() failed. I think that's wrong.
Bart.
prev parent reply other threads:[~2022-12-09 18:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 10:13 [PATCH v3 1/1] scsi: ufs: core: fix device management cmd timeout flow Mason Zhang
2022-12-09 18:50 ` 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=d53f0b3e-a831-ed1e-9a8e-3c6902a81fdf@acm.org \
--to=bvanassche@acm.org \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=j-young.choi@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mason.zhang@mediatek.com \
--cc=matthias.bgg@gmail.com \
--cc=peng.zhou@mediatek.com \
--cc=peter.wang@mediatek.com \
--cc=stanley.chu@mediatek.com \
--cc=wsd_upstream@mediatek.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