diff options
author | Avi Kivity <avi@qumranet.com> | 2007-02-21 11:04:26 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-03-04 04:12:42 -0500 |
commit | bccf2150fe62dda5fb09efa2f64d2a234694eb48 (patch) | |
tree | b5e6fc6440b864ddd1c32c4cee1916a0c5484c63 /drivers/kvm/vmx.c | |
parent | c5ea76600653b1a242321734435cb1c54778941a (diff) |
KVM: Per-vcpu inodes
Allocate a distinct inode for every vcpu in a VM. This has the following
benefits:
- the filp cachelines are no longer bounced when f_count is incremented on
every ioctl()
- the API and internal code are distinctly clearer; for example, on the
KVM_GET_REGS ioctl, there is no need to copy the vcpu number from
userspace and then copy the registers back; the vcpu identity is derived
from the fd used to make the call
Right now the performance benefits are completely theoretical since (a) we
don't support more than one vcpu per VM and (b) virtualization hardware
inefficiencies completely everwhelm any cacheline bouncing effects. But
both of these will change, and we need to prepare the API today.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index ff956a6302ec..c07178e61122 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -204,7 +204,7 @@ static void vmcs_write64(unsigned long field, u64 value) | |||
204 | * Switches to specified vcpu, until a matching vcpu_put(), but assumes | 204 | * Switches to specified vcpu, until a matching vcpu_put(), but assumes |
205 | * vcpu mutex is already taken. | 205 | * vcpu mutex is already taken. |
206 | */ | 206 | */ |
207 | static struct kvm_vcpu *vmx_vcpu_load(struct kvm_vcpu *vcpu) | 207 | static void vmx_vcpu_load(struct kvm_vcpu *vcpu) |
208 | { | 208 | { |
209 | u64 phys_addr = __pa(vcpu->vmcs); | 209 | u64 phys_addr = __pa(vcpu->vmcs); |
210 | int cpu; | 210 | int cpu; |
@@ -242,7 +242,6 @@ static struct kvm_vcpu *vmx_vcpu_load(struct kvm_vcpu *vcpu) | |||
242 | rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); | 242 | rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); |
243 | vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ | 243 | vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ |
244 | } | 244 | } |
245 | return vcpu; | ||
246 | } | 245 | } |
247 | 246 | ||
248 | static void vmx_vcpu_put(struct kvm_vcpu *vcpu) | 247 | static void vmx_vcpu_put(struct kvm_vcpu *vcpu) |