Hi greg k-h, We found during development that when there are data packets to be sent on the USB RNDIS network card, unplugging the USB cable will trigger a certain probability of system warning or panic. We observed that the mtu3_gadget_wakeup function uses the usleep_range_state function, which has certain scenario limitations. Therefore, we made this optimization. The specific call trace information is as follows: [ 594.638749] Call trace: [ 594.639059] dump_backtrace+0x0/0x174 [ 594.639531] show_stack+0x18/0x24 [ 594.639953] dump_stack_lvl+0x64/0x80 [ 594.640420] dump_stack+0x18/0x34 [ 594.640842] __schedule_bug+0x50/0x6c [ 594.641308] __schedule+0x94/0x468 [ 594.641741] schedule+0xa0/0xe8 [ 594.642140] schedule_hrtimeout_range_clock+0xa8/0xe0 [ 594.642780] schedule_hrtimeout_range+0x14/0x20 [ 594.643352] usleep_range_state+0x5c/0x90 [ 594.643859] mtu3_gadget_wakeup+0x90/0xd4 [ 594.644369] usb_gadget_wakeup+0x1c/0x30 [ 594.644868] 0xffffffc00150f110 [ 594.645315] 0xffffffc00151006c [ 594.645723] netdev_start_xmit+0x40/0x6c [ 594.646223] dev_hard_start_xmit+0x90/0xe4 [ 594.646743] sch_direct_xmit+0x100/0x270 [ 594.647242] __dev_queue_xmit+0x404/0x600 [ 594.647750] dev_queue_xmit+0x14/0x20 [ 594.648214] br_dev_queue_push_xmit+0x13c/0x1b4 [ 594.648788] NF_HOOK.constprop.0+0x5c/0xd4 [ 594.649307] br_forward_finish+0x34/0x40 [ 594.649804] NF_HOOK.constprop.0+0x5c/0xd4 [ 594.650323] __br_forward+0xcc/0xe0 [ 594.650766] br_forward+0x80/0x98 [ 594.651187] br_dev_xmit+0x354/0x380 [ 594.651639] netdev_start_xmit+0x40/0x6c [ 594.652137] dev_hard_start_xmit+0x90/0xe4 [ 594.652656] __dev_queue_xmit+0x52c/0x600 [ 594.653164] dev_queue_xmit+0x14/0x20 [ 594.653628] neigh_resolve_output+0xf4/0x12c [ 594.654170] __neigh_update+0x514/0x650 [ 594.654656] neigh_update+0x14/0x20 [ 594.655098] arp_ioctl+0x410/0x58c [ 594.655531] inet_ioctl+0x11c/0x1b4 [ 594.655974] sock_do_ioctl+0x48/0xf8 [ 594.656429] sock_ioctl+0x150/0x338 [ 594.656871] vfs_ioctl+0x28/0x48 [ 594.657283] __arm64_sys_ioctl+0x78/0xac [ 594.657781] invoke_syscall+0x6c/0xf8 [ 594.658247] el0_svc_common.constprop.0+0x78/0xe4 [ 594.658842] do_el0_svc+0x64/0x70 [ 594.659263] el0_svc+0x18/0x44 [ 594.659652] el0t_64_sync_handler+0xb4/0x134 [ 594.660193] el0t_64_sync+0x184/0x188 [ 594.662319] ------------[ cut here ]------------ [ 594.662322] WARNING: CPU: 2 PID: 14162 at kernel/softirq.c:362 __local_bh_enable_ip+0x1c/0x80 ________________________________________ 发件人: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> 发送时间: 2024年11月5日 16:41 收件人: Haowei Cheng(Harvey) 抄送: chunfeng.yun@xxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-mediatek@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx 主题: Re: 0001-usb-mtu3-fix-panic-in-mtu3_gadget_wakeup.patch On Mon, Nov 04, 2024 at 05:54:43PM +0000, Haowei Cheng(Harvey) wrote: > For some reason you only attached a patch, please send it properly so we can actually review and apply it if needed. thanks, greg k-h