aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLaurent Vivier <Laurent.Vivier@bull.net>2007-10-15 11:00:19 -0400
committerIngo Molnar <mingo@elte.hu>2007-10-15 11:00:19 -0400
commitd172fcd3ae1ca7ac27ec8904242fd61e0e11d332 (patch)
tree5009ae88a2ab2aa7f17219c7ddfc0a694c2ff6b4 /drivers
parent94886b84b1bcdc95f34f70e7fce407efefe472e1 (diff)
sched: guest CPU accounting: maintain guest state in KVM
Modify KVM to update guest time accounting. [ mingo@elte.hu: ported to 2.6.24 KVM. ] Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net> Acked-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/kvm/kvm.h10
-rw-r--r--drivers/kvm/kvm_main.c2
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index ad0813843adc..3b0bc4bda5f2 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -624,6 +624,16 @@ void kvm_mmu_unload(struct kvm_vcpu *vcpu);
624 624
625int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run); 625int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run);
626 626
627static inline void kvm_guest_enter(void)
628{
629 current->flags |= PF_VCPU;
630}
631
632static inline void kvm_guest_exit(void)
633{
634 current->flags &= ~PF_VCPU;
635}
636
627static inline int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, 637static inline int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva,
628 u32 error_code) 638 u32 error_code)
629{ 639{
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 353e58527d15..af2d288c881d 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2046,6 +2046,7 @@ again:
2046 kvm_x86_ops->inject_pending_vectors(vcpu, kvm_run); 2046 kvm_x86_ops->inject_pending_vectors(vcpu, kvm_run);
2047 2047
2048 vcpu->guest_mode = 1; 2048 vcpu->guest_mode = 1;
2049 kvm_guest_enter();
2049 2050
2050 if (vcpu->requests) 2051 if (vcpu->requests)
2051 if (test_and_clear_bit(KVM_TLB_FLUSH, &vcpu->requests)) 2052 if (test_and_clear_bit(KVM_TLB_FLUSH, &vcpu->requests))
@@ -2053,6 +2054,7 @@ again:
2053 2054
2054 kvm_x86_ops->run(vcpu, kvm_run); 2055 kvm_x86_ops->run(vcpu, kvm_run);
2055 2056
2057 kvm_guest_exit();
2056 vcpu->guest_mode = 0; 2058 vcpu->guest_mode = 0;
2057 local_irq_enable(); 2059 local_irq_enable();
2058 2060