On Sat, 3 Mar 2018, Fredrik Noring wrote:
> Christoph, Alan,
>
> > If it is allocating / freeing this memory all the time in the hot path
> > it should really use a dma pool (see include/ilinux/dmapool.h).
> > The dma coherent APIs aren't really built for being called in the
> > hot path.
>
> hcd_buffer_free uses a combination of dma pools and dma coherent APIs:
>
> ...
> for (i = 0; i < HCD_BUFFER_POOLS; i++) {
> if (size <= pool_max[i]) {
> dma_pool_free(hcd->pool[i], addr, dma);
> return;
> }
> }
> dma_free_coherent(hcd->self.sysdev, size, addr, dma);
>
> Alan, can dma_free_coherent be delayed to a point when IRQs are enabled?
Yes, subject to the usual concerns about not being delayed for too
long. Also, some HCDs are highly memory-constrained. I don't know if
they use this API, but if they do then delaying a free could result in
not enough memory being available when an allocation is needed.
Alan Stern
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu