Commit:     e56a7a28e21aa2d1af659d8f38952411ce9ae40e
Parent:     8a7ae055f3533b520401c170ac55e30628b34df5
Author:     Christian Borntraeger <[EMAIL PROTECTED]>
AuthorDate: Thu Oct 18 14:39:10 2007 +0200
Committer:  Avi Kivity <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 17:52:54 2008 +0200

    KVM: Use virtual cpu accounting if available for guest times.
    ppc and s390 offer the possibility to track process times precisely
    by looking at cpu timer on every context switch, irq, softirq etc.
    We can use that infrastructure as well for guest time accounting.
    We need to account the used time before we change the state.
    This patch adds a call to account_system_vtime to kvm_guest_enter
    and kvm_guest exit. If CONFIG_VIRT_CPU_ACCOUNTING is not set,
    account_system_vtime is defined in hardirq.h as an empty function,
    which means this patch does not change the behaviour on other
    I compile tested this patch on x86 and function tested the patch on
    Signed-off-by: Christian Borntraeger <[EMAIL PROTECTED]>
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
 drivers/kvm/kvm.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index df0711c..e8a21e8 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -7,6 +7,7 @@
 #include <linux/types.h>
+#include <linux/hardirq.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
@@ -671,11 +672,13 @@ __init void kvm_arch_init(void);
 static inline void kvm_guest_enter(void)
+       account_system_vtime(current);
        current->flags |= PF_VCPU;
 static inline void kvm_guest_exit(void)
+       account_system_vtime(current);
        current->flags &= ~PF_VCPU;
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

Reply via email to