Re: [PATCH V12 00/20] riscv: Add COMPAT mode support for 64BIT
On Fri, May 20, 2022 at 1:50 AM Palmer Dabbelt wrote: > > On Tue, 05 Apr 2022 00:12:54 PDT (-0700), guo...@kernel.org wrote: > > From: Guo Ren > > > > Currently, most 64-bit architectures (x86, parisc, powerpc, arm64, > > s390, mips, sparc) have supported COMPAT mode. But they all have > > history issues and can't use standard linux unistd.h. RISC-V would > > be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic > > /unistd.h. > > > > The patchset are based on v5.18-rc1, you can compare rv64-compat > > v.s. rv32-native in qemu with following steps: > > > > - Prepare rv32 rootfs & fw_jump.bin by buildroot.org > >$ git clone git://git.busybox.net/buildroot > >$ cd buildroot > >$ make qemu_riscv32_virt_defconfig O=qemu_riscv32_virt_defconfig > >$ make -C qemu_riscv32_virt_defconfig > >$ make qemu_riscv64_virt_defconfig O=qemu_riscv64_virt_defconfig > >$ make -C qemu_riscv64_virt_defconfig > >(Got fw_jump.bin & rootfs.ext2 in qemu_riscvXX_virt_defconfig/images) > > > > - Prepare Linux rv32 & rv64 Image > >$ git clone g...@github.com:c-sky/csky-linux.git -b riscv_compat_v12 > > linux > >$ cd linux > >$ echo "CONFIG_STRICT_KERNEL_RWX=n" >> arch/riscv/configs/defconfig > >$ echo "CONFIG_STRICT_MODULE_RWX=n" >> arch/riscv/configs/defconfig > >$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- > > O=../build-rv32/ rv32_defconfig > >$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- > > O=../build-rv32/ Image > >$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- > > O=../build-rv64/ defconfig > >$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- > > O=../build-rv64/ Image > > > > - Prepare Qemu: > >$ git clone https://gitlab.com/qemu-project/qemu.git -b master linux > >$ cd qemu > >$ ./configure --target-list="riscv64-softmmu riscv32-softmmu" > >$ make > > > > Now let's compare rv64-compat with rv32-native memory footprint with almost > > the same > > defconfig, rootfs, opensbi in one qemu. > > > > - Run rv64 with rv32 rootfs in compat mode: > >$ ./build/qemu-system-riscv64 -cpu rv64 -M virt -m 64m -nographic -bios > > qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image > > -drive file > > qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=raw,id=hd0 -device > > virtio-blk-device,drive=hd0 -append "rootwait root=/dev/vda ro > > console=ttyS0 earlycon=sbi" -netdev user,id=net0 -device > > virtio-net-device,netdev=net0 > > > > QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) > > OpenSBI v0.9 > > [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty > > (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld > > (GNU Binutils) 2.37) #96 SMP Tue Dec 28 21:01:55 CST 2021 > > [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020 > > [0.00] Machine model: riscv-virtio,qemu > > [0.00] earlycon: sbi0 at I/O port 0x0 (options '') > > [0.00] printk: bootconsole [sbi0] enabled > > [0.00] efi: UEFI not found. > > [0.00] Zone ranges: > > [0.00] DMA32[mem 0x8020-0x83ff] > > [0.00] Normal empty > > [0.00] Movable zone start for each node > > [0.00] Early memory node ranges > > [0.00] node 0: [mem 0x8020-0x83ff] > > [0.00] Initmem setup node 0 [mem > > 0x8020-0x83ff] > > [0.00] SBI specification v0.2 detected > > [0.00] SBI implementation ID=0x1 Version=0x9 > > [0.00] SBI TIME extension detected > > [0.00] SBI IPI extension detected > > [0.00] SBI RFENCE extension detected > > [0.00] SBI v0.2 HSM extension detected > > [0.00] riscv: ISA extensions acdfhimsu > > [0.00] riscv: ELF capabilities acdfim > > [0.00] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632 > > [0.00] Built 1 zonelists, mobility grouping on. Total pages: 15655 > > [0.00] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 > > earlycon=sbi > > [0.00] Dentry cache hash table entries: 8192 (order: 4, 65536 > > bytes, linear) > > [0.00] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, > > linear) > > [0.00] mem auto-init: stack:off, heap alloc:off, heap free:off > > [0.00] Virtual kernel memory layout: > > [0.00] fixmap : 0xffcefee0 - 0xffceff00 > > (2048 kB) > > [0.00] pci io : 0xffceff00 - 0xffcf ( > > 16 MB) > > [0.00] vmemmap : 0xffcf - 0xffcf > > (4095 MB) > > [0.00] vmalloc : 0xffd0 - 0xffdf > > (65535 MB) > > [0.00] lowmem : 0xffe0 - 0xffe003e0 ( > > 62 MB) > > [0.00] kernel : 0x8000 - 0x
Re: [PATCH V12 00/20] riscv: Add COMPAT mode support for 64BIT
On Tue, 05 Apr 2022 00:12:54 PDT (-0700), guo...@kernel.org wrote: From: Guo Ren Currently, most 64-bit architectures (x86, parisc, powerpc, arm64, s390, mips, sparc) have supported COMPAT mode. But they all have history issues and can't use standard linux unistd.h. RISC-V would be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic /unistd.h. The patchset are based on v5.18-rc1, you can compare rv64-compat v.s. rv32-native in qemu with following steps: - Prepare rv32 rootfs & fw_jump.bin by buildroot.org $ git clone git://git.busybox.net/buildroot $ cd buildroot $ make qemu_riscv32_virt_defconfig O=qemu_riscv32_virt_defconfig $ make -C qemu_riscv32_virt_defconfig $ make qemu_riscv64_virt_defconfig O=qemu_riscv64_virt_defconfig $ make -C qemu_riscv64_virt_defconfig (Got fw_jump.bin & rootfs.ext2 in qemu_riscvXX_virt_defconfig/images) - Prepare Linux rv32 & rv64 Image $ git clone g...@github.com:c-sky/csky-linux.git -b riscv_compat_v12 linux $ cd linux $ echo "CONFIG_STRICT_KERNEL_RWX=n" >> arch/riscv/configs/defconfig $ echo "CONFIG_STRICT_MODULE_RWX=n" >> arch/riscv/configs/defconfig $ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- O=../build-rv32/ rv32_defconfig $ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- O=../build-rv32/ Image $ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- O=../build-rv64/ defconfig $ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- O=../build-rv64/ Image - Prepare Qemu: $ git clone https://gitlab.com/qemu-project/qemu.git -b master linux $ cd qemu $ ./configure --target-list="riscv64-softmmu riscv32-softmmu" $ make Now let's compare rv64-compat with rv32-native memory footprint with almost the same defconfig, rootfs, opensbi in one qemu. - Run rv64 with rv32 rootfs in compat mode: $ ./build/qemu-system-riscv64 -cpu rv64 -M virt -m 64m -nographic -bios qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image -drive file qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -append "rootwait root=/dev/vda ro console=ttyS0 earlycon=sbi" -netdev user,id=net0 -device virtio-net-device,netdev=net0 QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) OpenSBI v0.9 [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.37) #96 SMP Tue Dec 28 21:01:55 CST 2021 [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020 [0.00] Machine model: riscv-virtio,qemu [0.00] earlycon: sbi0 at I/O port 0x0 (options '') [0.00] printk: bootconsole [sbi0] enabled [0.00] efi: UEFI not found. [0.00] Zone ranges: [0.00] DMA32[mem 0x8020-0x83ff] [0.00] Normal empty [0.00] Movable zone start for each node [0.00] Early memory node ranges [0.00] node 0: [mem 0x8020-0x83ff] [0.00] Initmem setup node 0 [mem 0x8020-0x83ff] [0.00] SBI specification v0.2 detected [0.00] SBI implementation ID=0x1 Version=0x9 [0.00] SBI TIME extension detected [0.00] SBI IPI extension detected [0.00] SBI RFENCE extension detected [0.00] SBI v0.2 HSM extension detected [0.00] riscv: ISA extensions acdfhimsu [0.00] riscv: ELF capabilities acdfim [0.00] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632 [0.00] Built 1 zonelists, mobility grouping on. Total pages: 15655 [0.00] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 earlycon=sbi [0.00] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes, linear) [0.00] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) [0.00] mem auto-init: stack:off, heap alloc:off, heap free:off [0.00] Virtual kernel memory layout: [0.00] fixmap : 0xffcefee0 - 0xffceff00 (2048 kB) [0.00] pci io : 0xffceff00 - 0xffcf ( 16 MB) [0.00] vmemmap : 0xffcf - 0xffcf (4095 MB) [0.00] vmalloc : 0xffd0 - 0xffdf (65535 MB) [0.00] lowmem : 0xffe0 - 0xffe003e0 ( 62 MB) [0.00] kernel : 0x8000 - 0x (2047 MB) [0.00] Memory: 52788K/63488K available (6184K kernel code, 888K rwdata, 1917K rodata, 294K init, 297K bss, 10700K reserved, 0K cma-reserved) [0.00] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 [0.00] rcu: Hierarchical RCU implementation. [0.00] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1. [0.00] rcu: RCU debug extended QS entry/exit. [0.00] Tracing variant
Re: [PATCH V12 00/20] riscv: Add COMPAT mode support for 64BIT
On Fri, Apr 29, 2022 at 2:22 AM Palmer Dabbelt wrote: > > On Thu, 28 Apr 2022 05:25:19 PDT (-0700), guo...@kernel.org wrote: > > Hi Palmer, > > > > I see you have taken v12 into your riscv-compat branch and added > > asm/signal32.h. Do you need me help put compat_sigcontext & > > compat_ucontext & compat_rt_sigframe into signal32.h? And could we > > rename signal32.h to compat_signal.h to match compat_signal.c? > > > > In the end, thx for taking care of compat patch series. > > No problem. I was just trying to get something clean through all the > autobuilders before making it look good, I think it didn't fail this > time so I'll do a bit more refactoring. Shouldn't be too much longer at > this point. Cool, thank you. Hope it could be in v5.19. > > > > > > > On Tue, Apr 5, 2022 at 3:13 PM wrote: > >> > >> From: Guo Ren > >> > >> Currently, most 64-bit architectures (x86, parisc, powerpc, arm64, > >> s390, mips, sparc) have supported COMPAT mode. But they all have > >> history issues and can't use standard linux unistd.h. RISC-V would > >> be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic > >> /unistd.h. > >> > >> The patchset are based on v5.18-rc1, you can compare rv64-compat > >> v.s. rv32-native in qemu with following steps: > >> > >> - Prepare rv32 rootfs & fw_jump.bin by buildroot.org > >>$ git clone git://git.busybox.net/buildroot > >>$ cd buildroot > >>$ make qemu_riscv32_virt_defconfig O=qemu_riscv32_virt_defconfig > >>$ make -C qemu_riscv32_virt_defconfig > >>$ make qemu_riscv64_virt_defconfig O=qemu_riscv64_virt_defconfig > >>$ make -C qemu_riscv64_virt_defconfig > >>(Got fw_jump.bin & rootfs.ext2 in qemu_riscvXX_virt_defconfig/images) > >> > >> - Prepare Linux rv32 & rv64 Image > >>$ git clone g...@github.com:c-sky/csky-linux.git -b riscv_compat_v12 > >> linux > >>$ cd linux > >>$ echo "CONFIG_STRICT_KERNEL_RWX=n" >> arch/riscv/configs/defconfig > >>$ echo "CONFIG_STRICT_MODULE_RWX=n" >> arch/riscv/configs/defconfig > >>$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- > >> O=../build-rv32/ rv32_defconfig > >>$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- > >> O=../build-rv32/ Image > >>$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- > >> O=../build-rv64/ defconfig > >>$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- > >> O=../build-rv64/ Image > >> > >> - Prepare Qemu: > >>$ git clone https://gitlab.com/qemu-project/qemu.git -b master linux > >>$ cd qemu > >>$ ./configure --target-list="riscv64-softmmu riscv32-softmmu" > >>$ make > >> > >> Now let's compare rv64-compat with rv32-native memory footprint with > >> almost the same > >> defconfig, rootfs, opensbi in one qemu. > >> > >> - Run rv64 with rv32 rootfs in compat mode: > >>$ ./build/qemu-system-riscv64 -cpu rv64 -M virt -m 64m -nographic -bios > >> qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image > >> -drive file > >> qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=raw,id=hd0 -device > >> virtio-blk-device,drive=hd0 -append "rootwait root=/dev/vda ro > >> console=ttyS0 earlycon=sbi" -netdev user,id=net0 -device > >> virtio-net-device,netdev=net0 > >> > >> QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) > >> OpenSBI v0.9 > >> [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty > >> (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU > >> ld (GNU Binutils) 2.37) #96 SMP Tue Dec 28 21:01:55 CST 2021 > >> [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020 > >> [0.00] Machine model: riscv-virtio,qemu > >> [0.00] earlycon: sbi0 at I/O port 0x0 (options '') > >> [0.00] printk: bootconsole [sbi0] enabled > >> [0.00] efi: UEFI not found. > >> [0.00] Zone ranges: > >> [0.00] DMA32[mem 0x8020-0x83ff] > >> [0.00] Normal empty > >> [0.00] Movable zone start for each node > >> [0.00] Early memory node ranges > >> [0.00] node 0: [mem 0x8020-0x83ff] > >> [0.00] Initmem setup node 0 [mem > >> 0x8020-0x83ff] > >> [0.00] SBI specification v0.2 detected > >> [0.00] SBI implementation ID=0x1 Version=0x9 > >> [0.00] SBI TIME extension detected > >> [0.00] SBI IPI extension detected > >> [0.00] SBI RFENCE extension detected > >> [0.00] SBI v0.2 HSM extension detected > >> [0.00] riscv: ISA extensions acdfhimsu > >> [0.00] riscv: ELF capabilities acdfim > >> [0.00] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632 > >> [0.00] Built 1 zonelists, mobility grouping on. Total pages: 15655 > >> [0.00] Kernel command line: rootwait root=/dev/vda ro > >> console=ttyS0 earlycon=sbi > >> [0.00] Dentry cache hash table entries: 8192 (order:
Re: [PATCH V12 00/20] riscv: Add COMPAT mode support for 64BIT
On Thu, 28 Apr 2022 05:25:19 PDT (-0700), guo...@kernel.org wrote: Hi Palmer, I see you have taken v12 into your riscv-compat branch and added asm/signal32.h. Do you need me help put compat_sigcontext & compat_ucontext & compat_rt_sigframe into signal32.h? And could we rename signal32.h to compat_signal.h to match compat_signal.c? In the end, thx for taking care of compat patch series. No problem. I was just trying to get something clean through all the autobuilders before making it look good, I think it didn't fail this time so I'll do a bit more refactoring. Shouldn't be too much longer at this point. On Tue, Apr 5, 2022 at 3:13 PM wrote: From: Guo Ren Currently, most 64-bit architectures (x86, parisc, powerpc, arm64, s390, mips, sparc) have supported COMPAT mode. But they all have history issues and can't use standard linux unistd.h. RISC-V would be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic /unistd.h. The patchset are based on v5.18-rc1, you can compare rv64-compat v.s. rv32-native in qemu with following steps: - Prepare rv32 rootfs & fw_jump.bin by buildroot.org $ git clone git://git.busybox.net/buildroot $ cd buildroot $ make qemu_riscv32_virt_defconfig O=qemu_riscv32_virt_defconfig $ make -C qemu_riscv32_virt_defconfig $ make qemu_riscv64_virt_defconfig O=qemu_riscv64_virt_defconfig $ make -C qemu_riscv64_virt_defconfig (Got fw_jump.bin & rootfs.ext2 in qemu_riscvXX_virt_defconfig/images) - Prepare Linux rv32 & rv64 Image $ git clone g...@github.com:c-sky/csky-linux.git -b riscv_compat_v12 linux $ cd linux $ echo "CONFIG_STRICT_KERNEL_RWX=n" >> arch/riscv/configs/defconfig $ echo "CONFIG_STRICT_MODULE_RWX=n" >> arch/riscv/configs/defconfig $ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- O=../build-rv32/ rv32_defconfig $ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- O=../build-rv32/ Image $ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- O=../build-rv64/ defconfig $ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- O=../build-rv64/ Image - Prepare Qemu: $ git clone https://gitlab.com/qemu-project/qemu.git -b master linux $ cd qemu $ ./configure --target-list="riscv64-softmmu riscv32-softmmu" $ make Now let's compare rv64-compat with rv32-native memory footprint with almost the same defconfig, rootfs, opensbi in one qemu. - Run rv64 with rv32 rootfs in compat mode: $ ./build/qemu-system-riscv64 -cpu rv64 -M virt -m 64m -nographic -bios qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image -drive file qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -append "rootwait root=/dev/vda ro console=ttyS0 earlycon=sbi" -netdev user,id=net0 -device virtio-net-device,netdev=net0 QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) OpenSBI v0.9 [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.37) #96 SMP Tue Dec 28 21:01:55 CST 2021 [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020 [0.00] Machine model: riscv-virtio,qemu [0.00] earlycon: sbi0 at I/O port 0x0 (options '') [0.00] printk: bootconsole [sbi0] enabled [0.00] efi: UEFI not found. [0.00] Zone ranges: [0.00] DMA32[mem 0x8020-0x83ff] [0.00] Normal empty [0.00] Movable zone start for each node [0.00] Early memory node ranges [0.00] node 0: [mem 0x8020-0x83ff] [0.00] Initmem setup node 0 [mem 0x8020-0x83ff] [0.00] SBI specification v0.2 detected [0.00] SBI implementation ID=0x1 Version=0x9 [0.00] SBI TIME extension detected [0.00] SBI IPI extension detected [0.00] SBI RFENCE extension detected [0.00] SBI v0.2 HSM extension detected [0.00] riscv: ISA extensions acdfhimsu [0.00] riscv: ELF capabilities acdfim [0.00] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632 [0.00] Built 1 zonelists, mobility grouping on. Total pages: 15655 [0.00] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 earlycon=sbi [0.00] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes, linear) [0.00] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) [0.00] mem auto-init: stack:off, heap alloc:off, heap free:off [0.00] Virtual kernel memory layout: [0.00] fixmap : 0xffcefee0 - 0xffceff00 (2048 kB) [0.00] pci io : 0xffceff00 - 0xffcf ( 16 MB) [0.00] vmemmap : 0xffcf - 0xffcf (4095 MB) [0.00] vmalloc : 0xffd0 - 0xffdf (65535 MB) [
Re: [PATCH V12 00/20] riscv: Add COMPAT mode support for 64BIT
Hi Palmer, I see you have taken v12 into your riscv-compat branch and added asm/signal32.h. Do you need me help put compat_sigcontext & compat_ucontext & compat_rt_sigframe into signal32.h? And could we rename signal32.h to compat_signal.h to match compat_signal.c? In the end, thx for taking care of compat patch series. On Tue, Apr 5, 2022 at 3:13 PM wrote: > > From: Guo Ren > > Currently, most 64-bit architectures (x86, parisc, powerpc, arm64, > s390, mips, sparc) have supported COMPAT mode. But they all have > history issues and can't use standard linux unistd.h. RISC-V would > be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic > /unistd.h. > > The patchset are based on v5.18-rc1, you can compare rv64-compat > v.s. rv32-native in qemu with following steps: > > - Prepare rv32 rootfs & fw_jump.bin by buildroot.org >$ git clone git://git.busybox.net/buildroot >$ cd buildroot >$ make qemu_riscv32_virt_defconfig O=qemu_riscv32_virt_defconfig >$ make -C qemu_riscv32_virt_defconfig >$ make qemu_riscv64_virt_defconfig O=qemu_riscv64_virt_defconfig >$ make -C qemu_riscv64_virt_defconfig >(Got fw_jump.bin & rootfs.ext2 in qemu_riscvXX_virt_defconfig/images) > > - Prepare Linux rv32 & rv64 Image >$ git clone g...@github.com:c-sky/csky-linux.git -b riscv_compat_v12 linux >$ cd linux >$ echo "CONFIG_STRICT_KERNEL_RWX=n" >> arch/riscv/configs/defconfig >$ echo "CONFIG_STRICT_MODULE_RWX=n" >> arch/riscv/configs/defconfig >$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- > O=../build-rv32/ rv32_defconfig >$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- > O=../build-rv32/ Image >$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- > O=../build-rv64/ defconfig >$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- > O=../build-rv64/ Image > > - Prepare Qemu: >$ git clone https://gitlab.com/qemu-project/qemu.git -b master linux >$ cd qemu >$ ./configure --target-list="riscv64-softmmu riscv32-softmmu" >$ make > > Now let's compare rv64-compat with rv32-native memory footprint with almost > the same > defconfig, rootfs, opensbi in one qemu. > > - Run rv64 with rv32 rootfs in compat mode: >$ ./build/qemu-system-riscv64 -cpu rv64 -M virt -m 64m -nographic -bios > qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image > -drive file qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=raw,id=hd0 > -device virtio-blk-device,drive=hd0 -append "rootwait root=/dev/vda ro > console=ttyS0 earlycon=sbi" -netdev user,id=net0 -device > virtio-net-device,netdev=net0 > > QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) > OpenSBI v0.9 > [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty > (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld > (GNU Binutils) 2.37) #96 SMP Tue Dec 28 21:01:55 CST 2021 > [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020 > [0.00] Machine model: riscv-virtio,qemu > [0.00] earlycon: sbi0 at I/O port 0x0 (options '') > [0.00] printk: bootconsole [sbi0] enabled > [0.00] efi: UEFI not found. > [0.00] Zone ranges: > [0.00] DMA32[mem 0x8020-0x83ff] > [0.00] Normal empty > [0.00] Movable zone start for each node > [0.00] Early memory node ranges > [0.00] node 0: [mem 0x8020-0x83ff] > [0.00] Initmem setup node 0 [mem > 0x8020-0x83ff] > [0.00] SBI specification v0.2 detected > [0.00] SBI implementation ID=0x1 Version=0x9 > [0.00] SBI TIME extension detected > [0.00] SBI IPI extension detected > [0.00] SBI RFENCE extension detected > [0.00] SBI v0.2 HSM extension detected > [0.00] riscv: ISA extensions acdfhimsu > [0.00] riscv: ELF capabilities acdfim > [0.00] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632 > [0.00] Built 1 zonelists, mobility grouping on. Total pages: 15655 > [0.00] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 > earlycon=sbi > [0.00] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes, > linear) > [0.00] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, > linear) > [0.00] mem auto-init: stack:off, heap alloc:off, heap free:off > [0.00] Virtual kernel memory layout: > [0.00] fixmap : 0xffcefee0 - 0xffceff00 (2048 > kB) > [0.00] pci io : 0xffceff00 - 0xffcf ( 16 > MB) > [0.00] vmemmap : 0xffcf - 0xffcf (4095 > MB) > [0.00] vmalloc : 0xffd0 - 0xffdf > (65535 MB) > [0.00] lowmem : 0xffe0 - 0xffe003e0 ( 62 > MB) > [0.00] kernel :