linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ta.omasab@gmail.com (Thomas Abraham)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 4/6] ARM: Exynos: switch to using generic cpufreq driver for Exynos4210/5250/5420
Date: Fri, 5 Sep 2014 19:11:05 +0530	[thread overview]
Message-ID: <CAJuA9ah7cxAySNObNjqEPdgwnTok3OiO81faex_8hJMNQtVU5g@mail.gmail.com> (raw)
In-Reply-To: <7hfvg74ioq.fsf@paris.lan>

On Thu, Sep 4, 2014 at 7:00 PM, Kevin Hilman <khilman@kernel.org> wrote:
> Thomas Abraham <ta.omasab@gmail.com> writes:
>
>> On Thu, Sep 4, 2014 at 4:45 AM, Kevin Hilman <khilman@kernel.org> wrote:
>>> Hi Thomas,
>>>
>>> Thomas Abraham <ta.omasab@gmail.com> writes:
>>>
>>> [...]
>>>
>>>> A new branch [1] has been created using commits from exynos5-v3.17-rc1
>>>> branch + cpufreq + regulator + temp fixes. I have tested this branch
>>>> on Exynos5800 Chromebook2 and cpufreq works fine with both ondemand
>>>> and performance governors. Please let me know if there are any issues
>>>> with this new branch. It is based on v3.17-rc3.
>>>
>>> Excellent!  Thank you.
>>>
>>> The only thing missing now is the CPUidle support for 5800, and all
>>> that's needed for that is the compatible string patch[1] which Daniel
>>> has queued up.
>>>
>>> With that patch, display + CPUidle + CPUfreq are working pretty well on
>>> my exynos5800/chromebook2 with the big.LITTLE switcher disabled.  If I
>>> turn on the switcher, it boots OK, but as soon as I try to run powertop
>>> (upstream v2.6.1) it gets stuck.  Have you tried this branch with the
>>> switcher enabled?
>>
>> Yes, I have tested switcher + cpufreq + cpuidle with this branch and
>> there are no issues found. I haven't tested with powertop yet. I will
>> try and do that and let you know the result.
>>
>> You mentioned that when you run powertop, it gets stuck. When that
>> happens, is there any log on the console or does system just turn
>> unresponsive?
>
> The console is not responsive, but kernel seems busy because I see
> periodic timeout messages from the samsung clock driver.

Ok, I haven't tried to recreate this issue. I will try and do that.

>
> Note that I see these messages when things are functioning normally
> also.

I did notice this a few times before but today I was able to reproduce
this consistently with other test cases. This timeout is because the
CPU clock blocks of the cluster that has been turned down are being
reconfigured, which on Exynos will not work. The following is a
temporary patch which solves this issue.


>From b0c4057d428134fe12446431ede1d9a579fd1d05 Mon Sep 17 00:00:00 2001
From: Thomas Abraham <thomas.ab@samsung.com>
Date: Fri, 5 Sep 2014 17:11:10 +0530
Subject: [PATCH] TEMP: cpufreq/bL: let the CPU switch complete before
scaling frequency

On Exynos5420/Exyons5800, the clock blocks that make up the CPU clock
supply do no operate when the cluster in which they belong is powered off.
The CPU clock supply path is PLL -> Mux/Dividers -> CPU_clock.

In the arm_big_little CPUfreq driver, the frequency is scaled first and
then the CPU is switched to the new cluster. In case the switch was for
the first-man CPU in that new cluster, the frequency scaling step in
arm_big_little CPUfreq driver would not work for Exynos since the
in-bound cluster is powered off at that point. Note: On Exynos, the
cluster is powered off when all the CPUs in that cluster are powered off
which implies that the CPU clock blocks for that cluster do not operate
anymore.

So when using arm_big_little CPUfreq driver for Exynos, two changes are
required. The first change is to let the CPU to switch to the new cluster
before scaling the frequency. The second change is to ensure that the
switch has been completed before scaling the frequency.

With these changes, the message "wait_until_divider_stable: timeout in
divider stabilization" is not seen anymore.

Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
---
 arch/arm/include/asm/bL_switcher.h |   15 ++++++++++++++-
 drivers/cpufreq/arm_big_little.c   |    9 ++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/bL_switcher.h
b/arch/arm/include/asm/bL_switcher.h
index 1714800..d609b86 100644
--- a/arch/arm/include/asm/bL_switcher.h
+++ b/arch/arm/include/asm/bL_switcher.h
@@ -20,9 +20,22 @@ typedef void (*bL_switch_completion_handler)(void *cookie);
 int bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id,
                         bL_switch_completion_handler completer,
                         void *completer_cookie);
+
+static void bL_switch_complete_cb(void *cookie)
+{
+        struct completion *switch_complete = (struct completion *) cookie;
+        complete(switch_complete);
+}
+
 static inline int bL_switch_request(unsigned int cpu, unsigned int
new_cluster_id)
 {
-       return bL_switch_request_cb(cpu, new_cluster_id, NULL, NULL);
+       struct completion complete;
+
+       init_completion(&complete);
+       bL_switch_request_cb(cpu, new_cluster_id, &bL_switch_complete_cb,
+                                       &complete);
+       wait_for_completion(&complete);
+       return 0;
 }

 /*
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index a46c223..baeff47 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -129,6 +129,13 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32
new_cluster, u32 rate)
        int ret;
        bool bLs = is_bL_switching_enabled();

+       /* Switch cluster */
+       if (old_cluster != new_cluster) {
+               pr_debug("%s: cpu: %d, old cluster: %d, new cluster: %d\n",
+                               __func__, cpu, old_cluster, new_cluster);
+               bL_switch_request(cpu, new_cluster);
+       }
+
        mutex_lock(&cluster_lock[new_cluster]);

        if (bLs) {
@@ -167,7 +174,7 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32
new_cluster, u32 rate)
                                __func__, cpu, old_cluster, new_cluster);

                /* Switch cluster */
-               bL_switch_request(cpu, new_cluster);
+               /*bL_switch_request(cpu, new_cluster);*/

                mutex_lock(&cluster_lock[old_cluster]);

-- 
1.6.6.rc2

>
> Kevin
>
>
> [1]
> [  337.832031] wait_until_divider_stable: timeout in divider stablization
> [  337.847024] wait_until_divider_stable: timeout in divider stablization
> [  337.862024] wait_until_divider_stable: timeout in divider stablization
> [  337.957028] wait_until_divider_stable: timeout in divider stablization
> [  337.972024] wait_until_divider_stable: timeout in divider stablization
> [  337.987024] wait_until_divider_stable: timeout in divider stablization
> [  340.082029] wait_until_divider_stable: timeout in divider stablization
> [  340.097024] wait_until_divider_stable: timeout in divider stablization
> [  340.112024] wait_until_divider_stable: timeout in divider stablization
> [  346.242030] wait_until_divider_stable: timeout in divider stablization
> [  346.257024] wait_until_divider_stable: timeout in divider stablization
> [  346.272024] wait_until_divider_stable: timeout in divider stablization
> [  348.322029] wait_until_divider_stable: timeout in divider stablization
> [  348.337025] wait_until_divider_stable: timeout in divider stablization
> [  348.352024] wait_until_divider_stable: timeout in divider stablization

  reply	other threads:[~2014-09-05 13:41 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30  8:07 [PATCH v9 0/6] cpufreq: use generic cpufreq drivers for exynos platforms Thomas Abraham
2014-07-30  8:07 ` [PATCH v9 1/6] clk: samsung: add infrastructure to register cpu clocks Thomas Abraham
2014-09-01 22:29   ` Mike Turquette
2014-09-02 13:53     ` Thomas Abraham
2014-07-30  8:07 ` [PATCH v9 2/6] clk: samsung: add cpu clock configuration data and instantiate cpu clock Thomas Abraham
2014-09-01 22:29   ` Mike Turquette
2014-07-30  8:07 ` [PATCH v9 3/6] ARM: dts: Exynos: add CPU OPP and regulator supply property Thomas Abraham
2014-07-30 11:28   ` Andreas Färber
2014-07-31  2:55     ` Thomas Abraham
2014-07-31  0:37   ` Doug Anderson
2014-07-31  3:21     ` Thomas Abraham
2014-07-31  3:53       ` Doug Anderson
2014-07-31  4:06         ` Thomas Abraham
2014-07-31  4:08           ` Doug Anderson
2014-07-31  4:18             ` Thomas Abraham
2014-08-02  3:49   ` Javier Martinez Canillas
2014-08-04  3:00     ` Thomas Abraham
2014-07-30  8:07 ` [PATCH v9 4/6] ARM: Exynos: switch to using generic cpufreq driver for Exynos4210/5250/5420 Thomas Abraham
2014-07-31 18:32   ` Kukjin Kim
2014-07-31 18:40     ` Tomasz Figa
2014-07-31 18:54       ` Tomasz Figa
2014-07-31 19:25         ` Thomas Abraham
2014-07-31 19:30           ` Tomasz Figa
2014-08-04  3:24             ` Thomas Abraham
2014-08-22 23:54       ` Kevin Hilman
2014-08-23  0:02         ` Tomasz Figa
2014-08-25  6:53           ` Lukasz Majewski
2014-08-25 12:15           ` Chander Kashyap
2014-08-25 15:32             ` Kevin Hilman
2014-08-25 15:56               ` Tomasz Figa
2014-08-26  4:54                 ` Viresh Kumar
2014-08-26  5:25               ` Chander Kashyap
2014-08-26 15:15                 ` Kevin Hilman
2014-08-26 22:25                   ` Kevin Hilman
2014-08-29 12:52                     ` Thomas Abraham
2014-08-29 15:03                       ` Kevin Hilman
2014-09-01  8:47                         ` Thomas Abraham
2014-09-02 19:32                           ` Kevin Hilman
2014-09-03  4:26                             ` Thomas Abraham
2014-09-03 13:18                               ` Thomas Abraham
2014-09-03 23:15                                 ` Kevin Hilman
2014-09-04 10:22                                   ` Thomas Abraham
2014-09-04 13:30                                     ` Kevin Hilman
2014-09-05 13:41                                       ` Thomas Abraham [this message]
2014-08-25  8:11         ` Sjoerd Simons
2014-07-30  8:07 ` [PATCH v9 5/6] cpufreq: exynos: remove exynos4210/5250 specific cpufreq driver support Thomas Abraham
2014-07-30  8:07 ` [PATCH v9 6/6] clk: samsung: remove unused clock aliases and update clock flags Thomas Abraham
2014-07-31 14:13   ` Tomasz Figa
2014-07-31 18:24     ` Thomas Abraham
2014-07-31 18:35       ` Tomasz Figa
2014-07-31 18:41         ` Thomas Abraham
2014-07-31 18:46           ` Tomasz Figa
2014-07-31 18:49             ` Thomas Abraham
2014-09-01 22:31   ` Mike Turquette
2014-07-31  6:20 ` [PATCH v9 0/6] cpufreq: use generic cpufreq drivers for exynos platforms Chander M. Kashyap
2014-07-31 10:59   ` Thomas Abraham
2014-07-31 12:24     ` Chander M. Kashyap
2014-07-31 14:15 ` Tomasz Figa
2014-07-31 18:25   ` Thomas Abraham
2014-07-31 18:34     ` Thomas Abraham
2014-08-01  9:42       ` Viresh Kumar

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=CAJuA9ah7cxAySNObNjqEPdgwnTok3OiO81faex_8hJMNQtVU5g@mail.gmail.com \
    --to=ta.omasab@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).