qemu源码调试出现锁错误
Posted li_Jiejun
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了qemu源码调试出现锁错误相关的知识,希望对你有一定的参考价值。
调试命令行
# gdb -tui --args /mnt/qemu-debug/bin/qemu-system-x86_64 -cpu host -smp 4,sockets=1,cores=4 -m 4096 -drive file=/mnt/win10.qcow2,format=qcow2 --enable-kvm -spice port=5900,ipv4,disable-ticketing,image-compression=auto_glz,jpeg-wan-compression=always,playback-compression=off,zlib-glz-wan-compression=always,streaming-video=filter,agent-mouse=on -device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x5 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 -device qxl-vga,id=video0,ram_size=67108864,vram_size=8388608,vram64_size_mb=0,vgamem_mb=16,bus=pci.0,addr=0x7 -chardev spicevmc,id=charchannel2,name=vdagent -drive file=/mnt/cn_windows_10_enterprise_ltsc_2019_x64_dvd_9c09ff24.iso,format=raw,if=none,id=drive-ide0-0-1,readonly=on -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,bootindex=1 -device virtserialport,bus=virtio-serial0.0,nr=3,chardev=charchannel2,id=channel2,name=com.redhat.spice.0 -vnc :0
问题:
multi-thre Thread 0x7ffff18587 In: __lll_lock_wait L52 PC: 0x7ffff66f1110
[New Thread 0x7ffff3b5b700 (LWP 318514)]
[New Thread 0x7ffff1858700 (LWP 318517)]
[New Thread 0x7ffff1057700 (LWP 318518)]
[New Thread 0x7ffff0853700 (LWP 318519)]
[New Thread 0x7fffdbfff700 (LWP 318520)]
[New Thread 0x7fffda5ff700 (LWP 318522)]
--Type <RET> for more, q to quit, c to continue without paging--r
Thread 4 "qemu-system-x86" received signal SIGUSR1, User defined signal 1.
[Switching to Thread 0x7ffff1858700 (LWP 318517)]
__lll_lock_wait (futex=futex@entry=0x55555665e0e0 <qemu_global_mutex>, private=0) at lowlevellock.c:52
lowlevellock.c: No such file or directory.
(gdb)
(gdb) bt
#0 __lll_lock_wait (futex=futex@entry=0x55555665e0e0 <qemu_global_mutex>, private=0) at lowlevellock.c:52
#1 0x00007ffff66eb07b in __pthread_mutex_cond_lock (mutex=mutex@entry=0x55555665e0e0 <qemu_global_mutex>)
at ../nptl/pthread_mutex_lock.c:80
#2 0x00007ffff66ed260 in __pthread_cond_wait_common
(abstime=0x0, clockid=0, mutex=0x55555665e0e0 <qemu_global_mutex>, cond=0x55555687bab0) at pthread_cond_wait.c:627
#3 __pthread_cond_wait (cond=0x55555687bab0, mutex=0x55555665e0e0 <qemu_global_mutex>) at pthread_cond_wait.c:638
#4 0x0000555555e53dbc in qemu_cond_wait_impl
(cond=0x55555687bab0, mutex=0x55555665e0e0 <qemu_global_mutex>, file=0x555555f67e30 "/mnt/qemu/cpus.c", line=1275)
at util/qemu-thread-posix.c:173
#5 0x00005555558826f9 in qemu_wait_io_event (cpu=0x5555568539b0) at /mnt/qemu/cpus.c:1275
#6 0x000055555588284c in qemu_kvm_cpu_thread_fn (arg=0x5555568539b0) at /mnt/qemu/cpus.c:1323
#7 0x0000555555e545d2 in qemu_thread_start (args=0x55555687baf0) at util/qemu-thread-posix.c:519
#8 0x00007ffff66e6609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#9 0x00007ffff660b293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
解决方案:
(gdb) c
根据信息__lll_lock_wait可知此时一直在等待锁,可以在gdb页面一直按 c 执行。
以上是关于qemu源码调试出现锁错误的主要内容,如果未能解决你的问题,请参考以下文章
qemu+gdb调试内核出现remote ‘g’ packet reply is too long