On 24/05/20 16:27, Philippe Mathieu-Daudé wrote: >> In an ideal world all our DMA devices would use some kind of common >> framework or design pattern so they didn't hog all the CPU >> and/or spend minutes with the BQL held if the guest requests >> an enormous-sized DMA. In practice many of them just have >> a simple "loop until the DMA transfer is complete" implementation... > Is this framework already implemented in the hidden dma-helpers.c? > > Apparently this file was written for BlockBackend, but the code seems > rather generic.
The code is generic, see dma_buf_rw, but the asynchronous code is currently used only for block devices. Above a certain limit it would make sense to reuse them to perform dma_buf_rw in the thread pool. Paolo