From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPCKX-0007K5-6w for qemu-devel@nongnu.org; Thu, 26 Sep 2013 10:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPCKV-0008AA-J4 for qemu-devel@nongnu.org; Thu, 26 Sep 2013 10:14:09 -0400 Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]:36048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPCKV-0008A5-59 for qemu-devel@nongnu.org; Thu, 26 Sep 2013 10:14:07 -0400 Received: by mail-lb0-f175.google.com with SMTP id y6so1112839lbh.20 for ; Thu, 26 Sep 2013 07:14:06 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <5243CF52.6020400@web.de> References: <5243CF52.6020400@web.de> Date: Thu, 26 Sep 2013 10:14:06 -0400 Message-ID: From: Hu Yaohui Content-Type: multipart/alternative; boundary=089e0160bb9a91eac304e749fb4a Subject: Re: [Qemu-devel] Fwd: Guest VM debug (Int 3 panic) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: qemu-devel@nongnu.org --089e0160bb9a91eac304e749fb4a Content-Type: text/plain; charset=ISO-8859-1 Hi Jan, Thanks for your reply. On Thu, Sep 26, 2013 at 2:08 AM, Jan Kiszka wrote: > On 2013-09-25 20:08, Hu Yaohui wrote: > > Hi All, > > I am trying to debug guest OS through qemu with kvm enabled. > > Following is what I have done: > > 1: fire the qemu-kvm > > > > sudo qemu-system-x86_64 -hda vdisk.img -m 4096 -smp 2 -vnc :2 -boot c -s > > > > > > 2: wait until login into guest OS (ubuntu 10.04) > > > > 3: fire gdb > > > > gdb vmlinux > > target remote :1234 > > b do_fork > > set arch i386:x86-64 > > "set arch" is unneeded. vmlinux already tells gdb that you are debugging > x86-64. > > > c > > > > > > 4: after I typed "ls" in guest OS. The guest OS paniced with some message > > related to "int 3 blah blah". Then crashed. > > > > Someone said we should use hardware breakpoint when kvm is enabled, or > > You can use hardware breakpoints as well but it is not required unless > the target code can be overwritten (e.g. due to a reset). > > > "monitor system_reset" after set the breakpoint, but it didn't work for > me. > > The hardware breakpoint could not been hit anyway. > > > > I have tried with "-no-kvm", it works normally with breakpoints. But I > want > > to debug the guest OS with kvm enabled. I don't know whether someone has > > met this similar situation. > > You didn't tell us which version of QEMU (or is it old qemu-kvm?) you > are using, what host kernel and which CPU type (AMD vs. Intel). Did you > try a recent version of all of them already? I'm currently not aware of > gdb problems with QEMU/KVM, I'm rather using it on an almost daily basis > (typically git head versions). > I am using a nested VM. My CPU type is intel. On L0, the QEMU-KVM version is 1.0, host kernel version: 2.6.32.10, kvm-kmod version: 3.2 On L1, the QEMU-KVM version is 1.2, kernel version: 3.2.2, kvm-kmod version: 3.2 On L2, guest kernel version: 2.6.32.10 I am trying to debug L2 guest kernel on L1 QEMU. It gives me "INT 3" related kernel oops. I also have tried to debug the L1 guest kernel through L0 QEMU which works fine. > > If you want to debug your issue: there is ftrace to record what KVM > events happen, and you can switch gdb into verbose mode as well, > comparing the communication between KVM on/off: set debug remote 1. > > Thanks for your suggestion! I will give that a try. > Jan > > > --089e0160bb9a91eac304e749fb4a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Jan,
Thanks for your reply.
On Thu,= Sep 26, 2013 at 2:08 AM, Jan Kiszka <jan.kiszka@web.de> wro= te:
On 2013-09-25 20:08, Hu Yaohui wrote:
> Hi All,
> I am trying to debug guest OS through qemu with kvm enabled.
> Following is what I have done:
> 1: fire the qemu-kvm
> <snip>
> sudo qemu-system-x86_64 -hda vdisk.img -m 4096 -smp 2 -vnc :2 -boot c = -s
> </snip>
>
> 2: wait until login into guest OS (ubuntu 10.04)
>
> 3: fire gdb
> <snip>
> gdb vmlinux
> target remote :1234
> b do_fork
> set arch i386:x86-64

"set arch" is unneeded. vmlinux already tells gdb that you = are debugging
x86-64.

> c
> </snip>
>
> 4: after I typed "ls" in guest OS. The guest OS paniced with= some message
> related to "int 3 blah blah". Then crashed.
>
> Someone said we should use hardware breakpoint when kvm is enabled, or=

You can use hardware breakpoints as well but it is not required unles= s
the target code can be overwritten (e.g. due to a reset).

> "monitor system_reset" after set the breakpoint, but it didn= 't work for me.
> The hardware breakpoint could not been hit anyway.
>
> I have tried with "-no-kvm", it works normally with breakpoi= nts. But I want
> to debug the guest OS with kvm enabled. I don't know whether someo= ne has
> met this similar situation.

You didn't tell us which version of QEMU (or is it old qemu-kvm?)= you
are using, what host kernel and which CPU type (AMD vs. Intel). Did you
try a recent version of all of them already? I'm currently not aware of=
gdb problems with QEMU/KVM, I'm rather using it on an almost daily basi= s
(typically git head versions).
I am using a nested VM.= My CPU type is intel.
On L0, the QEMU-KVM version is 1.0, = host kernel version: 2.6.32.10, kvm-kmod version: 3.2
On L1, the QEMU-KVM version is 1.2, kernel version: 3.2.2, kvm-kmod version= : 3.2
On L2, guest kernel version: 2.6.32.10
I am trying to debug L2 guest kernel on L1 QEMU. It gives me "INT 3&= quot; related kernel oops.=A0
I also have tried to debug the L1 guest kernel through L0 QEMU w= hich works fine.=A0

If you want to debug your issue: there is ftrace to record what KVM
events happen, and you can switch gdb into verbose mode as well,
comparing the communication between KVM on/off: set debug remote 1.

Tha= nks for your suggestion! I will give that a try.=A0
Jan



--089e0160bb9a91eac304e749fb4a--