[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d53f0b3e-a831-ed1e-9a8e-3c6902a81fdf@acm.org>
Date: Fri, 9 Dec 2022 10:50:48 -0800
From: Bart Van Assche <bvanassche@....org>
To: Mason Zhang <mason.zhang@...iatek.com>,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
"James E . J . Bottomley" <jejb@...ux.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Bean Huo <beanhuo@...ron.com>,
Stanley Chu <stanley.chu@...iatek.com>,
Jinyoung Choi <j-young.choi@...sung.com>
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Peter Wang <peter.wang@...iatek.com>,
Peng Zhou <peng.zhou@...iatek.com>, wsd_upstream@...iatek.com
Subject: Re: [PATCH v3 1/1] scsi: ufs: core: fix device management cmd timeout
flow
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.
Powered by blists - more mailing lists