So, entering this 4 lines is all you need to do in order to use 4 cores of A53? Do you need to change some settings in the router (Lucy)? What about A72 processor? Does it remain idle? I'm using R4S 4Gb RAM only for basic stuff (firewall, DNS, DHCP server, vLANs) with Lucy, no Docker etc. My ISP connection is 1000/100 Mbps.
It works for me but these commands give error in stock FriendlyWrt: echo 4 > /proc/irq/27/smp_affinity .... echo: write error: Invalid argument, I manually enter it in the file.
Also when you restart the device, the settings are deleted.
Yeah these commands dont stick unless you stop messing with your router, so yeah an update could also remove them...
Btw the person who actually has found the proper commands and did a lot of testing regards cpu affinity on the nanopi r4s was not me but @walmartshopper , my part on all of this was to engage on a discussion about the matter with @walmartshopper which lead him to do some testing and share here on this thread the results and the commands.
And since then i learned a bit more about the cpu affinity(still there is a lot to learn), but some time ago i stopped wasting my time with this for now! Because like i said, the default cpu affinity is enough for my needs with a 500/250 mb connection and because i want to wait for 22.03 to do a proper build that will suit my needs(for now i compile either friendly wrt or anaelorlinski)
Maybe @walmartshopper can come back here with a way to do the irq + queues adjustment permanently, in other words, make them stick in all cases? Or to proper spread the load to all 6 cores? Cause right now you can only use 4 cores(2 a53 and 2 a72) since with these commands the irq load wont spread in more than 2 cores, its one per eth.
"The number you echo into the file defines which CPUs to use. It's basically a binary number where each bit represents one CPU, then convert that to hex. Rightmost bit is CPU 0."
#ETH0 irq on core 2(a53 core)
echo 4 > /proc/irq/IRQ-NUMBER/smp_affinity
#ETH1 irq on core 3(a53 core)
echo 8 > /proc/irq/IRQ-NUMBER/smp_affinity
#ETH0 queues on core 4(a72 core)
echo 10 > /sys/class/net/eth0/queues/rx-0/rps_cpus
#ETH1 queues on core 5(a72 core)
echo 20 > /sys/class/net/eth1/queues/rx-0/rps_cpus
Binary = hex = cpu core
00000001 = hex 1 = cpu core 0
00000010 = hex 2 = cpu core 1
00000100 = hex 4 = cpu core 2
00001000 = hex 8 = cpu core 3
00010000 = hex 10 = cpu core 4
00100000 = hex 20 = cpu core 5
In theory we should be able to spread the irq load of both ETH on all four a53 cores with something like this:
Binary = hex = cpu core
00001111 = hex F = cpu cores 0,1,2,3
#ETH0 irq on cores 0, 1, 2 and 3 (a53 cores)
echo F > /proc/irq/IRQ-NUMBER/smp_affinity
#ETH1 irq on cores 0, 1, 2 and 3 (a53 cores)
echo F > /proc/irq/IRQ-NUMBER/smp_affinity
But it does not work, the load of both irq of both eth will only spread to one of the four a53 cores. In my testing it will be the first core, in other words, core 0.
So the commands that i have provided, will put the irq of each eth in one a53 core and the queues of each eth in one a72 core, in other words we are going to be using 4 of the 6 cores of the nanopi r4s, the first two will remain mostly idle unless you install a package that might use those cores.
From all the testing that has been done before by @walmartshopper and myself as well, the best result is always to put the queues on the a72 cores that are stronger and the irq on the a53 cores, but like i said right now manually with these commands you will be able to use 2 of the a53 cores instead of the 4 a53 cores.
There is also the automatic way like i said, by using irqbalance + packge steering... But manually seems to give far better results cause the auto solution might throw the queues on the a53 cores instead of the a72 cores.
For the settings to stay on a reboot you need to add the commands to rc.local like i said before, but i just did some testing right now and in my case with a custom anaelorlinski build, adding the commands to rc.local does not seem to be working properly, in other words, the affinity was back to default after a reboot even with the commands running on rc.local, did anyone else get this result also?
so i installed & enabled Irqbalance (you also need to install nano to edit the config to enable irqbalance) + i aktivated packet steering now i get 900/50 with sqm + i can restart and change settings in the GUI without losing the speeds.
The problem with irq balance is that at least on my tests, the device ping is not stable... In other words, when you ping the nanopi, instead of a stable ping of 1 ms, you get a lot of ping spikes and those spikes affect everything after the router, the entire route to the destination.
Also you can edit files using winscp with sftp, which is faster and easier than using a command line tool, see below:
You just need to download openssh-sftp-server package, and then use winscp to access the router with the same information(user, password, port and ip) that you used to connect to ssh.
I flashed the squashfs sysupgrade from luci right over my January build and everything is working fine so far (edit: ksmbd may be broken, looks like it's a bad version that many are having issues with)
you can do it easily from here
click on "Customize" and add/remove the packages you want, and then click "request Build". Wait 5min until the firmware is built for you. And finaly download your customized sysupgrade file
That only allows him to personalize the packages that he wants to use, besides packages he wants patchs as well if i did not misunderstood what he wants.
Download the r8168 sources from here. Save the openwrt-r8168 folder into openwrt/package (so you have openwrt/package/openwrt-r8168/Makefile + src)
Once you've done all that, do your make menuconfig and select all the packages you want. Make sure to go into the kernel network drivers and select r8168 and de-select r8169. Also select "firewall" and de-select "firewall4" under Base System. This will not include ip6tables-legacy by default, so also go into Network > Firewall and select that (it's needed for banip).