OPNsense Forum

English Forums => Hardware and Performance => Topic started by: thowe on August 20, 2019, 09:52:45 pm

Title: Optimized performance of my PC Engines APU2c4
Post by: thowe on August 20, 2019, 09:52:45 pm
My cable provider offers 100mbit/s down and 10mbit/s up.

With my current OPNsense configuration running on an PC Engines APU2c4 I couldn't use the full speed of my provider (75mbit/s down and 10mbit/s up only).

During a research I came across the following instructions for pfsense:
https://teklager.se/en/knowledge-base/apu2-1-gigabit-throughput-pfsense/

I followed the instructions for my OPNsense and made the changes. After a reboot I was astonished: Now my firewall reaches the maximum throughput of my provider.

So I recommend all users of an APU to optimize the settings.
Title: Re: Optimized performance of my PC Engines APU2c4
Post by: thowe on August 20, 2019, 10:35:25 pm
Hmmm. Just realized, that there is a similar page especially for OPNsense:
https://teklager.se/en/knowledge-base/opnsense-performance-optimization/

Somehow this instruction did not work for me.

Using the key/values tunables as set in the loader.conf.local file for pfsense seems to work. See attached screenshot.
Title: Re: Optimized performance of my PC Engines APU2c4
Post by: thowe on August 21, 2019, 10:57:26 pm
Today I flashed the APU2c4 from legacy coreboot 4.0.26 to mainline 4.10.0.0.
The APU2c4 seems to run stable with OPNsense 19.7.2 so far.

I then checked if CPU Core Performance Boost is working with that BIOS. I did this test as described here:
https://github.com/pcengines/apu2-documentation/blob/master/docs/apu_CPU_boost.md

Code: [Select]
# sysctl dev.cpu.0
dev.cpu.0.temperature: 63.6C
dev.cpu.0.cx_method: C1/hlt C2/io
dev.cpu.0.cx_usage_counters: 835226 1766
dev.cpu.0.cx_usage: 99.78% 0.21% last 863us
dev.cpu.0.cx_lowest: C2
dev.cpu.0.cx_supported: C1/1/0 C2/2/400
dev.cpu.0.freq_levels: 1400/-1 1200/-1 1000/-1
dev.cpu.0.freq: 1400
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.P000
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

It looks as the CPU frequency is constantly at 1400 now - without any special load. I never see other frequencies. Before the BIOS upgrade, frequency adapted dynamically to the load. The CPU temperatures are 5 degrees higher with the new BIOS and the new tunables.

Is there something I can do to have the dynamic CPU frequency modes on again?

These are all custom system tunables applied:

Code: [Select]
legal.intel_igb.license_ack="1"
legal.intel_ipw.license_ack="1"
legal.intel_iwi.license_ack="1"
hw.igb.rx_process_limit="-1"
hw.igb.tx_process_limit="-1"
hint.p4tcc.0.disabled="1"
hint.acpi_throttle.0.disabled="1"
hint.acpi_perf.0.disabled="1"
hw.igb.0.fc="0"
hw.igb.1.fc="0"
hw.igb.2.fc="0"
hw.igb.num_queues="0"
hw.igb.rxd="4096"
hw.igb.txd="4096"
net.link.ifqmaxlen="8192"
hw.igb.enable_aim="1"
hw.igb.max_interrupt_rate="64000"
hw.igb.enable_msix="1"
hw.pci.enable_msix="1"
dev.igb.0.eee_disabled="1"
dev.igb.1.eee_disabled="1"
dev.igb.2.eee_disabled="1"

Many thanks for your hints.
Title: Re: Optimized performance of my PC Engines APU2c4
Post by: thowe on August 21, 2019, 11:27:49 pm
Stupid me:

I copied some tunables I found in other posts without much thinking... Of course the CPU scaling was disabled by these tunables:

Code: [Select]
hint.p4tcc.0.disabled="1"
hint.acpi_throttle.0.disabled="1"
hint.acpi_perf.0.disabled="1"


After removal of these tunables I see other frequencies again:

Code: [Select]
root@router:~ # sysctl dev.cpu.0
dev.cpu.0.temperature: 64.1C
dev.cpu.0.cx_method: C1/hlt C2/io
dev.cpu.0.cx_usage_counters: 1542 2330
dev.cpu.0.cx_usage: 39.82% 60.17% last 505us
dev.cpu.0.cx_lowest: C2
dev.cpu.0.cx_supported: C1/1/0 C2/2/400
dev.cpu.0.freq_levels: 1000/952 800/783 600/590
dev.cpu.0.freq: 1000
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.P000
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

The question is, if the CPU really was running at 1400 MHz or not. Probably that is a display error only. But I am not sure.
Title: Re: Optimized performance of my PC Engines APU2c4
Post by: miroco on September 12, 2019, 10:57:52 pm
Did you ever get this tweak to work? I tried to replicate the settings proposed by Teklager but was unsuccessful.