From mboxrd@z Thu Jan 1 00:00:00 1970 From: ANNIE LI Subject: Re: how to keep time of windows pvhvm synchronized with host after resuming Date: Fri, 17 Sep 2010 18:44:58 +0800 Message-ID: <4C9346AA.4040902@oracle.com> References: <4C91D5C0.5030802@oracle.com> <291EDFCB1E9E224A99088639C47620228CF769FEC1@LONPMAILBOX01.citrite.net> <20100916091914.GC11387@whitby.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1227423903==" Return-path: In-Reply-To: <20100916091914.GC11387@whitby.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Tim Deegan Cc: Paul Durrant , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --===============1227423903== Content-Type: multipart/alternative; boundary="------------050801020304020002060805" This is a multi-part message in MIME format. --------------050801020304020002060805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > More specifically, they're what you should add to the current Xen system > time to get the wallclock time (they can change over time as the system > time drifts). I'm surprised to hear that they're zero. Even if dom0 > isn't updating them (which IIRC pv-ops dom0 doesn't) they should have > been set from the RTC at boot time. It's possible that your domain's > shared-info page is in the wrong word size - if you haven't set up a > hypercall page or set HVM_PARAM_CALLBACK_IRQ since the domain was > created (i.e. since restore) it might be wrong. > Maybe this is not a problem of shared-info page. The problem is wc_sec and wc_nsec does not change until i modify wallclock time of windows vm manually. If i do not change the wallclock, wc_sec will keep the same value. For example: the initial value of wc_sec is zero, then it changes to 0x4c64da92 if i change wallclock, 0x4c64da92 is about 40 years since 1970. I am using xen3.4 for test, any patch i missed? Thanks Annie > One problem with using wc_[n]sec to get the wallclock time is that the > usual Xen way to get the system time is to interpolate it from the RDTSC > value and the per-vcpu time info, but in a HVM guest the OS may have > changed the TSC offset to something that the driver can't figure out. > The Citrix PV drivers use the HVMOP_get_time hypercall to get the system > time instead; that hypercall is in xen-unstable but not the 4.0 branch. > > If you're using a linux guest with Stefano's pv-on-hvm patches then I > think you should be able to read the PV system time as normal. > > Tim. > > >> Paul >> >> >>> -----Original Message----- >>> From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel- >>> bounces@lists.xensource.com] On Behalf Of ANNIE LI >>> Sent: 16 September 2010 09:31 >>> To: xen-devel@lists.xensource.com >>> Subject: [Xen-devel] how to keep time of windows pvhvm synchronized >>> with host after resuming >>> >>> Hi >>> >>> When the virtual machine is resumed from suspend, the guest >>> operating >>> system's wall-clock time remains at the value it had at the time of >>> the >>> suspension. For linux pvm, we can avoid resolve issue by setting >>> independent_wallclock=0. However, HVM(or PVHVM) does not support >>> this >>> feature. >>> >>> I did some investigation on how to implement this in windows >>> para-virtualization driver. In \include\xen\interface\xen.h, there >>> are >>> several variables about timer such as: wc_sec and wc_nsec, and >>> vcpu_time_info struct. It is very strange, wc_sec and wc_nsec is >>> always >>> zero for my windows vm with para-virtualization driver. >>> Vcpu_time_info >>> only contains time info for specific vcpu. Should i use those >>> variables >>> to get accurate time for VM? Is there any corresponding source code >>> or >>> algorithms available now? Is it safe to simply update vm time after >>> resuming? >>> >>> Citrix 5.6 Windows para-virtualization driver will notify windows >>> kernel >>> time change after resuming, and resumed windows vm with Citrix pv >>> driver >>> can keep it's time synchronized with host. Would you like to give me >>> some clues about how to implement this? >>> >>> Any help is greatly appreciated. >>> >>> Thanks >>> Annie >>> >>> _______________________________________________ >>> Xen-devel mailing list >>> Xen-devel@lists.xensource.com >>> http://lists.xensource.com/xen-devel >>> > > Content-Description: ATT00001..txt > >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel >> > > > --------------050801020304020002060805 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
More specifically, they're what you should add to the current Xen system
time to get the wallclock time (they can change over time as the system
time drifts).  I'm surprised to hear that they're zero.  Even if dom0
isn't updating them (which IIRC pv-ops dom0 doesn't) they should have
been set from the RTC at boot time.  It's possible that your domain's
shared-info page is in the wrong word size - if you haven't set up a
hypercall page or set HVM_PARAM_CALLBACK_IRQ since the domain was
created (i.e. since restore) it might be wrong. 
  
Maybe this is not a problem of shared-info page.
The problem is wc_sec and wc_nsec does not change until i modify wallclock time of windows vm manually.
If i do not change the wallclock, wc_sec will keep the same value. For example: the initial value of wc_sec is zero,
then it changes to 0x4c64da92 if i change wallclock, 0x4c64da92 is about 40 years since 1970.

I am using xen3.4 for test, any patch i missed?

Thanks
Annie
One problem with using wc_[n]sec to get the wallclock time is that the
usual Xen way to get the system time is to interpolate it from the RDTSC
value and the per-vcpu time info, but in a HVM guest the OS may have
changed the TSC offset to something that the driver can't figure out.
The Citrix PV drivers use the HVMOP_get_time hypercall to get the system
time instead; that hypercall is in xen-unstable but not the 4.0 branch.

If you're using a linux guest with Stefano's pv-on-hvm patches then I
think you should be able to read the PV system time as normal.

Tim.

  
  Paul

    
-----Original Message-----
From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-
bounces@lists.xensource.com] On Behalf Of ANNIE LI
Sent: 16 September 2010 09:31
To: xen-devel@lists.xensource.com
Subject: [Xen-devel] how to keep time of windows pvhvm synchronized
with host after resuming

Hi

When the virtual machine is resumed from suspend, the guest
operating
system's wall-clock time remains at the value it had at the time of
the
suspension. For linux pvm, we can avoid resolve issue by setting
independent_wallclock=0. However, HVM(or PVHVM) does not support
this
feature.

I did some investigation on how to implement this in windows
para-virtualization driver. In \include\xen\interface\xen.h, there
are
several variables about timer such as: wc_sec and wc_nsec, and
vcpu_time_info struct. It is very strange, wc_sec and wc_nsec is
always
zero for my windows vm with para-virtualization driver.
Vcpu_time_info
only contains time info for specific vcpu. Should i use those
variables
to get accurate time for VM? Is there any corresponding source code
or
algorithms available now? Is it safe to simply update vm time after
resuming?

Citrix 5.6 Windows para-virtualization driver will notify windows
kernel
time change after resuming, and resumed windows vm with Citrix pv
driver
can keep it's time synchronized with host. Would you like to give me
some clues about how to implement this?

Any help is greatly appreciated.

Thanks
Annie

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
      

Content-Description: ATT00001..txt
  
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
    


  
--------------050801020304020002060805-- --===============1227423903== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1227423903==--