[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/3] xen: sync the CMOS RTC as well as the Xen wallclock



On 12/10/12 15:57, Konrad Rzeszutek Wilk wrote:
> On Fri, Oct 12, 2012 at 01:57:12PM +0100, David Vrabel wrote:
>> From: David Vrabel <david.vrabel@xxxxxxxxxx>
>>
>> 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@xxxxxxxxxx>
>> ---
>>  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);
> 
> So how does this work? Is the hypervisor traping on the RTC CMOS clock?

It's works the same as with the RTC driver.  I think the hypervisor
allows dom0 access to the relevant I/O ports.

It's worth pointing out that mach_set_rtc_mmss() only sets the minutes
and seconds so it doesn't handle big step changes which is why
update_persistent_clock() is only called once NTP is synchronized.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.