On Fri, Mar 28, 2025 at 5:06 AM David Laight wrote: > > On Tue, 25 Mar 2025 08:15:41 -0400 > guoren@kernel.org wrote: > > > From: "Guo Ren (Alibaba DAMO Academy)" > > > > Since 2001, the CONFIG_64BIT kernel has been built with the LP64 ABI, > > but this patchset allows the CONFIG_64BIT kernel to use an ILP32 ABI > > for construction to reduce cache & memory footprint (Compared to > > kernel-lp64-abi, kernel-rv64ilp32-abi decreased the used memory by > > about 20%, as shown in "free -h" in the following demo.) > ... > > Why on earth would you want to run a 64bit application on a 32bit kernel. > IIRC the main justification for 64bit was to get a larger address space. Because the below chips have built the Linux ecosystem with LP64-ABI: - allwinner/sun20i-d1-lichee (128MB~1GB) - allwinner/sun20i-d1s-mangopi (64MB) - bouffalo/bl808 (64MB) - canaan/k230 (512MB) - canaan/k230d (128MB) - renesas/rzfive-smarc (256MB~1GB DDR) - sophgo/cv1800b (64MB DDR) - sophgo/cv1812h (256MB DDR) - sophgo/sg2002 (64/256MB DDR) - https://docs.banana-pi.org/en/BPI-RV2/BananaPi_BPI-RV2 (512MB DDR) By swapping the rv64ilp32-abi Linux kernel, we could immediately reduce the 5~10% memory footprint without modifying the bootloader, firmware, or rootfs binaries. The userspace ilp32-abi porting requires substantial effort, and customers want the porting step by step. > > Now you might want to compile a 32bit (ILP32) system that actually > runs in 64bit mode (c/f x32) so that 64bit maths (long long) is > more efficient - but that is a different issue. We don't introduce any x32 userspace ABI here, only for the kernel self. > (I suspect you'd need to change the process switch code to save > all 64bits of the registers - but maybe not much else??) Indeed, the pt_regs & context regs are the same as CONFIG_64BIT (64-bit width). Best Regards Guo Ren