cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mason <mpeg.blue@free.fr>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Linux PM <linux-pm@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	cpufreq <cpufreq@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: How many frequencies would cpufreq optimally like to manage?
Date: Tue, 25 Nov 2014 14:02:50 +0100	[thread overview]
Message-ID: <54747DFA.3040802@free.fr> (raw)
In-Reply-To: <CAKohpomzxnCy7X+cPsVdDvi0cMRMp2Am1O-S5BeQtTr1CqBhEw@mail.gmail.com>

On 21/11/2014 04:36, Viresh Kumar wrote:

> All current governors depend on background timers for their functionality.
> These timers run at some sampling rate (in ms) and that time we change
> CPU's frequency depending on existing load on system.. So, that might
> not be fast enough.

As far as I can tell, on my SoC, the timer runs at 27 MHz.
But I have no idea how often it fires an interrupt.

I've been studying other cpufreq drivers, especially the OMAP driver.
I noticed that there is a lot of generic infrastructure that our driver
wasn't using, such as...

   cpufreq_generic_init
   cpufreq_generic_exit
   cpufreq_generic_frequency_table_verify
   cpufreq_generic_attr

I've changed our driver to use those.

I'm still confused about cpufreq_generic_get.
This is not a typical get/put type function, right?

What is it supposed to get?
Apparently, the actual frequency of the 'cpu-th' CPU?
I see that it calls clk_get_rate(policy->clk)

This 'struct clk' is an elusive beast.
Where is it defined? I only run into forward declarations.

On my platform, clk_get_accuracy returns -524 unconditionally,
and clk_prepare just returns 0.

of_clk_get and of_clk_get_by_name both return ERR_PTR(-2)

I suppose all this means I can't use this infrastructure "as-is",
correct? Where can I read more about it?

How is the kernel supposed to know what frequency each core is running at?
I imagine that's what the .get method override is for?

One more question (for now). Is the .get method supposed to return numbers
that match in freq_table, or can they be slightly different? For example,
I've defined my freq_table like this:

static struct cpufreq_frequency_table freq_table[] = {
	{ .driver_data = REG_VAL(1,0), .frequency = 999000 },
	{ .driver_data = REG_VAL(1,8), .frequency = 750000 },
	{ .driver_data = REG_VAL(2,0), .frequency = 500000 },
	{ .driver_data = REG_VAL(4,0), .frequency = 250000 },
	{ .driver_data = REG_VAL(8,0), .frequency = 125000 },
	{ .frequency = CPUFREQ_TABLE_END },
};

but the 3rd frequency is actually 999/2 MHz, not 500 MHz, etc.
Will that be a problem?

Regards.


  reply	other threads:[~2014-11-25 13:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19 23:24 How many frequencies would cpufreq optimally like to manage? Mason
2014-11-20  9:13 ` Viresh Kumar
2014-11-20 14:20   ` Mason
2014-11-21  3:36     ` Viresh Kumar
2014-11-25 13:02       ` Mason [this message]
2014-11-25 15:19         ` Viresh Kumar
2014-11-25 21:52           ` Mason
2014-11-26  4:14             ` 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=54747DFA.3040802@free.fr \
    --to=mpeg.blue@free.fr \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.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