powerd vs powerxx my experiments and observations

My laptop is AMD A9-9425 with 12gb ram 1 tb hdd running FreeBSD 13.2 RC5 with Xorg LXQT SDDM installed and running.

Following changes made to stock FreeBSD install

Code:
kern.hz=500
kern.preempt_thresh=171
kern.eventtimer.timer=HPET

performance_cx_lowest=Cmax
economy_cx_lowest=Cmax

These above changes were done primarily keeping the laptop use for a student or programmer

powerd was stock no changes.

powerdxx was started as

Code:
powerd++ -v -s1 -p.25s

This was to to mimic the default behaviour of powerd for sampling every 250ms

rest both powerd and powerxx were using all default values.

Initial test done basically to see idle performance which C states are entered most and which lowest frequency is hit at idle. This test was done on AC power.

System was booted to SDDM login screen.

switched to terminal ctrl+alt+F1 and logged in as root. htop started and left for 4-5mins

What I found was powerdxx uses CPU to the extent of being seen on htop as is evident in screen shot.

the min frequency 1400mhz was hit large number of times but hardly anything above 2000mhz was hit at idle BUT cpu entered less into C2 states which is surprising as lowest frequency was hit.
20230402_003008.jpg

20230402_003133.jpg


using powerd the cpu entered much more into C2 states but the cpu freq hardly hit the minimum 1400mhz

it touched highest 3100mhz and lowest was 1800mhz
1400mhz was blink and miss

20230402_003218.jpg


20230402_003236.jpg


Observed powerdxx uses much more cpu time than powerd.

Also one more observation is

dev.cpu.freq_levels did not show turbo boost frequency which for this processor is 3.7ghz
 
Are you able to measure power consumption? I'd like to know if I can make my laptop a bit more power efficient.
will look at that next.

but ideally if you are running X and a Desktop environment running powerd along with

kern.hz=250 in loader.conf

kern.sched.preempt_thresh=171 or 224 in sysctl.conf (chk n decide urself which value suits you)

performance_cx_lowest=Cmax
economy_cx_lowest=Cmax

both above in rc.conf

should make it more efficient.

I am still not sure about powerdxx so using powerd is better as of now.
 
Are you able to measure power consumption? I'd like to know if I can make my laptop a bit more power efficient.

No - if the CPU supports C-states, this will give you at least 95% (if not all 100%) of the possible CPU power savings. There's no real gain in throttling a core that can be just turned off via C-states.
A while ago I've checked power consumption on 4 servers with only C-states set to "Cmax" and additionally running powerd or powerdxx and there was absolutely no difference - i.e. nothing that couldn't just have been measuring tolerance: e.g. *maybe* 2-3W on a host that runs at 180W under normal load, but those 2-3W less are also sometimes hit without powerd[xx]. On hosts with ~90-100W idle with C-states there is absolutely no visible difference if powerd[xx] were running. The only thing I could observe was, that single-threaded jobs often couldn't trigger powerd[xx] to increase the frequency of this core (or all if the cpu only supports that) and OTOH sometimes a few smaller jobs that don't use that much cpu time triggered powerd[xx] to fully ramp up to turbo frequency.

Same on my new thinkpad T16 with 12th gen intel: Cmax brings the CPU down to <4W (~3.5-3.8) under normal load, powerd[xx] aren't able to shave off any more of that and instead often throttle single-threaded jobs because they keep the core at minimum frequency. Especially on those newer generations, just let the CPU handle frequencies and C-states. Again: there's no gain in changing the frequency of a core that can be switched off via C-states...
It's even possible that those frequency adjustments wake up cores that otherwise would just sit in their lowest C-state.

dev.cpu.freq_levels did not show turbo boost frequency which for this processor is 3.7ghz
It does. Turbo frequency scaling is fully handled by the CPU, so if freq_levels shows 'basefreq+1' it means the CPU has taken over and is running under turbo boost frequencies.
 
No - if the CPU supports C-states, this will give you at least 95% (if not all 100%) of the possible CPU power savings. There's no real gain in throttling a core that can be just turned off via C-states.
Isnt C-State only idle time savings?

throttling could be helpful when cpu is doing some work and full throttle open is not required for that work.
It does. Turbo frequency scaling is fully handled by the CPU, so if freq_levels shows 'basefreq+1' it means the CPU has taken over and is running under turbo boost frequencies.
for me it did not show the boost frequencies as in the attscjed screen shot in the original post.
 
Isnt C-State only idle time savings?
As soon as the CPU has nothing to do, it can enter a higher C-state. Even on a busy host you can often see most cores using the lowest C-state only ~30% of the time because they are send to (partial) sleep while e.g. waiting for IO, network, etc...

for me it did not show the boost frequencies as in the attscjed screen shot in the original post.
just stop powerd (powerdxx often doesn't restore the frequency settings) and have a look at the cpu_freq; it will show 3101Mhz, which refers to "turbo boost" or more general: the CPU handles its clock rate itself.
 
Back
Top