From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Fitzhardinge Subject: Re: [PATCH 0 of 5] PV on HVM Xen Date: Tue, 16 Mar 2010 11:26:14 -0700 Message-ID: <4B9FCD46.5090705@goop.org> References: <201003151205.29964.sheng@linux.intel.com> <4B9EBE03.4080105@goop.org> <4B9FBE94.4020303@goop.org> <4B9FC2B5.20103@goop.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Stefano Stabellini Cc: "xen-devel@lists.xensource.com" , Sheng Yang List-Id: xen-devel@lists.xenproject.org On 03/16/2010 11:06 AM, Stefano Stabellini wrote: > 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. > That seems pretty fragile. I don't think EPOCH is part of the ABI, and I don't think we should be relying on it. J