Subject: Re: [PATCH] arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES)

From: Catalin Marinas <[email-masked]>
Date: Thu, 27 May 2021 14:11:20 +0100

On Thu, May 27, 2021 at 01:43:56PM +0100, Will Deacon wrote:
> Back in 97303480753e ("arm64: Increase the max granular size"),
> ARCH_DMA_MINALIGN was effectively increased to 128 bytes thanks to an
> increase in L1_CACHE_BYTES due to an unsubstantiated performance claim
> on the now obsolete ThunderX-1. Although this was reverted in
> d93277b9839b, ARCH_DMA_MINALIGN was kept at 128 bytes by ebc7e21e0fa2
> ("arm64: Increase ARCH_DMA_MINALIGN to 128").
> 
> During discussion of the original patch, it was reported that the change
> also prevented a warning during boot on (again, now obsolete) Qualcomm
> server hardware where the cache writeback granule was larger than 64
> bytes. The reason for this warning was because non-coherent DMA could
> lead to data corruption due to unexpected writeback from the CPU where a
> cacheline is shared with other allocations.
> 
> Since then, systems have appeared with larger cachelines still, and so
> commit 8f5c9037a55b ("arm64/mm: Correct the cache line size warning with
> non coherent device") reworked the warning so that it only appears on
> systems where non-coherent DMA is actually required and taints the
> kernel with TAINT_CPU_OUT_OF_SPEC. We are not aware of any systems, even
> including the aforementioned obsolete machines, which have a CWG larger
> than 64 bytes and require non-coherent DMA.
> 
> More recently, it has been reported that a ARCH_DMA_MINALIGN of 128
> bytes wastes considerable memory (~6% immediately after boot on one
> system).
> 
> Reduce ARCH_DMA_MINALIGN to 64 bytes and allow the warning/taint to
> indicate if there are machines that unknowingly rely on this.
> 
> Cc: Catalin Marinas <[email-masked]>
> Cc: Mark Rutland <[email-masked]>
> Cc: Ard Biesheuvel <[email-masked]>
> Cc: Arnd Bergmann <[email-masked]>
> Cc: Vincent Whitchurch <[email-masked]>
> Link: https://lore.kernel.org/linux-arm-kernel/[email-masked]/
> Link: https://lore.kernel.org/linux-arm-kernel/CAOZdJXUiRMAguDV+HEJqPg57MyBNqEcTyaH+ya=[email-masked]/
> Link: https://lore.kernel.org/linux-arm-kernel/[email-masked]/
> Link: https://lore.kernel.org/r/[email-masked]
> Signed-off-by: Will Deacon <[email-masked]>

Unless we hear from anyone that the warning is triggered, I think we
should change this in mainline.

Acked-by: Catalin Marinas <[email-masked]>

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