On Mon, May 15, 2023 at 09:09:55PM +0800, Ruihan Li wrote:
To address these issues, this patch introduces hcd_alloc_coherent_pages, which addresses the above two problems. Specifically, hcd_alloc_coherent_pages uses gen_pool_dma_alloc_align instead of gen_pool_dma_alloc to ensure that the memory is page-aligned. To replace kmalloc, hcd_alloc_coherent_pages directly allocates pages by calling __get_free_pages.
This looks reasonable in that it fixes the bug. But I really don't like how it makes the mess of USB allocation APIs even messier :P
Not really your faul, but someone really needs to look into the usb memory allocators and DMA mapping, which is tied to that and just as bad.