Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335416
| From | Marcelo Tosatti <mtosatti@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 4/4] KVM: x86: track actual TSC frequency from the timekeeper struct |
| Date | 2016-02-16 15:10 +0100 |
| Message-ID | <r2Ouf-rL-17@gated-at.bofh.it> (permalink) |
| References | <qZVLA-74r-25@gated-at.bofh.it> <qZVLB-74r-37@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Feb 08, 2016 at 04:18:31PM +0100, Paolo Bonzini wrote:
> When an NTP server is running, it may adjust the time substantially
> compared to the "official" frequency of the TSC. A 12 ppm change
> sums up to one second per day.
>
> This already shows up if the guest compares kvmclock with e.g. the
> PM timer. It shows up even more once we add support for the Hyper-V
> TSC page, because the guest expects it to be in sync with the time
> reference counter; effectively the time reference counter is just a
> slow path to access the same clock that is in the TSC page.
>
> Therefore, we want kvmclock to provide the host kernel's
> ktime_get_boot_ns() value, at least if the master clock is active.
> To do so, reverse-compute the host's "actual" TSC frequency from
> pvclock_gtod_data and return it from kvm_get_time_and_clockread.
Paolo,
You'd have to generate an update to the guest structures as well,
to reflect the new {mult,shift} values calculated by the host.
Here:
/* disable master clock if host does not trust, or does not
* use, TSC clocksource
*/
if (gtod->clock.vclock_mode != VCLOCK_TSC &&
atomic_read(&kvm_guest_has_master_clock) != 0)
queue_work(system_long_wq, &pvclock_gtod_work);
No?
At first, i'm afraid this might be heavy, so it might be interesting
to rate limit the update operation.
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH 4/4] KVM: x86: track actual TSC frequency from the timekeeper struct Marcelo Tosatti <mtosatti@redhat.com> - 2016-02-16 15:10 +0100
Re: [PATCH 4/4] KVM: x86: track actual TSC frequency from the timekeeper struct Marcelo Tosatti <mtosatti@redhat.com> - 2016-02-16 15:30 +0100
Re: [PATCH 4/4] KVM: x86: track actual TSC frequency from the timekeeper struct Paolo Bonzini <pbonzini@redhat.com> - 2016-02-16 18:10 +0100
Re: [PATCH 4/4] KVM: x86: track actual TSC frequency from the timekeeper struct Marcelo Tosatti <mtosatti@redhat.com> - 2016-02-19 15:20 +0100
Re: [PATCH 4/4] KVM: x86: track actual TSC frequency from the timekeeper struct Paolo Bonzini <pbonzini@redhat.com> - 2016-02-19 17:00 +0100
csiph-web