[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 06/14] x86/time.c: Scale host TSC in pvclock properly
On 12/06/2015 03:58 PM, Haozhong Zhang wrote: This patch makes the pvclock return the scaled host TSC and corresponding scaling parameters to HVM domains if guest TSC is not emulated and TSC scaling is enabled. Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx> +Joao who has been staring at this code.Joao, can you run this series through your test with non-native frequency? (http://lists.xenproject.org/archives/html/xen-devel/2015-12/msg00683.html provides an interface to set it in config file). --- xen/arch/x86/time.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 95df4f1..732d1e9 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -815,10 +815,18 @@ static void __update_vcpu_system_time(struct vcpu *v, int force) } else { - tsc_stamp = t->local_tsc_stamp; - - _u.tsc_to_system_mul = t->tsc_scale.mul_frac; - _u.tsc_shift = (s8)t->tsc_scale.shift; + if ( is_hvm_domain(d) && cpu_has_tsc_ratio ) + { + tsc_stamp = hvm_funcs.scale_tsc(v, t->local_tsc_stamp); + _u.tsc_to_system_mul = d->arch.vtsc_to_ns.mul_frac; + _u.tsc_shift = d->arch.vtsc_to_ns.shift; I am not sure this is correct (which is why I asked Joao to look at this and test). The scaler below is calculated as result of TSC calibration across physical CPUs and what you use above (vtsc_to_ns) is an uncalibrated value. -boris + } + else + { + tsc_stamp = t->local_tsc_stamp; + _u.tsc_to_system_mul = t->tsc_scale.mul_frac; + _u.tsc_shift = (s8)t->tsc_scale.shift; + } }_u.tsc_timestamp = tsc_stamp; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |