Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d172fcd3ae1ca7ac27ec8904242fd61e0e11d332
Commit:     d172fcd3ae1ca7ac27ec8904242fd61e0e11d332
Parent:     94886b84b1bcdc95f34f70e7fce407efefe472e1
Author:     Laurent Vivier <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 15 17:00:19 2007 +0200
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Mon Oct 15 17:00:19 2007 +0200

    sched: guest CPU accounting: maintain guest state in KVM
    
    Modify KVM to update guest time accounting.
    
    [ [EMAIL PROTECTED]: ported to 2.6.24 KVM. ]
    
    Signed-off-by: Laurent Vivier <[EMAIL PROTECTED]>
    Acked-by: Avi Kivity <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 drivers/kvm/kvm.h      |   10 ++++++++++
 drivers/kvm/kvm_main.c |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index ad08138..3b0bc4b 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -624,6 +624,16 @@ void kvm_mmu_unload(struct kvm_vcpu *vcpu);
 
 int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run);
 
+static inline void kvm_guest_enter(void)
+{
+       current->flags |= PF_VCPU;
+}
+
+static inline void kvm_guest_exit(void)
+{
+       current->flags &= ~PF_VCPU;
+}
+
 static inline int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva,
                                     u32 error_code)
 {
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 353e585..af2d288 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2046,6 +2046,7 @@ again:
                kvm_x86_ops->inject_pending_vectors(vcpu, kvm_run);
 
        vcpu->guest_mode = 1;
+       kvm_guest_enter();
 
        if (vcpu->requests)
                if (test_and_clear_bit(KVM_TLB_FLUSH, &vcpu->requests))
@@ -2053,6 +2054,7 @@ again:
 
        kvm_x86_ops->run(vcpu, kvm_run);
 
+       kvm_guest_exit();
        vcpu->guest_mode = 0;
        local_irq_enable();
 
-
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