From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Nishanth Menon <nm@ti.com>,
Grygorii Strashko <grygorii.strashko@ti.com>,
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: Mon, 21 Sep 2015 14:52:27 +0100 [thread overview]
Message-ID: <20150921135226.GN21084@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <alpine.DEB.2.11.1509211255530.5606@nanos>
On Mon, Sep 21, 2015 at 03:06:18PM +0200, Thomas Gleixner wrote:
> On Tue, 4 Aug 2015, 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 these
> > > operations are "atomic" from hardware point of view. instead, they are a
> > > set of steps which culminates to moving from state A to state B of the
> > > 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, since
> > you may need to enable or disable a clock from any context. The remainder
> > of the clk API is callable only from contexts where sleeping is permissible.
> >
> > The reason we have this split is because clk_enable()/clk_disable() have
> > 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 not
> > 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.
>
> You wish. Drivers with loop/udelays in the enable/disable callbacks:
Most of what I've said above is entirely factual. What idiotic games
people play inside clk_enable() is not my problem (I'm not even the CCF
maintainer - something which Linaro "took over".)
> Of course we could solve that by making enable_lock a raw_spinlock,
> but looking at the various implementations of clk_ops.enable tells me
> that this is not a brilliant idea. See the PLL loops/delays crap
> above. There is another issue:
>
> Some callbacks have their own spinlocks which then need to be
> converted to raw_spinlocks as well. Not a big deal, but some of the
> clk drivers use that very same spinlock, which is supposed to protect
> register access, for all kind of other crap, which is going to
> introduce latencies. And that's a ratsnest of locks down to
> regmap->lock ....
>
> So for RT the only sensible choice at the moment is to leave
> enable_lock as non raw spinlock and deal with the very few places
> where clk_enable/disable() is really called from atomic context.
Right. Let's put it in the most direct and blunt way possible. Those
responsible for this mess won't like it. They're not _meant_ to like
this statement, because they're supposed to feel bad about the situation
they've created. Maybe, in the face of this leve of humiliation, they'll
assess whether they _should_ be doing better, and try to step up their
game.
We have:
clk_enable() & clk_disable() - which are _supposed_ to be the atomic
level operators, which take a spinlock and are supposed to be _fast_.
clk_prepare() & clk_unprepare() - which are _supposed_ to be the
time consuming bits of clk_enable()/clk_disable()
However, due to the generally idiotic nature of Linux programmers, they've
totally destroyed the reason for clk_enable() and clk_disable() existing.
So, we now need a _third_ level of API to work around their idiotic nature,
maybe clk_atomic_enable() and clk_atomic_disable(), which do what the
original clk_enable() and clk_disable() do.
So, we end up needing three levels because Linux programmers are basically
idiots.
And yes, if what you've found is correct, I think those who have created
the crap have very much earned the prestigious title of being an "idiotic
programmer".
I'm pissed at these idiotic programmers.
--
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2015-09-21 13:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 12:00 Common clock framework API vs RT patchset Grygorii Strashko
2015-08-04 12:06 ` Thomas Gleixner
2015-08-04 15:23 ` 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
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 [this message]
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=20150921135226.GN21084@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=balbi@ti.com \
--cc=grygorii.strashko@ti.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).