Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - becks0815

#1
And another one....

Just like with the C-states, I also played around with powerd. Tried to run my sys with "minimum" as power profile which resulted in an immediate drop in the CPU core temp on the most used core 3 by 4°C (from 60°C down to 56°C), but ended in network discos due to the cpu being overrun when trying to push 20 MB data/sec over the firewall.

Then I tried some settings with powerd and fine tune adaptive mode on command line, but this resulted in nor eal improvements.

And here comes powerd++ (https://github.com/lonkamikaze/powerdxx) which - according to the author(s) offers a much better way in handling/scaling the CPU based on the load.

Installation is pretty easy:

1) open the opnsense frontend, and under system -> settings -> misc disable powerd.
2) Open a shell on the FW box, change to the home directory of root, then install git:
# pkg install git

3) Clone powerd++, change to the directory, compile and install it:

# git clone https://github.com/lonkamikaze/powerdxx.git
# cd powerdxx/
# make
# make install


4) change the config for powerd++ by editing /etc/rc.conf:

# nano /etc/rc.conf

rc.conf:
powerdxx_flags="-a adp -n adp -m 480 -M 1600" # set adaptive mode, min frequency to 480 and max freq to 1600 MHz


5) Enable powerd++ and start it:

# service powerdxx enable
# service powerdxx start



Results on my end:
When running powerd in combination with minimum as cpu profile, idle temp of core 0 was 55-56°C but I ran into network disruptions as soon as I tried to push 12 MB/sec or more data from WAN to LAN. With powerd/adaptive I ended up on 59-60°C SPU core temp and 63°C under load, but was able to push 20 MB/sec without issues.

With powerd++ / adaptive (no other changes applied), idle temp is at 57°C and I have no network problems pushing 20 MB/sec with core 0 reaching 59°C max.

As soon as I can shutdown the box and plug in a powermeter I can have a look at how much difference this makes, but based on the initial results you can save some energy.
#2
I have a protectli Fw4 clone, running 22.1.6. While playing around with methods to reduce power consumption, I spotted the following:



root@OPNsense:~ # sysctl dev.cpu |grep cx
dev.cpu.3.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
dev.cpu.3.cx_usage_counters: 304429829 0 0
dev.cpu.3.cx_usage: 100.00% 0.00% 0.00% last 312us
dev.cpu.3.cx_lowest: C1
dev.cpu.3.cx_supported: C1/1/1 C2/2/500 C3/3/1000
dev.cpu.2.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
dev.cpu.2.cx_usage_counters: 352002831 0 0
dev.cpu.2.cx_usage: 100.00% 0.00% 0.00% last 47us
dev.cpu.2.cx_lowest: C1
dev.cpu.2.cx_supported: C1/1/1 C2/2/500 C3/3/1000
dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
dev.cpu.1.cx_usage_counters: 288856368 0 0
dev.cpu.1.cx_usage: 100.00% 0.00% 0.00% last 305us
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_supported: C1/1/1 C2/2/500 C3/3/1000
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
dev.cpu.0.cx_usage_counters: 268697840 0 0
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 529us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/500 C3/3/1000



My machine is able to support C1, C2 and C3 states, but the lowest C-state set by the OS is C1, and therrfor all cores run on C1 for 100% of the time.


Then I ran the commands to change this:




# sysctl dev.cpu.0.cx_lowest=C3

# sysctl dev.cpu.1.cx_lowest=C3

# sysctl dev.cpu.2.cx_lowest=C3

# sysctl dev.cpu.3.cx_lowest=C3





and now I can see the following:



root@OPNsense:/usr # sysctl dev.cpu.0.cx_usage
dev.cpu.0.cx_usage: 49.94% 20.18% 29.86% last 7798us



So core 0 suddenly only keeps C1 for 50% of the time but drops to C2/C3 for the rest. This should reduce power consumption at least a bit.


As far as I understand, I can also add the settings in the tunables in opnsense and make them permanent. I just had no time to run some tests with my FW to confirm this. I also lack a method to monitor the power consumption at the moment but will do this as soon as I can shut down the FW and plug in a power meter.


Maybe someone else wants to try this and test if he can save some energy by enabling unused C-states of his hardware?