On Mon, 12 Aug 2019, Felipe Balbi wrote: > I don't understand the intricacies of the coherent API to judge if it's > a bug in the API itself. In any case, here's where the splat comes from: > > void dma_free_attrs(struct device *dev, size_t size, void *cpu_addr, > dma_addr_t dma_handle, unsigned long attrs) > { > const struct dma_map_ops *ops = get_dma_ops(dev); > > if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr)) > return; > /* > * On non-coherent platforms which implement DMA-coherent buffers via > * non-cacheable remaps, ops->free() may call vunmap(). Thus getting > * this far in IRQ context is a) at risk of a BUG_ON() or trying to > * sleep on some machines, and b) an indication that the driver is > * probably misusing the coherent API anyway. > */ > WARN_ON(irqs_disabled()); > > if (!cpu_addr) > return; > > debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); > if (dma_is_direct(ops)) > dma_direct_free(dev, size, cpu_addr, dma_handle, attrs); > else if (ops->free) > ops->free(dev, size, cpu_addr, dma_handle, attrs); > } > EXPORT_SYMBOL(dma_free_attrs); > > maybe you're gonna have to fire up a workqueue to free this memory for > you :-( > > Unless someone else has better ideas. Alan, Greg, any ideas? I don't understand it very well myself, but there have been posts by some of the DMA maintainers on this topic. Maybe you can try asking them. Alan Stern