[RFC PATCH v2 3/3] usb: scan multiple buses simultaneously with coroutines

Marek Vasut marex at denx.de
Tue Jan 28 22:36:46 CET 2025


On 1/28/25 11:19 AM, Jerome Forissier wrote:
> Use the coroutines framework to scan USB buses in parallel for better
> performance. Tested on arm64 QEMU on a somewhat contrived example
> (4 USB buses, each with one audio device, one keyboard, one mouse and
> one tablet).
> 
> $ make qemu_arm64_defconfig
> $ make -j$(nproc) CROSS_COMPILE="ccache aarch64-linux-gnu-"
> $ qemu-system-aarch64 -M virt -nographic -cpu max -bios u-boot.bin \
>      $(for i in {1..4}; do echo -device qemu-xhci,id=xhci$i \
>          -device\ usb-{audio,kbd,mouse,tablet},bus=xhci$i.0; \
>      done)
> 
> The time spent in usb_init() is reported on the console and shows a
> significant improvement with COROUTINES enabled.
Have you considered using the cyclic framework ( cyclic_register() and 
co. ) to fully offload USB operations away from the main thread, i.e. to 
make the U-Boot shell and e.g. 'usb start' run fully in parallel ? That 
could then be extended to block transfers, which could run in 
background, and ... we would also get a concept of shell pipes to move 
data around like we do in Linux.


More information about the U-Boot mailing list