Commit d172fcd3 authored by Laurent Vivier's avatar Laurent Vivier Committed by Ingo Molnar
Browse files

sched: guest CPU accounting: maintain guest state in KVM

Modify KVM to update guest time accounting.

[ ported to 2.6.24 KVM. ]

Signed-off-by: default avatarLaurent Vivier <>
Acked-by: default avatarAvi Kivity <>
Signed-off-by: default avatarIngo Molnar <>
parent 94886b84
......@@ -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)
......@@ -2046,6 +2046,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
kvm_x86_ops->inject_pending_vectors(vcpu, kvm_run);
vcpu->guest_mode = 1;
if (vcpu->requests)
if (test_and_clear_bit(KVM_TLB_FLUSH, &vcpu->requests))
......@@ -2053,6 +2054,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
kvm_x86_ops->run(vcpu, kvm_run);
vcpu->guest_mode = 0;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment