All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Guittot <vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: Russell King - ARM Linux
	<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	LAK
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Nicolas Pitre <nico-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v2 1/2] ARM: topology: Use a clock if possible to get the CPU frequency
Date: Thu, 3 Jul 2014 09:51:27 +0200	[thread overview]
Message-ID: <CAKfTPtBonwH0PoEkKazUS9bPaR631Vu7p7qZ0AF1whmXq_53wg@mail.gmail.com> (raw)
In-Reply-To: <20140703071016.GB31996@lukather>

On 3 July 2014 09:10, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> On Mon, Jun 30, 2014 at 05:06:16PM +0200, Vincent Guittot wrote:
>> On 30 June 2014 16:58, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>> > On Mon, Jun 30, 2014 at 04:48:35PM +0200, Vincent Guittot wrote:
>> >> On 30 June 2014 16:01, Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>> >> > On Mon, Jun 30, 2014 at 03:27:21PM +0200, Vincent Guittot wrote:
>> >> >> >> >> -             rate = of_get_property(cn, "clock-frequency", &len);
>> >> >> >> >> -             if (!rate || len != 4) {
>> >> >> >> >> -                     pr_err("%s missing clock-frequency property\n",
>> >> >> >> >> -                             cn->full_name);
>> >> >> >> >> +             clk = of_clk_get(cn, 0);
>> >> >> >> >> +             if (!IS_ERR(clk))
>> >> >> >> >> +                     rate = clk_get_rate(clk);
>> >> >> >>
>> >> >> >> We need the max frequency as it will be used to weight the different
>> >> >> >> CPUs capacity. How do you ensure that the current clock rate is the
>> >> >> >> max one ?
>> >> >> >
>> >> >> > Hmm, the clock-frequency attribute in the ePAPR is defined at the
>> >> >> > current CPU frequency, not the max one.
>> >> >>
>> >> >> What means current frequency in device tree when DVFS is involved ?
>> >> >
>> >> > The ePAPR states that clock-frequency is supposed to be "the current
>> >> > clock speed of the CPU in Hertz". It's exactly what my patch add.
>> >> >
>> >> > Now, you're right, DVFS would be an issue here with clock-frequency,
>> >> > but this patch actually makes it easier to deal with, since you only
>> >> > get a reference to a clock, and you can get its rate at any given
>> >> > time.
>> >>
>> >> and what about using clk_round_rate(clk, ULONG_MAX) ?
>> >
>> > Well, the clock itself might generate a frequency higher that what the
>> > CPU can run at, so I'm not sure it's a valid assumption.
>>
>> yes, you're right
>>
>> >
>> >> We will not be dependent of when we parse DT
>> >
>> > You lost me there. clk_round_rate and clk_get_rate are available at
>> > the same time in the boot process, aren't they?
>>
>> yes, but  clk_round_rate(clk, ULONG_MAX) will return the max frequency
>> and not the current one. But as you mentioned, it doesn't ensure that
>> it's a possible frequency for the core
>
> Is this an Acked-by ?

 I still think that using the current rate with clk_get_rate is not a
good solution.

Could you give us more details about why you nee to use current clock ?

AFAICT, your patch only makes sense for HMP system which don't have
DVFS, is it your case ?

Vincent

>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: vincent.guittot@linaro.org (Vincent Guittot)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] ARM: topology: Use a clock if possible to get the CPU frequency
Date: Thu, 3 Jul 2014 09:51:27 +0200	[thread overview]
Message-ID: <CAKfTPtBonwH0PoEkKazUS9bPaR631Vu7p7qZ0AF1whmXq_53wg@mail.gmail.com> (raw)
In-Reply-To: <20140703071016.GB31996@lukather>

On 3 July 2014 09:10, Maxime Ripard <maxime.ripard@free-electrons.com> wrote:
> On Mon, Jun 30, 2014 at 05:06:16PM +0200, Vincent Guittot wrote:
>> On 30 June 2014 16:58, Maxime Ripard <maxime.ripard@free-electrons.com> wrote:
>> > On Mon, Jun 30, 2014 at 04:48:35PM +0200, Vincent Guittot wrote:
>> >> On 30 June 2014 16:01, Maxime Ripard <maxime.ripard@free-electrons.com> wrote:
>> >> > On Mon, Jun 30, 2014 at 03:27:21PM +0200, Vincent Guittot wrote:
>> >> >> >> >> -             rate = of_get_property(cn, "clock-frequency", &len);
>> >> >> >> >> -             if (!rate || len != 4) {
>> >> >> >> >> -                     pr_err("%s missing clock-frequency property\n",
>> >> >> >> >> -                             cn->full_name);
>> >> >> >> >> +             clk = of_clk_get(cn, 0);
>> >> >> >> >> +             if (!IS_ERR(clk))
>> >> >> >> >> +                     rate = clk_get_rate(clk);
>> >> >> >>
>> >> >> >> We need the max frequency as it will be used to weight the different
>> >> >> >> CPUs capacity. How do you ensure that the current clock rate is the
>> >> >> >> max one ?
>> >> >> >
>> >> >> > Hmm, the clock-frequency attribute in the ePAPR is defined at the
>> >> >> > current CPU frequency, not the max one.
>> >> >>
>> >> >> What means current frequency in device tree when DVFS is involved ?
>> >> >
>> >> > The ePAPR states that clock-frequency is supposed to be "the current
>> >> > clock speed of the CPU in Hertz". It's exactly what my patch add.
>> >> >
>> >> > Now, you're right, DVFS would be an issue here with clock-frequency,
>> >> > but this patch actually makes it easier to deal with, since you only
>> >> > get a reference to a clock, and you can get its rate at any given
>> >> > time.
>> >>
>> >> and what about using clk_round_rate(clk, ULONG_MAX) ?
>> >
>> > Well, the clock itself might generate a frequency higher that what the
>> > CPU can run at, so I'm not sure it's a valid assumption.
>>
>> yes, you're right
>>
>> >
>> >> We will not be dependent of when we parse DT
>> >
>> > You lost me there. clk_round_rate and clk_get_rate are available at
>> > the same time in the boot process, aren't they?
>>
>> yes, but  clk_round_rate(clk, ULONG_MAX) will return the max frequency
>> and not the current one. But as you mentioned, it doesn't ensure that
>> it's a possible frequency for the core
>
> Is this an Acked-by ?

 I still think that using the current rate with clk_get_rate is not a
good solution.

Could you give us more details about why you nee to use current clock ?

AFAICT, your patch only makes sense for HMP system which don't have
DVFS, is it your case ?

Vincent

>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

  reply	other threads:[~2014-07-03  7:51 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 10:12 [PATCH v2 0/2] ARM: topology: Allow to set the frequency through a clock Maxime Ripard
2014-06-30 10:12 ` Maxime Ripard
     [not found] ` <1404123143-13041-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-06-30 10:12   ` [PATCH v2 1/2] ARM: topology: Use a clock if possible to get the CPU frequency Maxime Ripard
2014-06-30 10:12     ` Maxime Ripard
     [not found]     ` <1404123143-13041-2-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-06-30 10:29       ` Russell King - ARM Linux
2014-06-30 10:29         ` Russell King - ARM Linux
     [not found]         ` <20140630102934.GV32514-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2014-06-30 10:39           ` Vincent Guittot
2014-06-30 10:39             ` Vincent Guittot
     [not found]             ` <CAKfTPtC+XcH122AytyZ=x1JVx9THmxCasJLA3Z1e17X_OmH1xA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-30 12:49               ` Maxime Ripard
2014-06-30 12:49                 ` Maxime Ripard
2014-06-30 13:27                 ` Vincent Guittot
2014-06-30 13:27                   ` Vincent Guittot
     [not found]                   ` <CAKfTPtCgpc1J888hbqxoaF5UfcUoRwcpokme32WHPpsPAAawUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-30 14:01                     ` Maxime Ripard
2014-06-30 14:01                       ` Maxime Ripard
2014-06-30 14:48                       ` Vincent Guittot
2014-06-30 14:48                         ` Vincent Guittot
2014-06-30 14:58                         ` Maxime Ripard
2014-06-30 14:58                           ` Maxime Ripard
2014-06-30 15:06                           ` Vincent Guittot
2014-06-30 15:06                             ` Vincent Guittot
     [not found]                             ` <CAKfTPtDvQJ5i=t8FN0gLQex0yAC4NNgewTnGKdiCeGk7nQwZYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-03  7:10                               ` Maxime Ripard
2014-07-03  7:10                                 ` Maxime Ripard
2014-07-03  7:51                                 ` Vincent Guittot [this message]
2014-07-03  7:51                                   ` Vincent Guittot
     [not found]                                   ` <CAKfTPtBonwH0PoEkKazUS9bPaR631Vu7p7qZ0AF1whmXq_53wg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-04  8:02                                     ` Maxime Ripard
2014-07-04  8:02                                       ` Maxime Ripard
2014-07-04  9:22                                       ` Vincent Guittot
2014-07-04  9:22                                         ` Vincent Guittot
     [not found]                                         ` <CAKfTPtBPR9QA9h4bF3EkCZufpF+X84N7JzjU88CptR1RtiNrdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-08  7:39                                           ` Maxime Ripard
2014-07-08  7:39                                             ` Maxime Ripard
2014-06-30 10:12   ` [PATCH v2 2/2] ARM: sunxi: Add clocks node to the CPU nodes Maxime Ripard
2014-06-30 10:12     ` 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=CAKfTPtBonwH0PoEkKazUS9bPaR631Vu7p7qZ0AF1whmXq_53wg@mail.gmail.com \
    --to=vincent.guittot-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=nico-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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.