]> git.baikalelectronics.ru Git - kernel.git/commit
x86: kvm: rate-limit global clock updates
authorAndrew Jones <drjones@redhat.com>
Fri, 28 Feb 2014 11:52:54 +0000 (12:52 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 4 Mar 2014 10:50:47 +0000 (11:50 +0100)
commit37e21d6f189cfedb257d7e2295967ae0de08ba6d
tree874a17c193b6be9621fbc32ba7c7ce633e316658
parenteafa10083be09a304ebd4db4ce073ea7a963d664
x86: kvm: rate-limit global clock updates

When we update a vcpu's local clock it may pick up an NTP correction.
We can't wait an indeterminate amount of time for other vcpus to pick
up that correction, so commit a6cffff09aa8c introduced a global clock
update. However, we can't request a global clock update on every vcpu
load either (which is what happens if the tsc is marked as unstable).
The solution is to rate-limit the global clock updates. Marcelo
calculated that we should delay the global clock updates no more
than 0.1s as follows:

Assume an NTP correction c is applied to one vcpu, but not the other,
then in n seconds the delta of the vcpu system_timestamps will be
c * n. If we assume a correction of 500ppm (worst-case), then the two
vcpus will diverge 50us in 0.1s, which is a considerable amount.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c