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

Re: [Xen-devel] [PATCH for-next 7/7] x86: implement Hyper-V clock source



On Wed, Dec 18, 2019 at 12:56:41PM +0000, Andrew Cooper wrote:
> On 18/12/2019 12:51, Jan Beulich wrote:
> >>>> +        scale = tsc_page->tsc_scale;
> >>>> +        offset = tsc_page->tsc_offset;
> >>>> +
> >>>> +        smp_rmb();
> >>>> +
> >>>> +    } while (tsc_page->tsc_sequence != seq);
> >>>> +
> >>>> +    /* x86 has ARCH_SUPPORTS_INT128 */
> >>>> +    ret = (uint64_t)(((__uint128_t)tsc * scale) >> 64) + offset;
> >>> The final cast isn't really needed, is it? As to the multiplication
> >>> - are you sure all compilers in all cases will avoid falling back
> >>> to a library call here? In other similar places I think we use
> >>> inline assembly instead.
> >> What library call? A function in libgcc (or clang's equivalence)?
> >> ISTR libgcc is always linked, but I could be wrong here.
> > No, the hypervisor (at least the x86 one) doesn't link libgcc afaik.
> 
> x86 can multiply uint128_t by uint64_t without a library call.  If this
> compiles, then it should be fine.

This obviously compiles fine for me. But Jan's comment was more about
making sure all possible x86 compilers can deal with it. I don't have a
definitive answer to that.

Wei.

> 
> ~Andrew

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