From: Bart Van Assche <bvanassche@acm.org>
To: ZhangHui <zhanghui31@xiaomi.com>,
James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com
Cc: alim.akhtar@samsung.com, avri.altman@wdc.co,
peter.wang@mediatek.com, manivannan.sadhasivam@linaro.org,
huangjianan@xiaomi.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ufs: core: fix bus timeout in ufshcd_wl_resume flow
Date: Tue, 13 Aug 2024 18:41:29 -0700 [thread overview]
Message-ID: <b2fbe277-2819-4af4-9b36-b7407618cbf6@acm.org> (raw)
In-Reply-To: <20240813134729.284583-1-zhanghui31@xiaomi.com>
On 8/13/24 6:47 AM, ZhangHui wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 5e3c67e96956..e5e3e0277d43 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -3291,6 +3291,8 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
> struct ufshcd_lrb *lrbp = &hba->lrb[tag];
> int err;
>
> + if (hba->ufshcd_reg_state == UFSHCD_REG_RESET)
> + return -EBUSY;
> /* Protects use of hba->reserved_slot. */
> lockdep_assert_held(&hba->dev_cmd.lock);
Does this change make ufshcd_exec_dev_cmd() unpredictable - it succeeds
if the controller is in the normal state and fails if error recovery
is ongoing? If so, which code paths does this affect and/or break?
Additionally, I think the above check is racy. hba->ufshcd_reg_state may
change after the above code checked it and before ufshcd_exec_dev_cmd()
has finished. Wouldn't it be better to make code that shouldn't be
executed while the error handler is ongoing wait until error handling
has finished?
Thanks,
Bart.
next prev parent reply other threads:[~2024-08-14 1:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 13:47 ZhangHui
2024-08-14 1:41 ` Bart Van Assche [this message]
2024-08-15 13:07 ` [External Mail]Re: " 章辉
2024-08-14 6:39 ` Peter Wang (王信友)
2024-08-15 13:14 ` [External Mail]Re: " 章辉
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=b2fbe277-2819-4af4-9b36-b7407618cbf6@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.co \
--cc=huangjianan@xiaomi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.com \
--cc=zhanghui31@xiaomi.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®