Subject: Re: [PATCH v3 13/13] dma: arm64: Add CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC and enable it for arm64

From: Catalin Marinas <[email-masked]>
Date: Tue, 8 Nov 2022 09:52:15 +0000

On Mon, Nov 07, 2022 at 01:03:31PM +0000, Robin Murphy wrote:
> On 2022-11-06 22:01, Catalin Marinas wrote:
> > With all the infrastructure in place for bouncing small kmalloc()
> > buffers, add the corresponding Kconfig entry and select it for arm64.
> 
> AFAICS we're missing the crucial part to ensure that SWIOTLB is available
> even when max_pfn <= arm64_dma_phys_limit, which is very likely to be true
> on low-memory systems that care most about kmalloc wastage.

This was a deliberate decision for this version. Patch 4 mitigates it a
bit by raising the kmalloc() minimum alignment to the cache line size
(typically 64). It's still an improvement from the current 128-byte
alignment.

Since it's hard to guess the optimal swiotlb buffer for such platforms,
I think a follow-up step would be to use the DMA coherent pool for
bouncing if no swiotlb buffer is available. At least the pool can grow
dynamically. Yet another option would be to increase the swiotlb buffer
at run-time but it has an overhead for is_swiotlb_buffer().

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel