mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 01:34:14 +08:00
KVM: x86: Fix kvmclock bug
If preempted after kvmclock values are updated, but before hardware virtualization is entered, the last tsc time as read by the guest is never set. It underflows the next time kvmclock is updated if there has not yet been a successful entry / exit into hardware virt. Fix this by simply setting last_tsc to the newly read tsc value so that any computed nsec advance of kvmclock is nulled. Signed-off-by: Zachary Amsden <zamsden@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
parent
0959ffacf3
commit
28e4639adf
@ -1095,6 +1095,7 @@ static int kvm_write_guest_time(struct kvm_vcpu *v)
|
||||
vcpu->hv_clock.tsc_timestamp = tsc_timestamp;
|
||||
vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset;
|
||||
vcpu->last_kernel_ns = kernel_ns;
|
||||
vcpu->last_guest_tsc = tsc_timestamp;
|
||||
vcpu->hv_clock.flags = 0;
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user