Re: RISC-V: crash in riscv_get_time()

Hi Heinrich
From: Heinrich Schuchardt [mailto:xypron.glpk@gmx.de] Sent: Thursday, August 06, 2020 6:45 PM To: Bin Meng; Rick Jian-Zhi Chen(陳建志) Cc: U-Boot Mailing List Subject: RISC-V: crash in riscv_get_time()
Hello Rick, hello Bin,
when I run qemu-riscv64_defconfig using
qemu-system-riscv64 -machine virt -m 1G -nographic \ -bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
a crash occurs in riscv_get_time() when executing readq().
$ qemu-system-riscv64 --version QEMU emulator version 5.0.0 (Debian 1:5.0-13)
Looking at doc/board/emulation/qemu-riscv.rst this should work.
Is there something missing in the documentation?
You can try this ./qemu-system-riscv64 -nographic -machine virt -bios u-boot -device virtio-net-device,netdev=net0 -netdev user,id=net0,tftp=tftp
It can work as below:
U-Boot 2020.10-rc1-00299-g89150a9 (Aug 06 2020 - 19:14:01 +0800)
CPU: rv64imafdcsu Model: riscv-virtio,qemu DRAM: 128 MiB In: uart@10000000 Out: uart@10000000 Err: uart@10000000 Net: eth0: virtio-net#0 Hit any key to stop autoboot: 0 => help ? - alias for 'help' base - print or set address offset bdinfo - print Board Info structure blkcache - block cache diagnostics and control boot - boot default, i.e., run 'bootcmd' bootd - boot default, i.e., run 'bootcmd' bootefi - Boots an EFI payload from memory bootelf - Boot from an ELF image in memory booti - boot Linux kernel 'Image' format from memory bootm - boot application image from memory bootp - boot image via network using BOOTP/TFTP protocol bootvx - Boot vxWorks from an ELF image cmp - memory compare coninfo - print console devices and information cp - memory copy cpu - display information about CPUs crc32 - checksum calculation dhcp - boot image via network using DHCP/TFTP protocol dm - Driver model low level access echo - echo args to console editenv - edit environment variable env - environment handling commands erase - erase FLASH memory exit - exit script ext2load - load binary file from a Ext2 filesystem ext2ls - list files in a directory (default /) ext4load - load binary file from a Ext4 filesystem ext4ls - list files in a directory (default /) ext4size - determine a file's size false - do nothing, unsuccessfully fatinfo - print information about filesystem fatload - load binary file from a dos filesystem fatls - list files in a directory (default /) fatmkdir - create a directory fatrm - delete a file fatsize - determine a file's size fatwrite - write file into a dos filesystem fdt - flattened device tree utility commands flinfo - print FLASH memory information fstype - Look up a filesystem type fstypes - List supported filesystem types go - start application at address 'addr' gzwrite - unzip and write memory to block device help - print command description/usage iminfo - print header information for application image imxtract - extract a part of a multi-image itest - return true/false on integer compare ln - Create a symbolic link load - load binary file from a filesystem loadb - load binary file over serial line (kermit mode) loads - load S-Record file over serial line loadx - load binary file over serial line (xmodem mode) loady - load binary file over serial line (ymodem mode) loop - infinite loop on address range ls - list files in a directory (default /) lzmadec - lzma uncompress a memory region md - memory display mm - memory modify (auto-incrementing address) mw - memory write (fill) nfs - boot image via network using NFS protocol nm - memory modify (constant address) nvme - NVM Express sub-system panic - Panic with optional message part - disk partition related commands pci - list and access PCI Configuration Space ping - send ICMP ECHO_REQUEST to network host poweroff - Perform POWEROFF of the device printenv - print environment variables protect - enable or disable FLASH write protection pxe - commands to get and boot from pxe files reset - Perform RESET of the CPU run - run commands in an environment variable save - save file to a filesystem setenv - set environment variables setexpr - set environment variable as the result of eval expression showvar - print local hushshell variables size - determine a file's size sleep - delay execution for some time source - run script from memory sysboot - command to get and boot from syslinux files test - minimal test like /bin/sh tftpboot - boot image via network using TFTP protocol true - do nothing, successfully unlz4 - lz4 uncompress a memory region unzip - unzip a memory region version - print monitor, compiler and linker version virtio - virtio block devices sub-system =>
Thanks, Rick
Best regards
Heinrich

On 06.08.20 13:18, Rick Chen wrote:
Hi Heinrich
From: Heinrich Schuchardt [mailto:xypron.glpk@gmx.de] Sent: Thursday, August 06, 2020 6:45 PM To: Bin Meng; Rick Jian-Zhi Chen(陳建志) Cc: U-Boot Mailing List Subject: RISC-V: crash in riscv_get_time()
Hello Rick, hello Bin,
when I run qemu-riscv64_defconfig using
qemu-system-riscv64 -machine virt -m 1G -nographic \ -bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
a crash occurs in riscv_get_time() when executing readq().
$ qemu-system-riscv64 --version QEMU emulator version 5.0.0 (Debian 1:5.0-13)
Looking at doc/board/emulation/qemu-riscv.rst this should work.
Is there something missing in the documentation?
You can try this ./qemu-system-riscv64 -nographic -machine virt -bios u-boot -device virtio-net-device,netdev=net0 -netdev user,id=net0,tftp=tftp
It can work as below:
U-Boot 2020.10-rc1-00299-g89150a9 (Aug 06 2020 - 19:14:01 +0800)
CPU: rv64imafdcsu Model: riscv-virtio,qemu DRAM: 128 MiB In: uart@10000000 Out: uart@10000000 Err: uart@10000000 Net: eth0: virtio-net#0 Hit any key to stop autoboot: 0 => help
But on Debian Bullseye it fails:
$ git reset --hard origin/master $ make mrproper $ make qemu-riscv64_defconfig $ export CROSS_COMPILE $ export CROSS_COMPILE=riscv64-linux-gnu- $ qemu-system-riscv64 -nographic -machine virt \
-bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
U-Boot 2020.10-rc1-00120-g1521326b7a (Aug 06 2020 - 16:17:14 +0200)
CPU: rv64imafdcsu Model: riscv-virtio,qemu DRAM: 128 MiB In: uart@10000000 Out: uart@10000000 Err: uart@10000000 Net: eth0: virtio-net#0 Hit any key to stop autoboot: 2 Unhandled exception: Load access fault EPC: 0000000087f6e282 TVAL: 000000000200bff8 ### ERROR ### Please RESET the board ###
Debian uses QEMU 5. QEMU emulator version 5.0.0 (Debian 1:5.0-13)
The QEMU in our Dockerimage used for Gitlab is QEMU emulator version 4.2.0 (v4.2.0-dirty)
With this outdated QEMU the emulation succeeds.
Our testing should succeed on current QEMU.
Best regards
Heinrich

On Thu, Aug 6, 2020 at 10:28 PM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 06.08.20 13:18, Rick Chen wrote:
Hi Heinrich
From: Heinrich Schuchardt [mailto:xypron.glpk@gmx.de] Sent: Thursday, August 06, 2020 6:45 PM To: Bin Meng; Rick Jian-Zhi Chen(陳建志) Cc: U-Boot Mailing List Subject: RISC-V: crash in riscv_get_time()
Hello Rick, hello Bin,
when I run qemu-riscv64_defconfig using
qemu-system-riscv64 -machine virt -m 1G -nographic \ -bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
a crash occurs in riscv_get_time() when executing readq().
$ qemu-system-riscv64 --version QEMU emulator version 5.0.0 (Debian 1:5.0-13)
Looking at doc/board/emulation/qemu-riscv.rst this should work.
Is there something missing in the documentation?
You can try this ./qemu-system-riscv64 -nographic -machine virt -bios u-boot -device virtio-net-device,netdev=net0 -netdev user,id=net0,tftp=tftp
It can work as below:
U-Boot 2020.10-rc1-00299-g89150a9 (Aug 06 2020 - 19:14:01 +0800)
CPU: rv64imafdcsu Model: riscv-virtio,qemu DRAM: 128 MiB In: uart@10000000 Out: uart@10000000 Err: uart@10000000 Net: eth0: virtio-net#0 Hit any key to stop autoboot: 0 => help
But on Debian Bullseye it fails:
$ git reset --hard origin/master $ make mrproper $ make qemu-riscv64_defconfig $ export CROSS_COMPILE $ export CROSS_COMPILE=riscv64-linux-gnu- $ qemu-system-riscv64 -nographic -machine virt \
-bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
Just rebuilt a QEMU 5.0.0 on Ubuntu 16.04 and cannot reproduce. Something is wrong with Debian?
Regards, Bin

On 06.08.20 16:40, Bin Meng wrote:
On Thu, Aug 6, 2020 at 10:28 PM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 06.08.20 13:18, Rick Chen wrote:
Hi Heinrich
From: Heinrich Schuchardt [mailto:xypron.glpk@gmx.de] Sent: Thursday, August 06, 2020 6:45 PM To: Bin Meng; Rick Jian-Zhi Chen(陳建志) Cc: U-Boot Mailing List Subject: RISC-V: crash in riscv_get_time()
Hello Rick, hello Bin,
when I run qemu-riscv64_defconfig using
qemu-system-riscv64 -machine virt -m 1G -nographic \ -bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
a crash occurs in riscv_get_time() when executing readq().
$ qemu-system-riscv64 --version QEMU emulator version 5.0.0 (Debian 1:5.0-13)
Looking at doc/board/emulation/qemu-riscv.rst this should work.
Is there something missing in the documentation?
You can try this ./qemu-system-riscv64 -nographic -machine virt -bios u-boot -device virtio-net-device,netdev=net0 -netdev user,id=net0,tftp=tftp
It can work as below:
U-Boot 2020.10-rc1-00299-g89150a9 (Aug 06 2020 - 19:14:01 +0800)
CPU: rv64imafdcsu Model: riscv-virtio,qemu DRAM: 128 MiB In: uart@10000000 Out: uart@10000000 Err: uart@10000000 Net: eth0: virtio-net#0 Hit any key to stop autoboot: 0 => help
But on Debian Bullseye it fails:
$ git reset --hard origin/master $ make mrproper $ make qemu-riscv64_defconfig $ export CROSS_COMPILE $ export CROSS_COMPILE=riscv64-linux-gnu- $ qemu-system-riscv64 -nographic -machine virt \
-bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
Just rebuilt a QEMU 5.0.0 on Ubuntu 16.04 and cannot reproduce. Something is wrong with Debian?
Regards, Bin
I can confirm that with an unpatched QEMU v5.0.0 no problem occurs. Same with QEMU 5.0.93 (v5.1.0-rc3-dirty).
Best regards
Heinrich

On Fri, Aug 7, 2020 at 6:53 PM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 06.08.20 16:40, Bin Meng wrote:
On Thu, Aug 6, 2020 at 10:28 PM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 06.08.20 13:18, Rick Chen wrote:
Hi Heinrich
From: Heinrich Schuchardt [mailto:xypron.glpk@gmx.de] Sent: Thursday, August 06, 2020 6:45 PM To: Bin Meng; Rick Jian-Zhi Chen(陳建志) Cc: U-Boot Mailing List Subject: RISC-V: crash in riscv_get_time()
Hello Rick, hello Bin,
when I run qemu-riscv64_defconfig using
qemu-system-riscv64 -machine virt -m 1G -nographic \ -bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
a crash occurs in riscv_get_time() when executing readq().
$ qemu-system-riscv64 --version QEMU emulator version 5.0.0 (Debian 1:5.0-13)
Looking at doc/board/emulation/qemu-riscv.rst this should work.
Is there something missing in the documentation?
You can try this ./qemu-system-riscv64 -nographic -machine virt -bios u-boot -device virtio-net-device,netdev=net0 -netdev user,id=net0,tftp=tftp
It can work as below:
U-Boot 2020.10-rc1-00299-g89150a9 (Aug 06 2020 - 19:14:01 +0800)
CPU: rv64imafdcsu Model: riscv-virtio,qemu DRAM: 128 MiB In: uart@10000000 Out: uart@10000000 Err: uart@10000000 Net: eth0: virtio-net#0 Hit any key to stop autoboot: 0 => help
But on Debian Bullseye it fails:
$ git reset --hard origin/master $ make mrproper $ make qemu-riscv64_defconfig $ export CROSS_COMPILE $ export CROSS_COMPILE=riscv64-linux-gnu- $ qemu-system-riscv64 -nographic -machine virt \
-bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
Just rebuilt a QEMU 5.0.0 on Ubuntu 16.04 and cannot reproduce. Something is wrong with Debian?
Regards, Bin
I can confirm that with an unpatched QEMU v5.0.0 no problem occurs. Same with QEMU 5.0.93 (v5.1.0-rc3-dirty).
Unpatched QEMU? Do you mean Debian shipped a patched QEMU? If so, what is patched?
Regards, Bin

Am 7. August 2020 13:11:25 MESZ schrieb Bin Meng bmeng.cn@gmail.com:
On Fri, Aug 7, 2020 at 6:53 PM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 06.08.20 16:40, Bin Meng wrote:
On Thu, Aug 6, 2020 at 10:28 PM Heinrich Schuchardt
xypron.glpk@gmx.de wrote:
On 06.08.20 13:18, Rick Chen wrote:
Hi Heinrich
From: Heinrich Schuchardt [mailto:xypron.glpk@gmx.de] Sent: Thursday, August 06, 2020 6:45 PM To: Bin Meng; Rick Jian-Zhi Chen(陳建志) Cc: U-Boot Mailing List Subject: RISC-V: crash in riscv_get_time()
Hello Rick, hello Bin,
when I run qemu-riscv64_defconfig using
qemu-system-riscv64 -machine virt -m 1G -nographic \ -bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
a crash occurs in riscv_get_time() when executing readq().
$ qemu-system-riscv64 --version QEMU emulator version 5.0.0 (Debian 1:5.0-13)
Looking at doc/board/emulation/qemu-riscv.rst this should work.
Is there something missing in the documentation?
You can try this ./qemu-system-riscv64 -nographic -machine virt -bios u-boot
-device
virtio-net-device,netdev=net0 -netdev user,id=net0,tftp=tftp
It can work as below:
U-Boot 2020.10-rc1-00299-g89150a9 (Aug 06 2020 - 19:14:01 +0800)
CPU: rv64imafdcsu Model: riscv-virtio,qemu DRAM: 128 MiB In: uart@10000000 Out: uart@10000000 Err: uart@10000000 Net: eth0: virtio-net#0 Hit any key to stop autoboot: 0 => help
But on Debian Bullseye it fails:
$ git reset --hard origin/master $ make mrproper $ make qemu-riscv64_defconfig $ export CROSS_COMPILE $ export CROSS_COMPILE=riscv64-linux-gnu- $ qemu-system-riscv64 -nographic -machine virt \
-bios u-boot \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0,tftp=tftp
Just rebuilt a QEMU 5.0.0 on Ubuntu 16.04 and cannot reproduce. Something is wrong with Debian?
Regards, Bin
I can confirm that with an unpatched QEMU v5.0.0 no problem occurs. Same with QEMU 5.0.93 (v5.1.0-rc3-dirty).
Unpatched QEMU? Do you mean Debian shipped a patched QEMU? If so, what is patched?
See http://deb.debian.org/debian/pool/main/q/qemu/qemu_5.0-13.debian.tar.xz directory debian/patches.
Regards, Bin
participants (3)
-
Bin Meng
-
Heinrich Schuchardt
-
Rick Chen