linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Turquette <mturquette@baylibre.com>
To: Stephen Boyd <sboyd@codeaurora.org>,
Cc: linux-clk@vger.kernel.org, lee.jones@linaro.org,
	maxime.ripard@free-electrons.com, maxime.coquelin@st.com,
	geert@linux-m68k.org, heiko@sntech.de, andre.przywara@arm.com,
	rklein@nvidia.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v42 1/6] clk: Allow clocks to be marked as CRITICAL
Date: Fri, 19 Feb 2016 09:30:51 -0800	[thread overview]
Message-ID: <20160219173051.2278.51705@quark.deferred.io> (raw)
In-Reply-To: <20160219020333.GO4847@codeaurora.org>

Quoting Stephen Boyd (2016-02-18 18:03:33)
> On 02/15, Michael Turquette wrote:
> > Quoting Stephen Boyd (2016-02-12 17:14:03)
> > > On 02/11, Michael Turquette wrote:
> > > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > > > index b4db67a..993f775 100644
> > > > --- a/drivers/clk/clk.c
> > > > +++ b/drivers/clk/clk.c
> > > > @@ -2484,6 +2484,11 @@ static int __clk_init(struct device *dev, st=
ruct clk *clk_user)
> > > >       if (core->ops->init)
> > > >               core->ops->init(core->hw);
> > > >  =

> > > > +     if (core->flags & CLK_IS_CRITICAL) {
> > > > +             clk_core_prepare(core);
> > > > +             clk_core_enable(core);
> > > > +     }
> > > =

> > > What do we do if this is an orphan clk? From what I can tell
> > > we're not going to increment the ref count on the parents that
> > > may or may not appear at some later time when this flag is set.
> > =

> > I don't see how this is any different than any other orphan clock.
> > __clk_set_parent_before and __clk_set_parent_after should still handle
> > migration and propagation of the {prepare,enable}_count when it is
> > finally re-parented.
> =

> From what I can see we don't call __clk_set_parent_before() or
> __clk_set_parent_after() when we're reparenting orphans to
> registered clks. We just call clk_core_reparent() that does

I realized that after sending this reply and I've started to try and fix
it locally. The idea is for calls to clk_core_{prepare,enable} to
propagate their ref counts even if a clk is an orphan, which handles
critical and handoff clocks. Then when we reparent an orphan clk, we
propagate the refcount up at that time.

However, any clk consumers calling clk_{prepare,enable} when a clk is an
orphan will get an error code. This allows drivers to -EPROBE_DEFER when
enabling their clk fails inside of .probe().

It is also a different strategy than Heiko's patch set from last year
which returned an error while get'ing a clk that is an orphan. I think
its fine to have the pointer to the orphan clk, but operations on that
clk must fail until it is no longer an orphan.

Thoughts?

Regards,
Mike

> mostly a list manipulation and recalc down the tree (BTW we
> probably shouldn't recalc at all if a clk is still orphaned
> because the rate is totally bogus).
> =

> > =

> > (as an aside, that code conditionally calls clk_prepare AND clk_enable
> > based solely on the prepare refcount, which seems weird to me...)
> =

> Yeah I think I was questioning why we need to call clk_enable()
> there too so we should probably revisit this topic in another
> thread.
> =

> > =

> > > Furthermore, do we want to propagate the CLK_IS_CRITICAL flag up
> > > to all the parent clocks so that the warning mechanism spits out
> > > errors for parent clocks? I suppose that may not be very useful
> > > assuming refcounts are correct, but it may be useful to know
> > > which clocks are critical and which ones aren't during debug.
> > =

> > No, propagating flags is a bad idea. Existing prepare/enable ref counts
> > should do the job for us.
> > =

> > Regarding debug, propagating the flag will hurt debug-ability. We
> > already expose the clk_core->flags in sysfs, and debuggers can grep for
> > the CRITICAL flag there to find any spuriously enabled clocks.
> > =

> =

> Awesome.
> =

> -- =

> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project

  reply	other threads:[~2016-02-19 17:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 21:19 [PATCH v42 0/6] critical clocks and handoff clocks Michael Turquette
2016-02-11 21:19 ` [PATCH v42 1/6] clk: Allow clocks to be marked as CRITICAL Michael Turquette
2016-02-12  8:03   ` Lee Jones
2016-02-13  1:14   ` Stephen Boyd
2016-02-15 20:27     ` Michael Turquette
2016-02-19  2:03       ` Stephen Boyd
2016-02-19 17:30         ` Michael Turquette [this message]
2016-02-11 21:19 ` [PATCH v42 2/6] clk: WARN_ON about to disable a critical clock Michael Turquette
2016-02-13  1:14   ` Stephen Boyd
2016-02-11 21:19 ` [PATCH v42 3/6] clk: Provide OF helper to mark clocks as CRITICAL Michael Turquette
2016-02-12  8:02   ` Lee Jones
2016-03-30 17:15     ` Michael Turquette
2016-03-31  9:14       ` Lee Jones
2016-02-13  1:09   ` Stephen Boyd
2016-02-15 20:09     ` Michael Turquette
2016-02-11 21:19 ` [PATCH v42 4/6] clk: per-user clk prepare & enable ref counts Michael Turquette
2016-02-13  1:16   ` Stephen Boyd
2016-02-11 21:19 ` [PATCH v42 5/6] clk: clk_put WARNs if user has not disabled clk Michael Turquette
2016-02-13  1:18   ` Stephen Boyd
2016-02-14 14:51     ` Geert Uytterhoeven
2016-02-11 21:19 ` [PATCH v42 6/6] clk: introduce CLK_ENABLE_HAND_OFF flag Michael Turquette
2016-02-12  8:06 ` [PATCH v42 0/6] critical clocks and handoff clocks Lee Jones

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=20160219173051.2278.51705@quark.deferred.io \
    --to=mturquette@baylibre.com \
    --cc=andre.przywara@arm.com \
    --cc=geert@linux-m68k.org \
    --cc=heiko@sntech.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.coquelin@st.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=rklein@nvidia.com \
    --cc=sboyd@codeaurora.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 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).