# how should new cpupower be used

## ayvango

I've read from several topics that cpufrequtils should be discarded for sake of cpupower utility. I've installed it and got some troubles.

There is no config file in /etc that describe cpupowerd behaviour like it was done by cpufreqd. Moreover the cpupowerd run-script in /etc/init.d just sets cpu frequency governor on the service spawning and stopping. It invokes no persistent daemons to watch for acpi events and temperature sensors.

So, how can cpupowerd be used in place of cpufreqd?

----------

## Logicien

cpufrequtils and cpupower just set the cpu frequency scaling policy on the start and stop of the service. They do not do anything else. They do not have a background daemon. Their configuration file is in /etc/conf.d directory.

cpufreqd is a daemon who can change the cpu frequency scaling policy according to it's configuration file /etc/cpufreqd.conf. cpufrequtils, cpupower and cpufreqd have to be install separately, cpufrequtils and cpupower conflicting each other.

----------

## ayvango

So, should I keep using cpufreqd with newest kernels?

----------

## Logicien

It's depend of what you want. I do not see a big difference between cpupower and cpufrequtils. If you want a fine tune of the CPU according to events you can use cpufreqd. I stop using it since a couple of years. I only switch between ondemand and performance frequency scaling policie from time to time.

For a laptop you can use laptop-mode-tools. Some CPU setup can be done via the ACPI subsystem too.

----------

## FaeLLe

cpufreqd is now masked and will be removed in a month.

Any recommendations on how cpupower can be used a deamon to dynamically scale CPU frequencies?

----------

## Anon-E-moose

I've just started using the freq govs. I installed ondemand, and it seems to be working pretty well.

I have conky set up to monitor each cpu core freq and the Vcore for the cpu.

Ramps up and down smoothly, both for video and compiling, as the freq drops the Vcore power drops correspondingly with it.

Unless you have some special needs I would just use ondemand and see how it works.

As Logicien said compile the performance gov and if needed swap to it.

----------

## FaeLLe

So if I understand correctly the governor should be able to manage the CPU frequency scaling and there should be no need for any third party tools (unless any special needs exist). Is this correct?

----------

## khayyam

 *FaeLLe wrote:*   

> So if I understand correctly the governor should be able to manage the CPU frequency scaling and there should be no need for any third party tools (unless any special needs exist). Is this correct?

 

FaeLLe ... correct, infact if you use cpufreqd/cpufrequtils with > 3.7.x you may find the load average becomes somewhat high due (I think) to them being unaware of the changes made when cpupower was introduced.

With cpupower you can still set 'up_threshold', ' sampling_down_factor', 'ignore_nice_load', etc, via the SYSFS_EXTRA variable in /etc/conf.d/cpupower, but there is no facility (as with cpufreqd) to alter the freq based on the application used ... but that shouldn't be necessary anyhow.

best ... khay

----------

## v_2e

Is there a way to perform the CPU governor (or maximum frequency) change depending on the CPU temperature with some tools other than cpufreqd?

----------

## CaptainBlood

Hi dear all,

Same question here, as we have 27°C 6:30 AM ...

We're on a rolling out compiling distro, remember?

Not to mention a possibly warming up world?

Thks for your attention.Last edited by CaptainBlood on Wed Apr 09, 2014 4:44 pm; edited 1 time in total

----------

## khayyam

v_2e, CaptainBlood ...

It somewhat depends on the cpufreq driver used ... if intel_pstate is used then thermald may work. Also disabling 'turbo' via /sys/devices/system/cpu/intel_pstate/no_turbo will help keep the temp down.

Otherwise, might look under /sys/devices/system/cpu and see what features the driver provides ...

best ... khay

----------

## lexflex

 *CaptainBlood wrote:*   

> 
> 
> Same question here, as we have 27° C 6:30 AM ...
> 
> We're on a rolling out compiling distro, remember?
> ...

 

Lol misread three times due to the typo, but it seems the warming up is slow enough for any important new packages regarding temperature-monitoring to be developed, introduced in portage, and for any monthly emerge --sync to catch up with the changes  :Wink: 

----------

## CaptainBlood

Hi dear all,

I've been on cpufreqd for ages now, coz it allows to cap freq according to temp.

And since I moved to where I'm now, I experience shutdown du to overheat detection :

Xen dom0 and un to for domUs are making a fool out of me when competing with my daily simulatenous eix-sync && emerge -uDN world syndroma on my laptop.

khayyam : I thought p-state was obsolete (depreciated). Pardon me if I"m wrong. Anyhow will investigate accordingly. Thks

By the way I run on a Intel Core 2 Duo SU9400 / 1.4 GHz (plz stop laughing). Distcc in configured but untested yet due to lack of HW.

Bye RvryBudy and thanks for your attention.

----------

## khayyam

 *CaptainBlood wrote:*   

> I've been on cpufreqd for ages now, coz it allows to cap freq according to temp.

 

CaptainBlood ... well, before I switched from cpufreqd to cpupower (this was round about the same time as cpupower was introduced in the kernel) I experienced very weird behaviour with cpufreqd (heavy load ... due I think to it polling parts of cpufreq which had changed) ... this may have been a bug, I can't say, but I stopped using it for that reason. As always, YMMV.

 *CaptainBlood wrote:*   

> khayyam : I thought p-state was obsolete (depreciated). Pardon me if I"m wrong. Anyhow will investigate accordingly.

 

No, "intel_pstate" is that used for processors such as 'Sandy bridge' ...

 *kernel config wrote:*   

> CONFIG_X86_INTEL_PSTATE: This driver provides a P state for Intel core processors. The driver implements an internal governor and will become the scaling driver and governor for Sandy bridge processors.

 

 *kernel config wrote:*   

> By the way I run on a Intel Core 2 Duo SU9400 / 1.4 GHz (plz stop laughing).

 

In which case you're probably using X86_ACPI_CPUFREQ (acpi-cpufreq) which is also a "p-states" driver. I am too (T2500  @ 2.00GHz ... which isn't even a core2), and no thermal control is provided ... you should take a look in /sys/devices/system/cpu/cpufreq/<governor>.

BTW, I'm surprised you can run virtualisation with such a processor ...

best ... khay

----------

## Princess Nell

The whole cpufreqd/cpufrequtils/cpupower situation is quite unsatisfactory for mate users. How can we solve this conundrum?

```

# emerge -upDN world

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild  N     ] sys-power/cpufrequtils-008-r4  USE="nls -debug" 

[ebuild  N     ] app-text/gnome-doc-utils-0.20.10-r1  PYTHON_TARGETS="python2_7 -python2_6" 

[ebuild  N     ] gnome-extra/yelp-xsl-3.10.1 

[ebuild  N     ] dev-util/gtk-doc-1.20  USE="-debug -doc -emacs -highlight {-test} -vim" PYTHON_SINGLE_TARGET="python2_7 -python2_6" PYTHON_TARGETS="python2_7 -python2_6" 

[ebuild  N    ~] mate-base/mate-applets-1.6.1  USE="networkmanager policykit -ipv6" 

[blocks B      ] sys-power/cpufrequtils ("sys-power/cpufrequtils" is blocking sys-power/cpupower-3.13)

 * Error: The above package list contains packages which cannot be

 * installed at the same time on the same system.

  (sys-power/cpufrequtils-008-r4::gentoo, ebuild scheduled for merge) pulled in by

    sys-power/cpufrequtils required by (mate-base/mate-applets-1.6.1::mate-overlay, ebuild scheduled for merge)

  (sys-power/cpupower-3.13::gentoo, installed) pulled in by

    sys-power/cpupower required by @selected

For more information about Blocked Packages, please refer to the following

section of the Gentoo Linux x86 Handbook (architecture is irrelevant):

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1#blocked

# 

```

----------

## Logicien

Cpufrequtils and Cpupower cannot be installed at the same time. You have to choose between one of the two. Only gkrellm-cpufreq depend on Cpufrequtils. So if you do not use this Gkrellm plugin you can switch between Cpupower and Cpufrequtils by unmerge one and emerge the other.

For the moment, I do not see any other package than Cpufreqd who can set the cpu frequency and governor according on the temperature of the processor. It is very usefull with Amd processors to prevent preventive shutdown due to overheating. Maybe laptop-mode-tools can. I haven't use it since long.

```
equery d cpufreqd cpufrequtils cpupower

 * These packages depend on cpufreqd:

 * These packages depend on cpufrequtils:

x11-plugins/gkrellm-cpufreq-0.6.1 (sys-power/cpufrequtils)

 * These packages depend on cpupower:
```

----------

## Princess Nell

The point of my posting was to show that mate-applets has a dependency on cpufrequtils.

Maybe there should be a virtual for it.

----------

## energyman76b

 *FaeLLe wrote:*   

> So if I understand correctly the governor should be able to manage the CPU frequency scaling and there should be no need for any third party tools (unless any special needs exist). Is this correct?

 

correct for many, many years.

----------

## netixen

There is a big difference in how the on-demand governor works on different cpus. 

For instance some mobile cpus can only step up/down in to 3 frequencies (e.g 1200Mhz 2000Mhz 2200Mhz) while desktop cpus in to more or even step up/down through small steps +/- 10Mhz.

So the on-demand governor can deal with the performance management well but if you have thermal issues you will need to manage it from user-space. 

I have written a user-space governor that monitors the thermal zones and adjusts the frequency when trip points are triggered. But I've only tested it on my own machines so it's not ready for the wild.

However if your system is about to catch on fire feel free to give me a shout.

----------

## szatox

Some procesors are said  to be working better with conservative governor rather than on-demand.  I think conservative is better for AMD CPUs and perhaps mobile CPUs. Purpose is the same as on-demand.

Never bothered to verify though, so well, just sain'.

----------

## Anon-E-moose

From linux/Documentation/cpu-freq/governors.txt

The CPUfreq governor "ondemand" sets the CPU depending on the

current usage. To do this the CPU must have the capability to

switch the frequency very quickly.

---

The CPUfreq governor "conservative", much like the "ondemand"

governor, sets the CPU depending on the current usage.  It differs in

behaviour in that it gracefully increases and decreases the CPU speed

rather than jumping to max speed the moment there is any load on the

CPU.  This behaviour more suitable in a battery powered environment.

----------

## defer-

I have heard that ondemand saves more power than conservative in real word situations. Ondemand finishes tasks more quickly and cpu can go to sleep state more quickly.

----------

## Gusar

 *defer- wrote:*   

> I have heard that ondemand saves more power than conservative in real word situations. Ondemand finishes tasks more quickly and cpu can go to sleep state more quickly.

 

Indeed. That help text for the conservative governor is severely outdated. Race-to-idle is the game nowadays, and conservative completely screws with that. Power saving mostly comes from C-states, not P-states. Even ondemand is outdated in this regard, its constant P-state switching is superfluous. In deep C states, the frequency is 0 anyway, only in the C0 state is the frequency at the one determined by the P-state. That's why Intel developed the intel_pstate driver, which pretty much only switches P-states to handle turbo modes.

Required reading for everyone, it explains in more detail how modern processors work: https://plus.google.com/114657443111661859546/posts/dLn9T4ehywL

----------

