[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/time: implement PVCLOCK_TSC_STABLE_BIT
commit fe0364d29323cf2acccdf37d000f6c2f2f7267df Author: Joao Martins <joao.m.martins@xxxxxxxxxx> AuthorDate: Fri Sep 23 18:25:49 2016 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Sep 23 18:25:49 2016 +0200 x86/time: implement PVCLOCK_TSC_STABLE_BIT This patch proposes relying on host TSC synchronization and passthrough to the guest, when running on a TSC-safe platform. On time_calibration we retrieve the platform time in ns and the counter read by the clocksource that was used to compute system time. We can guarantee that on a platform with a constant and reliable TSC, that the time read on vcpu B right after A is bigger independently of the VCPU calibration error. Since pvclock time infos are monotonic as seen by any vCPU set PVCLOCK_TSC_STABLE_BIT, which then enables usage of VDSO on Linux. IIUC, this is similar to how it's implemented on KVM. Add also a comment regarding this bit changing and that guests are expected to check this bit on every read. Should note that I've yet to see time going backwards in a long running test I ran for 2 weeks (in a dual socket machine), plus few other tests I did on older platforms. Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/time.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 128e653..d307d93 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -955,6 +955,14 @@ static void __update_vcpu_system_time(struct vcpu *v, int force) _u.tsc_timestamp = tsc_stamp; _u.system_time = t->stamp.local_stime; + /* + * It's expected that domains cope with this bit changing on every + * pvclock read to check whether they can resort solely on this tuple + * or if it further requires monotonicity checks with other vcpus. + */ + if ( clocksource_is_tsc() ) + _u.flags |= XEN_PVCLOCK_TSC_STABLE_BIT; + if ( is_hvm_domain(d) ) _u.tsc_timestamp += v->arch.hvm_vcpu.cache_tsc_offset; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |