Re: [PATCH] x86/Hyper-V: Fix hv sched clock function return wrong time unit
From: Vitaly Kuznetsov
Date: Wed Mar 25 2020 - 10:28:53 EST
Tianyu Lan <ltykernel@xxxxxxxxx> writes:
>>> @@ -398,7 +399,8 @@ static u64 notrace read_hv_clock_msr_cs(struct clocksource *arg)
>>>
>>> static u64 read_hv_sched_clock_msr(void)
>>> {
>>> - return read_hv_clock_msr() - hv_sched_clock_offset;
>>> + return (read_hv_clock_msr() - hv_sched_clock_offset)
>>> + * (NSEC_PER_SEC / HV_CLOCK_HZ);
>>> }
>>
>> kvmclock seems to have the same (pre-patch) code ...
>
>
> kvm sched clock gets time from pvclock_clocksource_read() and
> the time unit is nanosecond. So there is such issue in KVM code.
>
Ah, true, kvmclock is always 1Ghz so it's reading 'naturally' converts
to ns.
--
Vitaly