Problem with KVM guest switching to x86 long mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
 [ efer: 0000000000000500  apic base: 0000000000000000  nmi: disabled ]
Interrupt bitmap:
 0000000000000000 0000000000000000 0000000000000000 0000000000000000
Code: 08 49 75 f3 8d 83 00 60 4d 00 0f 22 d8 b9 80 00 00 c0 0f 32 0f
ba e8 08 0f 30 6a 10 8d 85 00 02 00 00 50 b8 01 00 00 80 0f 22 c0 <cb>
f4 eb fd 9c 6a 00 9d 9c 58 89 c3 35 00 00 20 00 50 9d 9c 58

Using Linux 'scripts/decodecode', we can see that we are at
startup_32() of arch/x86/boot/compressed/head_64.S:

All code
========
   0:	08 49 75             	or     %cl,0x75(%rcx)
   3:	f3 8d 83 00 60 4d 00 	repz lea 0x4d6000(%rbx),%eax
   a:	0f 22 d8             	mov    %rax,%cr3
   d:	b9 80 00 00 c0       	mov    $0xc0000080,%ecx
  12:	0f 32                	rdmsr
  14:	0f ba e8 08          	bts    $0x8,%eax
  18:	0f 30                	wrmsr
  1a:	6a 10                	pushq  $0x10
  1c:	8d 85 00 02 00 00    	lea    0x200(%rbp),%eax
  22:	50                   	push   %rax
  23:	b8 01 00 00 80       	mov    $0x80000001,%eax
  28:	0f 22 c0             	mov    %rax,%cr0
  2b:*	cb                   	lret        <-- trapping instruction
  2c:	f4                   	hlt
  2d:	eb fd                	jmp    0x2c
  2f:	9c                   	pushfq
  30:	6a 00                	pushq  $0x0
  32:	9d                   	popfq
  33:	9c                   	pushfq
  34:	58                   	pop    %rax
  35:	89 c3                	mov    %eax,%ebx
  37:	35 00 00 20 00       	xor    $0x200000,%eax
  3c:	50                   	push   %rax
  3d:	9d                   	popfq
  3e:	9c                   	pushfq
  3f:	58                   	pop    %rax

I already asked Avi in private about this and he suggested I'd post a
register dump to the list. Please note that I am in no way ruling out
a bug in our fakebios "emulation" but my gut feeling is that I'm just
missing something obvious in the KVM setup.

For those that might be interested, source code to the launcher is
available here:

  git clone git://github.com/penberg/vm.git

Launching a Linux kernel is as simple as:

  make ; ./kvm bzImage

                        Pekka
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux