Arm emulation do a crash

Bug #1011142 reported by BRULE Herman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Invalid
Undecided
Unassigned

Bug Description

Hello, I have try multiple image for the raspberry pi, with this cli:
/usr/bin/qemu-system-arm -kernel kernel-rasptoo -M versatilepb -cpu arm1176 -hda hdd.img -m 256 -append "root=/dev/sda2 loglevel=7 debug" -serial stdio -no-kvm
I don't know why, with kvm it say:
KVM not supported for this target
No accelerator found!

I can't debug it with gdb, it crash after the kernel boot (the qemu application crash).
I'm under gentoo:
[ebuild R ~] app-emulation/qemu-kvm-1.0.1-r1 USE="aio alsa curl ncurses opengl sdl threads vhost-net -bluetooth -brltty -debug -fdt -pulseaudio -qemu-ifup (-rbd) -sasl -smartcard -spice -static -test -tls -usbredir -vde -xattr -xen" QEMU_SOFTMMU_TARGETS="arm x86_64 -cris -i386 -m68k -microblaze -mips -mips64 -mips64el -mipsel -ppc -ppc64 -ppcemb -sh4 -sh4eb -sparc -sparc64" QEMU_USER_TARGETS="arm -alpha -armeb -cris -i386 -m68k -microblaze -mips -mipsel -ppc -ppc64 -ppc64abi32 -sh4 -sh4eb -sparc -sparc32plus -sparc64 -x86_64" 0 kB

Thanks to help me.

Revision history for this message
Dunrong Huang (dunrong) wrote : Re: [Qemu-devel] [Bug 1011142] [NEW] Arm emulation do a crash

2012/6/10 BRULE Herman <email address hidden>:
> I can't debug it with gdb, it crash after the kernel boot (the qemu application crash).
> I'm under gentoo:
I am under gentoo too, why cant you use debug qemu?

There is another way to debug qemu:

Open a terminal, set you core file size to unlimited with command:
"ulimit -c unlimited",
then launch qemu in same a terminal

After qemu crash, a file called core will be created, use command
"gdb /usr/bin/qemu-system-x86_64 core" to enter gdb console, then
input "bt" command in gdb console, you will get a backtrace of the entire stack.

Send the these message to mailing list, those backtrace message will
help qemu developer localize the source of the problem.

--
linuxer and emacser and pythoner living in beijing
blog: http://mathslinux.org
twitter: https://twitter.com/mathslinux
google+: https://plus.google.com/118129852578326338750

Revision history for this message
BRULE Herman (brule-herman) wrote :

Because it stop on:
Program received signal SIG38, Real-time event 38.
[Switching to Thread 0x7ffff1125700 (LWP 32348)]
tcg_qemu_tb_exec (cpustate=<optimized out>, tb_ptr=0x400016b3 "\025\b") at /var/tmp-disk/portage/app-emulation/qemu-kvm-1.0.1-r1/work/qemu-kvm-1.0.1/tci.c:442
442 /var/tmp-disk/portage/app-emulation/qemu-kvm-1.0.1-r1/work/qemu-kvm-1.0.1/tci.c: No such file or directory.
(gdb)

Same with the ulimit:
/usr/bin/qemu-system-arm -kernel zImage -M versatilepb -cpu arm1176 -hda debian6-19-04-2012.img -m 256 -append "root=/dev/sda2 loglevel=7 debug" -serial stdio -no-kvm
Uncompressing Linux... done, booting the kernel.
Segmentation fault (core dumped)

gdb /usr/bin/qemu-system-x86_64 core
(gdb) bt
#0 0x00007f6ced5d1894 in ?? ()
#1 0x0000010300000dd7 in ?? ()
#2 0xb8bf47b874ea5100 in ?? ()
#3 0x0000000000000000 in ?? ()

For whole my system:
CFLAGS="-pipe -O2 -g"
The bt for other program crash work.

Revision history for this message
Stefan Weil (ubuntu-weilnetz) wrote :

Obviously you compiled QEMU using the experimental TCI (TCG interpreter).
That's not wrong (for debugging some kinds of crashes it is even useful),
but it's slow.

You also called gdb with qemu-system-x86_64, but the core was from qemu-system-arm.

Which kernel did you use? zImage or kernel-rasptoo? Where did you get it from?
If it is a kernel for an original Raspberry PI, it won't work with QEMU.
QEMU only works with kernels for some other ARM systems.

Revision history for this message
BRULE Herman (brule-herman) wrote :

Then the correct gdb command provide:
#0 tcg_qemu_tb_exec (cpustate=<optimized out>, tb_ptr=0x0) at /var/tmp-disk/portage/app-emulation/qemu-kvm-1.0.1-r1/work/qemu-kvm-1.0.1/tci.c:444
#1 0x00007f6ced51393d in cpu_arm_exec (env=0x7f6cee66c3d0) at /var/tmp-disk/portage/app-emulation/qemu-kvm-1.0.1-r1/work/qemu-kvm-1.0.1/cpu-exec.c:566
#2 0x00007f6ced51515b in tcg_cpu_exec (env=0x7f6cee66c3d0) at /var/tmp-disk/portage/app-emulation/qemu-kvm-1.0.1-r1/work/qemu-kvm-1.0.1/cpus.c:1007
#3 tcg_exec_all () at /var/tmp-disk/portage/app-emulation/qemu-kvm-1.0.1-r1/work/qemu-kvm-1.0.1/cpus.c:1039
#4 qemu_tcg_cpu_thread_fn (arg=<optimized out>) at /var/tmp-disk/portage/app-emulation/qemu-kvm-1.0.1-r1/work/qemu-kvm-1.0.1/cpus.c:774
#5 0x00007f6cebd36d0c in start_thread (arg=0x7f6ce64b0700) at pthread_create.c:301
#6 0x00007f6ceb09fbed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

I have try multiple, kernel/OS, mainly provided by official website of paspberry pi. Provided here:
http://www.raspberrypi.org/downloads
But I have try too official gentoo kernel for arm, custom build from a website... In all case, the rest of world can run it (lot of do that's to test the OS before setup it into raspberry pi), and in my case, no.
The kernel seam work, and found/mount/boot the root partition.
Can you fix qemu to emulate correctly the raspberry pi platform, because it's very popular hardware.

I can test some patch or other if you want. If it's just question of kernel, I will change it.

Revision history for this message
Stefan Weil (ubuntu-weilnetz) wrote :

The missing emulation of Raspberry PI hardware is not a QEMU bug.

Anybody is free to add this emulation or to support others to do the job.
It won't be easy because the RPi hardware is only partially documented,
and the RPi system uses closed source drivers for video.

If nobody objects, I suggest setting the status of this report to 'invalid'.

Revision history for this message
BRULE Herman (brule-herman) wrote :

Just basic support, that's mean: no crash, and minimal system in console boot (all device emulated by QEMU is already supported). For me the crash, and mainly this cpu seam be supported by QEMU, just have the instruction bugged.

Revision history for this message
BRULE Herman (brule-herman) wrote :

I have found the bug, gentoo "qemu-kvm" is not "qemu" package, and with qemu packages all work. Now I don't know where repport the bug...

Revision history for this message
Peter Maydell (pmaydell) wrote : Re: [Qemu-devel] [Bug 1011142] Re: Arm emulation do a crash

On 10 June 2012 18:52, BRULE Herman <email address hidden> wrote:
> Because it stop on:
> Program received signal SIG38, Real-time event 38.
> [Switching to Thread 0x7ffff1125700 (LWP 32348)]
> tcg_qemu_tb_exec (cpustate=<optimized out>, tb_ptr=0x400016b3 "\025\b") at /var/tmp-disk/portage/app-emulation/qemu-kvm-1.0.1-r1/work/qemu-kvm-1.0.1/tci.c:442
> 442     /var/tmp-disk/portage/app-emulation/qemu-kvm-1.0.1-r1/work/qemu-kvm-1.0.1/tci.c: No such file or directory.
> (gdb)

This is normal and expected -- SIG38 is used by QEMU internally.
Type "handle SIG38 pass noprint nostop" to gdb and then "continue"
(this tells gdb not to bother telling you about SIG38).

-- PMM

Revision history for this message
BRULE Herman (brule-herman) wrote :

Hello, I have succefull run debian raspberry pi under qemu.
Then I try do like under my x86, mount -t proc none proc,..., chroot /mnt/gentoo /bin/bash, ... -> illegal instruction.
Then I try with boot directly from the gentoo's part -> lot of illegal instruction, I have used like say on the web: stage3-armv6j_hardfp-20120603.tar.bz2
What's appends? Qemu not emulate hardfp? Or something like that's?

Revision history for this message
Peter Maydell (pmaydell) wrote :

This appears to be user confusion.

Changed in qemu:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.