Debian – Xen: synchronizing time with Dom0

debianntpxen

I have Xen virtual machines running on Debian 6 (both Dom0 and DomU).
I would like to synchronize clock on DomU with Dom0.
On http://wiki.xen.org/wiki/Xen_FAQ_DomU I have read that I need to set /proc/sys/xen/independent_wallclock to 0 but I do not even have /proc/sys/xen directory on DomU:

# ls /proc/sys/xen
ls: cannot access /proc/sys/xen: No such file or directory

What should I do to synchronize clock on DomU with Dom0?

Update:

[    0.000000] Booting paravirtualized kernel on Xen
[    0.000000] Xen version: 4.0.1 (preserve-AD) (dom0)

Best Answer

If you are running Xen 3 or earlier, set proc/sys/xen/independent_wallclock to 0 and the clocks should synchronize automatically.
If you are arunning Xen 4+, set tsc_mode=2 in the vm.cfg file for the VM.

Synchronizing automatically can cause problems with some software. Your OS should handle it, though it might complain about time going backward. The most notable problems are ones where time jumping backward causes something in the program to misbehave (it's somewhat rare, but happens).

If you can't run automatic time synchronization for any reason, set independent_wallclock to 1 or tsc_mode to 0 and run NTP. This will still have drifting problems as the clock will be inconsistent (it's the nature of VMs and really can't be "fixed").