Re: [RFC PATCH v2 0/3] prerequisites for device reserved local mem rework

From: Fredrik Noring
Date: Thu May 16 2019 - 11:17:56 EST


Hi Laurentiu,

> I took your code, added the missing mapping and placed it in a patch.
> Please see attached (compile tested only).

Thanks! Unfortunately, the OHCI fails with errors such as

usb 1-1: device descriptor read/64, error -12

that I tracked down to the calls

hub_port_init
-> usb_control_msg
-> usb_internal_control_msg
-> usb_start_wait_urb
-> usb_submit_urb
-> usb_hcd_submit_urb
-> hcd->driver->urb_enqueue
-> ohci_urb_enqueue
-> ed_get
-> ed_alloc
-> dma_pool_zalloc
-> dma_pool_alloc
-> pool_alloc_page,

which returns NULL. Then I noticed

/* pool_alloc_page() might sleep, so temporarily drop &pool->lock */

that might be a problem considering that the HCD handles pool memory in
IRQ handlers, for instance:

do_IRQ
-> generic_handle_irq
-> handle_level_irq
-> handle_irq_event
-> handle_irq_event_percpu
-> __handle_irq_event_percpu
-> usb_hcd_irq
-> ohci_irq
-> ohci_work
-> finish_urb
-> __usb_hcd_giveback_urb
-> usb_hcd_unmap_urb_for_dma
-> hcd_buffer_free

Also, DMA_BUFFER_SIZE in ohci-ps2.c is only 256 KiB in total. Is the new
pool implementation at least as efficient as the previous one?

Fredrik