Topton sell a unit ideal for OPNSense. Based off an Intel N100, with an Intel i226 4 port 2.5GbE switch, HDMI, DisplayPort, NVMe and 6 USB.. it's ideal. But unfortunately, it runs hot.
Out-of-the-box Optimised PL Optimised OPNSense
Cores 4 4 4
Clock 2863hz 2863hz 1480-1678mhz
Power 11w 7w 5W
Ambient 24c 24c 24c
CPU temp 50c 45c 35-36c
Here's how to lower the power usage (and temperature) given the box uses only 5-10% of CPU utilisation for OPNSense...
Rear:
- 12th Gen Intel N100 i226
- Project Version BK-1264NP Ver 1.5
- Board [1.4]
- BIOS v1.5
- BIOS Build Date 09/28/2023 17:23:35
- Version 2.22.1287
Hardware optimisations
Before software tweaks, I made the following hardware checks/improvements:
- Reapply the thermal paste.
- Check the gap between the CPU and case heatsink, install a copper shim if needed.
- [Consider adding a 120mm 12v fan, using the motherboard fan controller - to explore]
Software optimisations
The notable challenge being the BIOS as supplied v1.5, has all of the power management controls hidden / locked.
1. Prep
Connect external display via HDMI and a USB keyboard.
Then power on the unit and press DEL to get into the BIOS settings.
2. Enable advanced BIOS
There's no need to mess about with a hacked BIOS...Use this trick to enable all BIOS functions.
Go to:
> Bios
> Chipset
> System agent configuration
>graphics configuration
set "yellow screen workaround" to enable
All settings will unlock in bios.
3. BIOS optimisations
Advanced > ACPI Settings
Key Value Default
Enable ACPI Auto Configuration Auto Disabled
Advanced > CPU Configuration
Key Value Default
PECI Disabled Enabled
Advanced > Power & performance > CPU – Power Management Control
Key Value Default
Boot performance mode Turbo Performance Turbo Performance
Intel(R) SpeedStep(tm) Enabled Enabled
Platform PL1 Enable Enabled Enabled
Platform PL1 Power 6000 (n100) 50000
Platform PL2 Enable Enabled Enabled
Platform PL2 Power 25000 (n100) 65000
C states Enabled Enabled
Per:
Advanced Power & performance > CPU – Power Management Control > CPU VR Settings > Acoustic Noise Settings > Acoustic Noise Mitigation (Only SSD SATA drive)
Key Value Default
Acoustic noise mitigation Enabled Disabled
Chipset > PCH-IO Configuration > PCI Express Configuration
Key Value Default
DMI Link ASPM Control Auto Auto
Chipset > PCH-IO Configuration > PCI Express Configuration > PCI express root port <1-11>
Key Value Default
ASPM Auto Disabled
Advanced > Power & performance > GT Power Management Console
Key Value Default
Maximium GT Frequency 450 Mhz Default max frequency
Advanced > Power & performance > CPU – Power Management Control
Key Value Default
Boot performance mode Max non-turbo performance Turbo Performance
Props to:
olavrb original post
Maciej Zytowiecki
source: https://windgate.net/topton-n5095-n5105-n100-opnsense-proxmox-powersave-tuning/
4. OPNSense optimisations
4.1 PowerD
PowerD is about how fast the CPU runs when it’s doing work (active management of frequency).
OPNSense is based on FreeBSD, and according to this section of the FreeBSD handbook:
https://docs.freebsd.org/en/books/handbook/config/#hwpstate_intel
It has the following note regarding PowerD and EIST (Enhanced Intel SpeedStep Technology):
NOTE: Users accustomed to using powerd or sysutils/powerdxx will find these utilities have been superseded by the hwpstate_intel driver and no longer work as expected.
The Intel N100 shows SpeedStep in the BIOS, although some further reading online also suggests that PowerD under FreeBSD should be avoided.
To adjust setting via OPNSense GUI - Go to:
> OPNSense
> System
> Advanced
> Misc settings.
Turn off PowerD and set to Adaptive to start off for all states.
4.2 C-state (CPU idle states)
C-states defines how deep the CPU sleeps when it’s doing nothing (idle management).
Applies to idle CPU cores (C1, C3, C6, etc.)
Range/Settings are discrete states: C0 (active) to Cn (deeper sleep = more power saving)
Setting C-state via **hw.acpi.cpu.cx_lowest** refers to the lowest allowable CPU idle power-saving state, that the operating system is allowed to use for the CPU.
The higher the C-state number, the deeper the sleep and the more power is saved—but with increased latency to return to an active state
C-State | Description | Power Usage | Wake-up Latency | Notes |
---|---|---|---|---|
C0 | Active (executing instructions) | High | N/A | CPU is working. |
C1 | Halt | Low | Very Low | Fast wake; minimal power save. |
C2 | Stop clock | Lower | Medium | More savings than C1. |
C3 | Sleep (cache not maintained) | Even Lower | Higher | Deeper sleep; longer wake. |
C6+ | Deep Sleep/Power Gated | Minimal | High | Cache flushed, registers lost. |
To check C-state via CLI:
sudo sysctl hw.acpi.cpu.cx_lowest
This for me by default returned C1
To set this via CLI to C3 run:
sudo sysctl hw.acpi.cpu.cx_lowest=C3
To adjust setting via OPNSense GUI - Go to:
> OPNSense
> System
> Advanced
> Tunables and add entries below:
TUNABLES ADDITIONAL PARAMETERS
Value
dev.cpu.0.cx_lowest C3
dev.cpu.1.cx_lowest C3
dev.cpu.2.cx_lowest C3
dev.cpu.3.cx_lowest C3
sysctl hw.acpi.cpu.cx_lowest C3
4.3 EPP (Energy Performance Preference)
EPP (Energy Performance Preference) balances performance vs energy efficiency when CPU is active.
Applies to active CPU workloads (C0 state)
Range/Settings are numeric: 0 (performance) to 255 (efficiency) per core
To check existing EPP via CLI:
sudo sysctl -a | grep epp
This for me returned out-of-the-box EPP=50 to increase energy saving try adjusting to 90/100
To set EPP via CLI:
sudo sysctl dev.hwpstate_intel.0.epp=90
sudo sysctl dev.hwpstate_intel.1.epp=90
sudo sysctl dev.hwpstate_intel.2.epp=90
sudo sysctl dev.hwpstate_intel.3.epp=90
To adjust setting via OPNSense GUI - Go to:
> OPNSense
> System
> Settings
> Tunables
TUNABLES ADDITIONAL PARAMETERS
Value
dev.hwpstate_intel.0.epp 90
dev.hwpstate_intel.0.epp 90
dev.hwpstate_intel.0.epp 90
dev.hwpstate_intel.0.epp 90
Miscellaneous
PowerD configuration via scripts [not currently effective]
1) Create a custom_startup script
sudo vi /usr/local/etc/rc.d/custom_startup.sh
Add:
#!/bin/sh
# PROVIDE: custom_startup
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name="custom_startup"
start_cmd="custom_startup"
stop_cmd=":"
custom_startup()
{
sysctl dev.hwpstate_intel.0.epp=90
sysctl dev.hwpstate_intel.1.epp=90
sysctl dev.hwpstate_intel.2.epp=90
sysctl dev.hwpstate_intel.3.epp=90
}
load_rc_config $name
run_rc_command "$1"
sudo mv /usr/local/etc/rc.d/custom_startup.sh /usr/local/etc/rc.d/custom_startup
sudo vi /etc/rc.conf.local
custom_startup_enable="YES"
No comments:
Post a Comment
Note: only a member of this blog may post a comment.