Re: About clk maintainership [Was: Re: [PULL] Add variants of devm_clk_get for prepared and enabled clocks enabled clocks]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 05, 2021 at 05:26:16PM -0700, Stephen Boyd wrote:
> Quoting Uwe Kleine-König (2021-08-03 03:40:12)
> > On Tue, Aug 03, 2021 at 01:11:54AM -0700, Stephen Boyd wrote:
> > > 
> > > Maybe this series would be more compelling if those various drivers that
> > > are hand rolling the devm action were converted to the consolidated
> > > official devm function. The truth is it's already happening in various
> > > subsystems so consolidating that logic into one place would be a win
> > > code size wise and very hard to ignore.
> > > 
> > > Doing
> > > 
> > >  $ git grep devm_add_action | grep clk
> > > 
> > > seems to catch quite a few of them.

Will do.
 
> > Another upside is that grepping for these drivers with a potential for
> > further improvement become easier to grep for as
> > devm_clk_get_{prepared,enabled} is a much better hint :-)
> 
> Sorry, but that's a pretty weak argument. I'd think grepping for the
> absence of pm_ops in drivers would be the same hint.

To be honest: Yes, it's a weak argument, but grepping for drivers
without pm_ops is a tad more complicated and yields a different set of
drivers. For example take the i2c-imx driver
(drivers/i2c/busses/i2c-imx.c) which has a pm_ops but still can make use
of devm_clk_get_enabled.

> > The changes to these drivers probably won't go through a clk tree, so
> > adding these patches before adding devm_clk_get_enabled() would only
> > help for the warm and cozy feeling that it is right to do so, correct?
> 
> It isn't to feel warm and cozy. It's to demonstrate the need for
> consolidating code. Converting the i2c and spi drivers to use this is
> actively damaging the cause though. Those driver frameworks are more
> likely to encourage proper power management around bus transfers, so
> converting them to use the devm API moves them away from power
> management, not closer to it.

Well I think one could disagree here. Today these drivers are not power
efficient as they just enable the clock in their probe routine and keep
it on even though it might not be needed.

My patch still is beneficial as it simplifies the drivers without making
them worse. Agreed, this isn't the best optimisation to the drivers
(assuming it is possible to disable the clocks while the device isn't in
use).

> This proves why this topic is always contentious. It's too easy to
> blindly convert drivers to get the clk and leave it enabled forever and
> then they never use power management. The janitors win and nobody else.

If the janitors win and nobody else looses anything, this is fine for
me. And if in the future someone turns up who cares enough to improve
the converted drivers to a more efficient clock usage, they will
probably not stop their efforts just because then the driver uses
devm_clk_get_enabled.

> Is there some way to avoid that trap? Maybe through some combination of
> a device PM function that indicates the driver has no runtime PM
> callbacks (pm_runtime_no_callbacks() perhaps?) and
> devm_clk_get_enabled() checking for that and returning the clk only when
> that call has been made (i.e. pm_runtime_has_no_callbacks())? This
> approach would fail to catch the case where system wide suspend/resume
> could turn the clk off but the driver doesn't do it. I'm not sure how
> much we care about that case though.
> 
> > As my focus is limited to (mostly) drivers/pwm and I already have quite
> > some other patch quests on my list:
> 
> Don't we all? :)

Might be. The patches in your queue are however not a reason to drop my
efforts to make my queue shorter :-P

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux