[CentOS-virt] time drift with kvm guest

Fri Dec 23 15:22:50 UTC 2011
thomas veymont <thomas.veymont at gmail.com>


a big time drift appears along time on a guest VM (time is going too
slow on the guest).
here the setup:

~ physical machine ~

Centos 6.0 x86_64
time set with ntpd
Intel(R) Xeon(R) CPU X5650
/proc/cpuinfo shows the "constant_tsc" bit.

~ guest OS ~

Centos 6.0 x86_64

/proc/cpuinfo :

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : QEMU Virtual CPU version (cpu64-rhel6)
stepping        : 3
cpu MHz         : 2666.998
cache size      : 4096 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 4
wp              : yes
flags           : fpu de pse tsc msr pae mce cx8 apic mtrr pge mca
cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm up rep_good
unfair_spinlock pni cx16 hypervisor lahf_lm
bogomips        : 5333.99
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual

at boot time :

[root at xxxx ~]# dmesg | egrep -i 'clock|tsc|time'
kvm-clock: Using msrs 12 and 11
kvm-clock: cpu 0, msr 0:18c1901, boot clock
ACPI: PM-Timer IO Port: 0xb008
kvm-clock: cpu 0, msr 0:1e16901, primary cpu clock
..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
Switching to clocksource kvm-clock
uhci_hcd 0000:00:01.2: setting latency timer to 64
rtc_cmos 00:01: setting system clock to 2011-12-15 09:33:28 UTC (1323941608)
ata_piix 0000:00:01.1: setting latency timer to 64
Clocksource tsc unstable (delta = -547592984 ns)

[root at xxxx ~]# cat
kvm-clock acpi_pm

[root at xxxx ~]# cat

cpuspeed service is not active on the guest.
acpid service is active on the guest (so it can be shut down from the
host with "virsh shutdown").

reading Redhat documentation, I did everything ok (that is : guest
clocksource set to "kvm-clock" and physical
host has a CPU with constant_tsc flag + time set with NTP) :


is that right ?
does anyone have a suggestion about this problem ?