Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems
From: Vineet Gupta <hidden>
Date: 2021-04-20 21:14:48
Also in:
linux-arm-kernel, linux-mips, linux-mm, lkml, netdev
On 4/20/21 12:07 AM, Arnd Bergmann wrote:
On Tue, Apr 20, 2021 at 5:10 AM Matthew Wilcox [off-list ref] wrote:quoted
On Tue, Apr 20, 2021 at 02:48:17AM +0000, Vineet Gupta wrote:quoted
quoted
32-bit architectures which expect 8-byte alignment for 8-byte integers and need 64-bit DMA addresses (arc, arm, mips, ppc) had their struct page inadvertently expanded in 2019.FWIW, ARC doesn't require 8 byte alignment for 8 byte integers. This is only needed for 8-byte atomics due to the requirements of LLOCKD/SCOND instructions.Ah, like x86? OK, great, I'll drop your arch from the list of affected. Thanks!I mistakenly assumed that i386 and m68k were the only supported architectures with 32-bit alignment on u64. I checked it now and found $ for i in /home/arnd/cross/x86_64/gcc-10.1.0-nolibc/*/bin/*-gcc ; do echo `echo 'int a = __alignof__(long long);' | $i -xc - -Wall -S -o- | grep -A1 a: | tail -n 1 | cut -f 3 -d\ ` ${i#/home/arnd/cross/x86_64/gcc-10.1.0-nolibc/*/bin/} ; done 8 aarch64-linux-gcc 8 alpha-linux-gcc 4 arc-linux-gcc 8 arm-linux-gnueabi-gcc 8 c6x-elf-gcc 4 csky-linux-gcc 4 h8300-linux-gcc 8 hppa-linux-gcc 8 hppa64-linux-gcc 8 i386-linux-gcc 8 ia64-linux-gcc 2 m68k-linux-gcc 4 microblaze-linux-gcc 8 mips-linux-gcc 8 mips64-linux-gcc 8 nds32le-linux-gcc 4 nios2-linux-gcc 4 or1k-linux-gcc 8 powerpc-linux-gcc 8 powerpc64-linux-gcc 8 riscv32-linux-gcc 8 riscv64-linux-gcc 8 s390-linux-gcc 4 sh2-linux-gcc 4 sh4-linux-gcc 8 sparc-linux-gcc 8 sparc64-linux-gcc 8 x86_64-linux-gcc 8 xtensa-linux-gcc which means that half the 32-bit architectures do this. This may cause more problems when arc and/or microblaze want to support 64-bit kernels and compat mode in the future on their latest hardware, as that means duplicating the x86 specific hacks we have for compat. What is alignof(u64) on 64-bit arc?
$ echo 'int a = __alignof__(long long);' | arc64-linux-gnu-gcc -xc - -Wall -S -o - | grep -A1 a: | tail -n 1 | cut -f 3 8 Yeah ARCv2 alignment of 4 for 64-bit data was a bit of surprise finding for me as well. When 64-bit load/stores were initially targeted by the internal Metaware compiler (llvm based) they decided to keep alignment to 4 still (granted hardware allowed this) and then gcc guys decided to follow the same ABI. I only found this by accident :-) Can you point me to some specifics on the compat issue. For better of worse, arc64 does''t have a compat 32-bit mode, so everything is 64-on-64 or 32-on-32 (ARC32 flavor of ARCv3) Thx, -Vineet