From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xen.org
Cc: David Vrabel <david.vrabel@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 1/3] xen: sync the CMOS RTC as well as the Xen wallclock
Date: Fri, 12 Oct 2012 13:57:12 +0100	[thread overview]
Message-ID: <1350046634-2462-2-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1350046634-2462-1-git-send-email-david.vrabel@citrix.com>
From: David Vrabel <david.vrabel@citrix.com>
If NTP is used in dom0 and it is synchronized to its clock source,
then the kernel will periodically synchronize the Xen wallclock with
the system time.  Updates to the Xen wallclock do not persist across
reboots, so also synchronize the CMOS RTC (as on bare metal).
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
 arch/x86/xen/time.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 0296a95..5e7f536 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -14,6 +14,7 @@
 #include <linux/kernel_stat.h>
 #include <linux/math64.h>
 #include <linux/gfp.h>
+#include <linux/mc146818rtc.h>
 
 #include <asm/pvclock.h>
 #include <asm/xen/hypervisor.h>
@@ -208,6 +209,10 @@ static int xen_set_wallclock(unsigned long now)
 	if (!xen_initial_domain())
 		return -1;
 
+	/* Set the hardware RTC. */
+	mach_set_rtc_mmss(now);
+
+	/* Set the Xen wallclock. */
 	op.cmd = XENPF_settime;
 	op.u.settime.secs = now;
 	op.u.settime.nsecs = 0;
-- 
1.7.2.5
next prev parent reply	other threads:[~2012-10-12 12:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12 12:57 [PATCH 0/3] xen: fix various wallclock problems David Vrabel
2012-10-12 12:57 ` David Vrabel [this message]
2012-10-12 14:57   ` [PATCH 1/3] xen: sync the CMOS RTC as well as the Xen wallclock Konrad Rzeszutek Wilk
2012-10-12 16:13     ` David Vrabel
2012-10-12 12:57 ` [PATCH 2/3] xen: add correct 500 ms offset when setting " David Vrabel
2012-10-15  9:25   ` Ian Campbell
2012-10-15 12:21     ` David Vrabel
2012-10-15 12:27       ` Ian Campbell
2012-10-12 12:57 ` [PATCH 3/3] xen/privcmd: add IOCTL_PRIVCMD_SYNC_WALLCLOCK to sync Xen's wallclock David Vrabel
2012-10-12 13:41   ` Konrad Rzeszutek Wilk
2012-10-12 14:02     ` David Vrabel
2012-10-12 14:29       ` Konrad Rzeszutek Wilk
2012-10-12 14:59         ` David Vrabel
2012-10-12 15:02           ` Konrad Rzeszutek Wilk
2012-10-12 16:14             ` David Vrabel
2012-10-12 16:16               ` Konrad Rzeszutek Wilk
2012-10-12 16:30                 ` David Vrabel
2012-10-12 16:25 ` [PATCH 0/3] xen: fix various wallclock problems David Vrabel
2012-10-15  9:26   ` Ian Campbell
2012-10-15 12:23     ` David Vrabel
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=1350046634-2462-2-git-send-email-david.vrabel@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xen.org \
    /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).