Enable C3 at boot time

Status
Not open for further replies.

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
Hi, everyone!

I have found out that I can minimize the power draw of my server my enabling the C2 and C3 sleep-states of my CPU. They are supported by both FreeNAS and the CPU/Mainboard. I use them regularly and didn't notice any drawbacks, just a lower power consumption (by about 5W in idle).

To do this, I have to execute the command sysctl hw.acpi.cpu.cx_lowest="C3"' every time, I reboot. I think, there should be a way to do this with tunables (since I have a type of "sysctl" there), but I couldn't figure out how. Can you please enlighten me?

Thank you!
 

enemy85

Guru
Joined
Jun 10, 2011
Messages
757
Are u sure freenas supports C3? I read somewhere it only supported C1 & C2
 

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
I can successfully set it, the sysctl reads back "C3" and there is a slight drop in power consumtion. C1 -> C2 is about 4 Watts, C2 -> C3 is about another Watt.
 
D

dlavigne

Guest
Post a screenshot of how you're setting the tunable using the Tunables screen.
 

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
Here it is. I can save the tunable, it's there after reboot, but hw.acpi.cpu.cx_lowest is still "C1". It doesn't matter, if I include the " in the value or not.
 

Attachments

  • tunable.jpg
    tunable.jpg
    22.3 KB · Views: 311

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
Sounds great, thank you!
Since development is such quick with deploying bugfixes, I check for updates daily and apply them immediately. I have the luxury of running the server for my family, so no business-hours to mind. :smile:
I just set the tunable and rebooted and ... no Change. Still C1. However, I can't add the tunable with "C3" anymore. "No quotes allowed". And without quotes, it's still C1.
 

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
Here is a screenshot
 

Attachments

  • tunable.jpg
    tunable.jpg
    20.8 KB · Views: 295

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
...and the output from the console
 

Attachments

  • tunable.jpg
    tunable.jpg
    21.6 KB · Views: 294

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
However, in the console, I have to enter it with ".
 

Attachments

  • tunable.jpg
    tunable.jpg
    20.9 KB · Views: 296
D

dlavigne

Guest
That is weird. Though, yes, you should not include the quotes when setting the sysctl. After setting manually, are you seeing it in /etc/sysctl.conf after a reboot? And, after setting in the GUI, does is show in /etc/sysctl.conf after a reboot? Anything in /var/log/dmesg.boot mentioning that setting?
 

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
Hi, everybody! Thank you for your quick help.

@Fraoch : Thank you, I do fully understand the ramifications. I also read up on the differences in timer handling between 9.2 and 9.3, which handles most of the problems FreeBSD<9.2 had.

@dlavigne : Neither after setting it manually, nor after adding the tunable, my /etc/sysctl.conf changes. It is still:
-----------------------
# Template sysctl.conf file... Maybe we should put these in the database by default.

# By default, FreeBSD flushes things to disk every 30s or so. In an embedded
# environment, this can leave too much data unflushed. Reduced these times to
# about as short as you can go. The syncer flushes these different types
# of blocks after they have been in the queues for X seconds. It is critical
# that metadelay < dirdelay < filedelay and no fractions are allowed.

kern.metadelay=3
kern.dirdelay=4
kern.filedelay=5
kern.coredump=1
kern.sugid_coredump=1
net.inet.tcp.delayed_ack=0
vfs.timestamp_precision=3
----------------------
My dmesg doesn't show anything, even a dmesg|grep sysctl, dmesg|grep C1 and dmesg|grep C3 didn't show any result. A dmesg|grep acpi showed nothing of interest:
acpi0: <HPQOEM SLIC-WKS> on motherboard
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
cpu4: <ACPI CPU> on acpi0
cpu5: <ACPI CPU> on acpi0
cpu6: <ACPI CPU> on acpi0
cpu7: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
acpi_button0: <Power Button> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
acpi0: <HPQOEM SLIC-WKS> on motherboard
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
cpu4: <ACPI CPU> on acpi0
cpu5: <ACPI CPU> on acpi0
cpu6: <ACPI CPU> on acpi0
cpu7: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
acpi_button0: <Power Button> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
acpi0: <HPQOEM SLIC-WKS> on motherboard
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
cpu4: <ACPI CPU> on acpi0
cpu5: <ACPI CPU> on acpi0
cpu6: <ACPI CPU> on acpi0
cpu7: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
acpi_button0: <Power Button> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
I don't recommend C3, but as a hacky way to get around this problem you could just create a startup script that runs the appropriate command on bootup. Then you'd get your delicious C3 and the WebGUI bug won't hold you back. ;)
 

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
Thank you. Does anyone think, I should also file a bug?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
It does sound like a bug ticket is recommended.
 

Blues Guy

Explorer
Joined
Dec 1, 2014
Messages
69
I did and got the following answer:
sysctls are not put into sysctl.conf, they are set in runtime by ix-sysctl.

hw.acpi.cpu.hw_CX.lowest is a special sysctl that get resetted by a custom rc.d script later on the boot process.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
That.. kind of.. sucks.

So my "hacky" way I mentioned above should work just fine. :)
 
Status
Not open for further replies.
Top