public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* lapic2 branch rebased
@ 2007-07-31 17:44 Avi Kivity
       [not found] ` <46AF74F8.5010009-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2007-07-31 17:44 UTC (permalink / raw)
  To: Dong, Eddie; +Cc: kvm-devel

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.

-- 
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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: lapic2 branch rebased
       [not found] ` <46AF74F8.5010009-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-08-01  6:20   ` Dong, Eddie
       [not found]     ` <10EA09EFD8728347A513008B6B0DA77A01DB6B1F-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Dong, Eddie @ 2007-08-01  6:20 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]

Avi Kivity wrote:
> 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.
    
    Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>




diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index b09595e..cb244f6 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -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);
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index e3db1cd..7f60bf3 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -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)
 {
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 015ab4b..6bf0c21 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -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;
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 9bb8867..667c9cd 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -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;

[-- Attachment #2: lapic3_rebase_fix.patch --]
[-- Type: application/octet-stream, Size: 2124 bytes --]

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.
    
    Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index b09595e..cb244f6 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -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);
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index e3db1cd..7f60bf3 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -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)
 {
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 015ab4b..6bf0c21 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -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;
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 9bb8867..667c9cd 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -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;

[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
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/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: lapic2 branch rebased
       [not found]     ` <10EA09EFD8728347A513008B6B0DA77A01DB6B1F-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-08-01  6:47       ` Avi Kivity
  0 siblings, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2007-08-01  6:47 UTC (permalink / raw)
  To: Dong, Eddie; +Cc: kvm-devel

Dong, Eddie wrote:
> Avi Kivity wrote:
>   
>> 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.
>     
>     Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
>
>   

Thanks, applied.

-- 
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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-01  6:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 17:44 lapic2 branch rebased Avi Kivity
     [not found] ` <46AF74F8.5010009-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-01  6:20   ` Dong, Eddie
     [not found]     ` <10EA09EFD8728347A513008B6B0DA77A01DB6B1F-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-01  6:47       ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox