[Solution] USB adapter network speed

Post Reply
Soleil
Posts: 55
Joined: Tue Apr 30, 2019 9:20 am
languages_spoken: english
Has thanked: 1 time
Been thanked: 3 times
Contact:

[Solution] USB adapter network speed

Post by Soleil »

Just to share findings - having local NFS on N2 connected to lan via USB 3.0 AX88179 Gigabit Ethernet (AmazonBasics) at max 30Mb/s was seen.
Quick investigation shown that CPU0 is maxed out at 100% by ksoftirqd/0. This was in turn caused by USB port stuck on CPU0.

Quick & dirty workaround is to push it out to big cores. That gave instant bump to max out switch (100Mbps) and get out of it 98Mbps.

To automate that for after the reboot I've following script started automatically. It could be added to /etc/rc.local or as I've it as part of customer systemd service.

Code: Select all

############ cat usb_simaffinity.sh 
#!/bin/bash
# Adjust USB related interrupts to Big Core
#   - if not, USB GigabitEthernet adapter maxes at 30Mb/s 
#     with ksoftirqd/0 at 100% CPU0 and makes system unresponsive

source /etc/environment

if [ -z "$1" ]; then exit 1; fi
AFF=$1
IRQS=`cat /proc/interrupts |grep usb|cut -d":" -f1|tr -d '[:blank:]'`
while read -r i; do
  echo "$AFF" >> /proc/irq/$i/smp_affinity_list
done <<< $IRQS
Script can be called with "2-5" as parameter to push it out to big cores or "0-1" for small cores or as it was default "0-5". It takes anything what smp_affinity_list would take as input.

Speed issue might be applicable to embedded interface too - I just didn't have time to test it. If that would be the case, above script would need to be modified to identify also embedded interface irq id and amend sim_affinity.

Risks:
- if you'd plan to switch of cores 2-5, I'm not sure about behavior if adapter would be still limited to 2-5.
These users thanked the author Soleil for the post:
mad_ady (Wed May 08, 2019 3:33 am)

mad_ady
Posts: 8471
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 578 times
Been thanked: 464 times
Contact:

Re: [Solution] USB adapter network speed

Post by mad_ady »

I think it won't let you power off the cores while interrupts are attached to them. I guess that's the reason why it's difficult to turn off cpu0.

Soleil
Posts: 55
Joined: Tue Apr 30, 2019 9:20 am
languages_spoken: english
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: [Solution] USB adapter network speed

Post by Soleil »

good to know :)

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 0 guests