mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 章辉 <zhanghui31@xiaomi.com>
To: Bart Van Assche <bvanassche@acm.org>,
	"James.Bottomley@HansenPartnership.com"
	<James.Bottomley@HansenPartnership.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"avri.altman@wdc.co" <avri.altman@wdc.co>,
	"peter.wang@mediatek.com" <peter.wang@mediatek.com>,
	"manivannan.sadhasivam@linaro.org"
	<manivannan.sadhasivam@linaro.org>,
	"Huang Jianan" <huangjianan@xiaomi.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [External Mail]Re: [PATCH] ufs: core: fix bus timeout in ufshcd_wl_resume flow
Date: Thu, 15 Aug 2024 13:07:42 +0000	[thread overview]
Message-ID: <baef8886-5ec0-4ba4-930e-cd1487ba3a56@xiaomi.com> (raw)
In-Reply-To: <b2fbe277-2819-4af4-9b36-b7407618cbf6@acm.org>

On 2024/8/14 9:41, Bart Van Assche wrote:
> 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.
>
hi Bart,

1. If the host needs to send a dev command, the HBA must be enabled.
We have set the ufshcd_reg_state to operational in the ufshcd_hba_enable,
so it is not unpredictable.

2. That's a good question, but I think it makes sense to block dev cmd while
ufs is doing a reset.


Thanks
Zhanghui


  reply	other threads:[~2024-08-15 13:07 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
2024-08-15 13:07   ` 章辉 [this message]
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=baef8886-5ec0-4ba4-930e-cd1487ba3a56@xiaomi.com \
    --to=zhanghui31@xiaomi.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.co \
    --cc=bvanassche@acm.org \
    --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 \
    /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®