Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 45234
b: refs/heads/master
c: 965b58a
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jan 6, 2007
1 parent 511ab71 commit ac38c10
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 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: cd36beec0b83d28dceb85696a23542bf1b97cc8c
refs/heads/master: 965b58a550b6f84815cb555e6abb953e863f1610
32 changes: 21 additions & 11 deletions trunk/drivers/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,14 +1094,6 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
rdmsrl(MSR_IA32_SYSENTER_EIP, a);
vmcs_writel(HOST_IA32_SYSENTER_EIP, a); /* 22.2.3 */

ret = -ENOMEM;
vcpu->guest_msrs = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!vcpu->guest_msrs)
goto out;
vcpu->host_msrs = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!vcpu->host_msrs)
goto out_free_guest_msrs;

for (i = 0; i < NR_VMX_MSR; ++i) {
u32 index = vmx_msr_index[i];
u32 data_low, data_high;
Expand Down Expand Up @@ -1155,8 +1147,6 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)

return 0;

out_free_guest_msrs:
kfree(vcpu->guest_msrs);
out:
return ret;
}
Expand Down Expand Up @@ -1906,13 +1896,33 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu)
{
struct vmcs *vmcs;

vcpu->guest_msrs = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!vcpu->guest_msrs)
return -ENOMEM;

vcpu->host_msrs = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!vcpu->host_msrs)
goto out_free_guest_msrs;

vmcs = alloc_vmcs();
if (!vmcs)
return -ENOMEM;
goto out_free_msrs;

vmcs_clear(vmcs);
vcpu->vmcs = vmcs;
vcpu->launched = 0;

return 0;

out_free_msrs:
kfree(vcpu->host_msrs);
vcpu->host_msrs = NULL;

out_free_guest_msrs:
kfree(vcpu->guest_msrs);
vcpu->guest_msrs = NULL;

return -ENOMEM;
}

static struct kvm_arch_ops vmx_arch_ops = {
Expand Down

0 comments on commit ac38c10

Please sign in to comment.