lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YHQVr6HYpfW5r5AO@bogon.m.sigxcpu.org>
Date:   Mon, 12 Apr 2021 11:41:03 +0200
From:   Guido Günther <agx@...xcpu.org>
To:     Liu Ying <victor.liu@....com>
Cc:     Kishon Vijay Abraham I <kishon@...com>,
        Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>,
        Robert Chiras <robert.chiras@....com>,
        Sam Ravnborg <sam@...nborg.org>, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
        Heiko Stuebner <heiko.stuebner@...obroma-systems.com>
Subject: Re: [PATCH v5 1/2] phy: core: Use runtime pm during configure too

Hi,
On Mon, Apr 12, 2021 at 04:40:56PM +0800, Liu Ying wrote:
> Hi Guido,
> 
> On Fri, 2021-04-09 at 13:40 +0200, Guido Günther wrote:
> > The phy's configure phase usually needs register access so taking the
> > device out of pm_runtime suspend looks useful.
> > 
> > There's currently two in tree drivers using runtime pm and .configure
> > (qualcomm/phy-qcom-qmp.c, rockchip/phy-rockchip-inno-dsidphy.c) but both
> > don't use the phy layers 'transparent' runtime phy_pm_runtime handling
> > but manage it manually so this will for now only affect the
> > phy-fsl-imx8-mipi-dphy driver.
> 
> IIUC, the qualcomm one's runtime PM is managed by the phy core when
> users enable it using power/control in sysfs(see comment just before
> pm_runtime_forbid() in that driver).
> I'm assuming it's affected and it would be good to test it.

Ah, right. I'll reword the commit message but i don't have any means to
test it.

> I'm not pretty sure if the rockchip one is affected or not, because I'm
> assuming the power/control nodes of phy->dev and phy->parent.dev in
> sysfs are both 'auto' after the driver probes.

Testing if adding runtime pm for .configure to phy_core breaks anything
here would be great too.

I've added Dmitry and Heiko to cc: since they were active in those
drivers lately and i sure don't want to break these.

> > 
> > Signed-off-by: Guido Günther <agx@...xcpu.org>
> > ---
> >  drivers/phy/phy-core.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> > index ccb575b13777..256a964d52d3 100644
> > --- a/drivers/phy/phy-core.c
> > +++ b/drivers/phy/phy-core.c
> > @@ -470,10 +470,16 @@ int phy_configure(struct phy *phy, union phy_configure_opts *opts)
> >  	if (!phy->ops->configure)
> >  		return -EOPNOTSUPP;
> >  
> > +	ret = phy_pm_runtime_get_sync(phy);
> > +	if (ret < 0 && ret != -ENOTSUPP)
> > +		return ret;
> > +	ret = 0; /* Override possible ret == -ENOTSUPP */
> 
> This override is not needed, because 'ret' will be the return value of
> phy->ops->configure() right below.

I thought being explicit is better here but i'll drop that for the next
rev.

Thanks!
 -- Guido

> 
> Regards,
> Liu Ying
> 
> > +
> >  	mutex_lock(&phy->mutex);
> >  	ret = phy->ops->configure(phy, opts);
> >  	mutex_unlock(&phy->mutex);
> >  
> > +	phy_pm_runtime_put(phy);
> >  	return ret;
> >  }
> >  EXPORT_SYMBOL_GPL(phy_configure);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ