[PATCH v7 3/6] KVM: x86: Report host tsc and realtime values in KVM_GET_CLOCK

Paolo Bonzini pbonzini at redhat.com
Fri Sep 24 01:30:59 PDT 2021


On 20/08/21 14:46, Marcelo Tosatti wrote:
> On Mon, Aug 16, 2021 at 12:11:27AM +0000, Oliver Upton wrote:
>> Handling the migration of TSCs correctly is difficult, in part because
>> Linux does not provide userspace with the ability to retrieve a (TSC,
>> realtime) clock pair for a single instant in time. In lieu of a more
>> convenient facility, KVM can report similar information in the kvm_clock
>> structure.
>>
>> Provide userspace with a host TSC & realtime pair iff the realtime clock
>> is based on the TSC. If userspace provides KVM_SET_CLOCK with a valid
>> realtime value, advance the KVM clock by the amount of elapsed time. Do
>> not step the KVM clock backwards, though, as it is a monotonic
>> oscillator.
>>
>> Suggested-by: Paolo Bonzini <pbonzini at redhat.com>
>> Signed-off-by: Oliver Upton <oupton at google.com>
> 
> This is a good idea. Userspace could check if host and destination
> clocks are up to a certain difference and not use the feature if
> not appropriate.
> 
> Is there a qemu patch for it?

Not yet, but Maxim had a patch for a similar series (though with a 
different userspace API).

Paolo




More information about the linux-arm-kernel mailing list