aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2007-10-18 08:39:10 -0400
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:52:54 -0500
commite56a7a28e21aa2d1af659d8f38952411ce9ae40e (patch)
treeef8899484d5c805cf71d9138a705ef649487751d
parent8a7ae055f3533b520401c170ac55e30628b34df5 (diff)
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 platforms. I compile tested this patch on x86 and function tested the patch on s390. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--drivers/kvm/kvm.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index df0711ce9baa..e8a21e8cb2ad 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/hardirq.h>
10#include <linux/list.h> 11#include <linux/list.h>
11#include <linux/mutex.h> 12#include <linux/mutex.h>
12#include <linux/spinlock.h> 13#include <linux/spinlock.h>
@@ -671,11 +672,13 @@ __init void kvm_arch_init(void);
671 672
672static inline void kvm_guest_enter(void) 673static inline void kvm_guest_enter(void)
673{ 674{
675 account_system_vtime(current);
674 current->flags |= PF_VCPU; 676 current->flags |= PF_VCPU;
675} 677}
676 678
677static inline void kvm_guest_exit(void) 679static inline void kvm_guest_exit(void)
678{ 680{
681 account_system_vtime(current);
679 current->flags &= ~PF_VCPU; 682 current->flags &= ~PF_VCPU;
680} 683}
681 684