The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Can Guo <quic_cang@quicinc.com>
To: Bart Van Assche <bvanassche@acm.org>,
	SEO HOYOUNG <hy50.seo@samsung.com>, <linux-scsi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <alim.akhtar@samsung.com>,
	<avri.altman@wdc.com>, <jejb@linux.ibm.com>,
	<martin.petersen@oracle.com>, <beanhuo@micron.com>,
	<kwangwon.min@samsung.com>, <kwmad.kim@samsung.com>,
	<sh425.lee@samsung.com>, <sc.suh@samsung.com>,
	<quic_nguyenb@quicinc.com>, <cpgs@samsung.com>,
	<grant.jung@samsung.com>, <junwoo80.lee@samsung.com>
Subject: Re: [PATCH v1] scsi: ufs: core: Remove the ufshcd_release in ufshcd_err_handling_prepare
Date: Thu, 1 Feb 2024 11:36:18 +0800	[thread overview]
Message-ID: <fd3d7ea4-b1f8-429b-ba0d-588c2bbe25a3@quicinc.com> (raw)
In-Reply-To: <0ae6c12e-3b55-4d90-b042-e8c2b3a2c4a7@acm.org>



On 2/1/2024 1:44 AM, Bart Van Assche wrote:
> On 1/22/24 00:33, SEO HOYOUNG wrote:
>> This is because ufshcd_errhandling_prepare() and
>> ufshcd_err_handling_unprepare() repeatedly release calls.
> 
> It would have been much more clear if it would have been mentioned that
> ufshcd_err_handling_prepare() should call ufshcd_hold() once and
> also that ufshcd_err_handling_unprepare() should call ufshcd_release()
> once.
> 
> Additionally, a Fixes: tag is missing. Is this patch perhaps a fix for 
> commit
> c72e79c0ad2b ("scsi: ufs: Recover HBA runtime PM error in error handler")?
> Can Guo, since you wrote that patch, can you please take a look at this 
> patch?
> 
>> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
>> index 7c59d7a02243..423e83074a20 100644
>> --- a/drivers/ufs/core/ufshcd.c
>> +++ b/drivers/ufs/core/ufshcd.c
>> @@ -6351,7 +6351,6 @@ static void ufshcd_err_handling_prepare(struct 
>> ufs_hba *hba)
>>           ufshcd_hold(hba);
>>           if (!ufshcd_is_clkgating_allowed(hba))
>>               ufshcd_setup_clocks(hba, true);
>> -        ufshcd_release(hba);

When we are here, it means runtime resume has failed.

When I wrote the code (in older kernel), ufshcd_runtime_resume(), if 
fails, bails without calling ufshcd_release(), eventually 
ufshcd_err_handling_unprepare() would call ufshcd_release() to balance.

But now, I see that if __ufshcd_wl_resume() fails, ufshcd_release() is 
called anyways, so ufshcd_release() is not required here. Hence,

Reviewed-by: Can Guo <quic_cang@quicinc.com>

>>           pm_op = hba->is_sys_suspended ? UFS_SYSTEM_PM : UFS_RUNTIME_PM;
>>           ufshcd_vops_resume(hba, pm_op);
>>       } else {
> 
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>

  reply	other threads:[~2024-02-01  3:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240122083204epcas2p26a1bca522e201972ca072e0b24d23a52@epcas2p2.samsung.com>
2024-01-22  8:33 ` [PATCH v1] scsi: ufs: core: Remove the ufshcd_release in ufshcd_err_handling_prepare SEO HOYOUNG
2024-01-22 20:36   ` Bart Van Assche
2024-01-23  2:38     ` hoyoung seo
2024-01-24 16:17       ` Bart Van Assche
2024-01-31  8:23         ` hoyoung seo
2024-01-31 17:40           ` Bart Van Assche
2024-01-31 17:44   ` Bart Van Assche
2024-02-01  3:36     ` Can Guo [this message]
2024-02-06  2:08   ` Martin K. Petersen

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=fd3d7ea4-b1f8-429b-ba0d-588c2bbe25a3@quicinc.com \
    --to=quic_cang@quicinc.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cpgs@samsung.com \
    --cc=grant.jung@samsung.com \
    --cc=hy50.seo@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=junwoo80.lee@samsung.com \
    --cc=kwangwon.min@samsung.com \
    --cc=kwmad.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=quic_nguyenb@quicinc.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