Re: regression with SG DMA buf allocations and IOMMU in low-mem
Hi Takashi and list,
I've been debugging a SOF DSP load fail on VT-D/IOMMU systems [1] and that brought me to these two commits from you:
"ALSA: memalloc: Add fallback SG-buffer allocations for x86" and
"ALSA: memalloc: Revive x86-specific WC page allocations again"
We have an allocation with: snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, &pci->dev, size, dmab);
.. but in rare low-memory cases, the dma_alloc_noncontiguous() call will fail in core/memalloc.c and we go to the fallback path.
So we go to snd_dma_sg_fallback_alloc(), but here it seems something is missing. The pages are not allocated with DMA mapping API anymore, so IOMMU won't know about the memory and in our case the DSP load will fail to a IOMMU fault.
Looking at 5.15 code, the fallback looks very different, but in fallback we still use the DMA mapping API via snd_dma_dev_alloc() so even if we go to fallback path, mapping is still ok.
Any ideas which way this should be fixed? Given the many changes I thought it's better to ask early on the list about this.
[1] https://github.com/thesofproject/linux/issues/3915
Br, Kai
participants (1)
-
Kai Vehmanen