]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: require matched TSC offsets for master clock
authorMarcelo Tosatti <mtosatti@redhat.com>
Wed, 28 Nov 2012 01:29:03 +0000 (23:29 -0200)
committerMarcelo Tosatti <mtosatti@redhat.com>
Wed, 28 Nov 2012 01:29:15 +0000 (23:29 -0200)
commit7e18d38e047e4cd94f298c62415ad14430a7af09
tree360f44bce8cf39836e916f3b5ed5c2e8849cd263
parent202626a16c208ec0df071f6d4b69324c1f6cf11a
KVM: x86: require matched TSC offsets for master clock

With master clock, a pvclock clock read calculates:

ret = system_timestamp + [ (rdtsc + tsc_offset) - tsc_timestamp ]

Where 'rdtsc' is the host TSC.

system_timestamp and tsc_timestamp are unique, one tuple
per VM: the "master clock".

Given a host with synchronized TSCs, its obvious that
guest TSC must be matched for the above to guarantee monotonicity.

Allow master clock usage only if guest TSCs are synchronized.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/trace.h
arch/x86/kvm/x86.c