All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES)
@ 2021-05-27 12:43 Will Deacon
  2021-05-27 13:11 ` Catalin Marinas
                   ` (5 more replies)
  0 siblings, 6 replies; 73+ messages in thread
From: Will Deacon @ 2021-05-27 12:43 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: kernel-team, Will Deacon, Catalin Marinas, Mark Rutland,
	Ard Biesheuvel, Arnd Bergmann, Vincent Whitchurch

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 <catalin.marinas@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Vincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/linux-arm-kernel/1442944788-17254-1-git-send-email-rric@kernel.org/
Link: https://lore.kernel.org/linux-arm-kernel/CAOZdJXUiRMAguDV+HEJqPg57MyBNqEcTyaH+ya=U93NHb-pdJA@mail.gmail.com/
Link: https://lore.kernel.org/linux-arm-kernel/20190614131141.4428-1-msys.mizuma@gmail.com/
Link: https://lore.kernel.org/r/20210517074332.28280-1-vincent.whitchurch@axis.com
Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/cache.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
index a074459f8f2f..a9c0716e7440 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -47,7 +47,7 @@
  * cache before the transfer is done, causing old data to be seen by
  * the CPU.
  */
-#define ARCH_DMA_MINALIGN	(128)
+#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
 
 #ifdef CONFIG_KASAN_SW_TAGS
 #define ARCH_SLAB_MINALIGN	(1ULL << KASAN_SHADOW_SCALE_SHIFT)
-- 
2.31.1.818.g46aad6cb9e-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 73+ messages in thread

end of thread, other threads:[~2021-07-09 17:12 UTC | newest]

Thread overview: 73+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 12:43 [PATCH] arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES) Will Deacon
2021-05-27 13:11 ` Catalin Marinas
2021-05-27 13:19 ` Mark Rutland
2021-05-28  9:35   ` Arnd Bergmann
2021-06-01 10:14     ` Catalin Marinas
2021-05-31  5:38 ` Ard Biesheuvel
2021-06-01 18:21 ` Will Deacon
     [not found] ` <CGME20210602132541eucas1p17127696041c26c00d1d2f50bef9cfaf0@eucas1p1.samsung.com>
2021-06-02 13:25   ` Marek Szyprowski
2021-06-02 13:51     ` Mark Rutland
2021-06-02 14:09       ` Marek Szyprowski
2021-06-02 14:14         ` Arnd Bergmann
2021-06-02 14:28           ` Marek Szyprowski
2021-06-02 14:52             ` Arnd Bergmann
2021-06-07 12:17               ` Arnd Bergmann
2021-06-04 10:01         ` Mark Rutland
2021-06-07  9:58           ` Marek Szyprowski
2021-06-07 12:01             ` Mark Rutland
2021-06-07 13:08               ` Mark Rutland
2021-06-07 13:39                 ` Will Deacon
2021-06-07 13:39                   ` Will Deacon
2021-06-07 13:56                   ` Mark Rutland
2021-06-07 13:56                     ` Mark Rutland
2021-06-07 13:57                   ` Arnd Bergmann
2021-06-07 13:57                     ` Arnd Bergmann
2021-06-07 15:17                     ` Maxime Ripard
2021-06-07 15:17                       ` Maxime Ripard
2021-06-07 15:50                       ` Arnd Bergmann
2021-06-07 15:50                         ` Arnd Bergmann
2021-06-08  8:57                         ` Mark Rutland
2021-06-08  8:57                           ` Mark Rutland
2021-06-07 15:32                     ` Mark Rutland
2021-06-07 15:32                       ` Mark Rutland
2021-06-02 14:11       ` Arnd Bergmann
2021-06-02 14:15         ` Marek Szyprowski
2021-07-06  9:26 ` Yassine Oudjana
2021-07-06 10:26   ` Catalin Marinas
2021-07-06 10:26     ` Catalin Marinas
2021-07-06 13:29     ` Robin Murphy
2021-07-06 13:29       ` Robin Murphy
2021-07-06 13:33       ` Will Deacon
2021-07-06 13:33         ` Will Deacon
2021-07-06 13:44         ` Marc Zyngier
2021-07-06 13:44           ` Marc Zyngier
2021-07-06 14:21           ` Robin Murphy
2021-07-06 14:21             ` Robin Murphy
2021-07-06 14:30           ` Arnd Bergmann
2021-07-06 14:30             ` Arnd Bergmann
2021-07-06 14:46             ` Marc Zyngier
2021-07-06 14:46               ` Marc Zyngier
2021-07-06 15:43               ` Arnd Bergmann
2021-07-06 15:43                 ` Arnd Bergmann
2021-07-06 17:15                 ` Yassine Oudjana
2021-07-06 17:15                   ` Yassine Oudjana
2021-07-06 20:33                   ` Arnd Bergmann
2021-07-06 20:33                     ` Arnd Bergmann
2021-07-06 22:27                     ` Bjorn Andersson
2021-07-06 22:27                       ` Bjorn Andersson
2021-07-07  9:27                       ` Will Deacon
2021-07-07  9:27                         ` Will Deacon
2021-07-07  8:24                     ` Yassine Oudjana
2021-07-07  8:24                       ` Yassine Oudjana
2021-07-07  9:29                       ` Arnd Bergmann
2021-07-07  9:29                         ` Arnd Bergmann
2021-07-07 14:41                         ` Jeffrey Hugo
2021-07-07 14:41                           ` Jeffrey Hugo
2021-07-08 20:59                           ` Jeffrey Hugo
2021-07-08 20:59                             ` Jeffrey Hugo
2021-07-09  8:48                             ` Will Deacon
2021-07-09  8:48                               ` Will Deacon
2021-07-09 17:10                               ` Catalin Marinas
2021-07-09 17:10                                 ` Catalin Marinas
2021-07-06 16:20             ` Will Deacon
2021-07-06 16:20               ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.