* [RESEND][PATCH 4/4] Modify KVM to update guest time accounting.
@ 2007-09-10 12:03 Laurent Vivier
0 siblings, 0 replies; only message in thread
From: Laurent Vivier @ 2007-09-10 12:03 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
[PATCH 4/4] Modify KVM to update guest time accounting.
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
--
------------- Laurent.Vivier@bull.net --------------
"Software is hard" - Donald Knuth
[-- Attachment #2: kvm_account_guest --]
[-- Type: text/plain, Size: 2403 bytes --]
Index: linux-2.6/drivers/kvm/Kconfig
===================================================================
--- linux-2.6.orig/drivers/kvm/Kconfig 2007-09-10 13:00:18.000000000 +0200
+++ linux-2.6/drivers/kvm/Kconfig 2007-09-10 13:00:25.000000000 +0200
@@ -17,6 +17,7 @@ config KVM
tristate "Kernel-based Virtual Machine (KVM) support"
depends on X86 && EXPERIMENTAL
select ANON_INODES
+ select GUEST_ACCOUNTING
---help---
Support hosting fully virtualized guest machines using hardware
virtualization extensions. You will need a fairly recent
Index: linux-2.6/drivers/kvm/kvm.h
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm.h 2007-09-10 13:00:18.000000000 +0200
+++ linux-2.6/drivers/kvm/kvm.h 2007-09-10 13:00:25.000000000 +0200
@@ -625,6 +625,19 @@ void kvm_mmu_unload(struct kvm_vcpu *vcp
int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run);
+#ifndef PF_VCPU
+#define PF_VCPU 0
+#endif
+
+static inline void kvm_guest_enter(void)
+{
+ current->flags |= PF_VCPU;
+}
+
+static inline void kvm_guest_exit(void)
+{
+}
+
static inline int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva,
u32 error_code)
{
Index: linux-2.6/drivers/kvm/svm.c
===================================================================
--- linux-2.6.orig/drivers/kvm/svm.c 2007-09-10 13:00:18.000000000 +0200
+++ linux-2.6/drivers/kvm/svm.c 2007-09-10 13:00:25.000000000 +0200
@@ -1494,6 +1494,7 @@ again:
clgi();
vcpu->guest_mode = 1;
+ kvm_guest_enter();
if (vcpu->requests)
if (test_and_clear_bit(KVM_TLB_FLUSH, &vcpu->requests))
svm_flush_tlb(vcpu);
@@ -1629,6 +1630,7 @@ again:
#endif
: "cc", "memory" );
+ kvm_guest_exit();
vcpu->guest_mode = 0;
if (vcpu->fpu_active) {
Index: linux-2.6/drivers/kvm/vmx.c
===================================================================
--- linux-2.6.orig/drivers/kvm/vmx.c 2007-09-10 13:00:18.000000000 +0200
+++ linux-2.6/drivers/kvm/vmx.c 2007-09-10 13:00:25.000000000 +0200
@@ -2018,6 +2018,7 @@ again:
local_irq_disable();
vcpu->guest_mode = 1;
+ kvm_guest_enter();
if (vcpu->requests)
if (test_and_clear_bit(KVM_TLB_FLUSH, &vcpu->requests))
vmx_flush_tlb(vcpu);
@@ -2138,6 +2139,7 @@ again:
[cr2]"i"(offsetof(struct kvm_vcpu, cr2))
: "cc", "memory" );
+ kvm_guest_exit();
vcpu->guest_mode = 0;
local_irq_enable();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-09-10 12:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-10 12:03 [RESEND][PATCH 4/4] Modify KVM to update guest time accounting Laurent Vivier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.