]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: do not go through vcpu in __get_kvmclock_ns
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 16 Nov 2016 17:31:30 +0000 (18:31 +0100)
committerRadim Krčmář <rkrcmar@redhat.com>
Sat, 19 Nov 2016 17:03:03 +0000 (18:03 +0100)
commit47ad9decdf69ade6cd01e951e1ada58e195b4f68
tree029c08e8e130130e8e59331f8b15560a7e119c66
parent9ee2ffccba45458b49ea7b86db78bbd6824ae31c
KVM: x86: do not go through vcpu in __get_kvmclock_ns

Going through the first VCPU is wrong if you follow a KVM_SET_CLOCK with
a KVM_GET_CLOCK immediately after, without letting the VCPU run and
call kvm_guest_time_update.

To fix this, compute the kvmclock value ourselves, using the master
clock (tsc, nsec) pair as the base and the host CPU frequency as
the scale.

Reported-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/x86.c