VMware Communities > VMTN > VMware Server > VMware Server 1 > Discussions

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
9 Replies Last post: Nov 26, 2008 1:07 AM by dubek
Reply

Guest OS' clock runs too fast

Oct 23, 2007 2:27 PM

Click to view rubio's profile Lurker rubio 3 posts since
Oct 19, 2007
I have looked for solutions for this problem, but haven't found one that works for this system. Any help or pointers would be greatly appreciated.

The clock of the guest OS runs around 1.5x faster than that of the host OS. The problem is present whether the guest OS is idle or busy.

Among several things, I have disabled power management on the host. I have tried a time server which failed as the time drifted too fast. Also tried VMware tools, but it only corrects time when the guest falls behind, not when it goes ahead in time.

The host is:
  • One Dual-core Intel Xeon 5160 -- 3.00GHz; 12 GB
  • "SUSE Linux Enterprise Server 10 SP1 (x86_64)"
  • VMware-server-1.0.4-56528 (the problem was also there for version 1.0.2)
  • cpufreq governor set to "performance" (so cpu frequency is always at 3 Ghz)
  • No other apps running except for vmware

The guest is:
  • Windows Server 2003 Enterprise
  • 1 processor; 1 GB
  • c:\windows\system32\hal.dll internal name is halaacpi.dll
  • default "boot.ini"
  • Running VMware tools with time synchronization enabled
  • Running a database and other "periodic" daemons/services

Let me know if you have any questions or advice.
Reply Re: Guest OS' clock runs too fast Oct 23, 2007 2:18 PM
Click to view rubio's profile Lurker rubio 3 posts since
Oct 19, 2007
I also disabled processor power management in the BIOS as recommended here (http://communities.vmware.com/thread/106492?tstart=0). But the problem is still present.
Reply Re: Guest OS' clock runs too fast Oct 23, 2007 4:13 PM
Click to view rubio's profile Lurker rubio 3 posts since
Oct 19, 2007
BTW, the host is configured for 250 Hz (4ms):

% gunzip -c /proc/config.gz | grep CONFIG_HZ
CONFIG_HZ_250=y
CONFIG_HZ=250
Reply Re: Guest OS' clock runs too fast Oct 24, 2007 2:51 PM
Click to view Jim VandeVegt's profile Lurker Jim VandeVegt 3 posts since
Jul 23, 2007

I have the same situation. Both WinXP and Linux guests are running way fast.

No published fixes have had any effect. I first noticed the problem when I went to v1.0.3 and 64-bit and a dual-core host.

I am running 1.0.2 on 64-bit SLES 9 on a single-core AMD Athlon64 with no problems. WinXP guests stay right on target.

Reply Re: Guest OS' clock runs too fast Nov 20, 2007 4:38 AM
in response to: Jim VandeVegt
Click to view Knobee's profile Enthusiast Knobee 63 posts since
Jan 21, 2004
Well, I hate to say it, but this is the "never ending question". If we could get a good, definitive answer on this one, I'd be overjoyed.

Anyone?


I'm running on a Dell 6650 with 3 physical CPUs (6 cores) with Ubuntu 7.04 on the physical hardware (no skew), vmware server 1.0.3(?) and seeing time skew of about 1.5x on guests running FreeBSD 6.2 and other Linux variants

Help!

Message was edited by: Knobee to add version information

Reply Re: Guest OS' clock runs too fast Nov 21, 2007 9:34 AM
in response to: Knobee
Click to view chanla's profile Lurker chanla 2 posts since
Nov 21, 2007

I am very annouying with this never ending clock problem...

My host is Dell Laptop with 2GHz Core 2 Duo running Windows XP. I am using VMWare Workstation 6.0.2.

My guest is Linux 2.6.23.1 with the latest vmware tools installed and running.

I have pretty much tried every trick I can find on how to fix the fast clock problem, but nothing seems to work. My linux guest is not useable because the clock is running about 2x or 3x real time.

Setting the host config with:

host.cpukHz = "2000000"
host.noTSC = "TRUE"
ptsc.noTSC = "TRUE"

didn't seem to help. I also need to add the kernel option noapic to linux with that config.

I have tried two different clock settings for linux: clock=pit notsc and clock=mptmr and no luck with either.

I set the kernel config to use 100Hz clock. Didn't help.

Now im just tinkering with different kernal options in the kernel config in hopes that disabling something will make it start working...

Anyone else have any luck with this problem?

Andrew

Reply Re: Guest OS' clock runs too fast Nov 21, 2007 12:59 PM
in response to: chanla
Click to view chanla's profile Lurker chanla 2 posts since
Nov 21, 2007

After playing with the timing issues for a couple hours today I figured out that the guest OS runs perfectly as long as my laptop is on AC power when it boots. If the AC power goes away and comes back, it doesn't work without a reboot.

Andrew

Reply Re: Guest OS' clock runs too fast Mar 18, 2008 11:44 AM
in response to: chanla
Click to view Steve-J's profile Lurker Steve-J 3 posts since
Dec 3, 2007

might want to try this to get the cpu freq

cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq

use that result for the first line of :

host.cpukHz = 1833000
host.noTSC = TRUE
ptsc.noTSC = TRUE

and insert this into the /etc/vmware/config

I don't believe you use quotes around the values


Reply Re: Guest OS' clock runs too fast Mar 20, 2008 2:47 PM
Click to view AWo's profile Virtuoso AWo 2,910 posts since
Nov 27, 2003
Enable the VMware TimeTracker logging:

Add
timeTracker.periodicStats="True"
timeTracker.statsIntercal="10" (for 10 sec. tracking intervall"

to the guests .vmx file (guest needs to be restarted) and post the entries from vmware.log (start with "TimeTrackerStats").

General background:

The issue with virtualization and (mostly) Linux guests is, that Linux (and other OS's, too) are using the PIT (Programmable Interrupt Timer) to count the timer ticks. Linux requests a timer interrupt in frequencies of 100 - 1000 Hz per OS instance + per (virtual) processor (n+1). One bad thing about that is, that this will consume ressources, even if the system itself is idle.

The other bad thing is that only the guest which actually owns the processor receives the interrupt, so many interrupts are lost (Lost Timer Tick). That's why the time of a virtualized machine would always run too slow, if there is no compensation.
Windows uses the PIT, too, and other different mechanisms/time sources which can even change if you install software, for example Apple's Quick Time.

As loosing these ticks happens on hardware, as well, there is a Lost Timer Tick correction algorithm within Linux to compensate this. This works well enough on pure hardware.
But there's a second compensation mechanism if you run it onVMware: VMware tracks the interrupts lost and sends them in a timely compressed manner to the guest later (in fact not all are send, some lost ticks needs to be deleted by the Vmware time management). That's the reason why the time doesn't run consistent and seems to "jump" sometimes.

So there are two mechanisms to keep the time accurate and that could lead to a clock running too fast (overcompensation). There is no way to slow it down with the VMware tools, yet, nor do they set the time back. Slowing down the clock is planned for a future release of the tools.

The suboptimal usage of the PIT has changed from Kernel 2.6.18 for 32 Bit / 2.6.21 64 Bit. In newer Kernels Linux uses a different lock source (TSC, Time Stamp Counter) where it can read the time directly (has not to count the ticks to generate the time) and without using an interrupts. Another advantage is that his time device can be read faster that the PIT.

AWo

Reply Re: Guest OS' clock runs too fast Nov 26, 2008 1:07 AM
in response to: chanla
Click to view dubek's profile Lurker dubek 1 posts since
Nov 26, 2008
We had the same problem (guest clock running too fast), and solved it using Steve-J's solution from above.

Our setup is as follows:

  • Host: Dell R200 server, CentOS 5.2, Kernel 2.6.18-92.1.18.el5PAE (SMP)
  • Guest: 2 processors (this is a definition in the vmx file), CentOS 4.6, Kernel 2.6.9-78.0.8.ELsmp

We just followed Steve-J's steps; on the host:

# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
2133000


And then use that number when adding these lines to the end of /etc/vmware/config :

host.cpukHz = 2133000
host.noTSC = "TRUE"
ptsc.noTSC = "TRUE"


Then restart the vmware server:

service vmware restart
Actions