# CPU freq_levels



## BAlexandrov (Jun 14, 2016)

Hi all!

Sometime ago I remember that my router scaled down CPU freq to 200Mhz.
Recently I've checked and there are only two freq levels:
freq_levels: 1867/135000 1596/89602 and it stays at 1596Mhz.

I need it to scale down to 200Mhz to conserve power - its a home server with low load. Also there aren't C2, C3 states.

I was on 10.2, upgraded to 10.3 without improvement.
The system is: HP Compaq dc7700 Small Form Factor, Intel(R) Core(TM)2 CPU 6300  @ 1.86GHz


```
#uname -a
FreeBSD jdmfsm.info 10.3-RELEASE-p4 FreeBSD 10.3-RELEASE-p4 #0: Sat May 28 09:52:35 UTC 2016     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
```


```
#dmesg|grep cpu
cpu0 (BSP): APIC ID:  0
cpu1 (AP): APIC ID:  1
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
est1: <Enhanced SpeedStep Frequency Control> on cpu1
```


```
# sysctl dev.cpu
dev.cpu.1.cx_usage: 100.00% last 9162us
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_supported: C1/1/0
dev.cpu.1.%parent: acpi0
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%location: handle=\_PR_.CPU1
dev.cpu.1.%driver: cpu
dev.cpu.1.%desc: ACPI CPU
dev.cpu.0.cx_usage: 100.00% last 1328us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/0
dev.cpu.0.freq_levels: 1867/135000 1596/89602
dev.cpu.0.freq: 1596
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.%parent:
```

Some suggestions?


----------



## windscape (Jun 14, 2016)

The first thing that comes to mind is that your CPU usage on both cores is at 100%, as indicated by the dev.cpu.N.usage lines. 

Use the top command to determine what process is using your CPU cores. 

If the CPU cores are constantly being used, they will stay at the highest clock frequency.


----------



## BAlexandrov (Jun 15, 2016)

Thanks, but no that is not the case. The CPU is >99% idle. That param dev.cpu.N.usage seems always stay at 100% not sure why and what it means.
As is seen the CPU is actually at the lower freq  "dev.cpu.0.freq: 1596" and not at the max 1867.

The problem is that the lower freq_levels disappeared and it can't go lower even manually:

```
# sysctl dev.cpu.0.freq=200
dev.cpu.0.freq: 1596 -> 1596
```

That wasn't the case with previous version (probably 9.something that I remember) and the same system.


----------



## BAlexandrov (Jun 15, 2016)

Phew got it...
My /boot/loader.conf was empty but probably somewhere defaults have changed.
Adding this to /boot/loader.conf solves it:

```
hint.p4tcc.0.disabled="0"
hint.acpi_throttle.0.disabled="0"
```

Sysctl output:

```
# sysctl dev.cpu
dev.cpu.1.cx_usage: 100.00% last 6212us
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_supported: C1/1/0
dev.cpu.1.%parent: acpi0
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%location: handle=\_PR_.CPU1
dev.cpu.1.%driver: cpu
dev.cpu.1.%desc: ACPI CPU
dev.cpu.0.cx_usage: 100.00% last 961us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/0
dev.cpu.0.freq_levels: 1867/135000 1633/118125 1596/89602 1396/78401 1197/67201 997/56001 798/44801 598/33600 399/22400 199/11200
dev.cpu.0.freq: 199
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.%parent:
```


----------



## kpa (Jun 15, 2016)

Please read the linked document, those drivers were disabled by default for pretty good reasons:

https://wiki.freebsd.org/TuningPowerConsumption


----------



## BAlexandrov (Jun 15, 2016)

Thank you, during the research I've came across that article but failed to find these "good reasons" in a test of one person on one laptop and old FreeBSD. Also my CPU seems to not support many C states...
Also I didn't realized that the default now is disabled and not recommended to be disabled as per article and initially I've dismissed that as possible to be my case.

I don't have hardware power meter so will plug one external and check the actual consumption.


----------

