public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Jim Quinlan <jim2101024@gmail.com>
Cc: Mike Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-clk@vger.kernel.org,
	Naresh Kamboju <naresh.kamboju@linaro.org>,
	Alexander Stein <alexander.stein@ew.tq-group.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Yassine Oudjana <y.oudjana@protonmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Neil Armstrong <narmstrong@baylibre.com>
Subject: Re: [PATCH v4 13/28] clk: Take into account uncached clocks in clk_set_rate_range()
Date: Wed, 25 May 2022 10:30:17 +0200	[thread overview]
Message-ID: <20220525083017.eo3oxfduajrqoac4@houat> (raw)
In-Reply-To: <CANCKTBuWkkXNdK5eLJr=KzykDt+dbjfOiNGhxga4oEU5COyiUg@mail.gmail.com>

Hi,

On Tue, May 24, 2022 at 02:32:29PM -0400, Jim Quinlan wrote:
> On Fri, May 13, 2022 at 3:56 AM Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > clk_set_rate_range() will use the last requested rate for the clock when
> > it calls into the driver set_rate hook.
> >
> > However, if CLK_GET_RATE_NOCACHE is set on that clock, the last
> > requested rate might not be matching the current rate of the clock. In
> > such a case, let's read out the rate from the hardware and use that in
> > our set_rate instead.
>
> I'm probably out of the loop on this but I am wondering why we don't
> also apply this same reasoning to
> 
>         clk_core_set_rate_nolock()
> 
> which may usea stale clock rate and skip the actual setting of the rate:
> 
> static int clk_core_set_rate_nolock(core, req_rate)
> {
>         /* ... */
>         rate = clk_core_req_round_rate_nolock(core, req_rate);
> 
>         /* bail early if nothing to do */
>         if (rate == clk_core_get_rate_nolock(core))    /* [JQ] Does
> not check for CLK_GET_RATE_NOCACHE */
>                 return 0;
> 
> I can see that 9-10 years ago someone submitted a pullreq to fix above
> but I cannot locate the response and it obviously never made it
> upstream.

Yeah, that change would make sense to me.

Stephen was hinting at a different solution here though:
https://lore.kernel.org/linux-clk/20220423044228.2AA7AC385A0@smtp.kernel.org/

> Just thinking out loud, the simpler solution is to probably drop all
> rate caching in the CCF and get the frequency on a clk_get_rate()
> call. It complicates some of the core though when we check to see if
> we need to update clk rates. We could have some middle ground where
> drivers indicate that they want to update their cached rate because
> it's valid now (either from their enable path or from somewhere else).
> This may be nice actually because we could have clk providers call
> this to force a recalc down the tree from where they've updated. I
> think the qcom DisplayPort phy would want this.

Maxime

  reply	other threads:[~2022-05-25  8:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 16:03 [PATCH v4 00/28] clk: More clock rate fixes and tests Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 01/28] clk: Drop the rate range on clk_put() Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 02/28] clk: Skip clamping when rounding if there's no boundaries Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 03/28] clk: Introduce clk_get_rate_range() Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 04/28] drm/vc4: hdmi: Rework hdmi_enable_4kp60 detection Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 05/28] clk: Mention that .recalc_rate can return 0 on error Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 06/28] clk: Clarify clk_get_rate() expectations Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 07/28] clk: tests: Add test suites description Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 08/28] clk: tests: Add reference to the orphan mux bug report Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 09/28] clk: tests: Add tests for uncached clock Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 10/28] clk: tests: Add tests for single parent mux Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 11/28] clk: tests: Add tests for mux with multiple parents Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 12/28] clk: tests: Add some tests for orphan " Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 13/28] clk: Take into account uncached clocks in clk_set_rate_range() Maxime Ripard
2022-05-24 18:32   ` Jim Quinlan
2022-05-25  8:30     ` Maxime Ripard [this message]
2022-05-25 17:59       ` Jim Quinlan
2022-05-26 16:39         ` Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 14/28] clk: Fix clk_get_parent() documentation Maxime Ripard
2022-05-12 16:03 ` [PATCH v4 15/28] clk: Set req_rate on reparenting Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 16/28] clk: Change clk_core_init_rate_req prototype Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 17/28] clk: Move clk_core_init_rate_req() from clk_core_round_rate_nolock() to its caller Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 18/28] clk: Introduce clk_hw_init_rate_request() Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 19/28] clk: Add our request boundaries in clk_core_init_rate_req Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 20/28] clk: Switch from __clk_determine_rate to clk_core_round_rate_nolock Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 21/28] clk: Introduce clk_core_has_parent() Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 22/28] clk: Stop forwarding clk_rate_requests to the parent Maxime Ripard
2022-05-14  2:12   ` kernel test robot
2022-05-12 16:04 ` [PATCH v4 23/28] clk: Zero the clk_rate_request structure Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 24/28] clk: Test the clock pointer in clk_hw_get_name() Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 25/28] clk: Introduce the clk_hw_get_rate_range function Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 26/28] clk: qcom: clk-rcg2: Take clock boundaries into consideration for gfx3d Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 27/28] clk: tests: Add some tests for clk_get_rate_range() Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 28/28] clk: tests: Add missing test case for ranges Maxime Ripard

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=20220525083017.eo3oxfduajrqoac4@houat \
    --to=maxime@cerno.tech \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=jbrunet@baylibre.com \
    --cc=jim2101024@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mturquette@baylibre.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=narmstrong@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=tony@atomide.com \
    --cc=y.oudjana@protonmail.com \
    /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