[PATCH 1/4] [PATCH] kvmclock: release time_page if msr is rewritten

Glauber Costa
2008-03-05T18:41:29Z

If the calling cpu rewrites the system clock msr for any reason,
release the page we allocated in the last time

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
arch/x86/kvm/x86.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e65a9d6..6abd784 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -588,6 +588,9 @@ int kvm_set_msr_common(struct kvm_vcpu *
kvm_write_wall_clock(vcpu->kvm, data);
break;
case MSR_KVM_SYSTEM_TIME: {
+ if (vcpu->arch.time_page)
+ kvm_release_page_dirty(vcpu->arch.time_page);
+
vcpu->arch.time = data & PAGE_MASK;
vcpu->arch.time_offset = data & ~PAGE_MASK;

--
1.4.2