All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Mike Turquette <mturquette@linaro.org>,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	Russell King <linux@arm.linux.org.uk>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 8/8] clk: Add floor and ceiling constraints to clock rates
Date: Thu, 23 Oct 2014 17:54:11 -0700	[thread overview]
Message-ID: <5449A333.3050504@codeaurora.org> (raw)
In-Reply-To: <CAAObsKAsf9po2mUBTDSz9+OXdD8GZnBQBGQYhXcBSgDM3gmVBw@mail.gmail.com>

On 10/14/2014 06:27 AM, Tomeu Vizoso wrote:
> On 11 October 2014 01:55, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> On 10/09, Tomeu Vizoso wrote:
>>> +{
>>> +     int ret;
>>> +
>>> +     clk_prepare_lock();
>>> +
>>> +     clk->floor_constraint = rate;
>> No check for ceiling being less than floor?
> No, otherwise the calling code would have to be very careful to set
> both constraints in the correct order based on the current and next
> values. In practice I expect a given consumer to either set a floor or
> a constraint, but not both.

I totally missed this. Why can't we set the ceiling to ULONG_MAX when
the clock is created? That way we can drop the if check in the
aggregation logic for a 0 valued ceiling and then we can add the ceiling
being less than floor check here too?

>
>
>>> +
>>> +     WARN(rate > 0 && rate < clk->floor_constraint,
>>> +          "clk %s dev %s con %s: new ceiling %lu lower than existing floor %lu\n",
>>> +          clk->core->name, clk->dev_id, clk->con_id, rate,
>>> +          clk->floor_constraint);
>>> +
>>> +     clk->ceiling_constraint = rate;
>>> +     ret = clk_set_rate(clk, clk_get_rate(clk));
>> Why not just pass 0 as the second argument? The same comment
>> applies in the floor function.
> Both behaviours seem equally correct to me, but wonder if it wouldn't
> be better to store the rate that was last set explicitly with set_rate
> and try to reapply that one after every update to the constraints,
> instead of the current rate, or 0/INT_MAX.
>
>
>> This leads to another question though. What does it means for a
>> per-user clock to be disabled and change it's floor or ceiling?
>> Should that count in the aggregation logic?
> Per-user clocks don't get disabled, the whole clock does (but we can
> use per-user clk information to provide better debug information about
> unbalanced calls to prepare and enable).

Ok.

>> So far we haven't required drivers to explicitly call
>> clk_set_rate() with 0 so they can "drop" their rate request
>> because there isn't any other user and disabling the clock is
>> pretty much the same. With multiple users it looks like we're
>> going to require them to set the floor or ceiling to 0 or INT_MAX
>> if they want to remove their request. Alternatively we could
>> track the prepare/unprepare state of the per-user clock and drop
>> the constraint when that instance is unprepared (or reapply it
>> when prepared). It's pretty much a semantic difference, but one
>> benefit would be that we don't have to make two (or three?) calls
>> to the clock framework if we want to drop the rate constraints
>> and disable the clock.
> In my mind this is not such an issue because I view clock constraints
> as attributes of the per-user clks, while the enable and prepare
> states and the actual rate are attributes of the global clock
> instance.
>
>

Alright, I just want to make sure we thought about it. I'll try to think
of any reason for this behavior and if I don't think of anything I'm
happy with the way things are.

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


      reply	other threads:[~2014-10-24  0:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09 15:01 [PATCH v3 0/8] Per-user clock constraints Tomeu Vizoso
2014-10-09 15:01 ` Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 1/8] MIPS: Alchemy: Remove direct access to prepare_count field of struct clk Tomeu Vizoso
2014-10-09 20:45   ` Stephen Boyd
2014-10-09 15:01 ` [PATCH v3 2/8] clk: Remove unused function __clk_get_prepare_count Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 3/8] clk: Don't try to use a struct clk* after it could have been freed Tomeu Vizoso
2014-10-09 20:27   ` Stephen Boyd
2014-10-09 15:01 ` [PATCH v3 4/8] clk: Don't expose __clk_get_accuracy Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 5/8] clk: change clk_debugfs_add_file to take a struct clk_hw Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 6/8] clk: Change clk_ops->determine_rate to return a clk_hw as the best parent Tomeu Vizoso
2014-10-09 15:01   ` Tomeu Vizoso
2014-10-09 20:44   ` Stephen Boyd
2014-10-09 20:44     ` Stephen Boyd
2014-10-09 15:01 ` [PATCH v3 7/8] clk: Make clk API return per-user struct clk instances Tomeu Vizoso
2014-10-09 15:01   ` Tomeu Vizoso
2014-10-09 23:22   ` Stephen Boyd
2014-10-09 23:22     ` Stephen Boyd
2014-10-09 23:42     ` Kodiak Furr
2014-10-09 23:42       ` Kodiak Furr
2014-10-09 23:42       ` Kodiak Furr
2014-10-13 14:23     ` Tomeu Vizoso
2014-10-13 14:23       ` Tomeu Vizoso
2014-10-09 15:01 ` [PATCH v3 8/8] clk: Add floor and ceiling constraints to clock rates Tomeu Vizoso
2014-10-10 23:55   ` Stephen Boyd
2014-10-14 13:27     ` Tomeu Vizoso
2014-10-24  0:54       ` Stephen Boyd [this message]

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=5449A333.3050504@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mturquette@linaro.org \
    --cc=tomeu.vizoso@collabora.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 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.