Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80765
b: refs/heads/master
c: 26e5215
h: refs/heads/master
i:
  80763: 892b4ea
v: v3
  • Loading branch information
Avi Kivity committed Jan 30, 2008
1 parent 3003d31 commit 8d2f52e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0de10343b3ca7aa34dd606145748f73ed19f627e
refs/heads/master: 26e5215fdc6cf7b5a8b1269134095abbb7338b3c
1 change: 1 addition & 0 deletions trunk/drivers/kvm/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id);
int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);

int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu);
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,10 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n)

preempt_notifier_init(&vcpu->preempt_notifier, &kvm_preempt_ops);

r = kvm_arch_vcpu_setup(vcpu);
if (r)
goto vcpu_destroy;

mutex_lock(&kvm->lock);
if (kvm->vcpus[n]) {
r = -EEXIST;
Expand Down
16 changes: 7 additions & 9 deletions trunk/drivers/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -2478,13 +2478,12 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
unsigned int id)
{
int r;
struct kvm_vcpu *vcpu = kvm_x86_ops->vcpu_create(kvm, id);
return kvm_x86_ops->vcpu_create(kvm, id);
}

if (IS_ERR(vcpu)) {
r = -ENOMEM;
goto fail;
}
int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
{
int r;

/* We do fxsave: this must be aligned. */
BUG_ON((unsigned long)&vcpu->host_fx_image & 0xF);
Expand All @@ -2497,11 +2496,10 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
if (r < 0)
goto free_vcpu;

return vcpu;
return 0;
free_vcpu:
kvm_x86_ops->vcpu_free(vcpu);
fail:
return ERR_PTR(r);
return r;
}

void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
Expand Down

0 comments on commit 8d2f52e

Please sign in to comment.