Thomas Lefebvre <[email protected]> writes: ...
> > Under Hyper-V, raw RDTSC values are not consistent across vCPUs. > The hypervisor corrects them only through the TSC page scale/offset. > If pvclock_update_vm_gtod_copy() runs on CPU 0 and __get_kvmclock() > later runs on CPU 1 where the raw TSC is lower, the unsigned > subtraction wraps. > According to the TLFS, reference TSC page is partition wide: "The hypervisor provides a partition-wide virtual reference TSC page which is overlaid on the partition’s GPA space. A partition’s reference time stamp counter page is accessed through the Reference TSC MSR." so if as you say RAW rdtsc value is inconsistent across vCPUs, I can hardly see how we can use this time source at all, even without KVM. scale/offset are the same for all vCPUs. I think the fix here is to avoid setting up Hyper-V TSC page clocksource in L1. Unfortunately, with unsynchronized TSCs this will leave us the only choice for a sane clocksource: raw HV_X64_MSR_TIME_REF_COUNT MSR reads. -- Vitaly

