xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Tseglytskyi <andrii.tseglytskyi@globallogic.com>
To: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@globallogic.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	jinsong.liu@alibaba-inc.com, Tim Deegan <tim@xen.org>,
	xen-devel <xen-devel@lists.xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	jacob.shin@amd.com
Subject: Re: cpufreq implementation for OMAP under xen hypervisor.
Date: Fri, 29 Aug 2014 18:08:39 +0300	[thread overview]
Message-ID: <CAH_mUMNQLHeOWFC_SNB_8BjBz9rOs=moYOUFFhtOXo_WPZTa7w@mail.gmail.com> (raw)
In-Reply-To: <CAN58jivu91DcJX6rjuzW1h=NXEXDKaBA0r2cYLEWPzEUyJ5hjg@mail.gmail.com>

Hi,

Stefano, Ian,

Could you please clarify the following point:

I agree that decision about frequency change should be taken by Xen
hypervisor. But what about hardware frequency changing?
In general when frequency changed to bigger value (for example from 1
GHz to 1.5 GHz) for ARM kernels sequence looks like the following:

1) cpufreq governor decides that frequency should be changed. This
decision is taken after analysing of CPU performance data taking in
account governor policy.
2) cpufreq governor asks cpufreq driver about new frequency.
3) cpufreq driver compares current and target frequencies and asks
cpufreq regulator about voltage change.
4) cpufreq regulator send i2c command to standalone microchip, which
is responsible for voltage changing.
5) cpufreq driver asks clock framework about new frequency for CPU clock
6) clock framework performs frequency sanity checks, taking in account
clock parents and clock divider settings, and call platform specific
"set_frequency" callback.
7) platform specific callback performs proper HW registers
configuration for newly selected frequency

Also there are some special cases - for example for OMAP5+ when
frequency is changed to 1.5 GHz+, two additional HW IPs should be
triggered (ABB and DCC, if someone is familiar with OMAP5+ )

So, for generic ARM kernel we have 3 entities to change frequency:

- cpufreq governor
- cpufreq driver
- cpufreq regulator

+ 2 additional IP for OMAP5+
- ABB
- DCC

Taking in account all above, it looks like it would be better to
implement only Xen cpufreq governor. Xen will take a decision about
new frequency, and kernel dom0 will perform other steps. Dom0 contains
all generic and platform specific frameworks, needed for frequency
changing.

What do you think ?

Regards,
Andrii


On Fri, Aug 29, 2014 at 4:25 PM, Oleksandr Dmytryshyn
<oleksandr.dmytryshyn@globallogic.com> wrote:
> On Fri, Aug 22, 2014 at 7:31 PM, Stefano Stabellini
> <stefano.stabellini@eu.citrix.com> wrote:
>> On Fri, 22 Aug 2014, Oleksandr Dmytryshyn wrote:
>>> Hi, Stefano.
>>>
>>> On Fri, Aug 22, 2014 at 2:31 AM, Stefano Stabellini
>>> <stefano.stabellini@eu.citrix.com> wrote:
>>> > CC'ing the x86 maintainers and the cpufreq original author.
>>> >
>>> >
>>> > On Thu, 21 Aug 2014, Oleksandr Dmytryshyn wrote:
>>> >> Hi to all.
>>> >>
>>> >> I'm planning to do next work:
>>> >>
>>> >> 1. Move file xen/include/acpi/cpufreq/cpufreq.h to the
>>> >> xen/include/drivers/cpufreq/cpufreq.h
>>> >> 2. Create a new file xen/arch/x86/acpi/cpufreq/cpufreq_common.c
>>> >
>>> > you can call it cpufreq.c or cpufreq_ops.c
>>> I'll call it cpufreq_ops.c
>>>
>>> >> 3. Move some acpi-specific functions from
>>> >> xen/drivers/cpufreq/cpufreq.c to the
>>> >> xen/arch/x86/acpi/cpufreq/cpufreq_common.c:
>>> >> cpufreq_limit_change(), print_PCT(), print_PSS(), print_PSD(),
>>> >> print_PPC(), set_px_pminfo().
>>> >
>>> > Why cpufreq_limit_change?
>>> The function cpufreq_limit_change() is called only in the set_px_pminfo()
>>> function and will not be used for the ARM architecture.
>>
>> I see.
>> One thing to keep in mind is that although P states are obviously an
>> Intel concept, we could abstract them away and map them into
>> arch-independent power-saving states. That way we could share functions
>> like set_px_pminfo between ARM and x86. But I would have to see the
>> patches to actually know how feasible that is.
> Here is my RFC implementation:
> http://lists.xen.org/archives/html/xen-devel/2014-08/msg02919.html
>
>>> >> 4. Create a new file xen/arch/arm/cpufreq/cpufreq_common.c
>>> >> 5. Functions cpufreq_add_cpu()/cpufreq_del_cpu() should be implemented
>>> >> separately for the x86 and ARM architecture (in the correspond file
>>> >> cpufreq_common.c).
>>> >
>>> > Why? The implementation doesn't look x86 specific.
>>> The function cpufreq_add_cpu()/cpufreq_del_cpu() uses the acpi-specific
>>> data structures. I don't know how make them common for both architectures
>>> but I'll try to do this.
>>>
>>> >> 6. Port cpufreq driver for the OMAP from the Linux kernel.
>>> >>
>>> >> In case ARM the cpufreq driver will read the settings for the
>>> >> operating-points from the device tree and the
>>> >> XENPF_set_processor_pminfo platform hypercall will not be necessary
>>> >> for ARM.
>>> >>
>>> >> Is this the right way to implement the cpufreq for OMAP under xen hypervisor?
>>> >
>>> > Yes, it's more or less what I had in mind.
>>>
>>> I have a question. I see that the original file cpufreq.c contains
>>> 'Copyright (C)' fields. Could You please tell me which copyrights I should add
>>> to the new cpufreq_ops.c files (for x86 and ARM arhitectures).
>>> In case if cpufreq_add_cpu()/cpufreq_del_cpu() functions will be common for both
>>> architectures there will be only one cpufreq_ops.c file for x86 architecture.
>>> But there is a way when we will have two files file cpufreq_ops.c (for
>>> x86 and ARM).
>>
>> I would keep the current Copyright fields for the x86 implementation of
>> cpufreq_ops.c. You can use your own Copyright line for the ARM
>> implementation.
>
>
> --
> Oleksandr Dmytryshyn | Product Engineering and Development
> GlobalLogic
> M +38.067.382.2525
> www.globallogic.com
>
> http://www.globallogic.com/email_disclaimer.txt
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel



-- 

Andrii Tseglytskyi | Embedded Dev
GlobalLogic
www.globallogic.com

  reply	other threads:[~2014-08-29 15:08 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12 10:57 cpufreq implementation for OMAP under xen hypervisor Oleksandr Dmytryshyn
2014-08-12 12:15 ` Stefano Stabellini
2014-08-12 12:19   ` Oleksandr Dmytryshyn
2014-08-19 14:02   ` Vitaly V. Ch
2014-08-21 23:05     ` Stefano Stabellini
2014-08-22 14:21       ` Vitaly Chernooky
2014-08-22 16:20         ` Stefano Stabellini
2014-08-21 11:00   ` Oleksandr Dmytryshyn
2014-08-21 23:31     ` Stefano Stabellini
2014-08-22  9:02       ` Oleksandr Dmytryshyn
2014-08-22 16:31         ` Stefano Stabellini
2014-08-22 16:51           ` Ian Campbell
2014-08-29 13:25           ` Oleksandr Dmytryshyn
2014-08-29 15:08             ` Andrii Tseglytskyi [this message]
2014-09-02  1:00               ` Stefano Stabellini
2014-09-02  9:06                 ` Vitaly Chernooky
2014-09-02 15:43                 ` Andrii Tseglytskyi
2014-09-02 18:39                   ` Stefano Stabellini
2014-09-02 18:46                     ` Andrii Tseglytskyi
2014-09-04 14:43                       ` Oleksandr Dmytryshyn
2014-09-04 21:56                         ` Stefano Stabellini
2014-09-09 10:19                           ` Oleksandr Dmytryshyn
2014-09-09 21:52                             ` Stefano Stabellini
2014-09-09 10:32                           ` Ian Campbell
2014-09-09 21:41                             ` Stefano Stabellini
2014-09-10  9:42                               ` Ian Campbell
2014-09-10 10:19                                 ` Andrii Tseglytskyi
2014-09-10 18:35                                   ` Stefano Stabellini
2014-09-10 19:31                                     ` Konrad Rzeszutek Wilk
2014-09-16 13:49                                       ` Oleksandr Dmytryshyn
2014-09-17 17:06                                         ` Konrad Rzeszutek Wilk
2014-09-18  9:38                                           ` Oleksandr Dmytryshyn
2014-09-18 14:59                                             ` Konrad Rzeszutek Wilk
2014-09-19  9:38                                               ` Oleksandr Dmytryshyn
2014-09-24 14:36                                         ` Stefano Stabellini
2014-09-24 14:46                                           ` Konrad Rzeszutek Wilk
2014-09-25  9:13                                             ` Oleksandr Dmytryshyn
2014-09-25  9:08                                           ` Oleksandr Dmytryshyn
2014-09-25 10:14                                             ` Stefano Stabellini
2014-09-25 11:15                                               ` Oleksandr Dmytryshyn
2014-09-26 18:13                                             ` Konrad Rzeszutek Wilk
2014-09-29  9:45                                               ` Oleksandr Dmytryshyn
2014-09-29 15:18                                                 ` Konrad Rzeszutek Wilk
2014-09-30 10:28                                                   ` Oleksandr Dmytryshyn
2014-09-30 17:37                                                     ` Konrad Rzeszutek Wilk
2014-09-11  9:43                                     ` Ian Campbell
2014-09-09 13:25                           ` Vitaly Chernooky
2014-09-09 21:58                             ` Stefano Stabellini
2014-09-10 10:15                               ` Andrii Tseglytskyi
2014-09-10 10:24                                 ` Vitaly Chernooky
2014-09-10 11:18                                   ` Andrii Tseglytskyi
2014-09-10 18:37                                   ` Stefano Stabellini
2014-09-11  7:51                                     ` Vitaly Chernooky
2014-09-10 11:24                                 ` Vitaly Chernooky
2014-09-10 14:28                               ` Vitaly Chernooky
2014-09-10 18:41                                 ` Stefano Stabellini
2014-09-11  7:48                                   ` Vitaly Chernooky

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='CAH_mUMNQLHeOWFC_SNB_8BjBz9rOs=moYOUFFhtOXo_WPZTa7w@mail.gmail.com' \
    --to=andrii.tseglytskyi@globallogic.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=jacob.shin@amd.com \
    --cc=jbeulich@suse.com \
    --cc=jinsong.liu@alibaba-inc.com \
    --cc=oleksandr.dmytryshyn@globallogic.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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).