diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2011-04-18 05:42:53 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-05-11 07:57:10 -0400 |
commit | 7c4c0f4fd5c3e82234c0ab61c7e7ffdb8f3af07b (patch) | |
tree | f814169205d55c01702c880e9610e5bb97c09924 /arch/x86 | |
parent | 977b2d03e42e9ea9355d4baddb464810579719bd (diff) |
KVM: X86: Update last_guest_tsc in vcpu_put
The last_guest_tsc is used in vcpu_load to adjust the
tsc_offset since tsc-scaling is merged. So the
last_guest_tsc needs to be updated in vcpu_put instead of
the the last_host_tsc. This is fixed with this patch.
Reported-by: Jan Kiszka <jan.kiszka@web.de>
Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 1 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 3e03f37f43ea..e50bffcf3cc0 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -393,7 +393,6 @@ struct kvm_vcpu_arch { | |||
393 | unsigned int hw_tsc_khz; | 393 | unsigned int hw_tsc_khz; |
394 | unsigned int time_offset; | 394 | unsigned int time_offset; |
395 | struct page *time_page; | 395 | struct page *time_page; |
396 | u64 last_host_tsc; | ||
397 | u64 last_guest_tsc; | 396 | u64 last_guest_tsc; |
398 | u64 last_kernel_ns; | 397 | u64 last_kernel_ns; |
399 | u64 last_tsc_nsec; | 398 | u64 last_tsc_nsec; |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b05e3fcce298..6aa137701cda 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -2146,7 +2146,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | |||
2146 | { | 2146 | { |
2147 | kvm_x86_ops->vcpu_put(vcpu); | 2147 | kvm_x86_ops->vcpu_put(vcpu); |
2148 | kvm_put_guest_fpu(vcpu); | 2148 | kvm_put_guest_fpu(vcpu); |
2149 | vcpu->arch.last_host_tsc = native_read_tsc(); | 2149 | kvm_get_msr(vcpu, MSR_IA32_TSC, &vcpu->arch.last_guest_tsc); |
2150 | } | 2150 | } |
2151 | 2151 | ||
2152 | static int is_efer_nx(void) | 2152 | static int is_efer_nx(void) |