LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Stephen Boyd <sboyd@kernel.org>
Cc: alexandre.belloni@bootlin.com,
	Michael Turquette <mturquette@baylibre.com>,
	Ludovic.Desroches@microchip.com, lee.jones@linaro.org,
	linux-clk@vger.kernel.org, linux-rtc@vger.kernel.org,
	Russell King <linux@armlinux.org.uk>,
	o.rempel@pengutronix.de, andy.shevchenko@gmail.com,
	aardelean@deviqon.com, linux-pwm@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>,
	broonie@kernel.org, Jonathan.Cameron@huawei.com,
	linux-arm-kernel@lists.infradead.org, a.zummo@towertech.it,
	linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	wsa@kernel.org, thierry.reding@gmail.com, kernel@pengutronix.de,
	akpm@linux-foundation.org, torvalds@linux-foundation.org,
	Claudiu.Beznea@microchip.com
Subject: Re: About clk maintainership [Was: Re: [PULL] Add variants of devm_clk_get for prepared and enabled clocks enabled clocks]
Date: Tue, 14 Sep 2021 15:22:56 +0200	[thread overview]
Message-ID: <20210914132256.5ucytcfmk3sjn2vi@pengutronix.de> (raw)
In-Reply-To: <162820957661.19113.17221558053361108175@swboyd.mtv.corp.google.com>

[-- Attachment #1: Type: text/plain, Size: 3822 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-09-14 13:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210510174142.986250-1-u.kleine-koenig@pengutronix.de>
     [not found] ` <20210609202123.u5rmw7al4x3rrvun@pengutronix.de>
     [not found]   ` <20210625171434.3xusxpxjprcdqa47@pengutronix.de>
     [not found]     ` <20210705080144.zfbzkm7l3gmnh6st@pengutronix.de>
     [not found]       ` <20210722060654.nudpdtemosi64nlb@pengutronix.de>
     [not found]         ` <YPkg0wtYIoHKpTUW@kunai>
     [not found]           ` <20210722081817.2tsjzof4gvldq6ka@pengutronix.de>
     [not found]             ` <YPlfcbkxiBmB+vw1@kunai>
     [not found]               ` <CAHp75VfC=s12Unw3+Cn0ag71mM5i90=Jbwj4nYwB5cPKiUTRSA@mail.gmail.com>
2021-07-23  9:13                 ` [PULL] Add variants of devm_clk_get for prepared and enabled clocks enabled clocks Uwe Kleine-König
2021-07-26  9:18                   ` Claudiu.Beznea
2021-07-26  9:52                     ` Andy Shevchenko
2021-07-26 12:32                       ` Wolfram Sang
2021-07-26 13:28                         ` Andy Shevchenko
2021-07-26 17:40                           ` Wolfram Sang
2021-07-28 20:25                     ` About clk maintainership [Was: Re: [PULL] Add variants of devm_clk_get for prepared and enabled clocks enabled clocks] Uwe Kleine-König
2021-07-28 20:40                       ` Russell King (Oracle)
2021-07-31  7:41                         ` Stephen Boyd
2021-07-31  8:07                           ` Andy Shevchenko
2021-07-31 12:00                           ` Uwe Kleine-König
2021-08-02  9:36                             ` Jonathan Cameron
2021-08-02  9:48                             ` Russell King (Oracle)
2021-08-02 15:27                               ` Uwe Kleine-König
2021-08-02 16:38                                 ` Russell King (Oracle)
2021-08-02 17:13                                   ` Andy Shevchenko
2021-08-02 20:28                                     ` Russell King (Oracle)
2021-08-03  8:11                                   ` Stephen Boyd
2021-08-03 10:40                                     ` Uwe Kleine-König
2021-08-06  0:26                                       ` Stephen Boyd
2021-09-14 13:22                                         ` Uwe Kleine-König [this message]
2021-09-14 13:52                                           ` Mark Brown
2021-08-03  7:44                               ` Stephen Boyd

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=20210914132256.5ucytcfmk3sjn2vi@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=Claudiu.Beznea@microchip.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=a.zummo@towertech.it \
    --cc=aardelean@deviqon.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mturquette@baylibre.com \
    --cc=o.rempel@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=wsa@kernel.org \
    --subject='Re: About clk maintainership [Was: Re: [PULL] Add variants of devm_clk_get for prepared and enabled clocks enabled clocks]' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).