Short note: Time providers in virtual environments

Correct time in VMs is unfortunately has and will continue to be somewhat of an issue - some virtualization environments provide clock sources so you don't have  to rely on ntpd (which fails if the drift gets too high). So for the short note - how can you check if you are using a time provider of your VM platform when running Linux on:

KVM (e.g. Proxmox VE, bare Debian/Ubuntu/RHEL...):

root@proxvm:~$ cat /sys/devices/system/clocksource/clocksource0/available_clocksource
kvm-clock tsc hpet acpi_pm 

root@proxvm:~$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
kvm-clock

Additional resources:

  • http://pve.proxmox.com/wiki/Guest_Time_drift
  • http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_Configuration_and_Guest_Installation_Guide/chap-Virtualization_Host_Configuration_and_Guest_Installation_Guide-KVM_guest_timing_management.html

Bonus question: Is a Linux guest also able to use kvm_clock when running inside a illumo-KVM on illumos, like on SmartOS? 🙂

MS Hyper-V:

For what I know, the time provider is enabled per default also at Hyper-V level per VM, but you might want to disable this for specific guests like (Windows) domain controllers or Kerberos KDCs. (5' time drift will also break Kerberos authentication). This will at least require at Kernel from later 2011 but better look for a Kernel with more stable Hyper-V driver integration, 3.4 will likely make you happy or 3.2 is also reasonably stable.

root@hvtux:~$ cat /sys/devices/system/clocksource/clocksource0/available_clocksource
hyperv_clocksource tsc acpi_pm jiffies

root@hvtux:~$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
hyperv_clocksource

When using the provider by the VE platform, I had less issues with time drift (none to be correct).

2 Responses

  1. kaspar
    kaspar 2012-11-20 at 14:43 |

    The answer to the bonus question above eludes me. Can it or can it not?

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.