From: Mike Turquette <mturquette@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Pi-Cheng Chen <pi-cheng.chen@linaro.org>,
Mark Rutland <mark.rutland@arm.com>,
James Liao <jamesjj.liao@mediatek.com>,
Linaro Kernel Mailman List <linaro-kernel@lists.linaro.org>,
Pawel Moll <pawel.moll@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Stephen Boyd <sboyd@codeaurora.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Henry Chen <henryc.chen@mediatek.com>,
Chen Fan <fan.chen@mediatek.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Rob Herring <robh+dt@kernel.org>,
linux-mediatek@lists.infradead.org,
Kumar Gala <galak@codeaurora.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
"Joe.C" <yingjoe.chen@mediatek.com>,
Eddie Huang <eddie.huang@mediatek.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] clk: mediatek: Export CPU mux clocks for CPU frequency control
Date: Tue, 10 Mar 2015 17:13:28 -0700 [thread overview]
Message-ID: <20150311001328.14952.56422@quantum> (raw)
In-Reply-To: <CAKohpo=90YH3TLfnMro0AQOM6_uMB_SPS9Q3j6Myz4RqqBdVHg@mail.gmail.com>
Quoting Viresh Kumar (2015-03-05 03:02:06)
> On 5 March 2015 at 16:21, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > Given the variance of different SoCs I don't think it makes sense
> > to try to handle all these cases. Instead the cpufreq-dt driver
> > should just call clk_set_rate() on the CPU clock with the desired
> > target frequency. Everything else should be handled in the clock
> > driver which has intimate knowledge about the SoC anyway.
>
> I agree..
>
> @Russell: I wanted to ask you this since sometime..
>
> On CPU-freq changes we fire PRE/POST notifiers and they are
> used for updating loops_per_jiffies which then controls delays.
>
> Now, it is fine to do that for normal frequencies, but what should be
> the approach for intermediate frequencies ?
>
> Intermediate freqs: On some platforms changing PLL's straight away
> isn't considered safe and so we switch parent to another stable clock,
> change PLL rate and switch back.
>
> The *wild* thought I earlier had was to fire these notifiers for even these
> intermediate frequencies, otherwise some of the delays will end before
> they should have and that *might* cause other problems.
>
> I wanted to know what do you (and other champs) think about this..
>
> Thanks in advance for your advice.
Sorry, I am not who you asked for advice but I will chime in anyways ;-)
I really hate this intermediate frequency stuff in cpufreq. As we
discussed over lunch in Hong Kong, it does not scale. What if there two
intermediate frequencies? What if a processor steps frequency up in 5KHz
increments (albeit very quickly) until it converges to the target rate?
Or what if we have more complex levels of intermediate frequencies?
Stealing Sascha's excellent ascii art:
---
CPU_PLL ---| |
| |
| |----- CPU
| |
IM_PLL ----| |
---
Where the sequence is as follows:
1) set IM_PLL to a new freq
2) reparent CPU to IM_PLL
3) configure CPU_PLL
4) reparent CPU to CPU_PLL
5) restore IM_PLL to original frequency
Steps #1 and #5 are new in this example.
I don't see how the concept of an intermediate frequency in the cpufreq
core could ever scale gracefully to handle corner cases. They may be
hypothetical now but I'd rather see us dodge this mistake.
Furthermore any intermediate-frequency property in a Devicetree binding
would suffer the same fate. Trying to neatly encode some weird sequence
into this generic thing will get very ugly very fast.
For proof please look at clk-divider.c, clk-gate.c, clk-mux.c or
clk-composite.c and you'll see the result of the slow accumulation of
lots and lots of hardware corner cases onto generic code. If I had known
then what I know now I would not have created those generic clock types
and I would have tried for an abstraction layer between generic stuff
(e.g. find the best divider) and the real hardware stuff (write to the
register). Instead I kept all of it together and now things are super
ugly.
Regards,
Mike
next prev parent reply other threads:[~2015-03-11 0:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 10:49 [PATCH] clk: mediatek: Export CPU mux clocks for CPU frequency control pi-cheng.chen
2015-03-04 11:21 ` Sascha Hauer
2015-03-05 2:43 ` Pi-Cheng Chen
2015-03-05 7:42 ` Sascha Hauer
[not found] ` <20150305074207.GC11010-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-03-05 8:58 ` Pi-Cheng Chen
2015-03-05 8:59 ` Viresh Kumar
[not found] ` <CAKohponSqLPcULA9-T8y9b_b44Torti0p6W3sJfRZ1oKUWqtTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-05 9:19 ` Sascha Hauer
[not found] ` <20150305091948.GH11010-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-03-05 9:39 ` Pi-Cheng Chen
2015-03-05 10:51 ` Sascha Hauer
2015-03-05 11:02 ` Viresh Kumar
2015-03-11 0:13 ` Mike Turquette [this message]
2015-03-12 9:21 ` Viresh Kumar
2015-03-12 10:36 ` Russell King - ARM Linux
2015-03-05 11:33 ` Pi-Cheng Chen
2015-03-05 10:23 ` Viresh Kumar
2015-03-10 23:59 ` Mike Turquette
2015-03-12 9:22 ` Viresh Kumar
2015-03-05 10:59 ` Sascha Hauer
2015-03-10 1:53 ` Pi-Cheng Chen
2015-03-10 7:55 ` Sascha Hauer
2015-03-11 7:00 ` Pi-Cheng Chen
-- strict thread matches above, loose matches on Subject: below --
2015-07-14 12:47 [PATCH v4] " Daniel Kurtz
2015-07-15 6:38 ` [PATCH] " Pi-Cheng Chen
[not found] ` <1436942326-19747-1-git-send-email-pi-cheng.chen-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-08-03 11:13 ` Pi-Cheng Chen
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=20150311001328.14952.56422@quantum \
--to=mturquette@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=eddie.huang@mediatek.com \
--cc=fan.chen@mediatek.com \
--cc=galak@codeaurora.org \
--cc=henryc.chen@mediatek.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jamesjj.liao@mediatek.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=pawel.moll@arm.com \
--cc=pi-cheng.chen@linaro.org \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@codeaurora.org \
--cc=viresh.kumar@linaro.org \
--cc=yingjoe.chen@mediatek.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;
as well as URLs for NNTP newsgroup(s).