Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8d0be2b3bf4a55606967d7d84e56c52521e94333
Commit:     8d0be2b3bf4a55606967d7d84e56c52521e94333
Parent:     133de9021d2988f3fbdad84c2d26484c7a757526
Author:     Avi Kivity <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 12 00:54:46 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Feb 12 09:48:41 2007 -0800

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/kvm/vmx.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 4078628..28da0ca 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -125,6 +125,15 @@ static void __vcpu_clear(void *arg)
                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)
 {
        unsigned long value;
@@ -202,10 +211,8 @@ static struct kvm_vcpu *vmx_vcpu_load(struct kvm_vcpu 
*vcpu)
 
        cpu = get_cpu();
 
-       if (vcpu->cpu != cpu) {
-               smp_call_function(__vcpu_clear, vcpu, 0, 1);
-               vcpu->launched = 0;
-       }
+       if (vcpu->cpu != cpu)
+               vcpu_clear(vcpu);
 
        if (per_cpu(current_vmcs, cpu) != vcpu->vmcs) {
                u8 error;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to