From: Ian Campbell Subject: Re: [PATCH 2/3] xen: add correct 500 ms offset when setting Xen wallclock Date: Mon, 15 Oct 2012 10:25:21 +0100 Message-ID: <1350293121.18058.10.camel@zakaz.uk.xensource.com> References: <1350046634-2462-1-git-send-email-david.vrabel@citrix.com> <1350046634-2462-3-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1350046634-2462-3-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: Konrad Rzeszutek Wilk , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Fri, 2012-10-12 at 13:57 +0100, David Vrabel wrote: > From: David Vrabel > > update_persistent_wallclock() (and hence xet_set_wallclock()) is > called 500 ms after the second. The comment in sync_cmos_clock says it is called 500ms before the next second. I only mention it to double check that the right semantics for set_wallclock are being implemented, i.e. that we are compensating in the right direction. > xen_set_wallclock() was not > considering this so the Xen wallclock would end up ~500 ms behind the > correct time. > > Signed-off-by: David Vrabel > --- > arch/x86/xen/time.c | 9 +++++++-- > 1 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c > index 5e7f536..11770d0 100644 > --- a/arch/x86/xen/time.c > +++ b/arch/x86/xen/time.c > @@ -212,10 +212,15 @@ static int xen_set_wallclock(unsigned long now) > /* Set the hardware RTC. */ > mach_set_rtc_mmss(now); > > - /* Set the Xen wallclock. */ > + /* > + * Set the Xen wallclock. > + * > + * update_persistent_wallclock() is called ~500 ms after 'now' > + * so add an extra 500 ms. > + */ > op.cmd = XENPF_settime; > op.u.settime.secs = now; > - op.u.settime.nsecs = 0; > + op.u.settime.nsecs = NSEC_PER_SEC / 2; > op.u.settime.system_time = xen_clocksource_read(); > > rc = HYPERVISOR_dom0_op(&op);