public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: KVM General <kvm@vger.kernel.org>
Subject: Re: Problem with KVM guest switching to x86 long mode
Date: Thu, 08 Apr 2010 21:36:03 +0300	[thread overview]
Message-ID: <4BBE2213.6020802@redhat.com> (raw)
In-Reply-To: <u2u84144f021004081126sf2f6c8f9s3f228bd455356ab0@mail.gmail.com>

On 04/08/2010 09:26 PM, Pekka Enberg wrote:
> Hi!
>
> I am working on a light-weight KVM userspace launcher for Linux and am
> bit stuck with a guest Linux kernel restarting when it tries to enter
> long mode.
>
> The register dump looks like this:
>
> penberg@tiger:~/vm$ ./kvm bzImage
> KVM exit reason: 8 ("KVM_EXIT_SHUTDOWN")
> Registers:
>   rip: 00000000001000ed   rsp: 00000000005d54b8 flags: 0000000000010046
>   rax: 0000000080000001   rbx: 0000000001f2c000   rcx: 00000000c0000080
>   rdx: 0000000000000000   rsi: 0000000000013670   rdi: 0000000002408000
>   rbp: 0000000000100000   r8:  0000000000000000   r9:  0000000000000000
>   r10: 0000000000000000   r11: 0000000000000000   r12: 0000000000000000
>   r13: 0000000000000000   r14: 0000000000000000   r15: 0000000000000000
>   cr0: 0000000080000011   cr2: 00000000001000ed   cr3: 0000000002402000
>   cr4: 0000000000000020   cr8: 0000000000000000
> Segment registers:
>   register  selector  base              limit     type  p dpl db s l g avl
>   cs        0010      0000000000000000  ffffffff  0b    1 0   1  1 0 1 0
>   ss        0018      0000000000000000  ffffffff  03    1 0   1  1 0 1 0
>   ds        0018      0000000000000000  ffffffff  03    1 0   1  1 0 1 0
>   es        0018      0000000000000000  ffffffff  03    1 0   1  1 0 1 0
>   fs        0018      0000000000000000  ffffffff  03    1 0   1  1 0 1 0
>   gs        0018      0000000000000000  ffffffff  03    1 0   1  1 0 1 0
>   tr        0020      0000000000001000  00000067  0b    1 0   0  0 0 0 0
>   ldt       0000      0000000000000000  ffffffff  00    0 0   0  0 0 0 0
>    

These all look reasonable.  Please add a gdtr dump and an idtr dump.

>    2b:*	cb                   	lret<-- trapping instruction
>    

Post the two u32s at ss:rsp -> ss:rsp+8.  That will tell us where the 
guest is trying to return.  Actually, from the dump:

  1a:    6a 10                    pushq  $0x10
   1c:    8d 85 00 02 00 00        lea    0x200(%rbp),%eax
   22:    50                       push   %rax

it looks like you're returning to segment 0x10, this should be the word 
at ss:rsp+4.  So if you dump the 2 u32s at 
gdtr.base+0x10..gdtr.base+0x18 we'll see if there's anything wrong with 
the segment descriptor.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  reply	other threads:[~2010-04-08 18:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08 18:26 Problem with KVM guest switching to x86 long mode Pekka Enberg
2010-04-08 18:36 ` Avi Kivity [this message]
2010-04-08 18:59   ` Pekka Enberg
2010-04-08 19:30     ` Avi Kivity
2010-04-11  6:30       ` Pekka Enberg
2010-04-11  9:16         ` Avi Kivity
2010-04-11  9:48           ` Pekka Enberg
2010-04-11  9:59             ` Avi Kivity
2010-04-11 10:02               ` Pekka Enberg
2010-04-11 11:48                 ` Avi Kivity
2010-04-11 11:52                   ` Pekka Enberg
2010-04-11 12:02                     ` Avi Kivity
2010-04-11 12:04                       ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BBE2213.6020802@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox