PREEMPT_RT causes scheduling errors with f_rndis USB gadget

From: Yunhao Tian
Date: Sun Mar 06 2022 - 05:18:13 EST


Hi everyone,

I'm using Linux 5.15.24-rt31 kernel with PREEMPT_RT enabled, on my
RK3308 board. I set up f_rndis gadget with the following script, and
plugged my board to a x86 Linux computer running 5.15.25 kernel:

#!/bin/sh
cd /sys/kernel/config/usb_gadget
mkdir g_smartcross; cd g_smartcross
echo 0xF055 > idVendor
echo 0xCAFE > idProduct
mkdir strings/0x409
echo "SmartCross" > strings/0x409/manufacturer
echo "SC-1 USB Device" > strings/0x409/product
mkdir configs/c.1
mkdir functions/rndis.usb0
echo EF > functions/rndis.usb0/class
echo 4 > functions/rndis.usb0/subclass
echo 1 > functions/rndis.usb0/protocol
ln -s functions/rndis.usb0 configs/c.1
echo ff400000.usb > UDC

I started a HTTP server using python3 -m http.server on the x86
computer, and executed curl on my board to download a 100MB file from
the computer. I got the following kernel logs from serial console of
the board:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
7 100M 7 7500k 0 0 7217k 0 0:00:14 0:00:01 0:00:13 7218k[ 23.002846]
sched: RT throttling activated
23 100M 23 23.4M 0 0 5948k 0 0:00:17 0:00:04 0:00:13 5948k[ 25.992869]
NOHZ tick-stop error: Non-RCU local softi!
[ 25.993834] NOHZ tick-stop error: Non-RCU local softirq work is
pending, handler #80!!!
[ 25.994833] NOHZ tick-stop error: Non-RCU local softirq work is
pending, handler #80!!!
[ 25.995832] NOHZ tick-stop error: Non-RCU local softirq work is
pending, handler #80!!!
[ 25.995885] NOHZ tick-stop error: Non-RCU local softirq work is
pending, handler #180!!!
[ 25.996831] NOHZ tick-stop error: Non-RCU local softirq work is
pending, handler #180!!!
[ 25.997830] NOHZ tick-stop error: Non-RCU local softirq work is
pending, handler #180!!!

If I turn off PREEMPT_RT, there won't be any errors while downloading.

I believe this problem is not tied to any specific board, and anyone
can reproduce this problem using a Raspberry Pi (Although I didn't try
because I don't have one). I would like to ask for assistance
regarding this problem.