#
1fea96d1 |
|
30-Jan-2018 |
Mike Krinkin <krinkin@google.com> |
[kernel][hypervisor] KVM clock support in hypervisor KVM/Xen paravirtualized clock API consists of monotonic clock source (we refer to it as system time) and fixed point in time (we refer to it as boot time), and boot time + system time should give current wall time. Since system time is supposed to be monotonic it means that boot time may be adjusted (for example, by NTP) and therefore we use sys_get_clock to get boot time. System time is exported per VCPU and periodically updated by host. TSC is used to adjust system time value in the guest between those updates. We update system time on VCPU resume. Getting system time in the guest is expected to be fast, but boot time on the other hand is not expected to be fast and only guaranteed to be updated by host after MSR write from guest and therefore incurs vmexit. Despite the name boot time doesn't need to be guest boot time. In KVM it's actually host boot time and we use the same boot time for this implementation. And one comment regarding naming. KVM and Xen use the same structures layout for paravirtualized clock, but KVM uses MSRs to communicate with guests and Xen uses PV ops for that. So data strcutures are common and use prefix pv or Pv, while constants describing MSRs and KVM specific flags use Kvm prefix. Change-Id: I81cdbd893985ad17bcf5f163e652ec1bb63feacb
|