public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Turquette <mturquette@baylibre.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	"Grygorii Strashko" <grygorii.strashko@ti.com>
Cc: "Nishanth Menon" <nm@ti.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-rt-users@vger.kernel.org, "Felipe Balbi" <balbi@ti.com>,
	"Sekhar Nori" <nsekhar@ti.com>,
	linux-clk@vger.kernel.org
Subject: Re: Common clock framework API vs RT patchset
Date: Tue, 11 Aug 2015 15:06:09 -0700	[thread overview]
Message-ID: <20150811220609.31346.15943@quantum> (raw)
In-Reply-To: <20150811192514.GB7557@n2100.arm.linux.org.uk>

Quoting Russell King - ARM Linux (2015-08-11 12:25:15)
> On Tue, Aug 11, 2015 at 10:23:46PM +0300, Grygorii Strashko wrote:
> > Hi All,
> > =

> > On 08/04/2015 06:36 PM, Russell King - ARM Linux wrote:
> > > On Tue, Aug 04, 2015 at 10:23:31AM -0500, Nishanth Menon wrote:
> > >> Consider clk_enable/disable/set_parent/setfreq operations. none of t=
hese
> > >> operations are "atomic" from hardware point of view. instead, they a=
re a
> > >> set of steps which culminates to moving from state A to state B of t=
he
> > >> clock tree configuration.
> > > =

> > > There's a world of difference between clk_enable()/clk_disable() and
> > > the rest of the clk API.
> > > =

> > > clk_enable()/clk_disable() _should_ be callable from any context, sin=
ce
> > > you may need to enable or disable a clock from any context.  The rema=
inder
> > > of the clk API is callable only from contexts where sleeping is permi=
ssible.
> > > =

> > > The reason we have this split is because clk_enable()/clk_disable() h=
ave
> > > historically been used in interrupt handlers, and they're specifically
> > > not supposed to impose big delays.
> > > =

> > > Things like waiting for a PLL to re-lock is time-consuming, so it's n=
ot
> > > something I'd expect to see behind a clk_enable() implementation (the
> > > fact you can't sleep in there is a big hint.)  Such waits should be in
> > > the clk_prepare() stage instead.
> > > =

> > > Now, as for clk_enable() being interrupted - if clk_enable() is inter=
rupted
> > > and another clk_enable() comes along for the same clock, that second
> > > clk_enable() should not return until the clock has actually been enab=
led,
> > > and it's up to the implementation to decode how to achieve that.  If =
that
> > > means a RT implementation using a raw spinlock, then that's one option
> > > (which basically would have the side effect of blocking until the pre=
empted
> > > clk_enable() finishes its business.)  Alternatively, if we can preempt
> > > inside clk_enable(), then the clk_enable() implementation should be w=
ritten
> > > to cope with that (eg, by the second clk_enable() fiddling with the h=
ardware,
> > > and the first thread noticing that it has nothing to do.)
> > > =

> > =

> > Thanks a lot for your comments and explanations.
> > =

> > Now lock object in CCF is not a raw spinlock, so, seems, I have to upda=
te =

> > code and try to move clk_enable()/clk_disable() out of atomic context.
> =

> clk_enable/clk_disable _should_ be usable from atomic contexts.

Grygorii,

Note that the common clk implementation allows for the same thread to
re-enter the clock framework even while the lock is held. For instance
if calling clk_enable(foo) resulted in a call to clk_enable(bar), this
would not deadlock. However this re-entrant behavior is ONLY for the
same thread that is already holding the lock.

I doubt that the above bit of trivial will solve your problem and it
probably does not add any new complexity for you either, but it seems
relevant enough for me to add here.

Regards,
Mike

> =

> -- =

> FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
> according to speedtest.net.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-clk" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-08-11 22:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <55C0A96F.80307@ti.com>
     [not found] ` <alpine.DEB.2.11.1508041405290.3983@nanos>
2015-08-04 15:23   ` Common clock framework API vs RT patchset Nishanth Menon
2015-08-04 15:36     ` Russell King - ARM Linux
2015-08-11 19:23       ` Grygorii Strashko
2015-08-11 19:25         ` Russell King - ARM Linux
2015-08-11 22:06           ` Michael Turquette [this message]
2015-08-12 10:05             ` Grygorii Strashko
2015-08-12 10:11               ` Russell King - ARM Linux
2015-08-12 15:02                 ` Felipe Balbi
2015-08-12 16:46                   ` Michael Turquette
2015-08-12 19:08                     ` Felipe Balbi
2015-09-21 13:06       ` Thomas Gleixner
2015-09-21 13:52         ` Russell King - ARM Linux
2015-09-21 16:08           ` Common clock framework API vs RT patchset\ Thomas Gleixner

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=20150811220609.31346.15943@quantum \
    --to=mturquette@baylibre.com \
    --cc=balbi@ti.com \
    --cc=grygorii.strashko@ti.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nm@ti.com \
    --cc=nsekhar@ti.com \
    --cc=tglx@linutronix.de \
    /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