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

Re: [Xen-devel] [PATCH v2] viridian: unify time sources



>   /*
> @@ -136,7 +100,7 @@ static int64_t time_ref_count(const struct domain *d)
>    * 128 bit number which is then shifted 64 times to the right to obtain
>    * the high 64 bits."
>    */

Is there a good reason for using signed offset here? If so then maybe 
you should change the return type or check for bounds.

> -static uint64_t scale_tsc(uint64_t tsc, uint64_t scale, uint64_t offset)
> +static uint64_t scale_tsc(uint64_t tsc, uint64_t scale, int64_t offset)
>   {
>       uint64_t result;
>   
> @@ -153,22 +117,46 @@ static uint64_t scale_tsc(uint64_t tsc, uint64_t scale, 
> uint64_t offset)
>       return result + offset;
>   }
>   
> -static uint64_t time_now(struct domain *d)
> +static uint64_t trc_val(const struct domain *d, int64_t offset)
>   {
>       uint64_t tsc, scale;
>   
> -    /*
> -     * If the reference TSC page is not enabled, or has been invalidated
> -     * fall back to the partition reference counter.
> -     */
> -    if ( !d->arch.hvm.viridian->reference_tsc_valid )
> -        return time_ref_count(d);
> -
> -    /* Otherwise compute reference time in the same way the guest would */
>       tsc = hvm_get_guest_tsc(pt_global_vcpu_target(d));
>       scale = ((10000ul << 32) / d->arch.tsc_khz) << 32;
>   
> -    return scale_tsc(tsc, scale, 0);
> +    return scale_tsc(tsc, scale, offset);
> +}

Alex
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.