[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <433afef33c8ca61aa299fa453c0d25d3@codeaurora.org>
Date: Fri, 15 Nov 2019 20:27:18 +0800
From: Can Guo <cang@...eaurora.org>
To: Stanley Chu <stanley.chu@...iatek.com>
Cc: asutoshd@...eaurora.org, nguyenb@...eaurora.org,
rnayak@...eaurora.org, linux-scsi@...r.kernel.org,
kernel-team@...roid.com, saravanak@...gle.com, salyzyn@...gle.com,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
Pedro Sousa <pedrom.sousa@...opsys.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Bean Huo <beanhuo@...ron.com>,
Tomas Winkler <tomas.winkler@...el.com>,
Venkat Gopalakrishnan <venkatg@...eaurora.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 3/7] scsi: ufs: Fix up auto hibern8 enablement
On 2019-11-15 15:18, Stanley Chu wrote:
> Hi Can,
>
> On Fri, 2019-11-15 at 15:03 +0800, Can Guo wrote:
>> On 2019-11-15 14:35, Stanley Chu wrote:
>> > Hi Can,
>> >
>> > On Thu, 2019-11-14 at 22:09 -0800, Can Guo wrote:
>> >> + if (hba->ahit != ahit)
>> >> + hba->ahit = ahit;
>> >> spin_unlock_irqrestore(hba->host->host_lock, flags);
>> >> + if (!pm_runtime_suspended(hba->dev)) {
>> >
>> > Always do pm_runtime_get_sync() here could avoid possible racing?
>> >
>> > And thus AH8 could be enabled regardless of runtime status.
>> >
>> >> + pm_runtime_get_sync(hba->dev);
>> >> + ufshcd_hold(hba, false);
>> >> + ufshcd_auto_hibern8_enable(hba);
>> >> + ufshcd_release(hba);
>> >> + pm_runtime_put(hba->dev);
>> >> + }
>> >> }
>> >
>> > Thanks,
>> > Stanley
>>
>> Hi Stanley,
>>
>> if !pm_runtime_suspended() is true, hba->dev's runtime status, other
>> than RPM_ACTIVE,
>> may be RPM_SUSPENDING or RPM_RESUMING. So, here for safty, do
>> pm_runtime_get_sync() once
>> before access registers, in case we hit corner cases in which powers
>> and/or clocks are OFF.
>>
>
> Thanks for explanation.
>
> I fully understand the intention of this patch.
>
> Just wonder if "if (!pm_runtime_suspended(hba->dev))" could be removed
> and then always do pm_runtime_get_sync() here.
>
> This could avoid possible racing and enable AH8 regardless of current
> runtime status.
>
>> Thanks,
>> Can Guo.
>
> Thanks,
> Stanley
Hi Stanley,
Actually, I thought about the way you reommand.
But I guess the author's intention here is to update the AH8 timer
only when current runtime status is RPM_ACTIVE. If it is not RPM_ACTIVE,
we just update the hba->ahit and bail out, because the AH8 timer will be
updated in ufshcd_reusme() eventually when hba is resumed. This can
avoid
frequently waking up hba just for accessing a single register.
How do you think?
Thanks,
Can Guo.
Powered by blists - more mailing lists