You are not logged in.

#1 2013-07-12 16:20:50

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Tune a desktop with cpupower

Hello I am running a desktop, and I took a look at cpupower to tune the performance while powerusage isnt a problem. This is not a laptop!

Here is my /etc/default/cpupower:

# Define CPUs governor
# valid governors: ondemand, performance, powersave, conservative, userspace.
governor='performance'

# Limit frequency range
# Valid suffixes: Hz, kHz (default), MHz, GHz, THz
min_freq="3.10GHz"
max_freq="3.10GHz"

# Specific frequency to be set.
# Requires userspace governor to be available.
# Do not set governor field if you use this one.
#freq=

# Utilizes cores in one processor package/socket first before processes are
# scheduled to other processor packages/sockets.
# See man (1) CPUPOWER-SET for additional details.
#mc_scheduler=

# Utilizes thread siblings of one processor core first before processes are
# scheduled to other cores. See man (1) CPUPOWER-SET for additional details.
#smp_scheduler=

#  Sets a register on supported Intel processore which allows software to convey
# its policy for the relative importance of performance versus energy savings to
# the  processor. See man (1) CPUPOWER-SET for additional details.
#perf_bias=

# vim:set ts=2 sw=2 ft=sh et:

Basically I want it to run at full frequency all the time, so I don't need the cpu frequency to ramp up when doing performance demanding tasks.

But...

root@magda /h/roberth# cpupower frequency-info
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 0.97 ms.
  hardware limits: 1.60 GHz - 3.10 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 3.10 GHz and 3.10 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 2.73 GHz (asserted by call to hardware).
  boost state support:
    Supported: no
    Active: no
    25500 MHz max turbo 4 active cores
    25500 MHz max turbo 3 active cores
    25500 MHz max turbo 2 active cores
    25500 MHz max turbo 1 active cores

The cpu frequency is going all the time between 1,6 ghz and 3,1 ghz. What am I doing wrong?


Use the Source, Luke!

Offline

#2 2013-07-12 16:45:46

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: Tune a desktop with cpupower

You are using the new intel_pstate driver which was introduced with kernel 3.9. Afaik it doesn't really support different "governors". Just let the driver do its job, everything else is a completely waste of time and power. Setting the CPU to always run at full frequency will not actually give you more performance, it's much more complicated than that (search the forums or google for intel pstate).

Offline

#3 2013-07-12 16:51:14

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

So... cpupower is worthless with p-state?


Use the Source, Luke!

Offline

#4 2013-07-12 16:58:20

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: Tune a desktop with cpupower

I guess so. Even if you disable pstate, there is no reason to use anything other than the default ondemand governor. "performance" does not actually give you more performance.

Offline

#5 2013-07-12 17:31:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Tune a desktop with cpupower

With new processors (namely Sandy Bridge, Ivy Bridge, and Haswell, and maybe the first gen Cores as well) there is some evidence that ondemand is not necessarily the best route to take.  Using ondemand requires there to be detection in userspace in order to ramp up the processor speed.  So if intel_pstate is not available, it might be better to use performance so that the processor can decide for itself what c-state is would like to be in at any given time.  New processors have this capability, but when ondemand was designed some ten years ago, this was not the case and they had to be regulated.

FWIW, @OP the intel_pstate does a great job at regulating the performance of the machine.  You will not notice any difference, not will setting performance gain you any real advantage.  So you might as well leave it as is.  Though info is sparse on the topic, there is some out there that can give you more details on why you would want to use this.  This thread (and the links within) can get you started on understanding what is at play here.  The link to Theodore Tso's G+ thread about the topic is of particular value.

Offline

#6 2013-07-12 17:40:20

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

So summing it up, run performance governor when using c-state, and just leave it to the default if using pstate?


Use the Source, Luke!

Offline

#7 2013-07-12 19:37:14

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Tune a desktop with cpupower

Yeah, unless you notice major drawbacks, I would just leave it as is.  The intel_pstate driver was created by Intel, with the recent Core processors in mind.  So I would have to imagine that a driver that is tuned specifically for a family of processors is going to be the best option.

Also, I can't seem to find a discernible difference between the "performance" and "powersave" modes of the intel_pstate driver.  Those two things aren't synonymous with the "pwoersave" and "performance" of the acpi-cpufreq method.  I think that there is only potentially <5% difference in performance characteristics, so really there is not much of a reason to use "performance".  That is, unless benchmarks are the only thing you care about...

Offline

#8 2013-07-16 00:25:17

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

But how can I change the governor within pstate?


Use the Source, Luke!

Offline

#9 2013-07-16 00:29:06

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Tune a desktop with cpupower

You can change them the same way as before, using cpupower.  But with intel_pstate, you are not really changing a governor, but rather soemthing like tuning characteristics.  So the only options are "performance" and "powersave", defaulting to the latter.  The intel_pstate really is its own governor, which for the most part apparently defaults to letting the processor govern its own clock speeds, while only making requests for levels of power.

Offline

#10 2013-07-16 00:43:07

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

Well the thing is that I have an issue with video playback not going smoothly it's slow here and there.


Use the Source, Luke!

Offline

#11 2013-07-16 00:49:45

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Tune a desktop with cpupower

Are you sure that this can be fully attributed to the intel_pstate driver?  What kind of system do you have, and what kind of videos are you trying to play?

Offline

#12 2013-07-16 00:51:03

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

Kind of system? it's intel core i3 2100(sandybridge) and 8 gb ram, matroska containers with h264 formatted videos.


Use the Source, Luke!

Offline

#13 2013-07-16 01:00:49

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Tune a desktop with cpupower

So what about the other part of my last post? Have you determined that it is indeed the intel_pstate driver?  Have you tried turning it off?

Offline

#14 2013-07-16 01:05:12

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

So I have not tried turning it off, but Ill try...


Use the Source, Luke!

Offline

#15 2013-07-16 04:05:00

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

Well I disabled pstate, and set the governor to performance, and I have watched a movie now and I cannot notice it anymore plus the latency in desktopusage is greatly redused, especially rendering of web pages with chromium.


Use the Source, Luke!

Offline

#16 2013-07-16 04:24:07

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Tune a desktop with cpupower

So you are saying that it does appear to be the intel_pstate driver?  If that is the case, maybe you should run without it.

Did you try using the performance "governor" with intel_pstate, I noticed absolutely no difference, but maybe you might. 

Interestingly, the intel_pstate should give the processor the ability to react to changes in load without having to wait for signals from userspace.  So theoretically at least, it should be of better performance.  It also give the processor the ability to fully access the Turbo Mode in these Intel Core processors, meaning even more theoretical availability of performance.

Upon the release of the intel_pstate driver, there was some debate as to whether these modern processors would be better of using acpi-cpufreq's performance governor (the old one) since these processors are much more complex and capable of basically taking care of themselves.  I tried it for a while actually and noticed no noticeable loss of battery life, and i7z actually reported that my processor was in the lowest sleep state (C7) for the same amount of time as when it was using ondemand.

There are a few ways to tune the intel_pstate governor through the /sys interface.  Though I don't think that it will do what you expect it to do. It does not work in a reactive sort of a way anymore.  So when your processor gets to a given level of load, there is no reaction of bumping the frequency.  Instead, the intel_pstate driver tells the processor generally about what is going on in the system and lets the processor plan for how it will allot resources and what kind of setting it should give itself for the immediate future.

So now the tunables include the ability to throttle the processor on the high side, or raise the lowest frequency.  This is done not by frequencies, but by percentages.  There is also the option to turn off the Turbo.  So if anything is going to help you here, it would be turning the lowest frequency up a bit. 

Take a look at /sys/devices/system/cpu/intel_pstate, where you will find max_perf_pct, min_perf_pct, and no_turbo.  I think those options are pretty self explanatory.

I think you are just going to have to try things out and find what works best for you.  As a new implementation, there are obviously going to be some bugs that need to be ironed out, and it unfortunately sounds as though you are one of those with hardware that has these issues.  Ultimately, if intel_pstate doesn't work well for you now, I would continue to check back with it from time to time, since it will obviously improve as development continues.

Edit: Sorry for the long post... I guess I had more to say about the matter than I thought.

Last edited by WonderWoofy (2013-07-16 04:24:45)

Offline

#17 2013-07-16 04:46:48

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

Well just to mention, I use BFS and BFQ schedulers, that might be the reason.

But, I am a little confused now, how do I set the governor pstate use?


Use the Source, Luke!

Offline

#18 2013-07-16 05:26:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Tune a desktop with cpupower

Like I mentioned before, they are not governors in the traditional sense, but you have the option of either performance or powersave.  If you want to use performance over the default powersave, then you would just use cpupower as you would normally to adjust it.  That is, you can either adjust /etc/default/cpupower and thenstart the cpupower service, or you can do it manually with the cpupower tool.  I think that it will apply globally though, so if you choose to do it manually, it might not require the specification of which prcessors/cores to change.

Using BFS/BFQ probably should have been mentioned earlier.  There have been various bugs with the 3.10 series and the CK patchset, though I haven't personally come across anything as specific as this video problem.  What happens if you use the normal kernel?  Do these issues persist with intel_pstate?

Offline

#19 2013-07-24 22:56:13

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

Well after some more investigation, I found that the harddrive that contained the video files didn't work properly, it spun down when it was not suposed to etc. So I got a new harddrive, the issue was still there but again reduced, so I made that harddisk use the cfq instead of bfq, and had turned pstate off and used cpupower to set governor to performance, and so far it seems to have solved it. I use on this harddrive btrfs, which with my previous drive made the issue even worse.


Use the Source, Luke!

Offline

#20 2013-07-27 04:07:35

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Tune a desktop with cpupower

DAMMIT, it is still present, I tried watching a movie with cfq and cfs enabled instead, the issue is again significantly reduced but still present.

So I have tried watching video and watch a system monitor at the same time, with bfq on root and /home and cfq harddrive containing the video files, the cpu usage is at 100 % all the time, using cfq and cfs, it is at 10 %, but when the issue appears, it rises to 15 %.

I'll be back with more info when I have tested with another video player.

EDIT: current one I am using is mpv with libav.

Last edited by Roberth (2013-07-27 04:09:06)


Use the Source, Luke!

Offline

Board footer

Powered by FluxBB