From: Laurent Vivier <Laurent.Vivier@bull.net>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [RESEND 2][PATCH 4/4] Modify KVM to update guest time accounting.
Date: Mon, 10 Sep 2007 16:13:03 +0200 [thread overview]
Message-ID: <46E550EF.5080209@bull.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 217 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: 1845 bytes --]
Index: linux-2.6/drivers/kvm/kvm.h
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm.h 2007-09-10 14:56:52.000000000 +0200
+++ linux-2.6/drivers/kvm/kvm.h 2007-09-10 15:08:42.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 14:56:52.000000000 +0200
+++ linux-2.6/drivers/kvm/svm.c 2007-09-10 15:08:42.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 14:56:52.000000000 +0200
+++ linux-2.6/drivers/kvm/vmx.c 2007-09-10 15:08:42.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();
next reply other threads:[~2007-09-10 14:14 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-10 14:13 Laurent Vivier [this message]
2007-10-15 9:38 ` [RESEND 2][PATCH 4/4] Modify KVM to update guest time accounting Ingo Molnar
2007-10-15 9:47 ` Avi Kivity
2007-10-15 9:50 ` Ingo Molnar
2007-10-15 9:51 ` Ingo Molnar
2007-10-15 10:02 ` Avi Kivity
2007-10-15 10:53 ` Laurent Vivier
2007-10-15 11:15 ` Avi Kivity
2007-10-15 11:33 ` Christian Borntraeger
2007-10-15 11:38 ` Laurent Vivier
2007-10-15 14:39 ` Christian Borntraeger
2007-10-15 14:45 ` Laurent Vivier
2007-10-15 11:37 ` Laurent Vivier
2007-10-15 12:07 ` Avi Kivity
2007-10-15 12:29 ` Laurent Vivier
2007-10-15 16:46 ` Avi Kivity
2007-10-15 19:45 ` Laurent Vivier
2007-10-17 13:08 ` [PATCH] clear PF_VCPU in kvm_guest_exit() Laurent Vivier
2007-10-17 13:18 ` Christian Borntraeger
2007-10-17 14:16 ` Avi Kivity
2007-10-17 15:09 ` Laurent Vivier
2007-10-18 12:39 ` Use virtual cpu accounting if available for guest times Christian Borntraeger
2007-10-18 12:41 ` Avi Kivity
2007-10-19 16:57 ` [kvm-devel] " Hollis Blanchard
2007-10-19 17:18 ` Hollis Blanchard
2007-10-18 13:19 ` [PATCH] move kvm_guest_exit() after local_irq_enable() Laurent Vivier
2007-10-18 13:32 ` [kvm-devel] " Avi Kivity
2007-10-18 13:49 ` Laurent Vivier
2007-10-22 8:26 ` Ingo Molnar
2007-10-22 8:51 ` Avi Kivity
2007-10-22 8:57 ` Ingo Molnar
2007-10-22 9:10 ` [kvm-devel] " Avi Kivity
2007-10-15 11:19 ` [RESEND 2][PATCH 4/4] Modify KVM to update guest time accounting Christian Borntraeger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46E550EF.5080209@bull.net \
--to=laurent.vivier@bull.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox