Page 1 of 1

Xen cpufreq control

Posted: Sat Apr 06, 2013 11:14 pm
by gordon.cooke
I have not been able to get cpu power management under Xen to work yet. Before Xen was installed cpufreq worked fine in LM 13.

Found some info about the topic at: http://wiki.xen.org/wiki/Xen_power_management
And details on teh xenpm at: http://wiki.xen.org/wiki/Xenpm_command

I tried:

Code: Select all

xenpm get-cpufreq-states
and got nothing back. Tried will a cpu number at end and still got nothing back
Then tried:

Code: Select all

xenpm get-cpufreq-para
and it returned the following

Code: Select all

[CPU0] failed to get cpufreq parameter
[CPU1] failed to get cpufreq parameter
[CPU2] failed to get cpufreq parameter
[CPU3] failed to get cpufreq parameter
[CPU4] failed to get cpufreq parameter
[CPU5] failed to get cpufreq parameter
[CPU6] failed to get cpufreq parameter
[CPU7] failed to get cpufreq parameter
Next

Code: Select all

xenpm get-cpuidle-states
returnes info on max c-state (C7) and info on each cpu
Last:

Code: Select all

xenpm set-scaling-governor ondemand
returns a failure

Code: Select all

[CPU0] failed to set governor name
[CPU1] failed to set governor name
[CPU2] failed to set governor name
[CPU3] failed to set governor name
[CPU4] failed to set governor name
[CPU5] failed to set governor name
[CPU6] failed to set governor name
[CPU7] failed to set governor name
Any ideas? It doesnt apear that the governor or anything is set in grub, so default should be xen control with userspace control. But I cant change.

Re: Xen cpufreq control

Posted: Tue Apr 09, 2013 3:32 am
by powerhouse
It might depend on the CPU you got (Intel or AMD). For reference, I get the following output on my i7 3930K based system:

Code: Select all

#     xenpm get-cpufreq-states 0
cpu id               : 0
total P-states       : 12
usable P-states      : 12
current frequency    : 1200 MHz
P0                   : freq       [3201 MHz]
                       transition [00000000000000001276]
                       residency  [00000000000000048333 ms]
P1                   : freq       [3200 MHz]
                       transition [00000000000000000047]
                       residency  [00000000000000000456 ms]
P2                   : freq       [3000 MHz]
                       transition [00000000000000000056]
                       residency  [00000000000000000560 ms]
P3                   : freq       [2800 MHz]
                       transition [00000000000000000036]
                       residency  [00000000000000000258 ms]
P4                   : freq       [2600 MHz]
                       transition [00000000000000000046]
                       residency  [00000000000000000278 ms]
P5                   : freq       [2400 MHz]
                       transition [00000000000000000042]
                       residency  [00000000000000000268 ms]
P6                   : freq       [2200 MHz]
                       transition [00000000000000000030]
                       residency  [00000000000000000168 ms]
P7                   : freq       [2000 MHz]
                       transition [00000000000000000045]
                       residency  [00000000000000000295 ms]
P8                   : freq       [1800 MHz]
                       transition [00000000000000000037]
                       residency  [00000000000000000311 ms]
P9                   : freq       [1600 MHz]
                       transition [00000000000000000050]
                       residency  [00000000000000000305 ms]
P10                   : freq       [1400 MHz]
                       transition [00000000000000000045]
                       residency  [00000000000000000277 ms]
*P11                  : freq       [1200 MHz]
                       transition [00000000000000001128]
                       residency  [00000000000000042023 ms]
The regular power states seem to work, but I'm unsure about the turbo mode.

Right now my system is idle, with only Firefox and a terminal window open, and it consumes ~116W (I got a watt meter).

Your system should definitely display the power states.

My idle states are as follows:

Code: Select all

# xenpm get-cpuidle-states 0
Max C-state: C7

cpu id               : 0
total C-states       : 2
idle time(ms)        : 3097186
C0                   : transition [00000000000000000001]
                       residency  [00000000000000106662 ms]
C1                   : transition [00000000000000000001]
                       residency  [00000000000003097186 ms]
pc3                  : [00000000000000000000 ms]
pc6                  : [00000000000000000000 ms]
pc7                  : [00000000000000000000 ms]
cc3                  : [00000000000000000000 ms]
cc6                  : [00000000000000000000 ms]
The above looks like what's discussed here: http://xen.1045712.n5.nabble.com/Workin ... 64799.html

Do you get an error message during boot about cpufreq? Just had a look at my /var/log/boot.log file:

Code: Select all

 * Loading cpufreq kernel modules...       [160G 
[154G[[31mfail[39;49m]
 * Stopping save kernel messages[74G[ OK ]
 * disabled, governor not available...       [160G  * CPUFreq Utilities: Setting ondemand CPUFreq governor...       [160G 
[154G[ OK ]
However, the CPU frequency governor seems to work:

Code: Select all

# xenpm get-cpufreq-para 0
cpu id               : 0
affected_cpus        : 0
cpuinfo frequency    : max [3201000] min [1200000] cur [1200000]
scaling_driver       : acpi-cpufreq
scaling_avail_gov    : userspace performance powersave ondemand
current_governor     : ondemand
  ondemand specific  :
    sampling_rate    : max [10000000] min [10000] cur [20000]
    up_threshold     : 80
scaling_avail_freq   : 3201000 3200000 3000000 2800000 2600000 2400000 2200000 2000000 1800000 1600000 1400000 *1200000
scaling frequency    : max [3201000] min [1200000] cur [1200000]
turbo mode           : enabled
Can you provide some more information on the CPU, motherboard, BIOS, kernel, hypervisor revisions?

I would also make sure you run the latest kernel and hypervisor from repo: 3.5.0-26-generic, and Xen 4.1.3. In my system the upgrade to the 3.5.0-26 kernel solved a minor issue that delayed the boot process. Might be worth trying.

Re: Xen cpufreq control

Posted: Sat Apr 13, 2013 9:18 pm
by gordon.cooke
CPU is AMD FX8320, 8 core 3.5 GHz
MB is MSI 970A-G43
Im using whatever stock kernel came through the repo. Will have to wait till Im home to check specifics and pull logs. But I know I see errors I believe are related to not finding freq control (repeated 8 times) during bootup right before GDM login screen comes up.

Re: Xen cpufreq control

Posted: Sun Apr 14, 2013 5:18 pm
by powerhouse
gordon.cooke wrote:CPU is AMD FX8320, 8 core 3.5 GHz
MB is MSI 970A-G43
Im using whatever stock kernel came through the repo. Will have to wait till Im home to check specifics and pull logs. But I know I see errors I believe are related to not finding freq control (repeated 8 times) during bootup right before GDM login screen comes up.
If I remember correctly there is a problem with AMD CPUs and power states. See here for another user report: http://www.overclock.net/t/1205216/guid ... t_19602860 - "...i recently switched from arch + xen to opensuse + kvm because of xen poor power management options on my amd machine (suspend doesnt work, cool'n quiet crash my system, etc)..."

In the same thread, the same user nbhusain also describes how to work around the kvm issues (for example host crash when restarting domU, or performance degradation). So if cpufreq is important to you, you may want to try kvm instead of xen.

EDIT: Check the Xen release notes - perhaps 4.1.4 or 4.2.1 solve the issue? I haven't checked, though. I assume you are currently running Xen 4.1.3?

Re: Xen cpufreq control

Posted: Mon Oct 07, 2013 4:03 am
by Queeq
Got the same problem on my laptop. Both "cpufreq=xen" and "cpufreq=dom0-kernel" don't work. There's also a message in boot.log that loading cpufreq kernel modules fails. The only difference is that I run custom 3.10.14 kernel. Xen version 4.1.3.
Have anybody figured this out?