OpenWrt Forum Archive

Topic: CPU Frequency Scaling on x86

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have just installed the 15.05-rc1 x86 generic build on an older laptop with a Core 2 Duo T7500 processor.  Almost everything is working fine, but the CPU runs continuously at the full speed of 2.2gHz instead of throttling down when idle as it should.  I searched the forum, wiki, and Google and looked through the list of available packages for anything cpufreq related, but couldn't find anything.  Is it possible to get CPU frequency scaling to work with OpenWRT x86, or would it be necessary to recompile the kernel for this?

I'm not able to answer to your question, and I'm sorry about that, but since I saw CPU frequency scaling options only into kernel menuconfig I think that it is necessary to recompile, but as I said I'm not sure.

In any case, I'm curious, how did u measured the CPU frequency?

I used "cat /proc/cpuinfo".

I can definitely recompile the kernel and I may very well end up doing that; I was just hoping to avoid that hmm

If I don't mistake cpuinfo contains only the info about the CPU, I mean it's a static read of the cpu properties (stuff like cache, cores, ...), is not a dynamic read of the status of the CPU.
So the frequency that you're reading is the is the maximum frequency of the CPU.

mirko_47 wrote:

If I don't mistake cpuinfo contains only the info about the CPU, I mean it's a static read of the cpu properties (stuff like cache, cores, ...), is not a dynamic read of the status of the CPU.
So the frequency that you're reading is the is the maximum frequency of the CPU.

I dont think so (my CPU is 3GHz)

$ cat /proc/cpuinfo 
processor    : 0
vendor_id    : AuthenticAMD
cpu family    : 16
model        : 6
model name    : AMD Athlon(tm) II X2 250 Processor
stepping    : 2
microcode    : 0x100009f
cpu MHz        : 800.000
cache size    : 1024 KB
physical id    : 0
siblings    : 2
core id        : 0
cpu cores    : 2
apicid        : 0
initial apicid    : 0
fpu        : yes
fpu_exception    : yes
cpuid level    : 5
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt hw_pstate npt lbrv svm_lock nrip_save vmmcall
bugs        : tlb_mmatch apic_c1e fxsave_leak
bogomips    : 5999.78
TLB size    : 1024 4K pages
clflush size    : 64
cache_alignment    : 64
address sizes    : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate

...and the other core...

The 800Mhz value changes with load.
This is not from OpenWrt though, but I guess the Linux kernel behaves and reports the same in OpenWrt and Xubuntu.

(Last edited by zo0ok on 25 May 2015, 14:30)

I would check:

/sys/bus/cpu/drivers/processor/cpu0/cpufreq
zo0ok wrote:

I would check:

/sys/bus/cpu/drivers/processor/cpu0/cpufreq

That file doesn't exist.

Ok... I dont have an x86/x64 OpenWrt-machine. You should have

/sys/bus/cpu/drivers

On my OpenWrt (ar71xx) that folder is empty, but in Xubuntu (x64) it contains stuff.

I think usually you should have some daemon checking system load and adjusting cpufreq. But I think you can also manually change cpufreq by writing to (virtual) files somewhere under that folder. However, as mentioned earlier, a kernel recompile or kernel module might be required. Again, no personal experience with OpenWrt on x64.

There isn't anything under there pertaining to cpufreq, so I did "ls -al / | grep -i cpufreq" and that didn't turn up anything either.  It looks like the OpenWRT kernel just doesn't support it on x86.  I should probably file a bug.  That is a pretty important thing to be missing.

maybe this can help you:
http://unix.stackexchange.com/a/87537
so it seems that I was defenetly wrong, sorry.

(Last edited by mirko_47 on 25 May 2015, 20:53)

mamarley wrote:
zo0ok wrote:

I would check:

/sys/bus/cpu/drivers/processor/cpu0/cpufreq

That file doesn't exist.

On my GoFLEX Home, it is under (which is a symbolic link):

[root@GoFLEX:/root 20%] # ls /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_cur_freq

When my system is idle, the CPU frequency shows about 400 MHz as below:

[root@GoFLEX:/root 20%] # cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_cur_freq 
400000
[root@GoFLEX:/root 21%] # cat /proc/cpuinfo 
processor    : 0
model name    : Feroceon 88FR131 rev 1 (v5l)
BogoMIPS    : 397.03
Features    : swp half fastmult edsp 
CPU implementer    : 0x56
CPU architecture: 5TE
CPU variant    : 0x2
CPU part    : 0x131
CPU revision    : 1

Hardware    : Marvell Kirkwood (Flattened Device Tree)
Revision    : 0000
Serial        : 0000000000000000
[root@GoFLEX:/root 22%] #

However, when I start doing some heavy works on my GoFLEX Home, the CPU frequency throttled to max as shown below:

[root@GoFLEX:/root 23%] # cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_cur_freq
1200000
[root@GoFLEX:/root 24%] # cat /proc/cpuinfo
processor    : 0
model name    : Feroceon 88FR131 rev 1 (v5l)
BogoMIPS    : 1191.11
Features    : swp half fastmult edsp 
CPU implementer    : 0x56
CPU architecture: 5TE
CPU variant    : 0x2
CPU part    : 0x131
CPU revision    : 1

Hardware    : Marvell Kirkwood (Flattened Device Tree)
Revision    : 0000
Serial        : 0000000000000000
[root@GoFLEX:/root 25%] #

(Last edited by mazilo on 26 May 2015, 13:23)

Guys,
sorry but I'm playing with it and had no possibility to find any relevant infos around. Could you please explain to a newbie to openwrt how to turn on cpu prefquency scaling on x86? It's the only thing blocking me on putting it in production.

Thanks in advance!

The discussion might have continued from here.