Skip to contentSkip to conversation

WinDbg runs too slowly or exits unexpectly when debug windows guest driver under QEMU 0.15.50

Qemu-devel Mars.Cao 3 participants 3 messages Oct 19, 2011 – Oct 20, 2011

lore
Share & tools
lore

Mars.Cao

author
#0 lore raw

WinDbg runs too slowly or exits unexpectedly when debug windows guest driver under QEMU 0.15.

I installed 2 windows (WinXP SP3)VMs on my host (RHEL6.1). The basic debug method is :

1.Setup the Windows driver Kit in host

/usr/local/bin/qemu-system-x86_64 -drive file=winxpsp3.img,if=virtio,format=qcow2,cache=none,aio=threads -smp 2 -net tap,ifname=tap0,script=no,downscript=no -net nic,model=virtio,macaddr=52:54:00:d6:be:bb -m 1024 --enable-kvm -serial tcp:127.0.0.1:4445,server,nowait -cdrom WDK.iso

power off.

2.Run the guest and edit the boot.ini of the guest windows

/usr/local/bin/qemu-system-x86_64 -drive file=winxp-guest.img,if=virtio,format=qcow2,cache=none,aio=threads -smp 2 -net tap,ifname=tap1,script=no,downscript=no -net nic,model=virtio,macaddr=52:54:00:d6:be:ee -m 1024 --enable-kvm

edit boot.ini and duplicate the default boot option add the line "/debug /debugport=COM1 /baudrate=115200"

3.Run host and WinDbg

/usr/local/bin/qemu-system-x86_64 -drive file=winxpsp3.img,if=virtio,format=qcow2,cache=none,aio=threads -smp 2 -net tap,ifname=tap0,script=no,downscript=no -net nic,model=virtio,macaddr=52:54:00:d6:be:bb -m 1024 --enable-kvm -serial tcp:127.0.0.1:4445,server,nowait

Run the host VM,and then run WinDbg then "Ctrl+k" kernel debug to connect the guest for debugging through COM1.

4.Run the guest to debug

Restart the guest,select the windows debug option in the boot menu.

/usr/local/bin/qemu-system-x86_64 -drive file=winxp-guest.img,if=virtio,format=qcow2,cache=none,aio=threads -smp 2 -net tap,ifname=tap1,script=no,downscript=no -net nic,model=virtio,macaddr=52:54:00:d6:be:ee -m 1024 --enable-kvm -serial tcp:127.0.0.1:4445

There are several problems when debugging:

1).The Windows VM boot slow (more than 20 seconds)and does not run smoothly.
I use the qemu-kvm (version 0.12.1) which pre-installed in the RedHat RHEL6.1 with same option and same image file, the VM boots and runs much more better than using QEMU-0.15.0.

[root@oc2115466153 images]# /usr/local/bin/qemu-system-x86_64 --version QEMU emulator version 0.15.50, Copyright (c) 2003-2008 Fabrice Bellard

[root@oc2115466153 images]# /usr/libexec/qemu-kvm --version
QEMU PC emulator version 0.12.1 (qemu-kvm-0.12.1.2), Copyright (c) 2003-2008 Fabrice Bellard

2).The process of WinDbg on the host VM connecting to the guest occupy so much time.

It spend at least 10 minutes to connect the guest VM when debugging the windows kernel by WinDbg.

3).When WinDbg connecting to the guest VM(not connected yet),WinDbg exit unexpected sometimes, and sometimes can not connect to the guest. And the probability of the problem is high.

I have no idea what is wrong?
The COM rate is too slow,the QEMU is not used correctly or some bugs in QEMU? Can anyone give me some tips?

#1 lore raw
Quoted 9 lines · Mars.Cao

There are several problems when debugging:

1).The Windows VM boot slow (more than 20 seconds)and does not run smoothly.
I use the qemu-kvm (version 0.12.1) which pre-installed in the RedHat RHEL6.1 with same option and same image file, the VM boots and runs much more better than using QEMU-0.15.0.

RHEL's qemu is actually qemu-kvm, which is significantly faster, especially running Windows. Try running upstream qemu-kvm.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#2 lore raw
In reply to Mars.Cao
Quoted 5 lines · Mars.Cao

/usr/local/bin/qemu-system-x86_64 -drive file=winxpsp3.img,if=virtio,format=qcow2,cache=none,aio=threads -smp 2 -net tap,ifname=tap0,script=no,downscript=no -net nic,model=virtio,macaddr=52:54:00:d6:be:bb -m 1024 --enable-kvm -serial tcp:127.0.0.1:4445,server,nowait -cdrom WDK.iso

--enable-kvm should be -enable-kvm.

Stefan