[PATCH 12/16] KVM-HV: KVM Steal time implementation

From: Glauber Costa
Date: Mon Jan 24 2011 - 13:08:20 EST


To implement steal time, we need the hypervisor to pass the guest information
about how much time was spent running other processes outside the VM.
This is per-vcpu, and using the kvmclock structure for that is an abuse
we decided not to make.

This patch contains the hypervisor part for it. I am keeping it separate from
the headers to facilitate backports to people who wants to backport the kernel
part but not the hypervisor, or the other way around.

Signed-off-by: Glauber Costa <glommer@xxxxxxxxxx>
CC: Rik van Riel <riel@xxxxxxxxxx>
CC: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
CC: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CC: Avi Kivity <avi@xxxxxxxxxx>
---
arch/x86/kvm/x86.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 81b2f34..f129ea1 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1564,6 +1564,11 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
goto rma_out;
}

+ if (area_desc.type == KVM_AREA_STEAL_TIME) {
+ vcpu->arch.stime = area_desc.base;
+ goto rma_out;
+ }
+
if (vcpu->kvm->register_mem_area_uspace) {
vcpu->run->exit_reason = KVM_EXIT_X86_MSR_OP;
vcpu->run->msr.msr_data = data;
--
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/