R7800 performance

Any suggestions how to get max performance and lowest (internal LAN) latency running in AP mode (no NAT, no WAN). I have already turned off all services that I don't need (firewall, adblocking, dns, dhcp, ...) I normally run hnyman's builds, I use 4 SSIDs (2 on each radio) and 3 VLANs to isolate traffic (e.g. home, guest, work, iot networks)

I keep reading a lot of conflicting info about:

  • setting min CPU freq at 800MHz or L2 cache doesn't function correctly. IIRC there were similar issues in the Android world where you could not run a phone at lowest freq the Qcom CPUs supported or it would lock up.
  • ondemand vs performance governors and tweaks for them
  • IRQ pinning to specific CPU
  • eth0/1 rx/tx tweaks

I have two r7800s running as access points. All non essential services turned off, running latest hynman’s master build.

Bottom line, if your access points are hardwired, you are not going to notice a big difference with all the above tweaks. Wifi speeds don’t strain the CPU much. If you have multiple 5ghz devices simultaneously needing bandwidth, hardwired devices, or higher throughput requirements- doing some CPU tweaks will get you the most bang for buck.

-L2 cache issue was fixed by ansuel in master a month ago. :sunglasses:
-found no benefit to specifying IRQs or ethtool tweaking for an access point
-I’ve run more aggressive ondemand settings vs the performance governor with similar results on the access points. I’ve found getting the CPU to ramp up more quickly (or being on the performance governor) makes the r7800 perform better on testing, especially as you get up there on throughput. With ondemand, over 24 hours I average a 80/20 split on the lower frequency / max CPU frequency with these settings:
echo 35 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold; echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor

2 Likes

What are your measured performance numbers in throughput and latency before and after your reconfiguration? What's your target?

I haven't done any scientific measurements, just trying to see what choices we have and where to look. I tried some eth0/1 rx/tx-usecs tweaks and noticed the wired latency going down by about 0.150ms (from 0.350ms to 0.200ms when pinging the r7800 from a wired linux server). The interesting part is that it matters which direction I ping from, if I ping from r7800 to linux server I'm back to 0.350ms or higher. There are no firewalls involved on either device.

Is there a danger to run performance governor at max 1.7GHz always? The temperature increase seems very low by about 2C and the reported temps stay under 55C.

I wonder whether not adjusting the CPU freq constantly also may contribute to stability, I occasionally get random reboots/freezes with kernel 4.14, with 4.19 I only had 1 random reboot.

As for WiFi stability in general I'm in a tough spot, the "ct" firmware does not work for me with my clients, lots of problems with low power devices such as IoT or with discovery traffic, devices just can't find each other on the WLAN. Classic/old firmware works well but there's no recent master build that works with it, I have to get the "ct" build and just replace the firmware but I wonder how long the "ct" driver will continue to work with "old" firmware or whether there might be weird interactions.

I’ve run the performance governor for weeks with no issues. Adds a couple degrees Celsius, that’s all I’ve seen. Never seen anyone say their router had a shorter life because of the performance governor. DD-WRT by default runs in performance mode on the r7800 as an example.

With all of ansuel’s recent updates I don’t really notice a big difference between aggressive ondemand settings and performance governor.

Increasing the sampling down factor results in less changing (checking to turn the cpu frequency down).

I tried using packet steering with the value of 3 (both cores) and it seems to be working better than the defaults, but the CPU usage was very uneven in my env. FWIW, I decided to try a slightly different config (below) and it resulted in an almost even CPU usage under load and also lowered overall CPU utilization. I am curious if anyone is willing to give it a shot to make sure I am not seeing things.

  find /sys/devices/ -name xps_cpus | while read f; do echo 1 > $f; done
  find /sys/devices/ -name rps_cpus | while read f; do echo 2 > $f; done

I ran with ondemand, up_threshold at 50 and sampling_down_factor at 10, looked at the stats and one of the cores gets to 1GHz every 10 min, while the other core pretty much bounces between 384-800MHz. Temps are about 2C lower than performance at max speed. It looks like AP mode barely needs any CPU.

Curious, what are your current temp values?

50-55C, lower half of the range with ondemand scaling, higher half with performance at max freq. Keep in mind that I run it in AP mode with all non-essential services disabled.

How does ondemand decide to scale down? At what load? It doesn't seem configurable.

It generally selects CPU frequencies proportional to the estimated load, so that the value of the cpuinfo_max_freq policy attribute corresponds to the load of 1 (or 100%), and the value of the cpuinfo_min_freq policy attribute corresponds to the load of 0, unless when the load exceeds a (configurable) speedup threshold, in which case it will go straight for the highest frequency it is allowed to use (the scaling_max_freq policy limit).

From kernel.org

1 Like

Thank you! That is a much better written doc than this.

Just keep in mind that frequency scaling is broken in 19.07 and will make your router slower by ~1/3. There is a back port PR to fix it, but there is no telling if it will be accepted.

I run hnyman's latest master build. I thought that was fixed? If not, what's the solution either on master or if I try a 19.07 stable build? performance governor max speed?

It is fixed in master.

Great. Could someone intimately familiar with the issue please describe what the issue was? Was it the L2 freq not being set right? What was the fix? Going through 384 before stepping up to a higher freq?

With this fix in master, if we use the performance governor, do we still need to step through 800Mhz first? In the past we had to set 800; sleep 1s; set max.

And in general, why do we bother with ondemand and not just set performance at max by default, just like DDWRT seems to do? I see the value of ondemand for devices that run on battery or run hot, but this router doesn't seem to have a heat problem and it's plugged in all the time, drawing a bit more power doesn't really matter.

Your experience may not be the same of everyone... Even a small power save is good and should not be wasted.

2 Likes

ipq806x (as pretty much all highend ARM routers) is running relatively hot (and the radios add their own share of heat to that), so having a dynamic factor in the mix that can scale the CPU as needed does make sense.

2 Likes

Looks like the CPU freq scaling back port fix will be merged into 19.07 soon.

1 Like