[Solution] USB adapter network speed

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

[Solution] USB adapter network speed

Unread post by Soleil » Wed May 08, 2019 1:36 am

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)

User avatar
mad_ady
Posts: 6401
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 150 times
Been thanked: 109 times
Contact:

Re: [Solution] USB adapter network speed

Unread post by mad_ady » Wed May 08, 2019 3:35 am

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: 35
Joined: Tue Apr 30, 2019 9:20 am
languages_spoken: english
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: [Solution] USB adapter network speed

Unread post by Soleil » Thu May 09, 2019 9:17 am

good to know :)

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 0 guests