From: Stanley Chu <stanley.chu@mediatek.com>
To: Avri Altman <Avri.Altman@wdc.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"marc.w.gonzalez@free.fr" <marc.w.gonzalez@free.fr>,
"andy.teng@mediatek.com" <andy.teng@mediatek.com>,
"chun-hung.wu@mediatek.com" <chun-hung.wu@mediatek.com>,
"kuohong.wang@mediatek.com" <kuohong.wang@mediatek.com>,
"peter.wang@mediatek.com" <peter.wang@mediatek.com>,
"evgreen@chromium.org" <evgreen@chromium.org>,
"subhashj@codeaurora.org" <subhashj@codeaurora.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"ygardi@codeaurora.org" <ygardi@codeaurora.org>,
"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
stanley.chu@mediatek.com,
"pedrom.sousa@synopsys.com" <pedrom.sousa@synopsys.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"beanhuo@micron.com" <beanhuo@micron.com>
Subject: RE: [PATCH v1] scsi: ufs: Avoid runtime suspend possibly being blocked forever
Date: Wed, 12 Jun 2019 22:03:24 +0800 [thread overview]
Message-ID: <1560348204.19782.6.camel@mtkswgap22> (raw)
In-Reply-To: <SN6PR04MB492546256F8F8635E7EE60C2FCEC0@SN6PR04MB4925.namprd04.prod.outlook.com>
Hi Avri,
On Wed, 2019-06-12 at 11:10 +0000, Avri Altman wrote:
> Hi,
>
> >
> > UFS runtime suspend can be triggered after pm_runtime_enable()
> > is invoked in ufshcd_pltfrm_init(). However if the first runtime
> > suspend is triggered before binding ufs_hba structure to ufs
> > device structure via platform_set_drvdata(), then UFS runtime
> > suspend will be no longer triggered in the future because its
> > dev->power.runtime_error was set in the first triggering and does
> > not have any chance to be cleared.
> >
> > To be more clear, dev->power.runtime_error is set if hba is NULL
> > in ufshcd_runtime_suspend() which returns -EINVAL to rpm_callback()
> > where dev->power.runtime_error is set as -EINVAL. In this case, any
> > future rpm_suspend() for UFS device fails because
> > rpm_check_suspend_allowed() fails due to non-zero
> > dev->power.runtime_error.
> >
> > To resolve this issue, make sure the first UFS runtime suspend
> > get valid "hba" in ufshcd_runtime_suspend(): Enable UFS runtime PM
> > only after hba is successfully bound to UFS device structure.
> >
> > Fixes: e3ce73d (scsi: ufs: fix bugs related to null pointer access and array size)
> This code was inserted before platform_set_drvdata in
> 6269473 [SCSI] ufs: Add runtime PM support for UFS host controller driver.
> Why do you point to e3ce73d?
e3ce73d (scsi: ufs: fix bugs related to null pointer access and array
size) changed the returned value from 0 to -EINVAL in case of NULL "hba"
in ufshcd_runtime_suspend().
But you are right, above patch may do the right thing, and the real root
cause is the incorrect timing of pm_runtime_enable().
I will fix commit message in next version.
>
> Thanks,
> Avri
Thanks.
Stanley
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-06-12 14:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 7:42 [PATCH v1] scsi: ufs: Avoid runtime suspend possibly being blocked forever Stanley Chu
2019-06-12 11:10 ` Avri Altman
2019-06-12 14:03 ` Stanley Chu [this message]
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=1560348204.19782.6.camel@mtkswgap22 \
--to=stanley.chu@mediatek.com \
--cc=Avri.Altman@wdc.com \
--cc=alim.akhtar@samsung.com \
--cc=andy.teng@mediatek.com \
--cc=beanhuo@micron.com \
--cc=chun-hung.wu@mediatek.com \
--cc=evgreen@chromium.org \
--cc=kuohong.wang@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=marc.w.gonzalez@free.fr \
--cc=martin.petersen@oracle.com \
--cc=matthias.bgg@gmail.com \
--cc=pedrom.sousa@synopsys.com \
--cc=peter.wang@mediatek.com \
--cc=stable@vger.kernel.org \
--cc=subhashj@codeaurora.org \
--cc=ygardi@codeaurora.org \
/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