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

Re: [Xen-devel] [PATCH v4 2/3] x86/svn: Enable TSC scaling



>>> On 16.04.14 at 03:27, <boris.ostrovsky@xxxxxxxxxx> wrote:
> TSC ratio enabling logic is inverted: we want to use it when we
> are running in native tsc mode, i.e. when d->arch.vtsc is zero.
> 
> Also, since now svm_set_tsc_offset()'s calculations depend
> on vtsc's value, we need to call hvm_funcs.set_tsc_offset() after
> vtsc changes in tsc_set_info().
> 
> In addition, with TSC ratio enabled, svm_set_tsc_offset() will
> need to do rdtsc. With that we may end up having TSCs on guest's
> processors out of sync. d->arch.hvm_domain.sync_tsc which is set
> by the boot processor can now be used by APs as reference TSC
> value instead of host's current TSC.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
with two cosmetic remarks:

> @@ -688,11 +688,14 @@ static void svm_set_tsc_offset(struct vcpu *v, u64 
> offset)
>      struct domain *d = v->domain;
>      uint64_t host_tsc, guest_tsc;
>  
> -    guest_tsc = hvm_get_guest_tsc(v);
> +    guest_tsc = hvm_get_guest_tsc_fixed(v, at_tsc);
>  
>      /* Re-adjust the offset value when TSC_RATIO is available */
> -    if ( cpu_has_tsc_ratio && d->arch.vtsc ) {
> -        rdtscll(host_tsc);
> +    if ( cpu_has_tsc_ratio && !d->arch.vtsc ) {

Please fix the coding style violation here if you already touch the line.

> --- a/xen/include/asm-x86/hvm/domain.h
> +++ b/xen/include/asm-x86/hvm/domain.h
> @@ -90,6 +90,12 @@ struct hvm_domain {
>      bool_t                 qemu_mapcache_invalidate;
>      bool_t                 is_s3_suspended;
>  
> +    /*
> +     * TSC value that VCPUs use to calculate their tsc_offset value.
> +     * Used during initialization and save/restore

Stop missing at end of sentence.

Jan


_______________________________________________
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®.