Skip to contentSkip to conversation

Can not boot up guest on latest kvm commit a605af...

kvm-Bugs-2260759 Applied SourceForge.net 5 participants 7 messages Nov 11, 2008 – Nov 12, 2008 KVM

lore
Share & tools
lore

SourceForge.net

author bot
#0 lore raw

Bugs item #2260759, was opened at 2008-11-10 23:14
Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=2260759&group_id=180599

Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jiajun Xu (jiajun)
Assigned to: Nobody/Anonymous (nobody)
Summary: Can not boot up guest on latest kvm commit a605af...

Initial Comment:
Against latest kvm commit
, kvm.git a605af55f79a1b28dc2ae574cb42a89c2949e439, userspace.git a3442e8165f4d639ca4d542b039697a8abae026f, guest can not boot up, qemu window will pop-up but only show a black screen.

dmesg shows that:
Pid: 11287, comm: qemu-system-x86 Not tainted 2.6.26.2 #1

RIP: 0010:[<ffffffffa050a8fd>]  [<ffffffffa050a8fd>]
:kvm:kvm_vm_ioctl+0xc7/0x517
RSP: 0018:ffff81009f025df8  EFLAGS: 00010207
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff8100cf968040
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff810206c54480
RBP: ffff81009f074000 R08: 0000000000000008 R09: ffff810001101980
R10: 0000000000000002 R11: 00000000ffffffea R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000007 R15: 0000000000001000
FS:  00000000408a1940(0063) GS:ffff81022f0cd540(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000020 CR3: 000000014129b000 CR4: 00000000000026e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process qemu-system-x86 (pid: 11287, threadinfo ffff81009f024000, task
ffff81009f00f100)
Stack:  ffff81009f00f100 0000000000000000 001280d2010a9760 0000000300000010
 ffffe20001ae7078 0000000000000000 ffff8100010a9760 ffff81022a4d6ff8
 00000000408a0fe8 ffff81014137d008 ffff81009f11b500 0000000000000000
Call Trace:
 [<ffffffff8027278e>] ? handle_mm_fault+0x2e8/0x708
 [<ffffffff80296c89>] ? vfs_ioctl+0x21/0x6b
 [<ffffffff80296f1b>] ? do_vfs_ioctl+0x248/0x261
 [<ffffffff80296f85>] ? sys_ioctl+0x51/0x70
 [<ffffffff8020bef2>] ? tracesys+0xd5/0xda


Code: 41 89 cd 41 bc ea ff ff ff 0f 87 54 04 00 00 89 ce 48 89 ef e8 35 12 00

00 48 3d 00 f0 ff ff 48 89 c3 41 89 c4 0f 87 38 04 00 00 <48> c7 40 20 00 c8 52 a0 48 89 c7 e8 20 15 00 00 85 c0 41 89 c4
RIP [<ffffffffa050a8fd>] :kvm:kvm_vm_ioctl+0xc7/0x517
RSP <ffff81009f025df8>
CR2: 0000000000000020

---[ end trace 85ba6bd8af7e61d0 ]---

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=893831&aid=2260759&group_id=180599

#1 lore raw

PATCH 1/1 KVM: Fix kernel allocated memory slot

Commit 7fd49de9773fdcb7b75e823b21c1c5dc1e218c14 "KVM: ensure that memslot userspace addresses are page-aligned" broke kernel space allocated memory slot, for the userspace_addr is invalid.

---
 virt/kvm/kvm_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
virt/kvm/kvm_main.c +1 -1
index 0a0a959..4727c08 100644
@@ -715,7 +715,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		goto out;
 	if (mem->guest_phys_addr & (PAGE_SIZE - 1))
 		goto out;
-	if (mem->userspace_addr & (PAGE_SIZE - 1))
+	if (user_alloc && (mem->userspace_addr & (PAGE_SIZE - 1)))
 		goto out;
 	if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
 		goto out;
Signature · 1 line
1.5.4.5
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH 1/1] KVM: Fix kernel allocated memory slot

Quoted 14 lines · Sheng Yang

Commit 7fd49de9773fdcb7b75e823b21c1c5dc1e218c14 "KVM: ensure that memslot userspace addresses are page-aligned" broke kernel space allocated memory slot, for the userspace_addr is invalid.

---
 virt/kvm/kvm_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
virt/kvm/kvm_main.c +0 -0
index 0a0a959..4727c08 100644

virt/kvm/kvm_main.c int __kvm_set_memory_region(struct kvm *kvm, · line 721

Quoted 8 lines
virt/kvm/kvm_main.c +1 -1
@@ -715,7 +715,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		goto out;
 	if (mem->guest_phys_addr & (PAGE_SIZE - 1))
 		goto out;
-	if (mem->userspace_addr & (PAGE_SIZE - 1))
+	if (user_alloc && (mem->userspace_addr & (PAGE_SIZE - 1)))
 		goto out;
 	if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
 		goto out;

Wow, I didn't realize we still had kernel-allocated guest memory. Why is that?

Anyways, the above patch seems fine to me.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#3 lore raw

Re: [PATCH 1/1] KVM: Fix kernel allocated memory slot

Quoted 27 lines · On Tuesday 11 November 2008 22:58:25 Hollis Blanchard wrote:
Quoted 14 lines · Sheng Yang

Commit 7fd49de9773fdcb7b75e823b21c1c5dc1e218c14 "KVM: ensure that memslot userspace addresses are page-aligned" broke kernel space allocated memory slot, for the userspace_addr is invalid.

---
 virt/kvm/kvm_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
virt/kvm/kvm_main.c +0 -0
index 0a0a959..4727c08 100644

virt/kvm/kvm_main.c int __kvm_set_memory_region(struct kvm *kvm, · line 721

Quoted 8 lines
virt/kvm/kvm_main.c +1 -1
@@ -715,7 +715,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		goto out;
 	if (mem->guest_phys_addr & (PAGE_SIZE - 1))
 		goto out;
-	if (mem->userspace_addr & (PAGE_SIZE - 1))
+	if (user_alloc && (mem->userspace_addr & (PAGE_SIZE - 1)))
 		goto out;
 	if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
 		goto out;

Wow, I didn't realize we still had kernel-allocated guest memory. Why is that?

Quoted 2 lines

Anyways, the above patch seems fine to me.

it's for VMX EPT and APIC access page, as well as TSS pages. We are planning to change that in the future, but I think it's a quick fix for now.

Thanks.

Signature · 2 lines
regards
Yang, Sheng
#4 lore raw

Re: [PATCH 1/1] KVM: Fix kernel allocated memory slot

Quoted 30 lines · Sheng Yang
Quoted 28 lines · On Tuesday 11 November 2008 22:58:25 Hollis Blanchard wrote:
Quoted 15 lines · Sheng Yang

Commit 7fd49de9773fdcb7b75e823b21c1c5dc1e218c14 "KVM: ensure that memslot userspace addresses are page-aligned" broke kernel space allocated memory slot, for the userspace_addr is invalid.

---
 virt/kvm/kvm_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
virt/kvm/kvm_main.c +0 -0
index 0a0a959..4727c08 100644

virt/kvm/kvm_main.c int __kvm_set_memory_region(struct kvm *kvm, · line 721

Quoted 8 lines
virt/kvm/kvm_main.c +1 -1
@@ -715,7 +715,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		goto out;
 	if (mem->guest_phys_addr & (PAGE_SIZE - 1))
 		goto out;
-	if (mem->userspace_addr & (PAGE_SIZE - 1))
+	if (user_alloc && (mem->userspace_addr & (PAGE_SIZE - 1)))
 		goto out;
 	if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
 		goto out;

Wow, I didn't realize we still had kernel-allocated guest memory. Why is that?

Quoted 6 lines
Quoted 3 lines

Anyways, the above patch seems fine to me.

it's for VMX EPT and APIC access page, as well as TSS pages. We are planning to change that in the future, but I think it's a quick fix for now.

It's also there to support older userspaces that still rely on the kernel allocating guest memory. This is only applicable to x86 though.

Regards,

Anthony Liguori

Quoted 3 lines

Thanks.

#5 lore raw

Re: [PATCH 1/1] KVM: Fix kernel allocated memory slot

In reply to Hollis Blanchard
Quoted 3 lines · Hollis Blanchard

Wow, I didn't realize we still had kernel-allocated guest memory. Why is that?

As mentioned, both for compat with the original 2.6.22 interface and for guest memory needed by kvm itself. But note that this kernel-allocated memory is equivalent to user memory - it is mmap()ed in and thus pageable.

Signature · 1 line
error compiling committee.c: too many arguments to function
Applied
#6 lore raw

Re: [PATCH 1/1] KVM: Fix kernel allocated memory slot

In reply to Sheng Yang
Quoted 5 lines · Sheng Yang

Commit 7fd49de9773fdcb7b75e823b21c1c5dc1e218c14 "KVM: ensure that memslot userspace addresses are page-aligned" broke kernel space allocated memory slot, for the userspace_addr is invalid.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function