Re: [PATCH] dma-debug: ensure mappings are created and released with matching attributes

From: Marek Szyprowski

Date: Wed Mar 25 2026 - 16:56:23 EST


On 25.03.2026 18:56, Leon Romanovsky wrote:
> On Wed, Mar 25, 2026 at 06:28:41PM +0100, Marek Szyprowski wrote:
>> On 23.03.2026 21:20, Leon Romanovsky wrote:
>>> From: Leon Romanovsky <leonro@xxxxxxxxxx>
>>>
>>>
>>> The DMA API expects that callers use the same attributes when mapping
>>> and unmapping. Add tracking to verify this and catch mismatches.
>>>
>>>
>>> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
>> Applied to dma-mapping-for-next, thanks!
> Thanks a lot.

It looks I've hurries a bit too much. This patch is not yet ready for -next:

1. attrs are not passed to debug_dma_unmap_{phys, sg}

2. attrs are not propagated to 'struct dma_debug_entry ref' in
debug_dma_free_{coherent, pages}

3. DMA_ATTR_NO_WARN and DMA_ATTR_ALLOC_SINGLE_PAGES should be probably
ignored, as are they don't make any sense to check in free calls


The above issues result in dozens of false-positive warnings, even in
drivers doing simple dma_alloc_wc(...) and then dma_free_wc(...).

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland