aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-10-18 12:38:52 +0200
committerAvi Kivity <avi@qumranet.com>2007-10-18 12:38:52 +0200
commit341131670f028f8bec97db6121c018f53129b9c3 (patch)
tree1219f4c6f4d692d1c491baa64eb9b16078a486c4
parent1253f76f37189f0bfda7e4a46bfe537f329dc0db (diff)
KVM: VMX: Initialize vcpu with preemption enabledkvm-47
vcpu initialization require writes to memory (for the real mode tss), which is now a sleeping operation. Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--drivers/kvm/kvm_main.c2
-rw-r--r--drivers/kvm/vmx.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0d2ccfec2ef9..c84bbeae44fa 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -187,6 +187,7 @@ void vcpu_load(struct kvm_vcpu *vcpu)
kvm_arch_vcpu_load(vcpu, cpu);
put_cpu();
}
+EXPORT_SYMBOL_GPL(vcpu_load);
void vcpu_put(struct kvm_vcpu *vcpu)
{
@@ -196,6 +197,7 @@ void vcpu_put(struct kvm_vcpu *vcpu)
preempt_enable();
mutex_unlock(&vcpu->mutex);
}
+EXPORT_SYMBOL_GPL(vcpu_put);
static void ack_flush(void *_completed)
{
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index c8b80452eed8..244f6a670229 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -2423,7 +2423,6 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
{
int err;
struct vcpu_vmx *vmx = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL);
- int cpu;
if (!vmx)
return ERR_PTR(-ENOMEM);
@@ -2448,11 +2447,9 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
vmcs_clear(vmx->vmcs);
- cpu = get_cpu();
- vmx_vcpu_load(&vmx->vcpu, cpu);
+ vcpu_load(&vmx->vcpu);
err = vmx_vcpu_setup(vmx);
- vmx_vcpu_put(&vmx->vcpu);
- put_cpu();
+ vcpu_put(&vmx->vcpu);
if (err)
goto free_vmcs;