All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Stephen Boyd <sboyd@codeaurora.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Michael Turquette <mturquette@baylibre.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Dong Aisheng <aisheng.dong@nxp.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	 Krzysztof Kozlowski <krzk@kernel.org>
Subject: Re: [PATCH v2] clk: Properly update prepare/enable count on orphan clock reparent
Date: Thu, 15 Feb 2018 13:19:59 +0100	[thread overview]
Message-ID: <1518697199.2883.91.camel@baylibre.com> (raw)
In-Reply-To: <20180127004917.GI28313@codeaurora.org>

On Fri, 2018-01-26 at 16:49 -0800, Stephen Boyd wrote:
> On 01/26, Marek Szyprowski wrote:
> > If orphaned clock has been already prepared/enabled (for example if it or
> > one of its children has CLK_IS_CRITICAL flag), then the prepare/enable
> > counters of the newly assigned parent are not updated correctly. This
> > might later cause warnings during changing clock parents.
> 
> This doesn't feel right. Perhaps we should delay enabling a clk
> if it's CRITICAL until we adopt an orphaned clk.

It does not sounds right. A critical clock should be enabled as soon as
possible, regardless of current knowledge of the clock tree.

How would you decide when is right time anyway ?
The orphaned critical clock could be reparented to clock that is orphan itself,
you would get into the same count issue again.

> Good news is we
> have orphan status tracking now so this should be pretty simple.
> Otherwise migrating the count up is complicated and requires us
> to call the prepare/enable ops on a critical clk and then keep
> doing that each time it gets re-parented.

What is the problem with this ? We are going to have call those enable ops
anyway. Whether it is done one at a time or all at once, does it really matter ?

> Do you have this case,
> where some clk is marked as CRITICAL, and then we need to migrate
> that enable/prepare count to the parent?

yes.

> 
> Hopefully it isn't the worser case, where the clk is handed out
> to some consumer but it's still orphaned at that point, and then
> we have little control over the migration of state to the parent.
> 

This should not be a problem if the clock reparenting  and count migration is
done properly. To do  this, the __clk_set_parent_before() and
__clk_set_parent_after() function look good to me,  have I missed anything ? 

WARNING: multiple messages have this Message-ID (diff)
From: jbrunet@baylibre.com (Jerome Brunet)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] clk: Properly update prepare/enable count on orphan clock reparent
Date: Thu, 15 Feb 2018 13:19:59 +0100	[thread overview]
Message-ID: <1518697199.2883.91.camel@baylibre.com> (raw)
In-Reply-To: <20180127004917.GI28313@codeaurora.org>

On Fri, 2018-01-26 at 16:49 -0800, Stephen Boyd wrote:
> On 01/26, Marek Szyprowski wrote:
> > If orphaned clock has been already prepared/enabled (for example if it or
> > one of its children has CLK_IS_CRITICAL flag), then the prepare/enable
> > counters of the newly assigned parent are not updated correctly. This
> > might later cause warnings during changing clock parents.
> 
> This doesn't feel right. Perhaps we should delay enabling a clk
> if it's CRITICAL until we adopt an orphaned clk.

It does not sounds right. A critical clock should be enabled as soon as
possible, regardless of current knowledge of the clock tree.

How would you decide when is right time anyway ?
The orphaned critical clock could be reparented to clock that is orphan itself,
you would get into the same count issue again.

> Good news is we
> have orphan status tracking now so this should be pretty simple.
> Otherwise migrating the count up is complicated and requires us
> to call the prepare/enable ops on a critical clk and then keep
> doing that each time it gets re-parented.

What is the problem with this ? We are going to have call those enable ops
anyway. Whether it is done one at a time or all at once, does it really matter ?

> Do you have this case,
> where some clk is marked as CRITICAL, and then we need to migrate
> that enable/prepare count to the parent?

yes.

> 
> Hopefully it isn't the worser case, where the clk is handed out
> to some consumer but it's still orphaned at that point, and then
> we have little control over the migration of state to the parent.
> 

This should not be a problem if the clock reparenting  and count migration is
done properly. To do  this, the __clk_set_parent_before() and
__clk_set_parent_after() function look good to me,  have I missed anything ? 

  parent reply	other threads:[~2018-02-15 12:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180126091902eucas1p2b3ad9978e3ab09bd7a2bd9123c9eecaa@eucas1p2.samsung.com>
2018-01-26  9:18 ` [PATCH v2] clk: Properly update prepare/enable count on orphan clock reparent Marek Szyprowski
2018-01-26  9:18   ` Marek Szyprowski
2018-01-27  0:49   ` Stephen Boyd
2018-01-27  0:49     ` Stephen Boyd
2018-01-30  9:01     ` Marek Szyprowski
2018-01-30  9:01       ` Marek Szyprowski
2018-02-14 13:37       ` Marek Szyprowski
2018-02-14 13:37         ` Marek Szyprowski
2018-02-15 11:44         ` Jerome Brunet
2018-02-15 11:44           ` Jerome Brunet
2018-02-15 12:56           ` Marek Szyprowski
2018-02-15 12:56             ` Marek Szyprowski
2018-02-15 12:19     ` Jerome Brunet [this message]
2018-02-15 12:19       ` Jerome Brunet

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=1518697199.2883.91.camel@baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=aisheng.dong@nxp.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    --cc=shawnguo@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.