[CentOS-virt] ntp on kvm

Tue Jul 28 15:46:30 UTC 2009
Johnny Tan <linuxweb at gmail.com>

Nigel Metheringham wrote:
> On 21 Jul 2009, at 00:41, Johnny Tan wrote:
>> * Setting independent_wallclock=1 (or is that a xen-only thing)?
> [Can't comment - I'm not a Xen user]

Ok, I've done a bit more research, it seems the above is a 
xen-only thing, so it's a no-go for KVM.

>> * Passing kernel parameters? If so, which? The vmware KB
>> mentions "notsc divider=10" -- is that vmware-specific?

This is NOT vmware-specific. In fact, it seems like 
divider=10 is the only thing that works. "notsc" (at least 
by itself) does not help.

>> * Just don't run ntpd on virtual guests? And let it get its
>> time from the host.

This does not work. On Xen, domU's apparently get their time 
from the physical host, so it would work for Xen. But for 
KVM, this does not seem to be the case.

> My suggestions, from my position of complete ignorance on Xen (but I  
> do quite a lot under VMware) is to tweak your kernel params  
> (definitely divider, maybe some other tweaks depending on  how the  
> virtual hardware appears, but on our systems we use clocksource=acpi_pm)

Yes, divider works. I tried "clocksource=acpi_pm" -- it does 
not work for our KVM guests, at least not by itself. (We're 
using KVM-85.)

In summary: For KVM guests, pass "divider=10" as kernel 
option in grub.conf for your KVM guest, then use ntp to keep 
time (also on your KVM guest).

(p.s. However, I believe these issues are fixed with RHEL 5.4.)

> Hope that this helps but you have opened a very messy can of worms here!

I figured it'd be a can of worms, but a useful one. I'm 
surprised it's not asked more often. I'm guessing most 
people are using Xen still, where this is less of an issue.

Thanks Nigel.