Re: [PATCH V11 00/20] riscv: Add COMPAT mode support for rv64

2022-04-05 Thread Guo Ren
Hi Palmer,

On Tue, Apr 5, 2022 at 7:06 AM Palmer Dabbelt  wrote:
>
> On Mon, 04 Apr 2022 07:28:50 PDT (-0700), guo...@kernel.org wrote:
> > On Sat, Apr 2, 2022 at 10:04 PM Guo Ren  wrote:
> >>
> >> Hi Palmer,
> >>
> >> Sorry for the late reply, I still want COMPAT to catch up at 5.18..
> >> I've pushed it into my next branch, and it would get in linux-next the
> >> next day. You could have a look at that. The repo is:
> >> https://github.com/c-sky/csky-linux/tree/linux-next
> >>
> >> We still need your sending pull request for COMPAT, thank you very much.
>
> Sorry, but it was still failing the autobuilders on the previous
> versions and Saturday night is way, way too late for a respin of a big
> patch set.
It's my fault to miss the arm64 auto builder problem, and I've fixed it in v12.

>
> > Seems we have already missed 5.18, I just prepared the 5.18-rc1 for
> > you. It solved the arm64 compile problem and some conflicts, Hope you
> > could put it into your for-next (5.19-rc1).
> > https://github.com/c-sky/csky-linux/tree/riscv_compat_v12
>
> This says v11, but that says v12.  I'm going to put the v11 that was
> sent to the lists in a branch for the autobuilders to test again, but
> LMK if there's a difference (maybe by sending the v12?).  Might take a
> bit for me to get everything bumped and tested, my machine's super flaky
> right now...
v11 is based on 5.17-rc8, so you could abandon it.:
https://github.com/c-sky/csky-linux/commits/riscv_compat_v11

v12 is based on 5.18-rc1 (I haven't sent patches series to the list):
https://github.com/c-sky/csky-linux/commits/riscv_compat_v12

A new compile problem has been reported by Nathan and I've fixed it in
v12. I will soon send out the v12 patchset series in the mail list.





>
> >
> >>
> >> On Sat, Apr 2, 2022 at 9:53 PM  wrote:
> >> >
> >> > From: Guo Ren 
> >> >
> >> > Currently, most 64-bit architectures (x86, parisc, powerpc, arm64,
> >> > s390, mips, sparc) have supported COMPAT mode. But they all have
> >> > history issues and can't use standard linux unistd.h. RISC-V would
> >> > be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic
> >> > /unistd.h.
> >> >
> >> > The patchset are based on v5.17-rc8, you can compare rv64-compat
> >> > v.s. rv32-native in qemu with following steps:
> >> >
> >> >  - Prepare rv32 rootfs & fw_jump.bin by buildroot.org
> >> >$ git clone git://git.busybox.net/buildroot
> >> >$ cd buildroot
> >> >$ make qemu_riscv32_virt_defconfig O=qemu_riscv32_virt_defconfig
> >> >$ make -C qemu_riscv32_virt_defconfig
> >> >$ make qemu_riscv64_virt_defconfig O=qemu_riscv64_virt_defconfig
> >> >$ make -C qemu_riscv64_virt_defconfig
> >> >(Got fw_jump.bin & rootfs.ext2 in qemu_riscvXX_virt_defconfig/images)
> >> >
> >> >  - Prepare Linux rv32 & rv64 Image
> >> >$ git clone g...@github.com:c-sky/csky-linux.git -b riscv_compat_v11 
> >> > linux
> >> >$ cd linux
> >> >$ echo "CONFIG_STRICT_KERNEL_RWX=n" >> arch/riscv/configs/defconfig
> >> >$ echo "CONFIG_STRICT_MODULE_RWX=n" >> arch/riscv/configs/defconfig
> >> >$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- 
> >> > O=../build-rv32/ rv32_defconfig
> >> >$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- 
> >> > O=../build-rv32/ Image
> >> >$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- 
> >> > O=../build-rv64/ defconfig
> >> >$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- 
> >> > O=../build-rv64/ Image
> >> >
> >> >  - Prepare Qemu:
> >> >$ git clone https://gitlab.com/qemu-project/qemu.git -b master linux
> >> >$ cd qemu
> >> >$ ./configure --target-list="riscv64-softmmu riscv32-softmmu"
> >> >$ make
> >> >
> >> > Now let's compare rv64-compat with rv32-native memory footprint with 
> >> > almost the same
> >> > defconfig, rootfs, opensbi in one qemu.
> >> >
> >> >  - Run rv64 with rv32 rootfs in compat mode:
> >> >$ ./build/qemu-system-riscv64 -cpu rv64 -M virt -m 64m -nographic 
> >> > -bios qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel 
> >> > build-rv64/Image -drive file 
> >> > qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=raw,id=hd0 -device 
> >> > virtio-blk-device,drive=hd0 -append "rootwait root=/dev/vda ro 
> >> > console=ttyS0 earlycon=sbi" -netdev user,id=net0 -device 
> >> > virtio-net-device,netdev=net0
> >> >
> >> > QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8)
> >> > OpenSBI v0.9
> >> > [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty 
> >> > (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU 
> >> > ld (GNU Binutils) 2.37) #96 SMP Tue Dec 28 21:01:55 CST 2021
> >> > [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020
> >> > [0.00] Machine model: riscv-virtio,qemu
> >> > [0.00] earlycon: sbi0 at I/O port 0x0 (options '')
> >> > [0.00] printk: bootconsole [sbi0] enabled
> >> > [0.00] efi: UEFI not found.
> >> > [

Re: [PATCH V11 00/20] riscv: Add COMPAT mode support for rv64

2022-04-04 Thread Palmer Dabbelt

On Mon, 04 Apr 2022 07:28:50 PDT (-0700), guo...@kernel.org wrote:

On Sat, Apr 2, 2022 at 10:04 PM Guo Ren  wrote:


Hi Palmer,

Sorry for the late reply, I still want COMPAT to catch up at 5.18..
I've pushed it into my next branch, and it would get in linux-next the
next day. You could have a look at that. The repo is:
https://github.com/c-sky/csky-linux/tree/linux-next

We still need your sending pull request for COMPAT, thank you very much.


Sorry, but it was still failing the autobuilders on the previous 
versions and Saturday night is way, way too late for a respin of a big 
patch set.



Seems we have already missed 5.18, I just prepared the 5.18-rc1 for
you. It solved the arm64 compile problem and some conflicts, Hope you
could put it into your for-next (5.19-rc1).
https://github.com/c-sky/csky-linux/tree/riscv_compat_v12


This says v11, but that says v12.  I'm going to put the v11 that was 
sent to the lists in a branch for the autobuilders to test again, but 
LMK if there's a difference (maybe by sending the v12?).  Might take a 
bit for me to get everything bumped and tested, my machine's super flaky 
right now...






On Sat, Apr 2, 2022 at 9:53 PM  wrote:
>
> From: Guo Ren 
>
> Currently, most 64-bit architectures (x86, parisc, powerpc, arm64,
> s390, mips, sparc) have supported COMPAT mode. But they all have
> history issues and can't use standard linux unistd.h. RISC-V would
> be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic
> /unistd.h.
>
> The patchset are based on v5.17-rc8, you can compare rv64-compat
> v.s. rv32-native in qemu with following steps:
>
>  - Prepare rv32 rootfs & fw_jump.bin by buildroot.org
>$ git clone git://git.busybox.net/buildroot
>$ cd buildroot
>$ make qemu_riscv32_virt_defconfig O=qemu_riscv32_virt_defconfig
>$ make -C qemu_riscv32_virt_defconfig
>$ make qemu_riscv64_virt_defconfig O=qemu_riscv64_virt_defconfig
>$ make -C qemu_riscv64_virt_defconfig
>(Got fw_jump.bin & rootfs.ext2 in qemu_riscvXX_virt_defconfig/images)
>
>  - Prepare Linux rv32 & rv64 Image
>$ git clone g...@github.com:c-sky/csky-linux.git -b riscv_compat_v11 linux
>$ cd linux
>$ echo "CONFIG_STRICT_KERNEL_RWX=n" >> arch/riscv/configs/defconfig
>$ echo "CONFIG_STRICT_MODULE_RWX=n" >> arch/riscv/configs/defconfig
>$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- 
O=../build-rv32/ rv32_defconfig
>$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- 
O=../build-rv32/ Image
>$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- 
O=../build-rv64/ defconfig
>$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- 
O=../build-rv64/ Image
>
>  - Prepare Qemu:
>$ git clone https://gitlab.com/qemu-project/qemu.git -b master linux
>$ cd qemu
>$ ./configure --target-list="riscv64-softmmu riscv32-softmmu"
>$ make
>
> Now let's compare rv64-compat with rv32-native memory footprint with almost 
the same
> defconfig, rootfs, opensbi in one qemu.
>
>  - Run rv64 with rv32 rootfs in compat mode:
>$ ./build/qemu-system-riscv64 -cpu rv64 -M virt -m 64m -nographic -bios 
qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image -drive file 
qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=raw,id=hd0 -device 
virtio-blk-device,drive=hd0 -append "rootwait root=/dev/vda ro console=ttyS0 
earlycon=sbi" -netdev user,id=net0 -device virtio-net-device,netdev=net0
>
> QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8)
> OpenSBI v0.9
> [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty 
(guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld (GNU 
Binutils) 2.37) #96 SMP Tue Dec 28 21:01:55 CST 2021
> [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020
> [0.00] Machine model: riscv-virtio,qemu
> [0.00] earlycon: sbi0 at I/O port 0x0 (options '')
> [0.00] printk: bootconsole [sbi0] enabled
> [0.00] efi: UEFI not found.
> [0.00] Zone ranges:
> [0.00]   DMA32[mem 0x8020-0x83ff]
> [0.00]   Normal   empty
> [0.00] Movable zone start for each node
> [0.00] Early memory node ranges
> [0.00]   node   0: [mem 0x8020-0x83ff]
> [0.00] Initmem setup node 0 [mem 
0x8020-0x83ff]
> [0.00] SBI specification v0.2 detected
> [0.00] SBI implementation ID=0x1 Version=0x9
> [0.00] SBI TIME extension detected
> [0.00] SBI IPI extension detected
> [0.00] SBI RFENCE extension detected
> [0.00] SBI v0.2 HSM extension detected
> [0.00] riscv: ISA extensions acdfhimsu
> [0.00] riscv: ELF capabilities acdfim
> [0.00] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632
> [0.00] Built 1 zonelists, mobility grouping on.  Total pages: 15655
> [0.00] Kernel command line: rootwait root=/dev/vda ro 

Re: [PATCH V11 00/20] riscv: Add COMPAT mode support for rv64

2022-04-04 Thread Guo Ren
On Sat, Apr 2, 2022 at 10:04 PM Guo Ren  wrote:
>
> Hi Palmer,
>
> Sorry for the late reply, I still want COMPAT to catch up at 5.18..
> I've pushed it into my next branch, and it would get in linux-next the
> next day. You could have a look at that. The repo is:
> https://github.com/c-sky/csky-linux/tree/linux-next
>
> We still need your sending pull request for COMPAT, thank you very much.
Seems we have already missed 5.18, I just prepared the 5.18-rc1 for
you. It solved the arm64 compile problem and some conflicts, Hope you
could put it into your for-next (5.19-rc1).
https://github.com/c-sky/csky-linux/tree/riscv_compat_v12

>
> On Sat, Apr 2, 2022 at 9:53 PM  wrote:
> >
> > From: Guo Ren 
> >
> > Currently, most 64-bit architectures (x86, parisc, powerpc, arm64,
> > s390, mips, sparc) have supported COMPAT mode. But they all have
> > history issues and can't use standard linux unistd.h. RISC-V would
> > be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic
> > /unistd.h.
> >
> > The patchset are based on v5.17-rc8, you can compare rv64-compat
> > v.s. rv32-native in qemu with following steps:
> >
> >  - Prepare rv32 rootfs & fw_jump.bin by buildroot.org
> >$ git clone git://git.busybox.net/buildroot
> >$ cd buildroot
> >$ make qemu_riscv32_virt_defconfig O=qemu_riscv32_virt_defconfig
> >$ make -C qemu_riscv32_virt_defconfig
> >$ make qemu_riscv64_virt_defconfig O=qemu_riscv64_virt_defconfig
> >$ make -C qemu_riscv64_virt_defconfig
> >(Got fw_jump.bin & rootfs.ext2 in qemu_riscvXX_virt_defconfig/images)
> >
> >  - Prepare Linux rv32 & rv64 Image
> >$ git clone g...@github.com:c-sky/csky-linux.git -b riscv_compat_v11 
> > linux
> >$ cd linux
> >$ echo "CONFIG_STRICT_KERNEL_RWX=n" >> arch/riscv/configs/defconfig
> >$ echo "CONFIG_STRICT_MODULE_RWX=n" >> arch/riscv/configs/defconfig
> >$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- 
> > O=../build-rv32/ rv32_defconfig
> >$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- 
> > O=../build-rv32/ Image
> >$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- 
> > O=../build-rv64/ defconfig
> >$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- 
> > O=../build-rv64/ Image
> >
> >  - Prepare Qemu:
> >$ git clone https://gitlab.com/qemu-project/qemu.git -b master linux
> >$ cd qemu
> >$ ./configure --target-list="riscv64-softmmu riscv32-softmmu"
> >$ make
> >
> > Now let's compare rv64-compat with rv32-native memory footprint with almost 
> > the same
> > defconfig, rootfs, opensbi in one qemu.
> >
> >  - Run rv64 with rv32 rootfs in compat mode:
> >$ ./build/qemu-system-riscv64 -cpu rv64 -M virt -m 64m -nographic -bios 
> > qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image 
> > -drive file 
> > qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=raw,id=hd0 -device 
> > virtio-blk-device,drive=hd0 -append "rootwait root=/dev/vda ro 
> > console=ttyS0 earlycon=sbi" -netdev user,id=net0 -device 
> > virtio-net-device,netdev=net0
> >
> > QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8)
> > OpenSBI v0.9
> > [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty 
> > (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld 
> > (GNU Binutils) 2.37) #96 SMP Tue Dec 28 21:01:55 CST 2021
> > [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020
> > [0.00] Machine model: riscv-virtio,qemu
> > [0.00] earlycon: sbi0 at I/O port 0x0 (options '')
> > [0.00] printk: bootconsole [sbi0] enabled
> > [0.00] efi: UEFI not found.
> > [0.00] Zone ranges:
> > [0.00]   DMA32[mem 0x8020-0x83ff]
> > [0.00]   Normal   empty
> > [0.00] Movable zone start for each node
> > [0.00] Early memory node ranges
> > [0.00]   node   0: [mem 0x8020-0x83ff]
> > [0.00] Initmem setup node 0 [mem 
> > 0x8020-0x83ff]
> > [0.00] SBI specification v0.2 detected
> > [0.00] SBI implementation ID=0x1 Version=0x9
> > [0.00] SBI TIME extension detected
> > [0.00] SBI IPI extension detected
> > [0.00] SBI RFENCE extension detected
> > [0.00] SBI v0.2 HSM extension detected
> > [0.00] riscv: ISA extensions acdfhimsu
> > [0.00] riscv: ELF capabilities acdfim
> > [0.00] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632
> > [0.00] Built 1 zonelists, mobility grouping on.  Total pages: 15655
> > [0.00] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 
> > earlycon=sbi
> > [0.00] Dentry cache hash table entries: 8192 (order: 4, 65536 
> > bytes, linear)
> > [0.00] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, 
> > linear)
> > [0.00] mem auto-init: stack:off, heap alloc:off, heap free:off
> > [0.00] 

Re: [PATCH V11 00/20] riscv: Add COMPAT mode support for rv64

2022-04-02 Thread Guo Ren
Hi Palmer,

Sorry for the late reply, I still want COMPAT to catch up at 5.18..
I've pushed it into my next branch, and it would get in linux-next the
next day. You could have a look at that. The repo is:
https://github.com/c-sky/csky-linux/tree/linux-next

We still need your sending pull request for COMPAT, thank you very much.

On Sat, Apr 2, 2022 at 9:53 PM  wrote:
>
> From: Guo Ren 
>
> Currently, most 64-bit architectures (x86, parisc, powerpc, arm64,
> s390, mips, sparc) have supported COMPAT mode. But they all have
> history issues and can't use standard linux unistd.h. RISC-V would
> be first standard __SYSCALL_COMPAT user of include/uapi/asm-generic
> /unistd.h.
>
> The patchset are based on v5.17-rc8, you can compare rv64-compat
> v.s. rv32-native in qemu with following steps:
>
>  - Prepare rv32 rootfs & fw_jump.bin by buildroot.org
>$ git clone git://git.busybox.net/buildroot
>$ cd buildroot
>$ make qemu_riscv32_virt_defconfig O=qemu_riscv32_virt_defconfig
>$ make -C qemu_riscv32_virt_defconfig
>$ make qemu_riscv64_virt_defconfig O=qemu_riscv64_virt_defconfig
>$ make -C qemu_riscv64_virt_defconfig
>(Got fw_jump.bin & rootfs.ext2 in qemu_riscvXX_virt_defconfig/images)
>
>  - Prepare Linux rv32 & rv64 Image
>$ git clone g...@github.com:c-sky/csky-linux.git -b riscv_compat_v11 linux
>$ cd linux
>$ echo "CONFIG_STRICT_KERNEL_RWX=n" >> arch/riscv/configs/defconfig
>$ echo "CONFIG_STRICT_MODULE_RWX=n" >> arch/riscv/configs/defconfig
>$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- 
> O=../build-rv32/ rv32_defconfig
>$ make ARCH=riscv CROSS_COMPILE=riscv32-buildroot-linux-gnu- 
> O=../build-rv32/ Image
>$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- 
> O=../build-rv64/ defconfig
>$ make ARCH=riscv CROSS_COMPILE=riscv64-buildroot-linux-gnu- 
> O=../build-rv64/ Image
>
>  - Prepare Qemu:
>$ git clone https://gitlab.com/qemu-project/qemu.git -b master linux
>$ cd qemu
>$ ./configure --target-list="riscv64-softmmu riscv32-softmmu"
>$ make
>
> Now let's compare rv64-compat with rv32-native memory footprint with almost 
> the same
> defconfig, rootfs, opensbi in one qemu.
>
>  - Run rv64 with rv32 rootfs in compat mode:
>$ ./build/qemu-system-riscv64 -cpu rv64 -M virt -m 64m -nographic -bios 
> qemu_riscv64_virt_defconfig/images/fw_jump.bin -kernel build-rv64/Image 
> -drive file qemu_riscv32_virt_defconfig/images/rootfs.ext2,format=raw,id=hd0 
> -device virtio-blk-device,drive=hd0 -append "rootwait root=/dev/vda ro 
> console=ttyS0 earlycon=sbi" -netdev user,id=net0 -device 
> virtio-net-device,netdev=net0
>
> QEMU emulator version 6.2.50 (v6.2.0-29-g196d7182c8)
> OpenSBI v0.9
> [0.00] Linux version 5.16.0-rc6-00017-g750f87086bdd-dirty 
> (guoren@guoren-Z87-HD3) (riscv64-unknown-linux-gnu-gcc (GCC) 10.2.0, GNU ld 
> (GNU Binutils) 2.37) #96 SMP Tue Dec 28 21:01:55 CST 2021
> [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020
> [0.00] Machine model: riscv-virtio,qemu
> [0.00] earlycon: sbi0 at I/O port 0x0 (options '')
> [0.00] printk: bootconsole [sbi0] enabled
> [0.00] efi: UEFI not found.
> [0.00] Zone ranges:
> [0.00]   DMA32[mem 0x8020-0x83ff]
> [0.00]   Normal   empty
> [0.00] Movable zone start for each node
> [0.00] Early memory node ranges
> [0.00]   node   0: [mem 0x8020-0x83ff]
> [0.00] Initmem setup node 0 [mem 
> 0x8020-0x83ff]
> [0.00] SBI specification v0.2 detected
> [0.00] SBI implementation ID=0x1 Version=0x9
> [0.00] SBI TIME extension detected
> [0.00] SBI IPI extension detected
> [0.00] SBI RFENCE extension detected
> [0.00] SBI v0.2 HSM extension detected
> [0.00] riscv: ISA extensions acdfhimsu
> [0.00] riscv: ELF capabilities acdfim
> [0.00] percpu: Embedded 17 pages/cpu s30696 r8192 d30744 u69632
> [0.00] Built 1 zonelists, mobility grouping on.  Total pages: 15655
> [0.00] Kernel command line: rootwait root=/dev/vda ro console=ttyS0 
> earlycon=sbi
> [0.00] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes, 
> linear)
> [0.00] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, 
> linear)
> [0.00] mem auto-init: stack:off, heap alloc:off, heap free:off
> [0.00] Virtual kernel memory layout:
> [0.00]   fixmap : 0xffcefee0 - 0xffceff00   (2048 
> kB)
> [0.00]   pci io : 0xffceff00 - 0xffcf   (  16 
> MB)
> [0.00]  vmemmap : 0xffcf - 0xffcf   (4095 
> MB)
> [0.00]  vmalloc : 0xffd0 - 0xffdf   
> (65535 MB)
> [0.00]   lowmem : 0xffe0 - 0xffe003e0   (  62 
> MB)
> [0.00]   kernel :