Skip to contentSkip to conversation

lapic2 branch rebased

DISCUSSION Avi Kivity 2 participants 3 messages Jul 31, 2007 – Aug 1, 2007 2 messages not in the archive KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

I rebased the lapic2 branch onto current master. Because there were many nontrivial changes, the result is in a new branch, lapic3. This is for both kernel and userspace.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

A message that is not in the archive (sent off-list or not yet received): 46AF74F8.5010009-atKUWr5tajBWk0Htik3J/[email protected]

#2 lore raw
Quoted 5 lines · Avi Kivity

I rebased the lapic2 branch onto current master. Because there were many nontrivial changes, the result is in a new branch, lapic3. This is
for both kernel and userspace.

lapic3 clearly crashes after the rebase due to APIC register
access earlier than APIC instance is created, because
vcpu is dynamic created now.

Fix crash by moving APIC creation code into
VMX/SVM creation code.

drivers/kvm/kvm_main.c +0 -0
index b09595e..cb244f6 100644
@@ -2470,11 +2470,6 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm

*kvm, int n)
/* We do fxsave: this must be aligned. */ BUG_ON((unsigned long)&vcpu->host_fx_image & 0xF);

- if (irqchip_in_kernel(vcpu->kvm)) {
- r = kvm_create_lapic(vcpu);
- if (r < 0)
- goto free_vcpu;
- }
vcpu_load(vcpu);
r = kvm_mmu_setup(vcpu);
vcpu_put(vcpu);

drivers/kvm/lapic.c +1 -0
index e3db1cd..7f60bf3 100644
@@ -944,6 +944,7 @@ nomem:
 	kvm_free_apic(apic);
 	return -ENOMEM;
 }
+EXPORT_SYMBOL_GPL(kvm_create_lapic);
 
 int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu)
 {
drivers/kvm/svm.c +0 -0
index 015ab4b..6bf0c21 100644
@@ -587,6 +587,12 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm

*kvm, unsigned int id)
if (err)
goto free_svm;

+ if (irqchip_in_kernel(kvm)) {
+ err = kvm_create_lapic(&svm->vcpu);
+ if (err < 0)
+ goto free_svm;
+ }
+
page = alloc_page(GFP_KERNEL);
if (!page) {
err = -ENOMEM;

drivers/kvm/vmx.c +0 -0
index 9bb8867..667c9cd 100644
@@ -2439,6 +2439,12 @@ static struct kvm_vcpu *vmx_create_vcpu(struct

kvm *kvm, unsigned int id)
if (err)
goto free_vcpu;

+ if (irqchip_in_kernel(kvm)) {
+ err = kvm_create_lapic(&vmx->vcpu);
+ if (err < 0)
+ goto free_vcpu;
+ }
+
vmx->guest_msrs = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!vmx->guest_msrs) {
err = -ENOMEM;

commit 50afbbd224304898d972a8010455ac73d7de7538

Author: root <root@vt32-pae.(none)>
Date:   Wed Aug 1 14:20:34 2007 +0800

lapic3 branch crashed due to APIC register access earlier than APIC instance is created since last rebase of dynamic vcpu creation patch.

Fix crash by moving APIC creation code into
VMX/SVM creation code.

drivers/kvm/kvm_main.c +0 -5
index b09595e..cb244f6 100644
@@ -2470,11 +2470,6 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n)
 	/* We do fxsave: this must be aligned. */
 	BUG_ON((unsigned long)&vcpu->host_fx_image & 0xF);
 
-	if (irqchip_in_kernel(vcpu->kvm)) {
-		r = kvm_create_lapic(vcpu);
-		if (r < 0)
-			goto free_vcpu;
-	}
 	vcpu_load(vcpu);
 	r = kvm_mmu_setup(vcpu);
 	vcpu_put(vcpu);
drivers/kvm/lapic.c +1 -0
index e3db1cd..7f60bf3 100644
@@ -944,6 +944,7 @@ nomem:
 	kvm_free_apic(apic);
 	return -ENOMEM;
 }
+EXPORT_SYMBOL_GPL(kvm_create_lapic);
 
 int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu)
 {
drivers/kvm/svm.c +6 -0
index 015ab4b..6bf0c21 100644
@@ -587,6 +587,12 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
 	if (err)
 		goto free_svm;
 
+	if (irqchip_in_kernel(kvm)) {
+		err = kvm_create_lapic(&svm->vcpu);
+		if (err < 0)
+			goto free_svm;
+	}
+
 	page = alloc_page(GFP_KERNEL);
 	if (!page) {
 		err = -ENOMEM;
drivers/kvm/vmx.c +6 -0
index 9bb8867..667c9cd 100644
@@ -2439,6 +2439,12 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
 	if (err)
 		goto free_vcpu;
 
+	if (irqchip_in_kernel(kvm)) {
+		err = kvm_create_lapic(&vmx->vcpu);
+		if (err < 0)
+			goto free_vcpu;
+	}
+
 	vmx->guest_msrs = kmalloc(PAGE_SIZE, GFP_KERNEL);
 	if (!vmx->guest_msrs) {
 		err = -ENOMEM;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): 10EA09EFD8728347A513008B6B0DA77A01DB6B1F-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org

author Applied
#4 lore raw
Quoted 9 lines · Eddie
Quoted 6 lines · Avi Kivity

I rebased the lapic2 branch onto current master. Because there were many nontrivial changes, the result is in a new branch, lapic3. This is
for both kernel and userspace.

Quoted 11 lines

lapic3 clearly crashes after the rebase due to APIC register
access earlier than APIC instance is created, because
vcpu is dynamic created now.

Fix crash by moving APIC creation code into
VMX/SVM creation code.

Thanks, applied.

Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/