[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 18.12.2019 13:56, 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.

Hmm, a quick test proves what you say, but I'm uncertain relying
on it is a good idea. Especially with -Os the compiler _should_
really emit a library call.

Jan

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