WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 0 of 5] PV on HVM Xen

On Tue, 16 Mar 2010, Jeremy Fitzhardinge wrote:
> On 03/16/2010 10:32 AM, Stefano Stabellini wrote:
> > Actually I think Ian is right, we can do it without a new hypercall: if
> > we assume tsc_mode=2 then this simple patch makes the pv clocksource work
> > fine without any set_tsc_offset(v, 0) in xen:
> >    
> 
> Can we detect if this patch is present in Xen or not?  If not, we may 
> need to go back to having a feature flag.
> 

the following is the interesting bit of the pvclock interface:

static __always_inline
u64 pvclock_get_nsec_offset(const struct pvclock_vcpu_time_info *src)
{
        u64 delta = __native_read_tsc() - src->tsc_timestamp;
        return scale_delta(delta, src->tsc_to_system_mul, src->tsc_shift);
}


xen refreshes the values in pvclock_vcpu_time_info every EPOCH (1s),
therefore if the value returned by pvclock_get_nsec_offset is greater
than EPOCH than the patch is not present in xen.

This is a simple way of detecting if the offset is taken into account or
not and it works because the offset is the value returned by rdtsc in
the host when the VM was created and we can be sure it corresponds to
more than 1 sec.


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