bootlin / toolchains-builder

http://toolchains.free-electrons.com
89 stars 27 forks source link

Enable nios2 m68k risc64 testing #29

Closed RomainNaour closed 3 years ago

RomainNaour commented 4 years ago

This series enable runtime Qemu testing for architecture that requires Qemu >= 2.9 that wasn't present in the docker image (zesty and artful) previously used as build machine. Now we are using disco Ubuntu image that provide Qemu 3.1.

Note: I tried to add riscv32 architecture but I had some build and runtime issue as soon as I changed the toolchain componants. For now, riscv32 port is not completely stable, lets try latter.

RomainNaour commented 4 years ago

Actually, for the riscv32 the issue is related to the patch [1] and the glibc build [2]. For the qemu_riscv32-virt_defconfig, we are using BR2_KERNEL_HEADERS_AS_KERNEL=y, so the kernel patch is also used for linux-headers package.

Note: riscv32 is not yet merged in glibc [3]

[1] https://git.buildroot.net/buildroot/tree/board/qemu/riscv32-virt/patches/linux/0001-Revert-riscv-Use-latest-system-call-ABI.patch [2] https://gitlab.com/kubu93/toolchains-builder/-/jobs/424661562 [3] https://github.com/alistair23/glibc/tree/alistair/rv32.wip

tpetazzoni commented 3 years ago

Thank for the contribution. Unfortunately, the m68k test is not working here, it fails when running init:

Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
CPU: 0 PID: 1 Comm: init Not tainted 5.4.58 #2
Stack from 47023e74:
        47023e74 403190a8 40025778 000000ff 47022000 47038000 47023f8c 47030000
        47022000 4703c000 47023ed4 40027cb0 40312aa8 00000004 00000004 47022000
        47038000 47023f8c 47022000 47023f6c 4703c000 47022000 00000000 0000008d
        47022000 40027d66 00000004 47023f80 4703e510 40030b2a 00000004 0000000c
        00000000 47502178 00000000 00000002 00000000 47023fcc 47022000 47560a52
        4751cbdc 47023fa4 47022000 47022000 47022007 40021488 47023f6c 0000000c
Call Trace: [<40025778>] panic+0xcc/0x28e
 [<40027cb0>] do_exit+0x9a0/0x9f2
 [<40027d66>] do_group_exit+0x36/0xb8
 [<40030b2a>] get_signal+0xe4/0x6fe
 [<40021488>] do_notify_resume+0x5c/0x514
 [<40030a1c>] force_sig_fault_to_task+0x36/0x3c
 [<40022528>] Lsignal_return+0x14/0x24
 [<40100010>] ramfs_fill_super+0x54/0x7c
---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004 ]---

You might have missed this as there is an issue in toolchain-builder, which reports success even though this Qemu boot test obviously failed. See https://gitlab.com/bootlin/toolchains-builder/-/jobs/728388871

tpetazzoni commented 3 years ago

In fact, for m68k, the system boots, it's when we run the "poweroff" command that we have this kernel crash:


Welcome to Buildroot

buildroot login: root

Jan  1 00:00:06 login[81]: root login on 'ttyS0'

~ # poweroff

Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004

CPU: 0 PID: 1 Comm: init Not tainted 5.4.58 #2

Stack from 47023e74:

        47023e74 403190a8 40025778 000000ff 47022000 47038000 47023f8c 47030000

        47022000 4703c000 47023ed4 40027cb0 40312aa8 00000004 00000004 47022000

        47038000 47023f8c 47022000 47023f6c 4703c000 47022000 00000000 0000008d

        47022000 40027d66 00000004 47023f80 4703e510 40030b2a 00000004 0000000c

        00000000 47502178 00000000 00000002 00000000 47023fcc 47022000 47560a52

        4751cbdc 47023fa4 47022000 47022000 47022007 40021488 47023f6c 0000000c

Call Trace: [<40025778>] panic+0xcc/0x28e

 [<40027cb0>] do_exit+0x9a0/0x9f2

 [<40027d66>] do_group_exit+0x36/0xb8

 [<40030b2a>] get_signal+0xe4/0x6fe

 [<40021488>] do_notify_resume+0x5c/0x514

 [<40030a1c>] force_sig_fault_to_task+0x36/0x3c

 [<40022528>] Lsignal_return+0x14/0x24

 [<40100010>] ramfs_fill_super+0x54/0x7c

---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004 ]---
tpetazzoni commented 3 years ago

The riscv64 test also doesn't boot:

spawn qemu-system-riscv64 -M virt -kernel /builds/bootlin/toolchains-builder/build/opt/test-riscv64--glibc--bleeding-edge/images/fw_jump.elf -device loader,file=/builds/bootlin/toolchains-builder/build/opt/test-riscv64--glibc--bleeding-edge/images/Image,addr=0x80200000 -append rootwait root=/dev/vda ro  -drive file=/builds/bootlin/toolchains-builder/build/opt/test-riscv64--glibc--bleeding-edge/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic -nographic
qemu-system-riscv64: warning: No -bios option specified. Not loading a firmware.
qemu-system-riscv64: warning: This default will change in a future QEMU release. Please use the -bios option to avoid breakages when this happens.
qemu-system-riscv64: warning: See QEMU's deprecation documentation for details.
sbi_trap_error: hart0: trap handler failed (error -2)

sbi_trap_error: hart0: mcause=0x0000000000000007 mtval=0x0000000002004000

sbi_trap_error: hart0: mepc=0x000000008000c9bc mstatus=0x8000000000007800

sbi_trap_error: hart0: ra=0x000000008000cd68 sp=0x000000008001be70

sbi_trap_error: hart0: gp=0x0000000000000000 tp=0x000000008001c000

sbi_trap_error: hart0: s0=0x000000008001be80 s1=0x0000000000000000

sbi_trap_error: hart0: a0=0xffffffffffffffff a1=0x0000000002004000

sbi_trap_error: hart0: a2=0x0000000000000000 a3=0x0000000000000000

sbi_trap_error: hart0: a4=0x000000008000c9b0 a5=0x0000000000000000

sbi_trap_error: hart0: a6=0x0000000000000000 a7=0x00000000000000a4

sbi_trap_error: hart0: s2=0x0000000080018900 s3=0x0000000000000000

sbi_trap_error: hart0: s4=0x0000000080017028 s5=0x0000000000000000

sbi_trap_error: hart0: s6=0x0000000080018008 s7=0x0000000000000001

sbi_trap_error: hart0: s8=0x0000000000002000 s9=0x0000000080018700

sbi_trap_error: hart0: s10=0x0000000000000000 s11=0x0000000000000000

sbi_trap_error: hart0: t0=0x000000008000a160 t1=0x0000000000000ba0

sbi_trap_error: hart0: t2=0x0000000000001000 t3=0x0000000000000032

sbi_trap_error: hart0: t4=0x000000000c200000 t5=0x0000000000000000

sbi_trap_error: hart0: t6=0x0000000000000000
tpetazzoni commented 3 years ago

I've applied the m68k and nios2 bits, but not the riscv64, due to the issues reported above. I'm closing this pull request, don't hesitate to reopen another with an improved riscv64 support. Thanks!