我们这边概率出现 (压力测试大概4小时复现一次)一个mtp通信异常导致的 ANR问题。
我们分析发现在使用mtp播歌的时候,偶然就会卡住,然后usb一直通信失败。
发生在如下位置导致阻塞。
然后我们打开了usb的log 压力测试复现,
通过log发现当正常工作的时候,usb一直尝试进入suspend,但是suspend fail,usb通信就能保持正常。
01-13 08:40:56.743 0 0 D hub 2-0 : 1.0: hub_resume
01-13 08:40:56.743 0 0 D xhci-cdns3: get port status, actual port 0 status = 0xe0002e0
01-13 08:40:56.743 0 0 D xhci-cdns3: Get port status returned 0x2e0
01-13 08:40:56.743 0 0 D hub 2-0 : 1.0: state 7 ports 1 chg 0000 evt 0000
01-13 08:40:56.743 0 0 D xhci-cdns3: set port remote wake mask, actual port 0 status = 0xe0002e0
01-13 08:40:56.743 0 0 D hub 2-0 : 1.0: hub_suspend
01-13 08:40:56.743 0 0 D usb2 : bus auto-suspend, wakeup 1
01-13 08:40:56.743 0 0 D xhci-cdns3: Bus suspend bailout, port in polling
01-13 08:40:56.743 0 0 D usb2 : bus suspend fail, err -16
01-13 08:40:56.746 0 0 D xhci-cdns3: set port remote wake mask, actual port 0 status = 0xe0002e0
异常工作的时候,usb尝试进入suspend没有报fail,好像usb 进入休眠导致 usb这边无法正常通信阻塞。
01-13 08:42:08.511 0 0 D hub 2-0 : 1.0: hub_resume
01-13 08:42:08.512 0 0 D xhci-cdns3: get port status, actual port 0 status = 0x4002c0
01-13 08:42:08.512 0 0 D xhci-cdns3: Get port status returned 0x4002c0
01-13 08:42:08.512 0 0 D hub 2-0 : 1.0: state 7 ports 1 chg 0000 evt 0000
01-13 08:42:08.512 0 0 D xhci-cdns3: set port remote wake mask, actual port 0 status = 0xe4002c0
01-13 08:42:08.512 0 0 D hub 2-0 : 1.0: hub_suspend
01-13 08:42:08.512 0 0 D usb2 : bus auto-suspend, wakeup 1
01-13 08:42:08.512 0 0 D usb2 : suspend raced with wakeup event
01-13 08:42:08.512 0 0 D usb2 : usb auto-resume
Log如附件,正常异常的分界点时间如下,logcat.20210113_084105 前面都是正常的,后面都是异常的,
我们看这个status值应该是从寄存器读出来的,中间没有log,不知道为什么值会发生变化,
请帮忙看下这个问题,现象比较严重,谢谢。
Which product/board and BSP are you using?