[0/1] Avoiding RDTSC emulation due to host clock drift
mbox series

Message ID cover.1567448405.git.edvin.torok@citrix.com
Headers show
Series
  • Avoiding RDTSC emulation due to host clock drift
Related show

Message

Edwin Török Sept. 2, 2019, 6:27 p.m. UTC
I noticed that RDTSC emulation got turned on for a VM after a
suspend/host-reboot/resume cycle.
Xen currently expects an exact match between host CPU and saved guest CPU
frequency in KHz, otherwise it turns on RDTSC emulation if the CPU doesn't
support TSC scaling.

An exact match would require ~0.4 ppm accuracy, and even on physical hardware
the platform timer used for calibration is not that accurate.  The best
accuracy I could find that datasheets/specifications require is 100 ppm, so let
Xen accept a 100 ppm difference in clock frequency as "the same" and do not
turn on RDTSC emulation due to that.

So far I have manually tested this on Intel(R) Xeon(R) CPU E5-2697 v3 and a
Debian 9 guest, more tests pending.

See the commit for more details.

Edwin Török (1):
  x86/arch: VM resume: avoid RDTSC emulation due to host clock drift

 xen/arch/x86/time.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)