From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8F0BC4332F for ; Fri, 20 May 2022 18:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352598AbiETSTX (ORCPT ); Fri, 20 May 2022 14:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352663AbiETSTO (ORCPT ); Fri, 20 May 2022 14:19:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CAD8A7E27; Fri, 20 May 2022 11:19:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 10221B82D92; Fri, 20 May 2022 18:19:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C01ECC34119; Fri, 20 May 2022 18:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653070738; bh=dLpj7qKkKib+aI9CC01MUR5D/MbLKwYxjZ2Or3/u66w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kzNqqr8pp8bHR0I2mQVS/6H224ZnHvTx6hnUE4bnAlyFwem9P4NeAdJTKycGMo5uu Xmc3cnb1flrmdz8LYjY/9nCNOGmYcsWgP3lN0rWY6nGpY1+4PKZAjbGv3IBiw17TnW ngx6wK9zegEFnakupcp3PQEmvmlz0bczq7dYAuRKJfj5FKd1uGos+zRGiF/WYxOie6 oHmY/rMP1H1b3JUqQVCoUl3AIPx8EtJw1zbA6gambZPY9Fzr2bxJltx7IiVQp+pGnl 7X8+KvZKYqGdfUUiHpr/N8zThqV9V5005k4oYOWCA6Kv1v7JibgrscSWe+1Z4Kz52Z 2gy80+YxwRXMw== Received: by mail-vs1-f54.google.com with SMTP id z6so9009575vsp.0; Fri, 20 May 2022 11:18:58 -0700 (PDT) X-Gm-Message-State: AOAM532chkWUjeRJO1NYV6SBuRGhdvSxUFloM19VpTMtxV4gmg/iTVDF L7qflms7qB/NCjoM5Pn4dgTVY3oVeX9xNEN+pCI= X-Google-Smtp-Source: ABdhPJzNJFwsn6T9T5KIfZQ4CHoJUNjpTHgdCFaq6U5Mf9Bq6/7s0wM9wbreJ82vFhfCuqKoGio5ahZh4lQSCmWjcCA= X-Received: by 2002:a05:6102:a49:b0:335:fd3b:7ab8 with SMTP id i9-20020a0561020a4900b00335fd3b7ab8mr3647435vss.2.1653070737462; Fri, 20 May 2022 11:18:57 -0700 (PDT) MIME-Version: 1.0 References: <20220405071314.3225832-1-guoren@kernel.org> In-Reply-To: From: Guo Ren Date: Sat, 21 May 2022 02:18:46 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V12 00/20] riscv: Add COMPAT mode support for 64BIT To: Palmer Dabbelt Cc: Arnd Bergmann , Greg KH , Christoph Hellwig , Nathan Chancellor , Naresh Kamboju , linux-arch , Linux Kernel Mailing List , linux-riscv , linux-s390 , sparclinux , linuxppc-dev , Parisc List , "open list:BROADCOM NVRAM DRIVER" , Linux ARM , "the arch/x86 maintainers" , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Guo Ren Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On Fri, May 20, 2022 at 1:50 AM Palmer Dabbelt wrote: > > On Tue, 05 Apr 2022 00:12:54 PDT (-0700), guoren@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=3Dqemu_riscv32_virt_defconfig > > $ make -C qemu_riscv32_virt_defconfig > > $ make qemu_riscv64_virt_defconfig O=3Dqemu_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 git@github.com:c-sky/csky-linux.git -b riscv_compat_v12 = linux > > $ cd linux > > $ echo "CONFIG_STRICT_KERNEL_RWX=3Dn" >> arch/riscv/configs/defconfi= g > > $ echo "CONFIG_STRICT_MODULE_RWX=3Dn" >> arch/riscv/configs/defconfi= g > > $ make ARCH=3Driscv CROSS_COMPILE=3Driscv32-buildroot-linux-gnu- O= =3D../build-rv32/ rv32_defconfig > > $ make ARCH=3Driscv CROSS_COMPILE=3Driscv32-buildroot-linux-gnu- O= =3D../build-rv32/ Image > > $ make ARCH=3Driscv CROSS_COMPILE=3Driscv64-buildroot-linux-gnu- O= =3D../build-rv64/ defconfig > > $ make ARCH=3Driscv CROSS_COMPILE=3Driscv64-buildroot-linux-gnu- O= =3D../build-rv64/ Image > > > > - Prepare Qemu: > > $ git clone https://gitlab.com/qemu-project/qemu.git -b master linux > > $ cd qemu > > $ ./configure --target-list=3D"riscv64-softmmu riscv32-softmmu" > > $ make > > > > Now let's compare rv64-compat with rv32-native memory footprint with al= most 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 -b= ios qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image= -drive file qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=3Draw,id= =3Dhd0 -device virtio-blk-device,drive=3Dhd0 -append "rootwait root=3D/dev/= vda ro console=3DttyS0 earlycon=3Dsbi" -netdev user,id=3Dnet0 -device virti= o-net-device,netdev=3Dnet0 > > > > QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) > > OpenSBI v0.9 > > [ 0.000000] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guor= en@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.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 > > [ 0.000000] Machine model: riscv-virtio,qemu > > [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') > > [ 0.000000] printk: bootconsole [sbi0] enabled > > [ 0.000000] efi: UEFI not found. > > [ 0.000000] Zone ranges: > > [ 0.000000] DMA32 [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] Normal empty > > [ 0.000000] Movable zone start for each node > > [ 0.000000] Early memory node ranges > > [ 0.000000] node 0: [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000008= 3ffffff] > > [ 0.000000] SBI specification v0.2 detected > > [ 0.000000] SBI implementation ID=3D0x1 Version=3D0x9 > > [ 0.000000] SBI TIME extension detected > > [ 0.000000] SBI IPI extension detected > > [ 0.000000] SBI RFENCE extension detected > > [ 0.000000] SBI v0.2 HSM extension detected > > [ 0.000000] riscv: ISA extensions acdfhimsu > > [ 0.000000] riscv: ELF capabilities acdfim > > [ 0.000000] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632 > > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 1= 5655 > > [ 0.000000] Kernel command line: rootwait root=3D/dev/vda ro console= =3DttyS0 earlycon=3Dsbi > > [ 0.000000] Dentry cache hash table entries: 8192 (order: 4, 65536 b= ytes, linear) > > [ 0.000000] Inode-cache hash table entries: 4096 (order: 3, 32768 by= tes, linear) > > [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off > > [ 0.000000] Virtual kernel memory layout: > > [ 0.000000] fixmap : 0xffffffcefee00000 - 0xffffffceff000000 = (2048 kB) > > [ 0.000000] pci io : 0xffffffceff000000 - 0xffffffcf00000000 = ( 16 MB) > > [ 0.000000] vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff = (4095 MB) > > [ 0.000000] vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff = (65535 MB) > > [ 0.000000] lowmem : 0xffffffe000000000 - 0xffffffe003e00000 = ( 62 MB) > > [ 0.000000] kernel : 0xffffffff80000000 - 0xffffffffffffffff = (2047 MB) > > [ 0.000000] Memory: 52788K/63488K available (6184K kernel code, 888K= rwdata, 1917K rodata, 294K init, 297K bss, 10700K reserved, 0K cma-reserve= d) > > [ 0.000000] SLUB: HWalign=3D64, Order=3D0-3, MinObjects=3D0, CPUs=3D= 1, Nodes=3D1 > > [ 0.000000] rcu: Hierarchical RCU implementation. > > [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=3D8 to nr_cpu= _ids=3D1. > > [ 0.000000] rcu: RCU debug extended QS entry/exit. > > [ 0.000000] Tracing variant of Tasks RCU enabled. > > [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay = is 25 jiffies. > > [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=3D16, nr_cpu= _ids=3D1 > > [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 > > [ 0.000000] riscv-intc: 64 local interrupts mapped > > [ 0.000000] plic: plic@c000000: mapped 53 interrupts with 1 handlers= for 2 contexts. > > ... > > Welcome to Buildroot > > buildroot login: root > > # cat /proc/cpuinfo > > processor : 0 > > hart : 0 > > isa : rv64imafdcsuh > > mmu : sv48 > > > > # file /bin/busybox > > /bin/busybox: setuid ELF 32-bit LSB shared object, UCB RISC-V, version = 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv32-ilp32d.so.1= , for GNU/Linux 5.15.0, stripped > > # ca[ 78.386630] random: fast init done > > # cat /proc/meminfo > > MemTotal: 53076 kB > > MemFree: 40264 kB > > MemAvailable: 40244 kB > > Buffers: 236 kB > > Cached: 1560 kB > > SwapCached: 0 kB > > Active: 1700 kB > > Inactive: 516 kB > > Active(anon): 40 kB > > Inactive(anon): 424 kB > > Active(file): 1660 kB > > Inactive(file): 92 kB > > Unevictable: 0 kB > > Mlocked: 0 kB > > SwapTotal: 0 kB > > SwapFree: 0 kB > > Dirty: 0 kB > > Writeback: 0 kB > > AnonPages: 444 kB > > Mapped: 1188 kB > > Shmem: 44 kB > > KReclaimable: 952 kB > > Slab: 5744 kB > > SReclaimable: 952 kB > > SUnreclaim: 4792 kB > > KernelStack: 624 kB > > PageTables: 156 kB > > NFS_Unstable: 0 kB > > Bounce: 0 kB > > WritebackTmp: 0 kB > > CommitLimit: 26536 kB > > Committed_AS: 1748 kB > > VmallocTotal: 67108863 kB > > VmallocUsed: 652 kB > > VmallocChunk: 0 kB > > Percpu: 80 kB > > # > > > > - Run rv32 with rv32 rootfs: > > $ ./build/qemu-system-riscv32 -cpu rv32 -M virt -m 64m -nographic -b= ios qemu_riscv32_virt_defconfig/images/fw_jump.bin -kernel build-rv32/Image= -drive file qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=3Draw,id= =3Dhd0 -device virtio-blk-device,drive=3Dhd0 -append "rootwait root=3D/dev/= vda ro console=3DttyS0 earlycon=3Dsbi" -netdev user,id=3Dnet0 -device virti= o-net-device,netdev=3Dnet0 > > > > QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) > > OpenSBI v0.9 > > [ 0.000000] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guor= en@guoren-Z87-HD3) (riscv32-buildroot-linux-gnu-gcc.br_real (Buildroot 2021= .11-201-g7600ca7960-dirty) 10.3.0, GNU ld (GNU Binutils) 2.36.1) #7 SMP Tue= Dec 28 21:02:21 CST 2021 > > [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80400000 > > [ 0.000000] Machine model: riscv-virtio,qemu > > [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') > > [ 0.000000] printk: bootconsole [sbi0] enabled > > [ 0.000000] efi: UEFI not found. > > [ 0.000000] Zone ranges: > > [ 0.000000] Normal [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] Movable zone start for each node > > [ 0.000000] Early memory node ranges > > [ 0.000000] node 0: [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] Initmem setup node 0 [mem 0x0000000080400000-0x000000008= 3ffffff] > > [ 0.000000] SBI specification v0.2 detected > > [ 0.000000] SBI implementation ID=3D0x1 Version=3D0x9 > > [ 0.000000] SBI TIME extension detected > > [ 0.000000] SBI IPI extension detected > > [ 0.000000] SBI RFENCE extension detected > > [ 0.000000] SBI v0.2 HSM extension detected > > [ 0.000000] riscv: ISA extensions acdfhimsu > > [ 0.000000] riscv: ELF capabilities acdfim > > [ 0.000000] percpu: Embedded 12 pages/cpu s16600 r8192 d24360 u49152 > > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 1= 5240 > > [ 0.000000] Kernel command line: rootwait root=3D/dev/vda ro console= =3DttyS0 earlycon=3Dsbi > > [ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 b= ytes, linear) > > [ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 by= tes, linear) > > [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off > > [ 0.000000] Virtual kernel memory layout: > > [ 0.000000] fixmap : 0x9dc00000 - 0x9e000000 (4096 kB) > > [ 0.000000] pci io : 0x9e000000 - 0x9f000000 ( 16 MB) > > [ 0.000000] vmemmap : 0x9f000000 - 0x9fffffff ( 15 MB) > > [ 0.000000] vmalloc : 0xa0000000 - 0xbfffffff ( 511 MB) > > [ 0.000000] lowmem : 0xc0000000 - 0xc3c00000 ( 60 MB) > > [ 0.000000] Memory: 51924K/61440K available (6117K kernel code, 695K= rwdata, 1594K rodata, 255K init, 241K bss, 9516K reserved, 0K cma-reserved= ) > > [ 0.000000] SLUB: HWalign=3D64, Order=3D0-3, MinObjects=3D0, CPUs=3D= 1, Nodes=3D1 > > [ 0.000000] rcu: Hierarchical RCU implementation. > > [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=3D8 to nr_cpu= _ids=3D1. > > [ 0.000000] rcu: RCU debug extended QS entry/exit. > > [ 0.000000] Tracing variant of Tasks RCU enabled. > > [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay = is 25 jiffies. > > [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=3D16, nr_cpu= _ids=3D1 > > [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 > > [ 0.000000] riscv-intc: 32 local interrupts mapped > > [ 0.000000] plic: plic@c000000: mapped 53 interrupts with 1 handlers= for 2 contexts. > > ... > > Welcome to Buildroot > > buildroot login: root > > # cat /proc/cpuinfo > > processor : 0 > > hart : 0 > > isa : rv32imafdcsuh > > mmu : sv32 > > > > # file /bin/busybox > > /bin/busybox: setuid ELF 32-bit LSB shared object, UCB RISC-V, version = 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv32-ilp32d.so.1= , for GNU/Linux 5.15.0, stripped > > [ 79.320589] random: fast init done > > # cat /proc/meminfo > > MemTotal: 52176 kB > > MemFree: 41012 kB > > MemAvailable: 42176 kB > > Buffers: 644 kB > > Cached: 2724 kB > > SwapCached: 0 kB > > Active: 3128 kB > > Inactive: 752 kB > > Active(anon): 40 kB > > Inactive(anon): 516 kB > > Active(file): 3088 kB > > Inactive(file): 236 kB > > Unevictable: 0 kB > > Mlocked: 0 kB > > SwapTotal: 0 kB > > SwapFree: 0 kB > > Dirty: 4 kB > > Writeback: 0 kB > > AnonPages: 556 kB > > Mapped: 2172 kB > > Shmem: 44 kB > > KReclaimable: 656 kB > > Slab: 3684 kB > > SReclaimable: 656 kB > > SUnreclaim: 3028 kB > > KernelStack: 312 kB > > PageTables: 88 kB > > NFS_Unstable: 0 kB > > Bounce: 0 kB > > WritebackTmp: 0 kB > > CommitLimit: 26088 kB > > Committed_AS: 2088 kB > > VmallocTotal: 524287 kB > > VmallocUsed: 12 kB > > VmallocChunk: 0 kB > > Percpu: 60 kB > > # > > > > Some conclusions: > > - kernel statics: > > 64: Memory: 52788K/63488K available (6184K kernel code, 888K rwdata,= 1917K rodata, 294K init, 297K bss, 10700K reserved) > > 32: Memory: 51924K/61440K available (6117K kernel code, 695K rwdata,= 1594K rodata, 255K init, 241K bss, 9516K reserved) > > rv32 better than rv64: 1% 22% = 17% 13% 19% 11% > > The code size is very similar, but data size rv32 would be better. > > > > - rv32 kernel runtime KernelStack, Slab... are smaller, > > rv64: MemTotal: 53076 kB, MemFree: 40264 kB > > rv32: MemTotal: 52176 + 2048 kB, MemFree: 41012 + 2048 kB > > rv32 better than rv64: 2% 6% > > > > (Because opensbi problem, we could add another 2MB for rv32.) > > Overall in 64MB memory situation, rv64-compat is 6% worse than rv32-= native > > at memory footprint. If the userspace memory usage increases, I thin= k > > the gap will be further reduced. > > > > Changes in v12: > > - Rebase on 5.18-rc1 > > - Fixup compile conflicts with 5.18-rc1 > > - Fixup $(srctree) =3D=3D $(objtree) compile error reported by Nathan > > > > Changes in v11: > > - Using arch instead of kconfig for commit subject by Masahiro Yamada > > > > Changes in v10: > > - Fixup arm64 compile error with compat_statfs definition > > - Fixup compat_sys_fadvise64_64 function arguments error cause ltp fai= lure > > > > Changes in v9: > > - Fixup rv32 call rv64 segment fault > > - Ready for 5.18 > > > > Changes in v8: > > - Enhanced elf_check_arch with EI_CLASS > > - Fixup SR_UXL doesn't exist in CONFIG_32BIT > > - Add Tested-by with Heiko > > - Update qemu compile tips with upstream repo > > > > Changes in v7: > > - Re-construct compat_vdso/Makefile > > - Fixup disable COMPAT compile error by csr.h's macro. > > - Optimize coding convention for lo/hi in compat.h > > > > Changes in v6: > > - Rebase on linux-5.17-rc5 > > - Optimize hw capability check for elf > > - Optimize comment in thread_info.h > > - Optimize start_thread with SR_UXL setting > > - Optimize vdso.c with direct panic > > > > Changes in v5: > > - Rebase on linux-5.17-rc2 > > - Include consolidate the fcntl patches by Christoph Hellwig > > - Remove F_GETLK64/F_SETLK64/F_SETLKW64 from asm/compat.h > > - Change COMPAT_RLIM_INFINITY from 0x7fffffff to 0xffffffff > > - Bring back "Add hw-cap detect in setup_arch patch" in v1 > > > > Changes in v4: > > - Rebase on linux-5.17-rc1 > > - Optimize compat_sys_call_table implementation with Arnd's advice > > - Add reviewed-by for Arnd. Thx :) > > - Remove FIXME comment in elf.h > > - Optimize Cleanup duplicate definitions in compat.h with Arnd's advic= e > > > > Changes in v3: > > - Rebase on newest master (pre linux-5.17-rc1) > > - Using newest qemu version v7 for test > > - Remove fcntl common modification > > - Fixup SET_PERSONALITY in elf.h by Arnd > > - Fixup KVM Kconfig > > - Update Acked-by & Reviewed-by > > > > Changes in v2: > > - Add __ARCH_WANT_COMPAT_STAT suggested > > - Cleanup fcntl compatduplicate definitions > > - Cleanup compat.h > > - Move rv32_defconfig into Makefile > > - Fixup rv64 rootfs boot failed, remove hw_compat_mode_detect > > - Move SYSVIPC_COMPAT into init/Kconfig > > - Simplify compat_elf_check > > > > Christoph Hellwig (3): > > uapi: simplify __ARCH_FLOCK{,64}_PAD a little > > uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h > > compat: consolidate the compat_flock{,64} definition > > > > Guo Ren (17): > > arch: Add SYSVIPC_COMPAT for all architectures > > fs: stat: compat: Add __ARCH_WANT_COMPAT_STAT > > asm-generic: compat: Cleanup duplicate definitions > > syscalls: compat: Fix the missing part for __SYSCALL_COMPAT > > riscv: Fixup difference with defconfig > > riscv: compat: Add basic compat data type implementation > > riscv: compat: Support TASK_SIZE for compat mode > > riscv: compat: syscall: Add compat_sys_call_table implementation > > riscv: compat: syscall: Add entry.S implementation > > riscv: compat: process: Add UXL_32 support in start_thread > > riscv: compat: Add elf.h implementation > > riscv: compat: Add hw capability check for elf > > riscv: compat: vdso: Add COMPAT_VDSO base code implementation > > riscv: compat: vdso: Add setup additional pages implementation > > riscv: compat: signal: Add rt_frame implementation > > riscv: compat: ptrace: Add compat_arch_ptrace implement > > riscv: compat: Add COMPAT Kbuild skeletal support > > > > arch/arm64/Kconfig | 4 - > > arch/arm64/include/asm/compat.h | 93 +------ > > arch/arm64/include/asm/unistd.h | 1 + > > arch/mips/Kconfig | 5 - > > arch/mips/include/asm/compat.h | 41 +-- > > arch/mips/include/asm/unistd.h | 2 + > > arch/mips/include/uapi/asm/fcntl.h | 30 +-- > > arch/parisc/Kconfig | 4 - > > arch/parisc/include/asm/compat.h | 45 +--- > > arch/parisc/include/asm/unistd.h | 1 + > > arch/powerpc/Kconfig | 5 - > > arch/powerpc/include/asm/compat.h | 50 +--- > > arch/powerpc/include/asm/unistd.h | 1 + > > arch/riscv/Kconfig | 19 ++ > > arch/riscv/Makefile | 9 + > > arch/riscv/include/asm/compat.h | 129 ++++++++++ > > arch/riscv/include/asm/csr.h | 7 + > > arch/riscv/include/asm/elf.h | 50 +++- > > arch/riscv/include/asm/mmu.h | 1 + > > arch/riscv/include/asm/pgtable.h | 13 +- > > arch/riscv/include/asm/processor.h | 6 +- > > arch/riscv/include/asm/syscall.h | 1 + > > arch/riscv/include/asm/thread_info.h | 1 + > > arch/riscv/include/asm/unistd.h | 11 + > > arch/riscv/include/asm/vdso.h | 9 + > > arch/riscv/include/uapi/asm/unistd.h | 2 +- > > arch/riscv/kernel/Makefile | 3 + > > arch/riscv/kernel/compat_signal.c | 242 ++++++++++++++++++ > > arch/riscv/kernel/compat_syscall_table.c | 19 ++ > > arch/riscv/kernel/compat_vdso/.gitignore | 2 + > > arch/riscv/kernel/compat_vdso/Makefile | 78 ++++++ > > arch/riscv/kernel/compat_vdso/compat_vdso.S | 8 + > > .../kernel/compat_vdso/compat_vdso.lds.S | 3 + > > arch/riscv/kernel/compat_vdso/flush_icache.S | 3 + > > .../compat_vdso/gen_compat_vdso_offsets.sh | 5 + > > arch/riscv/kernel/compat_vdso/getcpu.S | 3 + > > arch/riscv/kernel/compat_vdso/note.S | 3 + > > arch/riscv/kernel/compat_vdso/rt_sigreturn.S | 3 + > > arch/riscv/kernel/entry.S | 18 +- > > arch/riscv/kernel/process.c | 37 +++ > > arch/riscv/kernel/ptrace.c | 87 ++++++- > > arch/riscv/kernel/signal.c | 13 +- > > arch/riscv/kernel/sys_riscv.c | 6 +- > > arch/riscv/kernel/vdso.c | 105 +++++--- > > arch/riscv/kernel/vdso/vdso.S | 6 +- > > arch/s390/Kconfig | 3 - > > arch/s390/include/asm/compat.h | 99 +------ > > arch/s390/include/asm/unistd.h | 1 + > > arch/sparc/Kconfig | 5 - > > arch/sparc/include/asm/compat.h | 61 ++--- > > arch/sparc/include/asm/unistd.h | 1 + > > arch/x86/Kconfig | 4 - > > arch/x86/include/asm/compat.h | 104 ++------ > > arch/x86/include/asm/unistd.h | 1 + > > fs/open.c | 24 ++ > > fs/read_write.c | 16 ++ > > fs/stat.c | 2 +- > > fs/sync.c | 9 + > > include/asm-generic/compat.h | 113 ++++++++ > > include/linux/compat.h | 68 +++++ > > include/uapi/asm-generic/fcntl.h | 23 +- > > include/uapi/asm-generic/unistd.h | 4 +- > > init/Kconfig | 4 + > > mm/fadvise.c | 11 + > > mm/readahead.c | 7 + > > tools/include/uapi/asm-generic/fcntl.h | 21 +- > > tools/include/uapi/asm-generic/unistd.h | 4 +- > > 67 files changed, 1206 insertions(+), 563 deletions(-) > > create mode 100644 arch/riscv/include/asm/compat.h > > create mode 100644 arch/riscv/kernel/compat_signal.c > > create mode 100644 arch/riscv/kernel/compat_syscall_table.c > > create mode 100644 arch/riscv/kernel/compat_vdso/.gitignore > > create mode 100644 arch/riscv/kernel/compat_vdso/Makefile > > create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.S > > create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.lds.S > > create mode 100644 arch/riscv/kernel/compat_vdso/flush_icache.S > > create mode 100755 arch/riscv/kernel/compat_vdso/gen_compat_vdso_offse= ts.sh > > create mode 100644 arch/riscv/kernel/compat_vdso/getcpu.S > > create mode 100644 arch/riscv/kernel/compat_vdso/note.S > > create mode 100644 arch/riscv/kernel/compat_vdso/rt_sigreturn.S > > Thanks. > > This touches a bunch of other trees, which I try to avoid without the > relevant acks and such. In this case I'm OK taking it because Arnd and > Christoph have written/reviewed/ack'd so much of it, and because some > autobuilders found build issues (and thus I'm assuming there aren't any > more). > > There's been a bunch of versions of this and I'm pretty sure I've said > this a handful of times without any comments. Now that it's passing all > my tests and I'm not getting any autobuilding breakages I've put it on > for-next, but happy to try and spin up some sort of multi-tree merge if Sounds good to me. Thx. > that's an issue for anyone. --=20 Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4AF4DC433EF for ; Fri, 20 May 2022 18:19:42 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4L4Zkh5sdFz3bp4 for ; Sat, 21 May 2022 04:19:40 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=kzNqqr8p; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=guoren@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=kzNqqr8p; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4L4Zjy45f0z30DC for ; Sat, 21 May 2022 04:19:02 +1000 (AEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 07AB861943 for ; Fri, 20 May 2022 18:19:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C431EC34118 for ; Fri, 20 May 2022 18:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653070738; bh=dLpj7qKkKib+aI9CC01MUR5D/MbLKwYxjZ2Or3/u66w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kzNqqr8pp8bHR0I2mQVS/6H224ZnHvTx6hnUE4bnAlyFwem9P4NeAdJTKycGMo5uu Xmc3cnb1flrmdz8LYjY/9nCNOGmYcsWgP3lN0rWY6nGpY1+4PKZAjbGv3IBiw17TnW ngx6wK9zegEFnakupcp3PQEmvmlz0bczq7dYAuRKJfj5FKd1uGos+zRGiF/WYxOie6 oHmY/rMP1H1b3JUqQVCoUl3AIPx8EtJw1zbA6gambZPY9Fzr2bxJltx7IiVQp+pGnl 7X8+KvZKYqGdfUUiHpr/N8zThqV9V5005k4oYOWCA6Kv1v7JibgrscSWe+1Z4Kz52Z 2gy80+YxwRXMw== Received: by mail-vs1-f51.google.com with SMTP id c62so9107132vsc.10 for ; Fri, 20 May 2022 11:18:58 -0700 (PDT) X-Gm-Message-State: AOAM530BjATLtFrhS3I0Njl+PRfoSQxdIt+IOS6dduVQ+252efo8vR0u jzMWFYyyILXf5ugwfK4sxd10VE9BPYLJeDKMk+g= X-Google-Smtp-Source: ABdhPJzNJFwsn6T9T5KIfZQ4CHoJUNjpTHgdCFaq6U5Mf9Bq6/7s0wM9wbreJ82vFhfCuqKoGio5ahZh4lQSCmWjcCA= X-Received: by 2002:a05:6102:a49:b0:335:fd3b:7ab8 with SMTP id i9-20020a0561020a4900b00335fd3b7ab8mr3647435vss.2.1653070737462; Fri, 20 May 2022 11:18:57 -0700 (PDT) MIME-Version: 1.0 References: <20220405071314.3225832-1-guoren@kernel.org> In-Reply-To: From: Guo Ren Date: Sat, 21 May 2022 02:18:46 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V12 00/20] riscv: Add COMPAT mode support for 64BIT To: Palmer Dabbelt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch , linux-s390 , Guo Ren , Parisc List , Arnd Bergmann , Greg KH , Naresh Kamboju , the arch/x86 maintainers , Linux Kernel Mailing List , "open list:BROADCOM NVRAM DRIVER" , Nathan Chancellor , sparclinux , linux-riscv , linuxppc-dev , Christoph Hellwig , Linux ARM , =?UTF-8?Q?Heiko_St=C3=BCbner?= Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, May 20, 2022 at 1:50 AM Palmer Dabbelt wrote: > > On Tue, 05 Apr 2022 00:12:54 PDT (-0700), guoren@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=3Dqemu_riscv32_virt_defconfig > > $ make -C qemu_riscv32_virt_defconfig > > $ make qemu_riscv64_virt_defconfig O=3Dqemu_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 git@github.com:c-sky/csky-linux.git -b riscv_compat_v12 = linux > > $ cd linux > > $ echo "CONFIG_STRICT_KERNEL_RWX=3Dn" >> arch/riscv/configs/defconfi= g > > $ echo "CONFIG_STRICT_MODULE_RWX=3Dn" >> arch/riscv/configs/defconfi= g > > $ make ARCH=3Driscv CROSS_COMPILE=3Driscv32-buildroot-linux-gnu- O= =3D../build-rv32/ rv32_defconfig > > $ make ARCH=3Driscv CROSS_COMPILE=3Driscv32-buildroot-linux-gnu- O= =3D../build-rv32/ Image > > $ make ARCH=3Driscv CROSS_COMPILE=3Driscv64-buildroot-linux-gnu- O= =3D../build-rv64/ defconfig > > $ make ARCH=3Driscv CROSS_COMPILE=3Driscv64-buildroot-linux-gnu- O= =3D../build-rv64/ Image > > > > - Prepare Qemu: > > $ git clone https://gitlab.com/qemu-project/qemu.git -b master linux > > $ cd qemu > > $ ./configure --target-list=3D"riscv64-softmmu riscv32-softmmu" > > $ make > > > > Now let's compare rv64-compat with rv32-native memory footprint with al= most 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 -b= ios qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image= -drive file qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=3Draw,id= =3Dhd0 -device virtio-blk-device,drive=3Dhd0 -append "rootwait root=3D/dev/= vda ro console=3DttyS0 earlycon=3Dsbi" -netdev user,id=3Dnet0 -device virti= o-net-device,netdev=3Dnet0 > > > > QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) > > OpenSBI v0.9 > > [ 0.000000] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guor= en@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.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 > > [ 0.000000] Machine model: riscv-virtio,qemu > > [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') > > [ 0.000000] printk: bootconsole [sbi0] enabled > > [ 0.000000] efi: UEFI not found. > > [ 0.000000] Zone ranges: > > [ 0.000000] DMA32 [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] Normal empty > > [ 0.000000] Movable zone start for each node > > [ 0.000000] Early memory node ranges > > [ 0.000000] node 0: [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000008= 3ffffff] > > [ 0.000000] SBI specification v0.2 detected > > [ 0.000000] SBI implementation ID=3D0x1 Version=3D0x9 > > [ 0.000000] SBI TIME extension detected > > [ 0.000000] SBI IPI extension detected > > [ 0.000000] SBI RFENCE extension detected > > [ 0.000000] SBI v0.2 HSM extension detected > > [ 0.000000] riscv: ISA extensions acdfhimsu > > [ 0.000000] riscv: ELF capabilities acdfim > > [ 0.000000] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632 > > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 1= 5655 > > [ 0.000000] Kernel command line: rootwait root=3D/dev/vda ro console= =3DttyS0 earlycon=3Dsbi > > [ 0.000000] Dentry cache hash table entries: 8192 (order: 4, 65536 b= ytes, linear) > > [ 0.000000] Inode-cache hash table entries: 4096 (order: 3, 32768 by= tes, linear) > > [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off > > [ 0.000000] Virtual kernel memory layout: > > [ 0.000000] fixmap : 0xffffffcefee00000 - 0xffffffceff000000 = (2048 kB) > > [ 0.000000] pci io : 0xffffffceff000000 - 0xffffffcf00000000 = ( 16 MB) > > [ 0.000000] vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff = (4095 MB) > > [ 0.000000] vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff = (65535 MB) > > [ 0.000000] lowmem : 0xffffffe000000000 - 0xffffffe003e00000 = ( 62 MB) > > [ 0.000000] kernel : 0xffffffff80000000 - 0xffffffffffffffff = (2047 MB) > > [ 0.000000] Memory: 52788K/63488K available (6184K kernel code, 888K= rwdata, 1917K rodata, 294K init, 297K bss, 10700K reserved, 0K cma-reserve= d) > > [ 0.000000] SLUB: HWalign=3D64, Order=3D0-3, MinObjects=3D0, CPUs=3D= 1, Nodes=3D1 > > [ 0.000000] rcu: Hierarchical RCU implementation. > > [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=3D8 to nr_cpu= _ids=3D1. > > [ 0.000000] rcu: RCU debug extended QS entry/exit. > > [ 0.000000] Tracing variant of Tasks RCU enabled. > > [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay = is 25 jiffies. > > [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=3D16, nr_cpu= _ids=3D1 > > [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 > > [ 0.000000] riscv-intc: 64 local interrupts mapped > > [ 0.000000] plic: plic@c000000: mapped 53 interrupts with 1 handlers= for 2 contexts. > > ... > > Welcome to Buildroot > > buildroot login: root > > # cat /proc/cpuinfo > > processor : 0 > > hart : 0 > > isa : rv64imafdcsuh > > mmu : sv48 > > > > # file /bin/busybox > > /bin/busybox: setuid ELF 32-bit LSB shared object, UCB RISC-V, version = 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv32-ilp32d.so.1= , for GNU/Linux 5.15.0, stripped > > # ca[ 78.386630] random: fast init done > > # cat /proc/meminfo > > MemTotal: 53076 kB > > MemFree: 40264 kB > > MemAvailable: 40244 kB > > Buffers: 236 kB > > Cached: 1560 kB > > SwapCached: 0 kB > > Active: 1700 kB > > Inactive: 516 kB > > Active(anon): 40 kB > > Inactive(anon): 424 kB > > Active(file): 1660 kB > > Inactive(file): 92 kB > > Unevictable: 0 kB > > Mlocked: 0 kB > > SwapTotal: 0 kB > > SwapFree: 0 kB > > Dirty: 0 kB > > Writeback: 0 kB > > AnonPages: 444 kB > > Mapped: 1188 kB > > Shmem: 44 kB > > KReclaimable: 952 kB > > Slab: 5744 kB > > SReclaimable: 952 kB > > SUnreclaim: 4792 kB > > KernelStack: 624 kB > > PageTables: 156 kB > > NFS_Unstable: 0 kB > > Bounce: 0 kB > > WritebackTmp: 0 kB > > CommitLimit: 26536 kB > > Committed_AS: 1748 kB > > VmallocTotal: 67108863 kB > > VmallocUsed: 652 kB > > VmallocChunk: 0 kB > > Percpu: 80 kB > > # > > > > - Run rv32 with rv32 rootfs: > > $ ./build/qemu-system-riscv32 -cpu rv32 -M virt -m 64m -nographic -b= ios qemu_riscv32_virt_defconfig/images/fw_jump.bin -kernel build-rv32/Image= -drive file qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=3Draw,id= =3Dhd0 -device virtio-blk-device,drive=3Dhd0 -append "rootwait root=3D/dev/= vda ro console=3DttyS0 earlycon=3Dsbi" -netdev user,id=3Dnet0 -device virti= o-net-device,netdev=3Dnet0 > > > > QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8) > > OpenSBI v0.9 > > [ 0.000000] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guor= en@guoren-Z87-HD3) (riscv32-buildroot-linux-gnu-gcc.br_real (Buildroot 2021= .11-201-g7600ca7960-dirty) 10.3.0, GNU ld (GNU Binutils) 2.36.1) #7 SMP Tue= Dec 28 21:02:21 CST 2021 > > [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80400000 > > [ 0.000000] Machine model: riscv-virtio,qemu > > [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') > > [ 0.000000] printk: bootconsole [sbi0] enabled > > [ 0.000000] efi: UEFI not found. > > [ 0.000000] Zone ranges: > > [ 0.000000] Normal [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] Movable zone start for each node > > [ 0.000000] Early memory node ranges > > [ 0.000000] node 0: [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] Initmem setup node 0 [mem 0x0000000080400000-0x000000008= 3ffffff] > > [ 0.000000] SBI specification v0.2 detected > > [ 0.000000] SBI implementation ID=3D0x1 Version=3D0x9 > > [ 0.000000] SBI TIME extension detected > > [ 0.000000] SBI IPI extension detected > > [ 0.000000] SBI RFENCE extension detected > > [ 0.000000] SBI v0.2 HSM extension detected > > [ 0.000000] riscv: ISA extensions acdfhimsu > > [ 0.000000] riscv: ELF capabilities acdfim > > [ 0.000000] percpu: Embedded 12 pages/cpu s16600 r8192 d24360 u49152 > > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 1= 5240 > > [ 0.000000] Kernel command line: rootwait root=3D/dev/vda ro console= =3DttyS0 earlycon=3Dsbi > > [ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 b= ytes, linear) > > [ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 by= tes, linear) > > [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off > > [ 0.000000] Virtual kernel memory layout: > > [ 0.000000] fixmap : 0x9dc00000 - 0x9e000000 (4096 kB) > > [ 0.000000] pci io : 0x9e000000 - 0x9f000000 ( 16 MB) > > [ 0.000000] vmemmap : 0x9f000000 - 0x9fffffff ( 15 MB) > > [ 0.000000] vmalloc : 0xa0000000 - 0xbfffffff ( 511 MB) > > [ 0.000000] lowmem : 0xc0000000 - 0xc3c00000 ( 60 MB) > > [ 0.000000] Memory: 51924K/61440K available (6117K kernel code, 695K= rwdata, 1594K rodata, 255K init, 241K bss, 9516K reserved, 0K cma-reserved= ) > > [ 0.000000] SLUB: HWalign=3D64, Order=3D0-3, MinObjects=3D0, CPUs=3D= 1, Nodes=3D1 > > [ 0.000000] rcu: Hierarchical RCU implementation. > > [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=3D8 to nr_cpu= _ids=3D1. > > [ 0.000000] rcu: RCU debug extended QS entry/exit. > > [ 0.000000] Tracing variant of Tasks RCU enabled. > > [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay = is 25 jiffies. > > [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=3D16, nr_cpu= _ids=3D1 > > [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 > > [ 0.000000] riscv-intc: 32 local interrupts mapped > > [ 0.000000] plic: plic@c000000: mapped 53 interrupts with 1 handlers= for 2 contexts. > > ... > > Welcome to Buildroot > > buildroot login: root > > # cat /proc/cpuinfo > > processor : 0 > > hart : 0 > > isa : rv32imafdcsuh > > mmu : sv32 > > > > # file /bin/busybox > > /bin/busybox: setuid ELF 32-bit LSB shared object, UCB RISC-V, version = 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv32-ilp32d.so.1= , for GNU/Linux 5.15.0, stripped > > [ 79.320589] random: fast init done > > # cat /proc/meminfo > > MemTotal: 52176 kB > > MemFree: 41012 kB > > MemAvailable: 42176 kB > > Buffers: 644 kB > > Cached: 2724 kB > > SwapCached: 0 kB > > Active: 3128 kB > > Inactive: 752 kB > > Active(anon): 40 kB > > Inactive(anon): 516 kB > > Active(file): 3088 kB > > Inactive(file): 236 kB > > Unevictable: 0 kB > > Mlocked: 0 kB > > SwapTotal: 0 kB > > SwapFree: 0 kB > > Dirty: 4 kB > > Writeback: 0 kB > > AnonPages: 556 kB > > Mapped: 2172 kB > > Shmem: 44 kB > > KReclaimable: 656 kB > > Slab: 3684 kB > > SReclaimable: 656 kB > > SUnreclaim: 3028 kB > > KernelStack: 312 kB > > PageTables: 88 kB > > NFS_Unstable: 0 kB > > Bounce: 0 kB > > WritebackTmp: 0 kB > > CommitLimit: 26088 kB > > Committed_AS: 2088 kB > > VmallocTotal: 524287 kB > > VmallocUsed: 12 kB > > VmallocChunk: 0 kB > > Percpu: 60 kB > > # > > > > Some conclusions: > > - kernel statics: > > 64: Memory: 52788K/63488K available (6184K kernel code, 888K rwdata,= 1917K rodata, 294K init, 297K bss, 10700K reserved) > > 32: Memory: 51924K/61440K available (6117K kernel code, 695K rwdata,= 1594K rodata, 255K init, 241K bss, 9516K reserved) > > rv32 better than rv64: 1% 22% = 17% 13% 19% 11% > > The code size is very similar, but data size rv32 would be better. > > > > - rv32 kernel runtime KernelStack, Slab... are smaller, > > rv64: MemTotal: 53076 kB, MemFree: 40264 kB > > rv32: MemTotal: 52176 + 2048 kB, MemFree: 41012 + 2048 kB > > rv32 better than rv64: 2% 6% > > > > (Because opensbi problem, we could add another 2MB for rv32.) > > Overall in 64MB memory situation, rv64-compat is 6% worse than rv32-= native > > at memory footprint. If the userspace memory usage increases, I thin= k > > the gap will be further reduced. > > > > Changes in v12: > > - Rebase on 5.18-rc1 > > - Fixup compile conflicts with 5.18-rc1 > > - Fixup $(srctree) =3D=3D $(objtree) compile error reported by Nathan > > > > Changes in v11: > > - Using arch instead of kconfig for commit subject by Masahiro Yamada > > > > Changes in v10: > > - Fixup arm64 compile error with compat_statfs definition > > - Fixup compat_sys_fadvise64_64 function arguments error cause ltp fai= lure > > > > Changes in v9: > > - Fixup rv32 call rv64 segment fault > > - Ready for 5.18 > > > > Changes in v8: > > - Enhanced elf_check_arch with EI_CLASS > > - Fixup SR_UXL doesn't exist in CONFIG_32BIT > > - Add Tested-by with Heiko > > - Update qemu compile tips with upstream repo > > > > Changes in v7: > > - Re-construct compat_vdso/Makefile > > - Fixup disable COMPAT compile error by csr.h's macro. > > - Optimize coding convention for lo/hi in compat.h > > > > Changes in v6: > > - Rebase on linux-5.17-rc5 > > - Optimize hw capability check for elf > > - Optimize comment in thread_info.h > > - Optimize start_thread with SR_UXL setting > > - Optimize vdso.c with direct panic > > > > Changes in v5: > > - Rebase on linux-5.17-rc2 > > - Include consolidate the fcntl patches by Christoph Hellwig > > - Remove F_GETLK64/F_SETLK64/F_SETLKW64 from asm/compat.h > > - Change COMPAT_RLIM_INFINITY from 0x7fffffff to 0xffffffff > > - Bring back "Add hw-cap detect in setup_arch patch" in v1 > > > > Changes in v4: > > - Rebase on linux-5.17-rc1 > > - Optimize compat_sys_call_table implementation with Arnd's advice > > - Add reviewed-by for Arnd. Thx :) > > - Remove FIXME comment in elf.h > > - Optimize Cleanup duplicate definitions in compat.h with Arnd's advic= e > > > > Changes in v3: > > - Rebase on newest master (pre linux-5.17-rc1) > > - Using newest qemu version v7 for test > > - Remove fcntl common modification > > - Fixup SET_PERSONALITY in elf.h by Arnd > > - Fixup KVM Kconfig > > - Update Acked-by & Reviewed-by > > > > Changes in v2: > > - Add __ARCH_WANT_COMPAT_STAT suggested > > - Cleanup fcntl compatduplicate definitions > > - Cleanup compat.h > > - Move rv32_defconfig into Makefile > > - Fixup rv64 rootfs boot failed, remove hw_compat_mode_detect > > - Move SYSVIPC_COMPAT into init/Kconfig > > - Simplify compat_elf_check > > > > Christoph Hellwig (3): > > uapi: simplify __ARCH_FLOCK{,64}_PAD a little > > uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h > > compat: consolidate the compat_flock{,64} definition > > > > Guo Ren (17): > > arch: Add SYSVIPC_COMPAT for all architectures > > fs: stat: compat: Add __ARCH_WANT_COMPAT_STAT > > asm-generic: compat: Cleanup duplicate definitions > > syscalls: compat: Fix the missing part for __SYSCALL_COMPAT > > riscv: Fixup difference with defconfig > > riscv: compat: Add basic compat data type implementation > > riscv: compat: Support TASK_SIZE for compat mode > > riscv: compat: syscall: Add compat_sys_call_table implementation > > riscv: compat: syscall: Add entry.S implementation > > riscv: compat: process: Add UXL_32 support in start_thread > > riscv: compat: Add elf.h implementation > > riscv: compat: Add hw capability check for elf > > riscv: compat: vdso: Add COMPAT_VDSO base code implementation > > riscv: compat: vdso: Add setup additional pages implementation > > riscv: compat: signal: Add rt_frame implementation > > riscv: compat: ptrace: Add compat_arch_ptrace implement > > riscv: compat: Add COMPAT Kbuild skeletal support > > > > arch/arm64/Kconfig | 4 - > > arch/arm64/include/asm/compat.h | 93 +------ > > arch/arm64/include/asm/unistd.h | 1 + > > arch/mips/Kconfig | 5 - > > arch/mips/include/asm/compat.h | 41 +-- > > arch/mips/include/asm/unistd.h | 2 + > > arch/mips/include/uapi/asm/fcntl.h | 30 +-- > > arch/parisc/Kconfig | 4 - > > arch/parisc/include/asm/compat.h | 45 +--- > > arch/parisc/include/asm/unistd.h | 1 + > > arch/powerpc/Kconfig | 5 - > > arch/powerpc/include/asm/compat.h | 50 +--- > > arch/powerpc/include/asm/unistd.h | 1 + > > arch/riscv/Kconfig | 19 ++ > > arch/riscv/Makefile | 9 + > > arch/riscv/include/asm/compat.h | 129 ++++++++++ > > arch/riscv/include/asm/csr.h | 7 + > > arch/riscv/include/asm/elf.h | 50 +++- > > arch/riscv/include/asm/mmu.h | 1 + > > arch/riscv/include/asm/pgtable.h | 13 +- > > arch/riscv/include/asm/processor.h | 6 +- > > arch/riscv/include/asm/syscall.h | 1 + > > arch/riscv/include/asm/thread_info.h | 1 + > > arch/riscv/include/asm/unistd.h | 11 + > > arch/riscv/include/asm/vdso.h | 9 + > > arch/riscv/include/uapi/asm/unistd.h | 2 +- > > arch/riscv/kernel/Makefile | 3 + > > arch/riscv/kernel/compat_signal.c | 242 ++++++++++++++++++ > > arch/riscv/kernel/compat_syscall_table.c | 19 ++ > > arch/riscv/kernel/compat_vdso/.gitignore | 2 + > > arch/riscv/kernel/compat_vdso/Makefile | 78 ++++++ > > arch/riscv/kernel/compat_vdso/compat_vdso.S | 8 + > > .../kernel/compat_vdso/compat_vdso.lds.S | 3 + > > arch/riscv/kernel/compat_vdso/flush_icache.S | 3 + > > .../compat_vdso/gen_compat_vdso_offsets.sh | 5 + > > arch/riscv/kernel/compat_vdso/getcpu.S | 3 + > > arch/riscv/kernel/compat_vdso/note.S | 3 + > > arch/riscv/kernel/compat_vdso/rt_sigreturn.S | 3 + > > arch/riscv/kernel/entry.S | 18 +- > > arch/riscv/kernel/process.c | 37 +++ > > arch/riscv/kernel/ptrace.c | 87 ++++++- > > arch/riscv/kernel/signal.c | 13 +- > > arch/riscv/kernel/sys_riscv.c | 6 +- > > arch/riscv/kernel/vdso.c | 105 +++++--- > > arch/riscv/kernel/vdso/vdso.S | 6 +- > > arch/s390/Kconfig | 3 - > > arch/s390/include/asm/compat.h | 99 +------ > > arch/s390/include/asm/unistd.h | 1 + > > arch/sparc/Kconfig | 5 - > > arch/sparc/include/asm/compat.h | 61 ++--- > > arch/sparc/include/asm/unistd.h | 1 + > > arch/x86/Kconfig | 4 - > > arch/x86/include/asm/compat.h | 104 ++------ > > arch/x86/include/asm/unistd.h | 1 + > > fs/open.c | 24 ++ > > fs/read_write.c | 16 ++ > > fs/stat.c | 2 +- > > fs/sync.c | 9 + > > include/asm-generic/compat.h | 113 ++++++++ > > include/linux/compat.h | 68 +++++ > > include/uapi/asm-generic/fcntl.h | 23 +- > > include/uapi/asm-generic/unistd.h | 4 +- > > init/Kconfig | 4 + > > mm/fadvise.c | 11 + > > mm/readahead.c | 7 + > > tools/include/uapi/asm-generic/fcntl.h | 21 +- > > tools/include/uapi/asm-generic/unistd.h | 4 +- > > 67 files changed, 1206 insertions(+), 563 deletions(-) > > create mode 100644 arch/riscv/include/asm/compat.h > > create mode 100644 arch/riscv/kernel/compat_signal.c > > create mode 100644 arch/riscv/kernel/compat_syscall_table.c > > create mode 100644 arch/riscv/kernel/compat_vdso/.gitignore > > create mode 100644 arch/riscv/kernel/compat_vdso/Makefile > > create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.S > > create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.lds.S > > create mode 100644 arch/riscv/kernel/compat_vdso/flush_icache.S > > create mode 100755 arch/riscv/kernel/compat_vdso/gen_compat_vdso_offse= ts.sh > > create mode 100644 arch/riscv/kernel/compat_vdso/getcpu.S > > create mode 100644 arch/riscv/kernel/compat_vdso/note.S > > create mode 100644 arch/riscv/kernel/compat_vdso/rt_sigreturn.S > > Thanks. > > This touches a bunch of other trees, which I try to avoid without the > relevant acks and such. In this case I'm OK taking it because Arnd and > Christoph have written/reviewed/ack'd so much of it, and because some > autobuilders found build issues (and thus I'm assuming there aren't any > more). > > There's been a bunch of versions of this and I'm pretty sure I've said > this a handful of times without any comments. Now that it's passing all > my tests and I'm not getting any autobuilding breakages I've put it on > for-next, but happy to try and spin up some sort of multi-tree merge if Sounds good to me. Thx. > that's an issue for anyone. --=20 Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9E8CC433F5 for ; Fri, 20 May 2022 18:31:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gHMHgK9ctV/Rp9KR+VTS3UFcHtEI3SzjZa/JAEr8kz0=; b=cW6+3TMwPfvNHJ mq7AZfsBRTbUABY0IdAbCyVKQkrioF58vzeIEzhDSu49qpYmBXDB7mGj0HqslLXgOEm2KASk4jwdh /LheJzWcBUtYG0baR9sSKAAUPGwiKWsaZzsaCYDlt+c3tDDqSdzA4wIiEekcBZGsLzUWWtXz4GKIQ K90ezV2lvRHjcf3N5aoQTrH7UH+vZVruRKFqamJqVqaLsU4wMgk8D+OELWTVwwA6rpQDYS3aMQJcR pbrfr1a+C4n4Ttwcbk0pSontIEfT5bVQfMbKy3+GMmSUez+6HgAcVgMnC0phBKrP8XwBK4tZbVfUS YPP8JkZGgjAfzkwmxtbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ns7N9-00E8Z8-KU; Fri, 20 May 2022 18:29:14 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ns7DK-00E3uG-0f; Fri, 20 May 2022 18:19:07 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 025ABB82D77; Fri, 20 May 2022 18:19:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD0B0C34114; Fri, 20 May 2022 18:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653070738; bh=dLpj7qKkKib+aI9CC01MUR5D/MbLKwYxjZ2Or3/u66w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kzNqqr8pp8bHR0I2mQVS/6H224ZnHvTx6hnUE4bnAlyFwem9P4NeAdJTKycGMo5uu Xmc3cnb1flrmdz8LYjY/9nCNOGmYcsWgP3lN0rWY6nGpY1+4PKZAjbGv3IBiw17TnW ngx6wK9zegEFnakupcp3PQEmvmlz0bczq7dYAuRKJfj5FKd1uGos+zRGiF/WYxOie6 oHmY/rMP1H1b3JUqQVCoUl3AIPx8EtJw1zbA6gambZPY9Fzr2bxJltx7IiVQp+pGnl 7X8+KvZKYqGdfUUiHpr/N8zThqV9V5005k4oYOWCA6Kv1v7JibgrscSWe+1Z4Kz52Z 2gy80+YxwRXMw== Received: by mail-vs1-f41.google.com with SMTP id j7so8393251vsj.7; Fri, 20 May 2022 11:18:58 -0700 (PDT) X-Gm-Message-State: AOAM533qbrnjgssG+Ylg3UsA0uhOFnmep+tOhxd5k3EzzOjbu3TxSvNo EbFEt0Po7TQMg0/b+Ek3w/uzX0fPJVzZL/oY79Q= X-Google-Smtp-Source: ABdhPJzNJFwsn6T9T5KIfZQ4CHoJUNjpTHgdCFaq6U5Mf9Bq6/7s0wM9wbreJ82vFhfCuqKoGio5ahZh4lQSCmWjcCA= X-Received: by 2002:a05:6102:a49:b0:335:fd3b:7ab8 with SMTP id i9-20020a0561020a4900b00335fd3b7ab8mr3647435vss.2.1653070737462; Fri, 20 May 2022 11:18:57 -0700 (PDT) MIME-Version: 1.0 References: <20220405071314.3225832-1-guoren@kernel.org> In-Reply-To: From: Guo Ren Date: Sat, 21 May 2022 02:18:46 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V12 00/20] riscv: Add COMPAT mode support for 64BIT To: Palmer Dabbelt Cc: Arnd Bergmann , Greg KH , Christoph Hellwig , Nathan Chancellor , Naresh Kamboju , linux-arch , Linux Kernel Mailing List , linux-riscv , linux-s390 , sparclinux , linuxppc-dev , Parisc List , "open list:BROADCOM NVRAM DRIVER" , Linux ARM , "the arch/x86 maintainers" , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Guo Ren X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220520_111902_419187_64682DF6 X-CRM114-Status: GOOD ( 20.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 20, 2022 at 1:50 AM Palmer Dabbelt wrote: > > On Tue, 05 Apr 2022 00:12:54 PDT (-0700), guoren@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 git@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.000000] 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.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 > > [ 0.000000] Machine model: riscv-virtio,qemu > > [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') > > [ 0.000000] printk: bootconsole [sbi0] enabled > > [ 0.000000] efi: UEFI not found. > > [ 0.000000] Zone ranges: > > [ 0.000000] DMA32 [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] Normal empty > > [ 0.000000] Movable zone start for each node > > [ 0.000000] Early memory node ranges > > [ 0.000000] node 0: [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] SBI specification v0.2 detected > > [ 0.000000] SBI implementation ID=0x1 Version=0x9 > > [ 0.000000] SBI TIME extension detected > > [ 0.000000] SBI IPI extension detected > > [ 0.000000] SBI RFENCE extension detected > > [ 0.000000] SBI v0.2 HSM extension detected > > [ 0.000000] riscv: ISA extensions acdfhimsu > > [ 0.000000] riscv: ELF capabilities acdfim > > [ 0.000000] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632 > > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 15655 > > [ 0.000000] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 earlycon=sbi > > [ 0.000000] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes, linear) > > [ 0.000000] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) > > [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off > > [ 0.000000] Virtual kernel memory layout: > > [ 0.000000] fixmap : 0xffffffcefee00000 - 0xffffffceff000000 (2048 kB) > > [ 0.000000] pci io : 0xffffffceff000000 - 0xffffffcf00000000 ( 16 MB) > > [ 0.000000] vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff (4095 MB) > > [ 0.000000] vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff (65535 MB) > > [ 0.000000] lowmem : 0xffffffe000000000 - 0xffffffe003e00000 ( 62 MB) > > [ 0.000000] kernel : 0xffffffff80000000 - 0xffffffffffffffff (2047 MB) > > [ 0.000000] Memory: 52788K/63488K available (6184K kernel code, 888K rwdata, 1917K rodata, 294K init, 297K bss, 10700K reserved, 0K cma-reserved) > > [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 > > [ 0.000000] rcu: Hierarchical RCU implementation. > > [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1. > > [ 0.000000] rcu: RCU debug extended QS entry/exit. > > [ 0.000000] Tracing variant of Tasks RCU enabled. > > [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. > > [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1 > > [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 > > [ 0.000000] riscv-intc: 64 local interrupts mapped > > [ 0.000000] plic: plic@c000000: mapped 53 interrupts with 1 handlers for 2 contexts. > > ... > > Welcome to Buildroot > > buildroot login: root > > # cat /proc/cpuinfo > > processor : 0 > > hart : 0 > > isa : rv64imafdcsuh > > mmu : sv48 > > > > # file /bin/busybox > > /bin/busybox: setuid ELF 32-bit LSB shared object, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv32-ilp32d.so.1, for GNU/Linux 5.15.0, stripped > > # ca[ 78.386630] random: fast init done > > # cat /proc/meminfo > > MemTotal: 53076 kB > > MemFree: 40264 kB > > MemAvailable: 40244 kB > > Buffers: 236 kB > > Cached: 1560 kB > > SwapCached: 0 kB > > Active: 1700 kB > > Inactive: 516 kB > > Active(anon): 40 kB > > Inactive(anon): 424 kB > > Active(file): 1660 kB > > Inactive(file): 92 kB > > Unevictable: 0 kB > > Mlocked: 0 kB > > SwapTotal: 0 kB > > SwapFree: 0 kB > > Dirty: 0 kB > > Writeback: 0 kB > > AnonPages: 444 kB > > Mapped: 1188 kB > > Shmem: 44 kB > > KReclaimable: 952 kB > > Slab: 5744 kB > > SReclaimable: 952 kB > > SUnreclaim: 4792 kB > > KernelStack: 624 kB > > PageTables: 156 kB > > NFS_Unstable: 0 kB > > Bounce: 0 kB > > WritebackTmp: 0 kB > > CommitLimit: 26536 kB > > Committed_AS: 1748 kB > > VmallocTotal: 67108863 kB > > VmallocUsed: 652 kB > > VmallocChunk: 0 kB > > Percpu: 80 kB > > # > > > > - Run rv32 with rv32 rootfs: > > $ ./build/qemu-system-riscv32 -cpu rv32 -M virt -m 64m -nographic -bios qemu_riscv32_virt_defconfig/images/fw_jump.bin -kernel build-rv32/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.000000] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guoren@guoren-Z87-HD3) (riscv32-buildroot-linux-gnu-gcc.br_real (Buildroot 2021.11-201-g7600ca7960-dirty) 10.3.0, GNU ld (GNU Binutils) 2.36.1) #7 SMP Tue Dec 28 21:02:21 CST 2021 > > [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80400000 > > [ 0.000000] Machine model: riscv-virtio,qemu > > [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') > > [ 0.000000] printk: bootconsole [sbi0] enabled > > [ 0.000000] efi: UEFI not found. > > [ 0.000000] Zone ranges: > > [ 0.000000] Normal [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] Movable zone start for each node > > [ 0.000000] Early memory node ranges > > [ 0.000000] node 0: [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] Initmem setup node 0 [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] SBI specification v0.2 detected > > [ 0.000000] SBI implementation ID=0x1 Version=0x9 > > [ 0.000000] SBI TIME extension detected > > [ 0.000000] SBI IPI extension detected > > [ 0.000000] SBI RFENCE extension detected > > [ 0.000000] SBI v0.2 HSM extension detected > > [ 0.000000] riscv: ISA extensions acdfhimsu > > [ 0.000000] riscv: ELF capabilities acdfim > > [ 0.000000] percpu: Embedded 12 pages/cpu s16600 r8192 d24360 u49152 > > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 15240 > > [ 0.000000] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 earlycon=sbi > > [ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear) > > [ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear) > > [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off > > [ 0.000000] Virtual kernel memory layout: > > [ 0.000000] fixmap : 0x9dc00000 - 0x9e000000 (4096 kB) > > [ 0.000000] pci io : 0x9e000000 - 0x9f000000 ( 16 MB) > > [ 0.000000] vmemmap : 0x9f000000 - 0x9fffffff ( 15 MB) > > [ 0.000000] vmalloc : 0xa0000000 - 0xbfffffff ( 511 MB) > > [ 0.000000] lowmem : 0xc0000000 - 0xc3c00000 ( 60 MB) > > [ 0.000000] Memory: 51924K/61440K available (6117K kernel code, 695K rwdata, 1594K rodata, 255K init, 241K bss, 9516K reserved, 0K cma-reserved) > > [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 > > [ 0.000000] rcu: Hierarchical RCU implementation. > > [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1. > > [ 0.000000] rcu: RCU debug extended QS entry/exit. > > [ 0.000000] Tracing variant of Tasks RCU enabled. > > [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. > > [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1 > > [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 > > [ 0.000000] riscv-intc: 32 local interrupts mapped > > [ 0.000000] plic: plic@c000000: mapped 53 interrupts with 1 handlers for 2 contexts. > > ... > > Welcome to Buildroot > > buildroot login: root > > # cat /proc/cpuinfo > > processor : 0 > > hart : 0 > > isa : rv32imafdcsuh > > mmu : sv32 > > > > # file /bin/busybox > > /bin/busybox: setuid ELF 32-bit LSB shared object, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv32-ilp32d.so.1, for GNU/Linux 5.15.0, stripped > > [ 79.320589] random: fast init done > > # cat /proc/meminfo > > MemTotal: 52176 kB > > MemFree: 41012 kB > > MemAvailable: 42176 kB > > Buffers: 644 kB > > Cached: 2724 kB > > SwapCached: 0 kB > > Active: 3128 kB > > Inactive: 752 kB > > Active(anon): 40 kB > > Inactive(anon): 516 kB > > Active(file): 3088 kB > > Inactive(file): 236 kB > > Unevictable: 0 kB > > Mlocked: 0 kB > > SwapTotal: 0 kB > > SwapFree: 0 kB > > Dirty: 4 kB > > Writeback: 0 kB > > AnonPages: 556 kB > > Mapped: 2172 kB > > Shmem: 44 kB > > KReclaimable: 656 kB > > Slab: 3684 kB > > SReclaimable: 656 kB > > SUnreclaim: 3028 kB > > KernelStack: 312 kB > > PageTables: 88 kB > > NFS_Unstable: 0 kB > > Bounce: 0 kB > > WritebackTmp: 0 kB > > CommitLimit: 26088 kB > > Committed_AS: 2088 kB > > VmallocTotal: 524287 kB > > VmallocUsed: 12 kB > > VmallocChunk: 0 kB > > Percpu: 60 kB > > # > > > > Some conclusions: > > - kernel statics: > > 64: Memory: 52788K/63488K available (6184K kernel code, 888K rwdata, 1917K rodata, 294K init, 297K bss, 10700K reserved) > > 32: Memory: 51924K/61440K available (6117K kernel code, 695K rwdata, 1594K rodata, 255K init, 241K bss, 9516K reserved) > > rv32 better than rv64: 1% 22% 17% 13% 19% 11% > > The code size is very similar, but data size rv32 would be better. > > > > - rv32 kernel runtime KernelStack, Slab... are smaller, > > rv64: MemTotal: 53076 kB, MemFree: 40264 kB > > rv32: MemTotal: 52176 + 2048 kB, MemFree: 41012 + 2048 kB > > rv32 better than rv64: 2% 6% > > > > (Because opensbi problem, we could add another 2MB for rv32.) > > Overall in 64MB memory situation, rv64-compat is 6% worse than rv32-native > > at memory footprint. If the userspace memory usage increases, I think > > the gap will be further reduced. > > > > Changes in v12: > > - Rebase on 5.18-rc1 > > - Fixup compile conflicts with 5.18-rc1 > > - Fixup $(srctree) == $(objtree) compile error reported by Nathan > > > > Changes in v11: > > - Using arch instead of kconfig for commit subject by Masahiro Yamada > > > > Changes in v10: > > - Fixup arm64 compile error with compat_statfs definition > > - Fixup compat_sys_fadvise64_64 function arguments error cause ltp failure > > > > Changes in v9: > > - Fixup rv32 call rv64 segment fault > > - Ready for 5.18 > > > > Changes in v8: > > - Enhanced elf_check_arch with EI_CLASS > > - Fixup SR_UXL doesn't exist in CONFIG_32BIT > > - Add Tested-by with Heiko > > - Update qemu compile tips with upstream repo > > > > Changes in v7: > > - Re-construct compat_vdso/Makefile > > - Fixup disable COMPAT compile error by csr.h's macro. > > - Optimize coding convention for lo/hi in compat.h > > > > Changes in v6: > > - Rebase on linux-5.17-rc5 > > - Optimize hw capability check for elf > > - Optimize comment in thread_info.h > > - Optimize start_thread with SR_UXL setting > > - Optimize vdso.c with direct panic > > > > Changes in v5: > > - Rebase on linux-5.17-rc2 > > - Include consolidate the fcntl patches by Christoph Hellwig > > - Remove F_GETLK64/F_SETLK64/F_SETLKW64 from asm/compat.h > > - Change COMPAT_RLIM_INFINITY from 0x7fffffff to 0xffffffff > > - Bring back "Add hw-cap detect in setup_arch patch" in v1 > > > > Changes in v4: > > - Rebase on linux-5.17-rc1 > > - Optimize compat_sys_call_table implementation with Arnd's advice > > - Add reviewed-by for Arnd. Thx :) > > - Remove FIXME comment in elf.h > > - Optimize Cleanup duplicate definitions in compat.h with Arnd's advice > > > > Changes in v3: > > - Rebase on newest master (pre linux-5.17-rc1) > > - Using newest qemu version v7 for test > > - Remove fcntl common modification > > - Fixup SET_PERSONALITY in elf.h by Arnd > > - Fixup KVM Kconfig > > - Update Acked-by & Reviewed-by > > > > Changes in v2: > > - Add __ARCH_WANT_COMPAT_STAT suggested > > - Cleanup fcntl compatduplicate definitions > > - Cleanup compat.h > > - Move rv32_defconfig into Makefile > > - Fixup rv64 rootfs boot failed, remove hw_compat_mode_detect > > - Move SYSVIPC_COMPAT into init/Kconfig > > - Simplify compat_elf_check > > > > Christoph Hellwig (3): > > uapi: simplify __ARCH_FLOCK{,64}_PAD a little > > uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h > > compat: consolidate the compat_flock{,64} definition > > > > Guo Ren (17): > > arch: Add SYSVIPC_COMPAT for all architectures > > fs: stat: compat: Add __ARCH_WANT_COMPAT_STAT > > asm-generic: compat: Cleanup duplicate definitions > > syscalls: compat: Fix the missing part for __SYSCALL_COMPAT > > riscv: Fixup difference with defconfig > > riscv: compat: Add basic compat data type implementation > > riscv: compat: Support TASK_SIZE for compat mode > > riscv: compat: syscall: Add compat_sys_call_table implementation > > riscv: compat: syscall: Add entry.S implementation > > riscv: compat: process: Add UXL_32 support in start_thread > > riscv: compat: Add elf.h implementation > > riscv: compat: Add hw capability check for elf > > riscv: compat: vdso: Add COMPAT_VDSO base code implementation > > riscv: compat: vdso: Add setup additional pages implementation > > riscv: compat: signal: Add rt_frame implementation > > riscv: compat: ptrace: Add compat_arch_ptrace implement > > riscv: compat: Add COMPAT Kbuild skeletal support > > > > arch/arm64/Kconfig | 4 - > > arch/arm64/include/asm/compat.h | 93 +------ > > arch/arm64/include/asm/unistd.h | 1 + > > arch/mips/Kconfig | 5 - > > arch/mips/include/asm/compat.h | 41 +-- > > arch/mips/include/asm/unistd.h | 2 + > > arch/mips/include/uapi/asm/fcntl.h | 30 +-- > > arch/parisc/Kconfig | 4 - > > arch/parisc/include/asm/compat.h | 45 +--- > > arch/parisc/include/asm/unistd.h | 1 + > > arch/powerpc/Kconfig | 5 - > > arch/powerpc/include/asm/compat.h | 50 +--- > > arch/powerpc/include/asm/unistd.h | 1 + > > arch/riscv/Kconfig | 19 ++ > > arch/riscv/Makefile | 9 + > > arch/riscv/include/asm/compat.h | 129 ++++++++++ > > arch/riscv/include/asm/csr.h | 7 + > > arch/riscv/include/asm/elf.h | 50 +++- > > arch/riscv/include/asm/mmu.h | 1 + > > arch/riscv/include/asm/pgtable.h | 13 +- > > arch/riscv/include/asm/processor.h | 6 +- > > arch/riscv/include/asm/syscall.h | 1 + > > arch/riscv/include/asm/thread_info.h | 1 + > > arch/riscv/include/asm/unistd.h | 11 + > > arch/riscv/include/asm/vdso.h | 9 + > > arch/riscv/include/uapi/asm/unistd.h | 2 +- > > arch/riscv/kernel/Makefile | 3 + > > arch/riscv/kernel/compat_signal.c | 242 ++++++++++++++++++ > > arch/riscv/kernel/compat_syscall_table.c | 19 ++ > > arch/riscv/kernel/compat_vdso/.gitignore | 2 + > > arch/riscv/kernel/compat_vdso/Makefile | 78 ++++++ > > arch/riscv/kernel/compat_vdso/compat_vdso.S | 8 + > > .../kernel/compat_vdso/compat_vdso.lds.S | 3 + > > arch/riscv/kernel/compat_vdso/flush_icache.S | 3 + > > .../compat_vdso/gen_compat_vdso_offsets.sh | 5 + > > arch/riscv/kernel/compat_vdso/getcpu.S | 3 + > > arch/riscv/kernel/compat_vdso/note.S | 3 + > > arch/riscv/kernel/compat_vdso/rt_sigreturn.S | 3 + > > arch/riscv/kernel/entry.S | 18 +- > > arch/riscv/kernel/process.c | 37 +++ > > arch/riscv/kernel/ptrace.c | 87 ++++++- > > arch/riscv/kernel/signal.c | 13 +- > > arch/riscv/kernel/sys_riscv.c | 6 +- > > arch/riscv/kernel/vdso.c | 105 +++++--- > > arch/riscv/kernel/vdso/vdso.S | 6 +- > > arch/s390/Kconfig | 3 - > > arch/s390/include/asm/compat.h | 99 +------ > > arch/s390/include/asm/unistd.h | 1 + > > arch/sparc/Kconfig | 5 - > > arch/sparc/include/asm/compat.h | 61 ++--- > > arch/sparc/include/asm/unistd.h | 1 + > > arch/x86/Kconfig | 4 - > > arch/x86/include/asm/compat.h | 104 ++------ > > arch/x86/include/asm/unistd.h | 1 + > > fs/open.c | 24 ++ > > fs/read_write.c | 16 ++ > > fs/stat.c | 2 +- > > fs/sync.c | 9 + > > include/asm-generic/compat.h | 113 ++++++++ > > include/linux/compat.h | 68 +++++ > > include/uapi/asm-generic/fcntl.h | 23 +- > > include/uapi/asm-generic/unistd.h | 4 +- > > init/Kconfig | 4 + > > mm/fadvise.c | 11 + > > mm/readahead.c | 7 + > > tools/include/uapi/asm-generic/fcntl.h | 21 +- > > tools/include/uapi/asm-generic/unistd.h | 4 +- > > 67 files changed, 1206 insertions(+), 563 deletions(-) > > create mode 100644 arch/riscv/include/asm/compat.h > > create mode 100644 arch/riscv/kernel/compat_signal.c > > create mode 100644 arch/riscv/kernel/compat_syscall_table.c > > create mode 100644 arch/riscv/kernel/compat_vdso/.gitignore > > create mode 100644 arch/riscv/kernel/compat_vdso/Makefile > > create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.S > > create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.lds.S > > create mode 100644 arch/riscv/kernel/compat_vdso/flush_icache.S > > create mode 100755 arch/riscv/kernel/compat_vdso/gen_compat_vdso_offsets.sh > > create mode 100644 arch/riscv/kernel/compat_vdso/getcpu.S > > create mode 100644 arch/riscv/kernel/compat_vdso/note.S > > create mode 100644 arch/riscv/kernel/compat_vdso/rt_sigreturn.S > > Thanks. > > This touches a bunch of other trees, which I try to avoid without the > relevant acks and such. In this case I'm OK taking it because Arnd and > Christoph have written/reviewed/ack'd so much of it, and because some > autobuilders found build issues (and thus I'm assuming there aren't any > more). > > There's been a bunch of versions of this and I'm pretty sure I've said > this a handful of times without any comments. Now that it's passing all > my tests and I'm not getting any autobuilding breakages I've put it on > for-next, but happy to try and spin up some sort of multi-tree merge if Sounds good to me. Thx. > that's an issue for anyone. -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 83EC5C433F5 for ; Fri, 20 May 2022 18:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=caIfssJmi9y5e6hzKpHt8596hpgo817YHoU0r2tqANg=; b=JbdXKp6XvaLgqf q2gXY2r2wjy2faP8M+vT7Xah09g+GdqdYIncEQbYbWxOyw2bP92HUL8wzVo+KW2kwuLICFKZbDgC9 U+0O3tyFD6etMqwQ+ifIpvswbkL7be8XyHOzRvNTRU3V3al5CvkXvFq4vdGJlSvlXpRTZqw34vKZ3 xczF6ahbzI4LPBAZbuwe+z/Bkoaj0XEnTkqVcAMtb4R1Uj3cnVUhWjn1WE22foC/3LQLS3LiE/9O8 tNhcLecVPI/05BjDKfRBs8ZMYWdGe8qbshJqyPFDsOyz6jUfuJn931Hz3ULNT7flwyul/ERawhaA6 zNyWGWkpJHEiMnlDHQ3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ns7Pp-00E9hq-8C; Fri, 20 May 2022 18:31:57 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ns7DK-00E3uG-0f; Fri, 20 May 2022 18:19:07 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 025ABB82D77; Fri, 20 May 2022 18:19:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD0B0C34114; Fri, 20 May 2022 18:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653070738; bh=dLpj7qKkKib+aI9CC01MUR5D/MbLKwYxjZ2Or3/u66w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kzNqqr8pp8bHR0I2mQVS/6H224ZnHvTx6hnUE4bnAlyFwem9P4NeAdJTKycGMo5uu Xmc3cnb1flrmdz8LYjY/9nCNOGmYcsWgP3lN0rWY6nGpY1+4PKZAjbGv3IBiw17TnW ngx6wK9zegEFnakupcp3PQEmvmlz0bczq7dYAuRKJfj5FKd1uGos+zRGiF/WYxOie6 oHmY/rMP1H1b3JUqQVCoUl3AIPx8EtJw1zbA6gambZPY9Fzr2bxJltx7IiVQp+pGnl 7X8+KvZKYqGdfUUiHpr/N8zThqV9V5005k4oYOWCA6Kv1v7JibgrscSWe+1Z4Kz52Z 2gy80+YxwRXMw== Received: by mail-vs1-f41.google.com with SMTP id j7so8393251vsj.7; Fri, 20 May 2022 11:18:58 -0700 (PDT) X-Gm-Message-State: AOAM533qbrnjgssG+Ylg3UsA0uhOFnmep+tOhxd5k3EzzOjbu3TxSvNo EbFEt0Po7TQMg0/b+Ek3w/uzX0fPJVzZL/oY79Q= X-Google-Smtp-Source: ABdhPJzNJFwsn6T9T5KIfZQ4CHoJUNjpTHgdCFaq6U5Mf9Bq6/7s0wM9wbreJ82vFhfCuqKoGio5ahZh4lQSCmWjcCA= X-Received: by 2002:a05:6102:a49:b0:335:fd3b:7ab8 with SMTP id i9-20020a0561020a4900b00335fd3b7ab8mr3647435vss.2.1653070737462; Fri, 20 May 2022 11:18:57 -0700 (PDT) MIME-Version: 1.0 References: <20220405071314.3225832-1-guoren@kernel.org> In-Reply-To: From: Guo Ren Date: Sat, 21 May 2022 02:18:46 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V12 00/20] riscv: Add COMPAT mode support for 64BIT To: Palmer Dabbelt Cc: Arnd Bergmann , Greg KH , Christoph Hellwig , Nathan Chancellor , Naresh Kamboju , linux-arch , Linux Kernel Mailing List , linux-riscv , linux-s390 , sparclinux , linuxppc-dev , Parisc List , "open list:BROADCOM NVRAM DRIVER" , Linux ARM , "the arch/x86 maintainers" , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Guo Ren X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220520_111902_419187_64682DF6 X-CRM114-Status: GOOD ( 20.40 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, May 20, 2022 at 1:50 AM Palmer Dabbelt wrote: > > On Tue, 05 Apr 2022 00:12:54 PDT (-0700), guoren@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 git@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.000000] 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.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 > > [ 0.000000] Machine model: riscv-virtio,qemu > > [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') > > [ 0.000000] printk: bootconsole [sbi0] enabled > > [ 0.000000] efi: UEFI not found. > > [ 0.000000] Zone ranges: > > [ 0.000000] DMA32 [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] Normal empty > > [ 0.000000] Movable zone start for each node > > [ 0.000000] Early memory node ranges > > [ 0.000000] node 0: [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x0000000083ffffff] > > [ 0.000000] SBI specification v0.2 detected > > [ 0.000000] SBI implementation ID=0x1 Version=0x9 > > [ 0.000000] SBI TIME extension detected > > [ 0.000000] SBI IPI extension detected > > [ 0.000000] SBI RFENCE extension detected > > [ 0.000000] SBI v0.2 HSM extension detected > > [ 0.000000] riscv: ISA extensions acdfhimsu > > [ 0.000000] riscv: ELF capabilities acdfim > > [ 0.000000] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632 > > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 15655 > > [ 0.000000] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 earlycon=sbi > > [ 0.000000] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes, linear) > > [ 0.000000] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, linear) > > [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off > > [ 0.000000] Virtual kernel memory layout: > > [ 0.000000] fixmap : 0xffffffcefee00000 - 0xffffffceff000000 (2048 kB) > > [ 0.000000] pci io : 0xffffffceff000000 - 0xffffffcf00000000 ( 16 MB) > > [ 0.000000] vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff (4095 MB) > > [ 0.000000] vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff (65535 MB) > > [ 0.000000] lowmem : 0xffffffe000000000 - 0xffffffe003e00000 ( 62 MB) > > [ 0.000000] kernel : 0xffffffff80000000 - 0xffffffffffffffff (2047 MB) > > [ 0.000000] Memory: 52788K/63488K available (6184K kernel code, 888K rwdata, 1917K rodata, 294K init, 297K bss, 10700K reserved, 0K cma-reserved) > > [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 > > [ 0.000000] rcu: Hierarchical RCU implementation. > > [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1. > > [ 0.000000] rcu: RCU debug extended QS entry/exit. > > [ 0.000000] Tracing variant of Tasks RCU enabled. > > [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. > > [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1 > > [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 > > [ 0.000000] riscv-intc: 64 local interrupts mapped > > [ 0.000000] plic: plic@c000000: mapped 53 interrupts with 1 handlers for 2 contexts. > > ... > > Welcome to Buildroot > > buildroot login: root > > # cat /proc/cpuinfo > > processor : 0 > > hart : 0 > > isa : rv64imafdcsuh > > mmu : sv48 > > > > # file /bin/busybox > > /bin/busybox: setuid ELF 32-bit LSB shared object, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv32-ilp32d.so.1, for GNU/Linux 5.15.0, stripped > > # ca[ 78.386630] random: fast init done > > # cat /proc/meminfo > > MemTotal: 53076 kB > > MemFree: 40264 kB > > MemAvailable: 40244 kB > > Buffers: 236 kB > > Cached: 1560 kB > > SwapCached: 0 kB > > Active: 1700 kB > > Inactive: 516 kB > > Active(anon): 40 kB > > Inactive(anon): 424 kB > > Active(file): 1660 kB > > Inactive(file): 92 kB > > Unevictable: 0 kB > > Mlocked: 0 kB > > SwapTotal: 0 kB > > SwapFree: 0 kB > > Dirty: 0 kB > > Writeback: 0 kB > > AnonPages: 444 kB > > Mapped: 1188 kB > > Shmem: 44 kB > > KReclaimable: 952 kB > > Slab: 5744 kB > > SReclaimable: 952 kB > > SUnreclaim: 4792 kB > > KernelStack: 624 kB > > PageTables: 156 kB > > NFS_Unstable: 0 kB > > Bounce: 0 kB > > WritebackTmp: 0 kB > > CommitLimit: 26536 kB > > Committed_AS: 1748 kB > > VmallocTotal: 67108863 kB > > VmallocUsed: 652 kB > > VmallocChunk: 0 kB > > Percpu: 80 kB > > # > > > > - Run rv32 with rv32 rootfs: > > $ ./build/qemu-system-riscv32 -cpu rv32 -M virt -m 64m -nographic -bios qemu_riscv32_virt_defconfig/images/fw_jump.bin -kernel build-rv32/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.000000] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty (guoren@guoren-Z87-HD3) (riscv32-buildroot-linux-gnu-gcc.br_real (Buildroot 2021.11-201-g7600ca7960-dirty) 10.3.0, GNU ld (GNU Binutils) 2.36.1) #7 SMP Tue Dec 28 21:02:21 CST 2021 > > [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80400000 > > [ 0.000000] Machine model: riscv-virtio,qemu > > [ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '') > > [ 0.000000] printk: bootconsole [sbi0] enabled > > [ 0.000000] efi: UEFI not found. > > [ 0.000000] Zone ranges: > > [ 0.000000] Normal [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] Movable zone start for each node > > [ 0.000000] Early memory node ranges > > [ 0.000000] node 0: [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] Initmem setup node 0 [mem 0x0000000080400000-0x0000000083ffffff] > > [ 0.000000] SBI specification v0.2 detected > > [ 0.000000] SBI implementation ID=0x1 Version=0x9 > > [ 0.000000] SBI TIME extension detected > > [ 0.000000] SBI IPI extension detected > > [ 0.000000] SBI RFENCE extension detected > > [ 0.000000] SBI v0.2 HSM extension detected > > [ 0.000000] riscv: ISA extensions acdfhimsu > > [ 0.000000] riscv: ELF capabilities acdfim > > [ 0.000000] percpu: Embedded 12 pages/cpu s16600 r8192 d24360 u49152 > > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 15240 > > [ 0.000000] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 earlycon=sbi > > [ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear) > > [ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear) > > [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off > > [ 0.000000] Virtual kernel memory layout: > > [ 0.000000] fixmap : 0x9dc00000 - 0x9e000000 (4096 kB) > > [ 0.000000] pci io : 0x9e000000 - 0x9f000000 ( 16 MB) > > [ 0.000000] vmemmap : 0x9f000000 - 0x9fffffff ( 15 MB) > > [ 0.000000] vmalloc : 0xa0000000 - 0xbfffffff ( 511 MB) > > [ 0.000000] lowmem : 0xc0000000 - 0xc3c00000 ( 60 MB) > > [ 0.000000] Memory: 51924K/61440K available (6117K kernel code, 695K rwdata, 1594K rodata, 255K init, 241K bss, 9516K reserved, 0K cma-reserved) > > [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 > > [ 0.000000] rcu: Hierarchical RCU implementation. > > [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1. > > [ 0.000000] rcu: RCU debug extended QS entry/exit. > > [ 0.000000] Tracing variant of Tasks RCU enabled. > > [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. > > [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1 > > [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 > > [ 0.000000] riscv-intc: 32 local interrupts mapped > > [ 0.000000] plic: plic@c000000: mapped 53 interrupts with 1 handlers for 2 contexts. > > ... > > Welcome to Buildroot > > buildroot login: root > > # cat /proc/cpuinfo > > processor : 0 > > hart : 0 > > isa : rv32imafdcsuh > > mmu : sv32 > > > > # file /bin/busybox > > /bin/busybox: setuid ELF 32-bit LSB shared object, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv32-ilp32d.so.1, for GNU/Linux 5.15.0, stripped > > [ 79.320589] random: fast init done > > # cat /proc/meminfo > > MemTotal: 52176 kB > > MemFree: 41012 kB > > MemAvailable: 42176 kB > > Buffers: 644 kB > > Cached: 2724 kB > > SwapCached: 0 kB > > Active: 3128 kB > > Inactive: 752 kB > > Active(anon): 40 kB > > Inactive(anon): 516 kB > > Active(file): 3088 kB > > Inactive(file): 236 kB > > Unevictable: 0 kB > > Mlocked: 0 kB > > SwapTotal: 0 kB > > SwapFree: 0 kB > > Dirty: 4 kB > > Writeback: 0 kB > > AnonPages: 556 kB > > Mapped: 2172 kB > > Shmem: 44 kB > > KReclaimable: 656 kB > > Slab: 3684 kB > > SReclaimable: 656 kB > > SUnreclaim: 3028 kB > > KernelStack: 312 kB > > PageTables: 88 kB > > NFS_Unstable: 0 kB > > Bounce: 0 kB > > WritebackTmp: 0 kB > > CommitLimit: 26088 kB > > Committed_AS: 2088 kB > > VmallocTotal: 524287 kB > > VmallocUsed: 12 kB > > VmallocChunk: 0 kB > > Percpu: 60 kB > > # > > > > Some conclusions: > > - kernel statics: > > 64: Memory: 52788K/63488K available (6184K kernel code, 888K rwdata, 1917K rodata, 294K init, 297K bss, 10700K reserved) > > 32: Memory: 51924K/61440K available (6117K kernel code, 695K rwdata, 1594K rodata, 255K init, 241K bss, 9516K reserved) > > rv32 better than rv64: 1% 22% 17% 13% 19% 11% > > The code size is very similar, but data size rv32 would be better. > > > > - rv32 kernel runtime KernelStack, Slab... are smaller, > > rv64: MemTotal: 53076 kB, MemFree: 40264 kB > > rv32: MemTotal: 52176 + 2048 kB, MemFree: 41012 + 2048 kB > > rv32 better than rv64: 2% 6% > > > > (Because opensbi problem, we could add another 2MB for rv32.) > > Overall in 64MB memory situation, rv64-compat is 6% worse than rv32-native > > at memory footprint. If the userspace memory usage increases, I think > > the gap will be further reduced. > > > > Changes in v12: > > - Rebase on 5.18-rc1 > > - Fixup compile conflicts with 5.18-rc1 > > - Fixup $(srctree) == $(objtree) compile error reported by Nathan > > > > Changes in v11: > > - Using arch instead of kconfig for commit subject by Masahiro Yamada > > > > Changes in v10: > > - Fixup arm64 compile error with compat_statfs definition > > - Fixup compat_sys_fadvise64_64 function arguments error cause ltp failure > > > > Changes in v9: > > - Fixup rv32 call rv64 segment fault > > - Ready for 5.18 > > > > Changes in v8: > > - Enhanced elf_check_arch with EI_CLASS > > - Fixup SR_UXL doesn't exist in CONFIG_32BIT > > - Add Tested-by with Heiko > > - Update qemu compile tips with upstream repo > > > > Changes in v7: > > - Re-construct compat_vdso/Makefile > > - Fixup disable COMPAT compile error by csr.h's macro. > > - Optimize coding convention for lo/hi in compat.h > > > > Changes in v6: > > - Rebase on linux-5.17-rc5 > > - Optimize hw capability check for elf > > - Optimize comment in thread_info.h > > - Optimize start_thread with SR_UXL setting > > - Optimize vdso.c with direct panic > > > > Changes in v5: > > - Rebase on linux-5.17-rc2 > > - Include consolidate the fcntl patches by Christoph Hellwig > > - Remove F_GETLK64/F_SETLK64/F_SETLKW64 from asm/compat.h > > - Change COMPAT_RLIM_INFINITY from 0x7fffffff to 0xffffffff > > - Bring back "Add hw-cap detect in setup_arch patch" in v1 > > > > Changes in v4: > > - Rebase on linux-5.17-rc1 > > - Optimize compat_sys_call_table implementation with Arnd's advice > > - Add reviewed-by for Arnd. Thx :) > > - Remove FIXME comment in elf.h > > - Optimize Cleanup duplicate definitions in compat.h with Arnd's advice > > > > Changes in v3: > > - Rebase on newest master (pre linux-5.17-rc1) > > - Using newest qemu version v7 for test > > - Remove fcntl common modification > > - Fixup SET_PERSONALITY in elf.h by Arnd > > - Fixup KVM Kconfig > > - Update Acked-by & Reviewed-by > > > > Changes in v2: > > - Add __ARCH_WANT_COMPAT_STAT suggested > > - Cleanup fcntl compatduplicate definitions > > - Cleanup compat.h > > - Move rv32_defconfig into Makefile > > - Fixup rv64 rootfs boot failed, remove hw_compat_mode_detect > > - Move SYSVIPC_COMPAT into init/Kconfig > > - Simplify compat_elf_check > > > > Christoph Hellwig (3): > > uapi: simplify __ARCH_FLOCK{,64}_PAD a little > > uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h > > compat: consolidate the compat_flock{,64} definition > > > > Guo Ren (17): > > arch: Add SYSVIPC_COMPAT for all architectures > > fs: stat: compat: Add __ARCH_WANT_COMPAT_STAT > > asm-generic: compat: Cleanup duplicate definitions > > syscalls: compat: Fix the missing part for __SYSCALL_COMPAT > > riscv: Fixup difference with defconfig > > riscv: compat: Add basic compat data type implementation > > riscv: compat: Support TASK_SIZE for compat mode > > riscv: compat: syscall: Add compat_sys_call_table implementation > > riscv: compat: syscall: Add entry.S implementation > > riscv: compat: process: Add UXL_32 support in start_thread > > riscv: compat: Add elf.h implementation > > riscv: compat: Add hw capability check for elf > > riscv: compat: vdso: Add COMPAT_VDSO base code implementation > > riscv: compat: vdso: Add setup additional pages implementation > > riscv: compat: signal: Add rt_frame implementation > > riscv: compat: ptrace: Add compat_arch_ptrace implement > > riscv: compat: Add COMPAT Kbuild skeletal support > > > > arch/arm64/Kconfig | 4 - > > arch/arm64/include/asm/compat.h | 93 +------ > > arch/arm64/include/asm/unistd.h | 1 + > > arch/mips/Kconfig | 5 - > > arch/mips/include/asm/compat.h | 41 +-- > > arch/mips/include/asm/unistd.h | 2 + > > arch/mips/include/uapi/asm/fcntl.h | 30 +-- > > arch/parisc/Kconfig | 4 - > > arch/parisc/include/asm/compat.h | 45 +--- > > arch/parisc/include/asm/unistd.h | 1 + > > arch/powerpc/Kconfig | 5 - > > arch/powerpc/include/asm/compat.h | 50 +--- > > arch/powerpc/include/asm/unistd.h | 1 + > > arch/riscv/Kconfig | 19 ++ > > arch/riscv/Makefile | 9 + > > arch/riscv/include/asm/compat.h | 129 ++++++++++ > > arch/riscv/include/asm/csr.h | 7 + > > arch/riscv/include/asm/elf.h | 50 +++- > > arch/riscv/include/asm/mmu.h | 1 + > > arch/riscv/include/asm/pgtable.h | 13 +- > > arch/riscv/include/asm/processor.h | 6 +- > > arch/riscv/include/asm/syscall.h | 1 + > > arch/riscv/include/asm/thread_info.h | 1 + > > arch/riscv/include/asm/unistd.h | 11 + > > arch/riscv/include/asm/vdso.h | 9 + > > arch/riscv/include/uapi/asm/unistd.h | 2 +- > > arch/riscv/kernel/Makefile | 3 + > > arch/riscv/kernel/compat_signal.c | 242 ++++++++++++++++++ > > arch/riscv/kernel/compat_syscall_table.c | 19 ++ > > arch/riscv/kernel/compat_vdso/.gitignore | 2 + > > arch/riscv/kernel/compat_vdso/Makefile | 78 ++++++ > > arch/riscv/kernel/compat_vdso/compat_vdso.S | 8 + > > .../kernel/compat_vdso/compat_vdso.lds.S | 3 + > > arch/riscv/kernel/compat_vdso/flush_icache.S | 3 + > > .../compat_vdso/gen_compat_vdso_offsets.sh | 5 + > > arch/riscv/kernel/compat_vdso/getcpu.S | 3 + > > arch/riscv/kernel/compat_vdso/note.S | 3 + > > arch/riscv/kernel/compat_vdso/rt_sigreturn.S | 3 + > > arch/riscv/kernel/entry.S | 18 +- > > arch/riscv/kernel/process.c | 37 +++ > > arch/riscv/kernel/ptrace.c | 87 ++++++- > > arch/riscv/kernel/signal.c | 13 +- > > arch/riscv/kernel/sys_riscv.c | 6 +- > > arch/riscv/kernel/vdso.c | 105 +++++--- > > arch/riscv/kernel/vdso/vdso.S | 6 +- > > arch/s390/Kconfig | 3 - > > arch/s390/include/asm/compat.h | 99 +------ > > arch/s390/include/asm/unistd.h | 1 + > > arch/sparc/Kconfig | 5 - > > arch/sparc/include/asm/compat.h | 61 ++--- > > arch/sparc/include/asm/unistd.h | 1 + > > arch/x86/Kconfig | 4 - > > arch/x86/include/asm/compat.h | 104 ++------ > > arch/x86/include/asm/unistd.h | 1 + > > fs/open.c | 24 ++ > > fs/read_write.c | 16 ++ > > fs/stat.c | 2 +- > > fs/sync.c | 9 + > > include/asm-generic/compat.h | 113 ++++++++ > > include/linux/compat.h | 68 +++++ > > include/uapi/asm-generic/fcntl.h | 23 +- > > include/uapi/asm-generic/unistd.h | 4 +- > > init/Kconfig | 4 + > > mm/fadvise.c | 11 + > > mm/readahead.c | 7 + > > tools/include/uapi/asm-generic/fcntl.h | 21 +- > > tools/include/uapi/asm-generic/unistd.h | 4 +- > > 67 files changed, 1206 insertions(+), 563 deletions(-) > > create mode 100644 arch/riscv/include/asm/compat.h > > create mode 100644 arch/riscv/kernel/compat_signal.c > > create mode 100644 arch/riscv/kernel/compat_syscall_table.c > > create mode 100644 arch/riscv/kernel/compat_vdso/.gitignore > > create mode 100644 arch/riscv/kernel/compat_vdso/Makefile > > create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.S > > create mode 100644 arch/riscv/kernel/compat_vdso/compat_vdso.lds.S > > create mode 100644 arch/riscv/kernel/compat_vdso/flush_icache.S > > create mode 100755 arch/riscv/kernel/compat_vdso/gen_compat_vdso_offsets.sh > > create mode 100644 arch/riscv/kernel/compat_vdso/getcpu.S > > create mode 100644 arch/riscv/kernel/compat_vdso/note.S > > create mode 100644 arch/riscv/kernel/compat_vdso/rt_sigreturn.S > > Thanks. > > This touches a bunch of other trees, which I try to avoid without the > relevant acks and such. In this case I'm OK taking it because Arnd and > Christoph have written/reviewed/ack'd so much of it, and because some > autobuilders found build issues (and thus I'm assuming there aren't any > more). > > There's been a bunch of versions of this and I'm pretty sure I've said > this a handful of times without any comments. Now that it's passing all > my tests and I'm not getting any autobuilding breakages I've put it on > for-next, but happy to try and spin up some sort of multi-tree merge if Sounds good to me. Thx. > that's an issue for anyone. -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/ _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv