linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: Lee Sang Hyun <sh425.lee@samsung.com>
Cc: linux-scsi@vger.kernel.org, alim.akhtar@samsung.com,
	avri.altman@wdc.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, beanhuo@micron.com,
	asutoshd@codeaurora.org, bvanassche@acm.org,
	grant.jung@samsung.com, sc.suh@samsung.com, hy50.seo@samsung.com,
	kwmad.kim@samsung.com
Subject: Re: [RFC PATCH v2] scsi: ufs: set STATE_ERROR when ufshcd_probe_hba() failed
Date: Sun, 19 Jul 2020 18:19:34 +0800	[thread overview]
Message-ID: <fe7ffa6778360cafeabbd238db85ae13@codeaurora.org> (raw)
In-Reply-To: <1594971107-37463-1-git-send-email-sh425.lee@samsung.com>

Hi Sang Hyun,

On 2020-07-17 15:31, Lee Sang Hyun wrote:
> set STATE_ERR like below to prevent a lockup(IO stuck)
> when ufshcd_probe_hba() returns error.
> 
> Change-Id: I6c85ff290503cc9414d7f5fdd934295497b854ff
> Signed-off-by: Lee Sang Hyun <sh425.lee@samsung.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index ad4fc82..37e4105 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -7368,6 +7368,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba,
> bool async)
>  {
>  	int ret;
>  	ktime_t start = ktime_get();
> +	unsigned long flags;
> 
>  	ret = ufshcd_link_startup(hba);
>  	if (ret)
> @@ -7439,6 +7440,11 @@ static int ufshcd_probe_hba(struct ufs_hba
> *hba, bool async)
>  	ufshcd_auto_hibern8_enable(hba);
> 
>  out:
> +	if (ret) {
> +		spin_lock_irqsave(hba->host->host_lock, flags);
> +		hba->ufshcd_state = UFSHCD_STATE_ERROR;
> +		spin_unlock_irqrestore(hba->host->host_lock, flags);
> +	}
> 
>  	trace_ufshcd_init(dev_name(hba->dev), ret,
>  		ktime_to_us(ktime_sub(ktime_get(), start)),

This change is included in my change
"scsi: ufs: Fix up and simplify error recovery mechanism".

Besides, this change seems not complete because

#1 You are only protecting your changes with spin lock in
ufshcd_probe_hba, what about the other line
"hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;"?

#2 As you are giving "hba->ufshcd_state = UFSHCD_STATE_ERROR;"
in ufshcd_probe_hba, why keep the same lines in
ufshcd_error_handler and ufshcd_eh_host_reset_handler?

Thanks,

Can Guo.

  parent reply	other threads:[~2020-07-19 10:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200717073950epcas2p3fe023138e3c04e706a1afb887998eb5c@epcas2p3.samsung.com>
2020-07-17  7:31 ` [RFC PATCH v2] scsi: ufs: set STATE_ERROR when ufshcd_probe_hba() failed Lee Sang Hyun
2020-07-19  7:14   ` Avri Altman
2020-07-19 10:19   ` Can Guo [this message]
2020-07-21 12:10     ` ???

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=fe7ffa6778360cafeabbd238db85ae13@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=grant.jung@samsung.com \
    --cc=hy50.seo@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=kwmad.kim@samsung.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).