diff options
author | Glauber Costa <glommer@redhat.com> | 2011-02-01 14:16:40 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-03-17 12:08:28 -0400 |
commit | 12f9a48f7bf5bfe6620b03028a865f26a10e1fce (patch) | |
tree | 03062791d7f1c24809bb1bebcd84c3fae4c9b80b /arch/x86/kvm/x86.c | |
parent | f58c9df78c0360f0eb3852b9cc3a61e689bc2dd1 (diff) |
KVM: x86: release kvmclock page on reset
When a vcpu is reset, kvmclock page keeps being written to this days.
This is wrong and inconsistent: a cpu reset should take it to its
initial state.
Signed-off-by: Glauber Costa <glommer@redhat.com>
CC: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 7faf262ab202..712af904706f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1453,6 +1453,14 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) | |||
1453 | return 0; | 1453 | return 0; |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | static void kvmclock_reset(struct kvm_vcpu *vcpu) | ||
1457 | { | ||
1458 | if (vcpu->arch.time_page) { | ||
1459 | kvm_release_page_dirty(vcpu->arch.time_page); | ||
1460 | vcpu->arch.time_page = NULL; | ||
1461 | } | ||
1462 | } | ||
1463 | |||
1456 | int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) | 1464 | int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) |
1457 | { | 1465 | { |
1458 | switch (msr) { | 1466 | switch (msr) { |
@@ -1510,10 +1518,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1510 | break; | 1518 | break; |
1511 | case MSR_KVM_SYSTEM_TIME_NEW: | 1519 | case MSR_KVM_SYSTEM_TIME_NEW: |
1512 | case MSR_KVM_SYSTEM_TIME: { | 1520 | case MSR_KVM_SYSTEM_TIME: { |
1513 | if (vcpu->arch.time_page) { | 1521 | kvmclock_reset(vcpu); |
1514 | kvm_release_page_dirty(vcpu->arch.time_page); | ||
1515 | vcpu->arch.time_page = NULL; | ||
1516 | } | ||
1517 | 1522 | ||
1518 | vcpu->arch.time = data; | 1523 | vcpu->arch.time = data; |
1519 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); | 1524 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); |
@@ -5837,10 +5842,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu) | |||
5837 | 5842 | ||
5838 | void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) | 5843 | void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) |
5839 | { | 5844 | { |
5840 | if (vcpu->arch.time_page) { | 5845 | kvmclock_reset(vcpu); |
5841 | kvm_release_page_dirty(vcpu->arch.time_page); | ||
5842 | vcpu->arch.time_page = NULL; | ||
5843 | } | ||
5844 | 5846 | ||
5845 | free_cpumask_var(vcpu->arch.wbinvd_dirty_mask); | 5847 | free_cpumask_var(vcpu->arch.wbinvd_dirty_mask); |
5846 | fx_free(vcpu); | 5848 | fx_free(vcpu); |
@@ -5901,6 +5903,8 @@ int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu) | |||
5901 | kvm_make_request(KVM_REQ_EVENT, vcpu); | 5903 | kvm_make_request(KVM_REQ_EVENT, vcpu); |
5902 | vcpu->arch.apf.msr_val = 0; | 5904 | vcpu->arch.apf.msr_val = 0; |
5903 | 5905 | ||
5906 | kvmclock_reset(vcpu); | ||
5907 | |||
5904 | kvm_clear_async_pf_completion_queue(vcpu); | 5908 | kvm_clear_async_pf_completion_queue(vcpu); |
5905 | kvm_async_pf_hash_reset(vcpu); | 5909 | kvm_async_pf_hash_reset(vcpu); |
5906 | vcpu->arch.apf.halted = false; | 5910 | vcpu->arch.apf.halted = false; |