All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Nicolas Pitre <npitre@baylibre.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Naresh Kamboju <naresh.kamboju@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Russell King <linux@armlinux.org.uk>,
	Linux PM <linux-pm@vger.kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v4] PM / clk: make PM clock layer compatible with clocks that must sleep
Date: Thu, 11 Feb 2021 08:55:07 +0100	[thread overview]
Message-ID: <CAMuHMdXvkhH3ELV2TF-KxWK1neeKEWdFFtLvbxrnorZk-yW1Pg@mail.gmail.com> (raw)
In-Reply-To: <161301451636.1254594.7473642352348913785@swboyd.mtv.corp.google.com>

Hi Stephen,

On Thu, Feb 11, 2021 at 4:35 AM Stephen Boyd <sboyd@kernel.org> wrote:
> Quoting Nicolas Pitre (2021-01-25 11:29:18)
> > The clock API splits its interface into sleepable ant atomic contexts:
> >
> > - clk_prepare/clk_unprepare for stuff that might sleep
> >
> > - clk_enable_clk_disable for anything that may be done in atomic context
> >
> > The code handling runtime PM for clocks only calls clk_disable() on
> > suspend requests, and clk_enable on resume requests. This means that
> > runtime PM with clock providers that only have the prepare/unprepare
> > methods implemented is basically useless.
> >
> > Many clock implementations can't accommodate atomic contexts. This is
> > often the case when communication with the clock happens through another
> > subsystem like I2C or SCMI.
> >
> > Let's make the clock PM code useful with such clocks by safely invoking
> > clk_prepare/clk_unprepare upon resume/suspend requests. Of course, when
> > such clocks are registered with the PM layer then pm_runtime_irq_safe()
> > can't be used, and neither pm_runtime_suspend() nor pm_runtime_resume()
> > may be invoked in atomic context.
> >
> > For clocks that do implement the enable and disable methods then
> > everything just works as before.
> >
> > A note on sparse:
> > According to https://lwn.net/Articles/109066/ there are things
> > that sparse can't cope with. In particular, pm_clk_op_lock() and
> > pm_clk_op_unlock() may or may not lock/unlock psd->lock depending on
> > some runtime condition. To work around that we tell it the lock is
> > always untaken for the purpose of static analisys.
> >
> > Thanks to Naresh Kamboju for reporting issues with the initial patch.
> >
> > Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
> > Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> >
> > ---
>
> Thanks for doing this. I think it's the main reason why nobody uses the
> PM clock code so far.

"git grep pm_clk_add" tells you otherwise?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  parent reply	other threads:[~2021-02-11  7:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05  3:17 [PATCH] PM / clk: make PM clock layer compatible with clocks that must sleep Nicolas Pitre
2021-01-17 23:49 ` Nicolas Pitre
2021-01-19 20:15   ` Rafael J. Wysocki
2021-01-19 18:45 ` Kevin Hilman
2021-01-19 20:38   ` Geert Uytterhoeven
2021-01-19 21:22     ` Nicolas Pitre
2021-01-21  9:11 ` Naresh Kamboju
2021-01-21 10:58   ` Geert Uytterhoeven
2021-01-21 12:09     ` Naresh Kamboju
2021-01-21 14:44       ` Rafael J. Wysocki
2021-01-21 16:18         ` Nicolas Pitre
2021-01-21 17:23         ` [PATCH v2] " Nicolas Pitre
2021-01-21 19:01           ` Rafael J. Wysocki
2021-01-22 15:09             ` Rafael J. Wysocki
2021-01-22 15:48               ` Naresh Kamboju
2021-01-22 15:56                 ` Rafael J. Wysocki
2021-01-22 15:59                   ` Nicolas Pitre
2021-01-22 16:00                     ` Nicolas Pitre
2021-01-22 16:02                     ` Rafael J. Wysocki
2021-01-23 23:07                       ` [PATCH v3] " Nicolas Pitre
2021-01-25 18:15                         ` Rafael J. Wysocki
2021-01-25 18:24                           ` Nicolas Pitre
2021-01-25 19:29                             ` [PATCH v4] " Nicolas Pitre
2021-01-27 18:31                               ` Rafael J. Wysocki
     [not found]                               ` <161301451636.1254594.7473642352348913785@swboyd.mtv.corp.google.com>
2021-02-11  7:55                                 ` Geert Uytterhoeven [this message]
2021-01-22 15:52               ` [PATCH v2] " Nicolas Pitre

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=CAMuHMdXvkhH3ELV2TF-KxWK1neeKEWdFFtLvbxrnorZk-yW1Pg@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mturquette@baylibre.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=npitre@baylibre.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.