From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: [PATCH 2/3] xen: add correct 500 ms offset when setting Xen wallclock Date: Fri, 12 Oct 2012 13:57:13 +0100 Message-ID: <1350046634-2462-3-git-send-email-david.vrabel@citrix.com> References: <1350046634-2462-1-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-1-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: xen-devel@lists.xen.org Cc: David Vrabel , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org From: David Vrabel update_persistent_wallclock() (and hence xet_set_wallclock()) is called 500 ms after the second. 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); -- 1.7.2.5