[PATCH] KVM: VMX: add vcpu_clear()
Like the inline code it replaces, this function decaches the vmcs from the cpu it last executed on. in addition: - vcpu_clear() works if the last cpu is also the cpu we're running on - it is faster on larger smps by virtue of using smp_call_function_single() Includes fix from Ingo Molnar. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Avi Kivity <avi@qumranet.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
133de9021d
commit
8d0be2b3bf
@@ -125,6 +125,15 @@ static void __vcpu_clear(void *arg)
|
|||||||
per_cpu(current_vmcs, cpu) = NULL;
|
per_cpu(current_vmcs, cpu) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vcpu_clear(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
if (vcpu->cpu != raw_smp_processor_id() && vcpu->cpu != -1)
|
||||||
|
smp_call_function_single(vcpu->cpu, __vcpu_clear, vcpu, 0, 1);
|
||||||
|
else
|
||||||
|
__vcpu_clear(vcpu);
|
||||||
|
vcpu->launched = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned long vmcs_readl(unsigned long field)
|
static unsigned long vmcs_readl(unsigned long field)
|
||||||
{
|
{
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
@@ -202,10 +211,8 @@ static struct kvm_vcpu *vmx_vcpu_load(struct kvm_vcpu *vcpu)
|
|||||||
|
|
||||||
cpu = get_cpu();
|
cpu = get_cpu();
|
||||||
|
|
||||||
if (vcpu->cpu != cpu) {
|
if (vcpu->cpu != cpu)
|
||||||
smp_call_function(__vcpu_clear, vcpu, 0, 1);
|
vcpu_clear(vcpu);
|
||||||
vcpu->launched = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (per_cpu(current_vmcs, cpu) != vcpu->vmcs) {
|
if (per_cpu(current_vmcs, cpu) != vcpu->vmcs) {
|
||||||
u8 error;
|
u8 error;
|
||||||
|
Reference in New Issue
Block a user