[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2] viridian: unify time sources
> -----Original Message----- > From: Alexandru Stefan ISAILA <aisaila@xxxxxxxxxxxxxxx> > Sent: 21 June 2019 14:49 > To: Paul Durrant <Paul.Durrant@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx > Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; Wei Liu <wl@xxxxxxx>; Jan > Beulich <jbeulich@xxxxxxxx>; > Roger Pau Monne <roger.pau@xxxxxxxxxx> > Subject: 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. The offset is actually negative most of the time but the resulting reference time should be unsigned so the return type of time_ref_count() does need fixing. Paul > > > -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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |