USB controller enumeration on APU3 is random since the update to kernel 6.6

Felix Fietkau nbd at nbd.name
Wed Jul 17 05:14:42 PDT 2024


On 17.07.24 13:10, Florian Eckert wrote:
> Hello Dev´s,
> 
> I hope someone can help me here. I have noticed since the
> kernel update in the master branch of OpenWrt to 6.6 that
> the enumeration of the USB host controllers is suddenly
> randomly.
> 
> This has been encountered on the APU3 board from PCengine[1].
> 
> That wasn't the case with the 5.15 kernel before, or I didn't
> notice it. I also don't know if it must have fixed paths
> so that the USB host controllers always have the same path.
> 
> Boot1
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 usb1 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 usb2 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb2
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 usb3 ->
> ../../../devices/pci0000:00/0000:00:10.0/usb3
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 usb4 ->
> ../../../devices/pci0000:00/0000:00:10.0/usb4
> 
> Boot2
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 usb1 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb1
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 usb2 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 usb3 ->
> ../../../devices/pci0000:00/0000:00:10.0/usb3
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 usb4 ->
> ../../../devices/pci0000:00/0000:00:10.0/usb4
> 
> As you can see the usb1 and usb2 are swapped!
> 
> The problem now is that the ModemManager is using the syspath
> to reference the modem in the uci configuration [2]. If the modem's
> syspath is now random, the system can no longer find the modem and
> cannot establish a connection.
> 
> 1. Does anyone have the same problem?
> 2. Is the path of usb<x> randomly intentional?
> 3. Can I somehow force the path across a restart?

I think the most likely cause is more parallelization in device probe in 
order to speed up boot time. Not sure if there is a way to make it 
deterministic, but even if there is, it might still change across kernel 
upgrades.

In my opinion, the best course of action is to just deal with it by 
changing the code to no longer rely on usbX names. Better make it depend 
on the sysfs path, similar to wifi-device path handling in the wireless 
config.

- Felix



More information about the openwrt-devel mailing list