diff options
author | Zachary Amsden <zamsden@redhat.com> | 2010-08-20 04:07:30 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:51:24 -0400 |
commit | 1d5f066e0b63271b67eac6d3752f8aa96adcbddb (patch) | |
tree | b3ba7c2783edbc6d9e6658d91e991913ba264684 /arch/x86/include/asm/kvm_host.h | |
parent | 347bb4448c2155eb2310923ccaa4be5677649003 (diff) |
KVM: x86: Fix a possible backwards warp of kvmclock
Kernel time, which advances in discrete steps may progress much slower
than TSC. As a result, when kvmclock is adjusted to a new base, the
apparent time to the guest, which runs at a much higher, nsec scaled
rate based on the current TSC, may have already been observed to have
a larger value (kernel_ns + scaled tsc) than the value to which we are
setting it (kernel_ns + 0).
We must instead compute the clock as potentially observed by the guest
for kernel_ns to make sure it does not go backwards.
Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/include/asm/kvm_host.h')
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 5ab1c3fb34ef..789e9462668f 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -339,6 +339,8 @@ struct kvm_vcpu_arch { | |||
339 | unsigned int time_offset; | 339 | unsigned int time_offset; |
340 | struct page *time_page; | 340 | struct page *time_page; |
341 | u64 last_host_tsc; | 341 | u64 last_host_tsc; |
342 | u64 last_guest_tsc; | ||
343 | u64 last_kernel_ns; | ||
342 | 344 | ||
343 | bool nmi_pending; | 345 | bool nmi_pending; |
344 | bool nmi_injected; | 346 | bool nmi_injected; |