Dynalink DL-WRX36 Askey RT5010W IPQ8072A technical discussion

Crashed the router 2 times when transferring files from usb, had to plug off - plug in the router.

Interesting.
I have a serial adapter plugged into the USB port and is working perfectly fine with IRQs handled by CPU3...

 89:        595          0          0     456655     GIC-0 172 Level     xhci-hcd:usb1

If you're using my script, it's easy to exclude the USB interrupts from IRQ balancing, add a new line in the case statement:

xhci*) ;;

as in:

		case "$desc" in
			arch*)	;;
			ce*)	;;
			xhci*)	;;
...
1 Like

I have a usb SSD attached, transmission is using the disk 24/7 and samba4 occasionally. Do I need to install irqbalance? No?

This is a 20h result using @hnyman 's script

# cat /proc/interrupts
           CPU0       CPU1       CPU2       CPU3       
  9:          0          0          0          0     GIC-0  39 Level     arch_mem_timer
 13:    5408817   12560262    6089234    6028447     GIC-0  20 Level     arch_timer
 16:          2          0          0          0     GIC-0 354 Edge      smp2p
 17:          0          0          0          0     GIC-0 216 Level     4a9000.thermal-sensor
 18:          0          0          0          0     GIC-0 239 Level     bam_dma
 21:          0          0          0          0     GIC-0 270 Level     bam_dma
 22:          4          0          0          0     GIC-0 340 Level     msm_serial0
 23:     148969          0          0          0     GIC-0 178 Level     bam_dma
 24:          0          0          0          0     GIC-0  35 Edge      wdt_bark
 25:          0          0          0          0     GIC-0 357 Edge      q6v5 wdog
 29:          5          0          0          0     GIC-0 348 Edge      ce0
 30:    1862749          0          0          0     GIC-0 347 Edge      ce1
 31:      32230          0          0          0     GIC-0 346 Edge      ce2
 32:     105688          0          0          0     GIC-0 343 Edge      ce3
 34:          0          0          0          0     GIC-0 443 Edge      ce5
 36:          1          0          0          0     GIC-0  72 Edge      ce7
 38:          0          0          0          0     GIC-0 334 Edge      ce9
 39:          0          0          0          0     GIC-0 333 Edge      ce10
 40:          0          0          0          0     GIC-0  69 Edge      ce11
 47:          0          0          0          0     GIC-0 323 Edge      reo2ost-exception
 48:      25903          0          0          0     GIC-0 322 Edge      wbm2host-rx-release
 49:         68          0          0          0     GIC-0 321 Edge      reo2host-status
 50:          0          0          0     109091     GIC-0 320 Edge      reo2host-destination-ring4
 51:          0          0      96983          0     GIC-0 271 Edge      reo2host-destination-ring3
 52:          0      89407          0          0     GIC-0 268 Edge      reo2host-destination-ring2
 53:          0          0          0     113326     GIC-0 267 Edge      reo2host-destination-ring1
 57:          1          0          0          0     GIC-0 263 Edge      ppdu-end-interrupts-mac3
 58:          0          0          0          0     GIC-0 262 Edge      ppdu-end-interrupts-mac2
 59:          1          0          0     620224     GIC-0 261 Edge      ppdu-end-interrupts-mac1
 60:          1          0          0          0     GIC-0 260 Edge      rxdma2host-monitor-status-ring-mac3
 61:          0          0          0          0     GIC-0 256 Edge      rxdma2host-monitor-status-ring-mac2
 62:          1          0          0          0     GIC-0 255 Edge      rxdma2host-monitor-status-ring-mac1
 63:          1          0          0          0     GIC-0 235 Edge      host2rxdma-host-buf-ring-mac3
 64:          0          0          0          0     GIC-0 215 Edge      host2rxdma-host-buf-ring-mac2
 65:          1          0          0          0     GIC-0 212 Edge      host2rxdma-host-buf-ring-mac1
 66:          0          0          0          0     GIC-0 211 Edge      rxdma2host-destination-ring-mac3
 67:          0          0          0          0     GIC-0 210 Edge      rxdma2host-destination-ring-mac2
 68:          0          0          0          0     GIC-0 209 Edge      rxdma2host-destination-ring-mac1
 73:          0          0      66211          0     GIC-0 191 Edge      wbm2host-tx-completions-ring3
 74:          0     121423          0          0     GIC-0 190 Edge      wbm2host-tx-completions-ring2
 75:          0          0          0     116932     GIC-0 189 Edge      wbm2host-tx-completions-ring1
 77:         35          0          0          0     GIC-0  47 Edge      cpr3
 78:   18319138          0          0          0     GIC-0 377 Level     edma_txcmpl
 79:          0          0          0          0     GIC-0 385 Level     edma_rxfill
 80:   13803650          0          0          0     GIC-0 393 Level     edma_rxdesc
 81:          0          0          0          0     GIC-0 376 Level     edma_misc
 82:          0          0          0          0  pmic_arb 51380237 Edge      pm-adc5
 83:          0          0          0          0     smp2p   0 Edge      q6v5 fatal
 84:          1          0          0          0     smp2p   1 Edge      q6v5 ready
 85:          0          0          0          0     smp2p   2 Edge      q6v5 handover
 86:          0          0          0          0     smp2p   3 Edge      q6v5 stop
 87:          0          0          0          0   msmgpio  34 Edge      keys
 88:          0          0          0          0   msmgpio  63 Edge      keys
 89:    1183828          0          0          0     GIC-0 172 Level     xhci-hcd:usb1
 90:         64          0          0          0     GIC-0 353 Edge      glink-native
IPI0:     10332       9616      13842      14374       Rescheduling interrupts
IPI1:   2425221    5509045    5582703    5462254       Function call interrupts
IPI2:         0          0          0          0       CPU stop interrupts
IPI3:         0          0          0          0       CPU stop (for crash dump) interrupts
IPI4:         0          0          0          0       Timer broadcast interrupts
IPI5:      4645       4361       6784       4234       IRQ work interrupts
IPI6:         0          0          0          0       CPU wake-up interrupts
Err:          0

Well you cannot use the irqbalance package, it doesn't work or do anything.
But you seem to have been using the various scripts that statically assign CPU affinities to interrupts.

Speaking of that, I've been experiencing hangs during times of high traffic with the script I've posted yesterday. Sadly, nothing gets logged over remote logging and the unit needs a power-cycle to recover.
I'll try to configure netconsole to see if I can catch some log messages.

1 Like

Wirelessly Attended sysupgrade to SNAPSHOT r23104 yesterday!

Seems we don't need to stop wpad for sysupgrades from here on in?

It was pure luck

1 Like

I got hangs in traffic test when I had balanced the edma IRQs (that seem to handle lan/wan wired), so I restricted my script to just selected ath11k IRQs.

You might test with edma IRQs left at core0.

1 Like

Like: ?

		case "$desc" in
			arch*)	;;
			ce*)	;;
			xhci*)	;;
			edma*)	;;
			*)	"$callback" "/proc/irq/$irq/smp_affinity" || ret=1 ;;
		esac

Like that.
(that script is not from me but from @fif )

Thanks @hnyman , I started with using your script which was running fine, now trying this one :slight_smile:

I hope you have the serial to TTL cable handy :slight_smile:

1 Like
login as: root
root@172.16.17.1's password:


BusyBox v1.36.1 (2023-05-24 06:29:35 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r23104-ef98dc3b3e
 -----------------------------------------------------
root@DL-WRX36:~# service irqbalance-manual status
active with no instances

Yes.
There is no running process (just as expected).
The init script from @fif simply sets the affinities and ends. There is no need for a permanent daemon process.

2 Likes

Has anyone tried with kernel 6.1 ?

Yes. These changes includes the feedback from @Spyros and @hnyman.
I hope it's not bad etiquette to repost the full thing to avoid confusion :slight_smile:...

Install this script in /etc/init.d/irqbalance-manual:

#!/bin/sh /etc/rc.common

# Version 2023-05-29

START=13
USE_PROCD=1
AFFINITY_MIN=2
AFFINITY_MAX=8
AFFINITY_ALL="$(printf %x $(( AFFINITY_MAX * 2 - 1 )))"

set_affinities() {
	local callback="$1" irq desc ret=0
	sed -nre 's!^[[:space:]]*([0-9]+):[[:space:]]+.*[[:space:]]GIC-0[[:space:]]+[0-9]+[[:space:]]+(Level|Edge)[[:space:]]+(.+)$!\1 \3! p' /proc/interrupts | \
	while read irq desc
  	do
		case "$desc" in
			arch*)	;; # Properly balanced
			ce*)	;; # Wifi firmware crashes
			edma*)	;; # Hangs wifi on high throughput https://forum.openwrt.org/t/dynalink-dl-wrx36-askey-rt5010w-ipq8072a-technical-discussion/110454/1743
			xhci*)	;; # Crashes with USB drive https://forum.openwrt.org/t/dynalink-dl-wrx36-askey-rt5010w-ipq8072a-technical-discussion/110454/1736
			*)	"$callback" "/proc/irq/$irq/smp_affinity" || ret=1 ;;
		esac
	done
	return $ret
}

set_affinity_per_cpu() {
	local procfile="$1" ret=0
	echo "$AFFINITY" > "$procfile" || ret=$?
	if [ $AFFINITY -ge $AFFINITY_MAX ]
	then
		AFFINITY=$AFFINITY_MIN
	else
		AFFINITY=$(( AFFINITY * 2 ))
	fi
	return $ret
}

set_affinity_shared() {
	local procfile="$1" ret=0
	echo "$AFFINITY_ALL" > "$procfile" || ret=$?
	return $ret
}

start_service() {
	reload_service
}

reload_service() {
	AFFINITY=$AFFINITY_MIN
	set_affinities set_affinity_per_cpu
}

stop_service() {
	set_affinities set_affinity_shared
}

Then, enable it for future boots:

service irqbalance-manual enable

Also enable it immediately with:

service irqbalance-manual start

And in reply to @odhiambo, as @hnyman pointed out, this is the expected output: the IRQ balancing happens only once at boot and no service is kept running.

5 Likes

Suppose I flash an image and my router is soft-bricked. I start the router with an initramfs via a USB stick. Do I need to flash a sysupgrade or factory image ?

Use the factory image to ensure a full, clean flash.

I recently bricked mine (too much tinkering) but I knew I could easily recover with the USB stick which loads the initramfs thanks to the altered bootcmd.

When the initramfs was loaded I used (win)scp to copy the factory image to the router and simply redid step 4, flashing the factory image to both partitions :

4. Do a ubiformat to both rootfs partitions:
   # ubiformat /dev/mtd18 -y -f /path_to/factory_image
   # ubiformat /dev/mtd20 -y -f /path_to/factory_image

and I was back in business

3 Likes

If you've just enabled the service...
then use service irqbalance-manual start to apply the settings without rebooting the router to do so.

1 Like