Torlus wrote:Oh, I wasn't sure if it was Linux or QEMU that locked, but it seems that it's QEMU... There are many references about similar issues on the net, but indeed the real reason isn't very clear.
If you can provide a trace, that would surely help.
Meanwhile, I will check my code... If by chance QEMU is still running fine but the kernel hangs, it might be an issue with the system timer or some faulty interrupt generation/processing.
I'm trying to use your qemu-rpi patches with the qemu tree you posted above. I'm doing this on MacOS 10.8.2, and I'm running in to a similar hang: white screen and no activity. This happens very early in the process, before I get any kernel messages. I'm using:
Code: Select all
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 512 -M raspi -serial stdio -append "rw dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1024 bcm2708_fb.fbheight=768 bcm2708.boardrev=0xf bcm2708.serial=0xcad0eedf smsc95xx.macaddr=B8:27:EB:D0:EE:DF sdhci-bcm2708.emmc_clock_freq=100000000 vc_mem.mem_base=0x1c000000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait" -snapshot -sd 2012-12-16-wheezy-raspbian.img -d guest_errors
I configured qemu with:
Code: Select all
./configure --disable-sdl --disable-kvm --enable-cocoa --cc=gcc-4.2 --host-cc=gcc-4.2 --enable-debug --extra-cflags=-g --extra-ldflags=-g
I see a similar hang when using vanilla arm qemu without your patches, (see
this post for more details), so I'd guess its not related to your code specifically. I'm wondering if you have any hints on debugging this.
Here's some debugger output:
Code: Select all
Program received signal SIGUSR1, User defined signal 1.
[Switching to process 44920 thread 0x604f]
0x00007fff9a5a9330 in strcmp ()
(gdb) bt
#0 0x00007fff9a5a9330 in strcmp ()
#1 0x0000000100fbdcb4 in g_str_equal ()
#2 0x0000000100fbe13f in g_hash_table_lookup ()
#3 0x00000001001b7503 in type_table_lookup (name=0x1003b940c "arm-cpu") at qom/object.c:86
#4 0x00000001001b77e7 in type_get_by_name (name=0x1003b940c "arm-cpu") at qom/object.c:144
#5 0x00000001001b8694 in object_class_dynamic_cast (class=0x102118f70, typename=0x1003b940c "arm-cpu") at qom/object.c:452
#6 0x00000001001b85b7 in object_dynamic_cast (obj=0x102992800, typename=0x1003b940c "arm-cpu") at qom/object.c:427
#7 0x00000001001b8616 in object_dynamic_cast_assert (obj=0x102992800, typename=0x1003b940c "arm-cpu") at qom/object.c:438
#8 0x000000010021247a in arm_env_get_cpu (env=0x102992860) at cpu-qom.h:105
#9 0x0000000100214067 in qemu_tcg_cpu_thread_fn (arg=0x102992800) at /usr/local/src/raspberry/qemu-rpi/cpus.c:836
#10 0x00007fff9a5bb742 in _pthread_start ()
#11 0x00007fff9a5a8181 in thread_start ()
(gdb) c
Continuing.
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x000000010147bc90
[Switching to process 44920 thread 0xf0b]
0x000000010147bc90 in ?? ()
(gdb) bt
#0 0x000000010147bc90 in ?? ()
#1 0x000000010016e209 in qemu_iohandler_poll (readfds=0x10097ca00, writefds=0x10097ca80, xfds=0x10097cb00, ret=3) at iohandler.c:124
#2 0x0000000100172acf in main_loop_wait (nonblocking=0) at main-loop.c:418
#3 0x0000000100207bbf in main_loop () at vl.c:1765
#4 0x000000010020e7b0 in qemu_main (argc=18, argv=0x7fff5fbff210, envp=0x7fff5fbff2a8) at vl.c:3992
#5 0x00000001001d5a79 in -[QemuCocoaAppController startEmulationWithArgc:argv:] (self=0x102308fb0, _cmd=0x1003ca438, argc=18, argv=0x7fff5fbff210) at ui/cocoa.m:798
#6 0x00000001001d5991 in -[QemuCocoaAppController applicationDidFinishLaunching:] (self=0x102308fb0, _cmd=0x7fff91517f79, note=0x10145fd50) at ui/cocoa.m:776
#7 0x00007fff950ca47a in _CFXNotificationPost ()
#8 0x00007fff8f376846 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#9 0x00007fff8f7ee60d in -[NSApplication _postDidFinishNotification] ()
#10 0x00007fff8f7ee346 in -[NSApplication _sendFinishLaunchingNotification] ()
#11 0x00007fff8f7eb532 in -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] ()
#12 0x00007fff8f7eb12c in -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] ()
#13 0x00007fff8f39012b in -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] ()
#14 0x00007fff8f38ff8d in _NSAppleEventManagerGenericHandler ()
#15 0x00007fff8dc89b48 in aeDispatchAppleEvent ()
#16 0x00007fff8dc899a9 in dispatchEventAndSendReply ()
#17 0x00007fff8dc89869 in aeProcessAppleEvent ()
#18 0x00007fff8e5a98e9 in AEProcessAppleEvent ()
#19 0x00007fff8f7e7916 in _DPSNextEvent ()
#20 0x00007fff8f7e6ed2 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#21 0x00007fff8f7de283 in -[NSApplication run] ()
#22 0x00000001001d6966 in main (argc=18, argv=0x7fff5fbff210) at ui/cocoa.m:946
(gdb) p ioh
$4 = (IOHandlerRecord *) 0x10147bb60
(gdb) p *ioh
$5 = {
fd_read_poll = 0,
fd_read = 0x10017212b <sigfd_handler>,
fd_write = 0,
opaque = 0x5,
next = {
le_next = 0x0,
le_prev = 0x102118b40
},
fd = 5,
deleted = false
}
(gdb) p io_handlers
$1 = {
lh_first = 0x102118b20
}
(gdb) p *io_handlers.lh_first
$2 = {
fd_read_poll = 0x10019eeec <fd_chr_read_poll>,
fd_read = 0x10019ef4c <fd_chr_read>,
fd_write = 0,
opaque = 0x102118a40,
next = {
le_next = 0x10147bb60,
le_prev = 0x10097c9c8
},
fd = 0,
deleted = false
}
(gdb) p *io_handlers.lh_first->next.le_next
$3 = {
fd_read_poll = 0,
fd_read = 0x10017212b <sigfd_handler>,
fd_write = 0,
opaque = 0x5,
next = {
le_next = 0x0,
le_prev = 0x102118b40
},
fd = 5,
deleted = false
}