xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Phil Evans <Phil.Evans@m247.com>
Cc: Yang Zhang <yang.z.zhang@Intel.com>,
	Jan Beulich <jbeulich@suse.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: Ever increasing time offset for HVM domain / Huge amounts of drift
Date: Thu, 17 Jan 2013 13:55:27 +0000	[thread overview]
Message-ID: <20130117135527.GD19975@ocelot.phlegethon.org> (raw)
In-Reply-To: <EADC3DF254630D49B534B802EE82035836A3345D@office-server2.m247.local>

Hi, 

At 13:37 +0000 on 14 Jan (1358170621), Phil Evans wrote:
> I am currently running Xen 4.2.1 (this has also happened in 4.2.0 as
> well).  We have been having a major problem with sometimes huge
> amounts of clock drift in Windows VMs.  Sometimes the clock on a VM
> could suddenly jump by over a week (usually forwards, however time has
> been known to go backwards as well).
> 
> The steps to reproduce this (for me at least), is to simply do a
> manual NTP sync on a Windows VM.  Upon monitoring the qemu-dm log file
> for the VM, I see similar to the following:

Which version of Windows are you using for this?
Did you see this on older (4.1.x) Xen versions?

> Time offset set 489, added offset 480
> Time offset set 436, added offset -53
> Time offset set 496, added offset 60
> Time offset set 494, added offset -2
> Time offset set 554, added offset 60
> Time offset set 565, added offset 11
> Time offset set 606, added offset 41
> Time offset set -1974, added offset -2580
> Time offset set 1626, added offset 3600
> Time offset set 1579, added offset -47
> Time offset set 1639, added offset 60
> 
> It seems to add the same number of seconds to the offset as has passed
> since the last sync.

This printout is from some code that gets given a _change_ in time
offset from Xen; it prints out the new value and the change, so they
should always add up like that.

But yes, it's striking that the VM is (mostly) drifting forward over
time. 

>  The offset just keeps on increasing, eventually
> resulting in huge numbers equating to days.  Occasionally the offset
> may jump a bit and go down but the general trend is up.  Although this
> does not affect the VM immediately, at some point I am guessing it
> syncs itself with the CMOS clock (which is now a large number of
> seconds offset from the actual time), resulting in a huge jump in
> time.  A reboot is a guaranteed way to get the new, incorrect time.

That makes sense; if the RTC is being set to the wrong time, a reboot
will copy the error into the new OS time. 

> Although I do not understand all of the underlying code, I presume the
> correct way this should work is it should be comparing the CMOS time
> that?s just been set with the hardware clock on the physical machine,
> resulting in an offset between the two.

More or less.  In fact IIRC it compares it with current CMOS time, and
propagates the difference into an offset from hardware-clock.

It's possible that the code to calculate 'current CMOS time' for a VM is
buggy -- that was changed in 4.2.  Cc'ing the people who touched that
code in 4.2 for their opinions.

Tim.

  parent reply	other threads:[~2013-01-17 13:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 13:37 Ever increasing time offset for HVM domain / Huge amounts of drift Phil Evans
2013-01-14 15:14 ` Pasi Kärkkäinen
2013-01-14 16:17   ` Phil Evans
2013-01-14 16:30     ` Pasi Kärkkäinen
2013-01-14 16:52       ` Phil Evans
2013-01-14 16:54         ` Pasi Kärkkäinen
2013-01-14 17:10           ` Phil Evans
2013-01-14 23:57         ` Dan Magenheimer
2013-01-17 13:55 ` Tim Deegan [this message]
2013-01-17 16:41   ` [PATCH] " Tim Deegan
2013-01-17 17:02     ` Jan Beulich
2013-01-17 17:13       ` Tim Deegan
2013-01-18  1:45     ` Zhang, Yang Z
2013-01-18 11:17     ` Phil Evans
2013-01-24 13:38       ` Pasi Kärkkäinen
2013-01-24 13:56         ` Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2013-01-10 18:27 Phil Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130117135527.GD19975@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=Phil.Evans@m247.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xen.org \
    --cc=yang.z.zhang@Intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).