# Trying to lower idle consumption < 39W: Unable to set C2 state



## soobaerodude (Jul 11, 2010)

I'm trying to build a low power ZFS home NAS server with FreeBsd.  I've installed the 8.0-Release on the following base hardware:

Athlon II X2 250u - 1.6GHz 25W TDP Dual Core Processor
Biostar TA760G M2+ (capable of < 30W systems with Linux)
250GB Hitachi 2.5" SATA laptop drive
4GB DDR2-533 ECC
250W Sparkle SPI250EP 80+ Power Supply

I've tried to be thrifty in the BIOS:
-Enabled Powernow
-Lowered CPU voltage to 0.9875V
-Reduced on-board graphics clock from 500MHz to 150MHz
-Disabled floppy drives, serial and parallel ports
-ACPI 2.0

I then tried to follow the Tuning Power Consumption tutorial:
-Enabled powerd, with 800 MHz as the lowest frequency
-Disabled throttling

I tried to enable the C2 state, by putting the following in /etc/rc.conf:

```
performance_cx_lowest="C2"
economy_cx_lowest="C2"
```

However, on bootup I see the following warning:

```
/etc/rc.d/power_profile: WARNING: unable to set hw.acpi.cpu.cx_lowest=C2
```

Is there something else I need to do?  Here's what sysctl dev.cpu says:

```
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.P001
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 800
dev.cpu.0.freq_levels: 1600/0 1400/8800 800/4500
dev.cpu.0.cx_supported: C1/0
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00% last 500us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.P002
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/0
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00% last 500us
```

And if it helps, here's what dmesg | grep -i cpu says:  (Shouldn't it say I have a K10-class CPU? Shouldn't I see Cool n Quiet enabled on cpu 1?)

```
CPU: AMD Athlon(tm) II X2 250u Processor (1600.10-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
cpu0: <ACPI CPU> on acpi0
hwpstate0: <Cool`n'Quiet 2.0> on cpu0
cpu1: <ACPI CPU> on acpi0
SMP: AP CPU #1 Launched!
```

As setup, my Kill-A-Watt says it's using 39W at the plug idle, which I'd like to lower.  Any help appreciated.


----------



## aragon (Jul 11, 2010)

It looks like your CPU does not support C-states above C1.  Here is dev.cpu from a notebook which does:


```
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 800
dev.cpu.0.freq_levels: 2501/32000 2000/24000 1600/18000 1200/13000 800/10000
dev.cpu.0.cx_supported: C1/1 C2/1 C3/57
dev.cpu.0.cx_lowest: C3
dev.cpu.0.cx_usage: 0.00% 9.52% 90.47% last 854us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.CPU1
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/1 C2/1 C3/57
dev.cpu.1.cx_lowest: C3
dev.cpu.1.cx_usage: 0.00% 11.10% 88.89% last 5422us
```

You might consider using/modifying a notebook for your purposes.  They always have much better power saving capabilities than desktops.  My 2.5 GHz Core 2 Duo Dell idles at 9.4 Watts with the LCD screen on and WiFi+Bluetooth off (7 Watts with the screen off).


----------



## soobaerodude (Jul 11, 2010)

I'm trying to find information on what C-states are supported by my CPU, but information is hard to find.  The C-state table in this article indicates that it should have at least a C1E state.

I'm trying to build a 6 disk RAIDZ-2 system, I don't think a laptop could accomodate that


----------



## aragon (Jul 11, 2010)

soobaerodude said:
			
		

> I'm trying to build a 6 disk RAIDZ-2 system, I don't think a laptop could accomodate that


Like I said, mod it.  Laptops don't have many SATA ports, but they do have PCI Express interfaces. 

SATA port multiplier could be useful too...


----------



## aragon (Jul 11, 2010)

Another option might be one of these:

http://www.anandtech.com/show/2950

Their idle power measurement isn't much lower than yours, but keep in mind they weren't shooting for efficiency - ATI card and high power PSU are less than ideal.


----------



## soobaerodude (Jul 11, 2010)

aragon said:
			
		

> Another option might be one of these:
> 
> http://www.anandtech.com/show/2950
> 
> Their idle power measurement isn't much lower than yours, but keep in mind they weren't shooting for efficiency - ATI card and high power PSU are less than ideal.



I considered Intel Atom based systems initially, but I wanted ECC support.  You need to purchase Xeon processors and server motherboards (usually much higher cost) to get ECC support on the Intel side.  My build is inspired by this post at silentpcreview Biostar A760G-M2+ - 30W barrier broken, so I know it's possible.

Regarding C-state support on the Athlon II's, I'm puzzled as to why FreeBsd is telling me my cpu only supports C1.  After carefully reading the the C-state article I mentioned earlier, my cpu should support C1, C1E, C2, and C3 states.

Can anyone else with an Athlon II share what [font="Courier New"]sysctl dev.cpu[/font] says for you?


----------



## Erratus (Jul 13, 2010)

soobaerodude said:
			
		

> Can anyone else with an Athlon II share what [font="Courier New"]sysctl dev.cpu[/font] says for you?




```
> dmesg | grep CPU:
CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 4800+ (2500.25-MHz K8-class CPU)

> sysctl dev.cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.P001
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 2500
dev.cpu.0.freq_levels: 2500/65000 2400/60067 2200/50907 2000/42651 1800/35254 1000/17919
dev.cpu.0.cx_supported: C1/0
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00% last 500us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.P002
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/0
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00% last 500us

> dmesg | grep powernow
powernow0: <PowerNow! K8> on cpu0
powernow1: <PowerNow! K8> on cpu1
```
I'm working too on getting C2 and C3 for my Athlon. For now I only know that this is possible via "powernow".


----------



## mav@ (Jul 14, 2010)

C-states should be reported by ACPI BIOS, to be detected, so try to update. Some BIOSes do not support C-states completely, others have some options controlling them. For example, enabling C1E in BIOS may automatically obsoletes C2 state and AFAIK potentially even C3 on some AMDs. On Core i5 board I've also seen BIOS options directly limiting highest reported C-state. Unluckily, I haven't yet seen C-states reported with AMD CPUs, but I haven't looked on AMD laptops yet.


----------



## Erratus (Jul 15, 2010)

@soobaerodude
You run a K8 CPU with cool&quiet.
My K8 CPU runs the powernow driver.
Both do CPU frequency scaling and both do not provide C2 and C3 states.
If you disable frequency scaling my opinion is, this is a shot in your own leg, as scaling of CPU frequency is quite effective.
Punching several times 

```
# sysctl dev.cpu.0.freq
```
shows changing frequencies under different CPU-usage.


----------



## soobaerodude (Jul 15, 2010)

Yeah, as I read more, I've been manually playing with the frequencies


```
sysctl debug.cpufreq.lowest=400
sysctl dev.cpu.0.freq=400
```

But idle power usage remains at 39W.  I was looking at this cpufreq patch to adjust the idle P-state voltage, but I am unable to set the values with it.

Since it seems I can't reduce power consumption any further, I've been looking into sleep and wake on lan.


----------

