Frequency scaling

It looks like FreeBSD on AMD platform scales all cores at the same time and in a manner, where it raises frequency immediately when load increases, but then slowly lowers the frequency over the next minute or two when load drops.

Is it possible to set frequency scaling module to only raise frequency of the core that performs work and drop it much quicker once there is no more load?
 
I have been wondering the same, but I am not sure that the CPU (APU, actually) I have supports scaling cores individually. I say this based on looking at the output of sysctl dev.cpu:

Code:
$ sysctl dev.cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.P000
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 175
dev.cpu.0.freq_levels: 3200/14210 2900/10695 2600/7455 2275/6523 2200/5530 1925/4838 1800/4312 1575/3773 1400/3150 1225/2756 1050/2362 875/1968 700/1575 525/1181 350/787 175/393
dev.cpu.0.cx_supported: C1/1/0 C2/2/100
dev.cpu.0.cx_lowest: C2
dev.cpu.0.cx_usage: 7.35% 92.64% last 365us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.P001
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/1/0
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00% last 16985us
dev.cpu.2.%desc: ACPI CPU
dev.cpu.2.%driver: cpu
dev.cpu.2.%location: handle=\_PR_.P002
dev.cpu.2.%pnpinfo: _HID=none _UID=0
dev.cpu.2.%parent: acpi0
dev.cpu.2.cx_supported: C1/1/0
dev.cpu.2.cx_lowest: C1
dev.cpu.2.cx_usage: 100.00% last 645us
dev.cpu.3.%desc: ACPI CPU
dev.cpu.3.%driver: cpu
dev.cpu.3.%location: handle=\_PR_.P003
dev.cpu.3.%pnpinfo: _HID=none _UID=0
dev.cpu.3.%parent: acpi0
dev.cpu.3.cx_supported: C1/1/0
dev.cpu.3.cx_lowest: C1
dev.cpu.3.cx_usage: 100.00% last 1604us

Only cpu.0 has freq/freq_levels, and I am assuming that the frequency of the other CPU cores follows cpu.0
 
I know mine (A6-3670) does under Linux and Windows:

Code:
$ sysctl dev.cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.C000
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 800
dev.cpu.0.freq_levels: 2700/27402 2400/23787 2100/20007 1900/17340 1600/14455 1300/11276 1100/9130 800/6765
dev.cpu.0.cx_supported: C1/1/0 C2/2/100
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00% 0.00% last 14757us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.C001
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/1/0 C2/2/100
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00% 0.00% last 21248us
dev.cpu.2.%desc: ACPI CPU
dev.cpu.2.%driver: cpu
dev.cpu.2.%location: handle=\_PR_.C002
dev.cpu.2.%pnpinfo: _HID=none _UID=0
dev.cpu.2.%parent: acpi0
dev.cpu.2.cx_supported: C1/1/0 C2/2/100
dev.cpu.2.cx_lowest: C1
dev.cpu.2.cx_usage: 100.00% 0.00% last 35934us
dev.cpu.3.%desc: ACPI CPU
dev.cpu.3.%driver: cpu
dev.cpu.3.%location: handle=\_PR_.C003
dev.cpu.3.%pnpinfo: _HID=none _UID=0
dev.cpu.3.%parent: acpi0
dev.cpu.3.cx_supported: C1/1/0 C2/2/100
dev.cpu.3.cx_lowest: C1
dev.cpu.3.cx_usage: 100.00% 0.00% last 25838us

The gnome frequency scaling monitor seems to behave different under FreeBSD: it does not allow to change between Economy and Performace - it rather does that all by itself.

Another observation is that after I changed the Xorg video driver from VESA to AMD, downscaling is much faster, within a few seconds, just like in Linux. So the only remaining request would be to scale individual cores.
 
I've got an A8-5500, but I've only ever run FreeBSD on it, so I have nothing to compare against. It's also headless, so no X or graphical monitors... I just use sysctl dev.cpu to see how powerd manages the frequencies.
 
Even though I do not have A8, only A6 and A10, I know for certain that all these APUs will scale individual cores. Even Phenom II could do that.
 
Frequency reduction gives power saving only together with voltage reduction. I very much doubt that even modern CPUs can control voltage separately for each CPU core. Any way, per-CPU frequency scaling, even if possible, is not so trivial since it would require close scheduler integration, that is why it is not supported by FreeBSD now.

Also, if some cores are completely idle, they should not reduce frequency, but go into some special idle state (C-state), that is much more efficient for power saving. For AMD CPUs C-states are controller by SMI BIOS code. For Intel they are controlled by OS and can be enabled by adding to /etc/rc.conf lines:
Code:
performance_cx_lowest="LOW"
economy_cx_lowest="LOW"
 
Back
Top