[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20EAA3C4-A9F4-4EC1-AE0C-D540CC2E024A@infradead.org>
Date: Tue, 03 Oct 2023 10:12:09 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: Sean Christopherson <seanjc@...gle.com>
CC: Dongli Zhang <dongli.zhang@...cle.com>,
Joe Jin <joe.jin@...cle.com>, x86@...nel.org,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
pbonzini@...hat.com, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com
Subject: Re: [PATCH RFC 1/1] KVM: x86: add param to update master clock periodically
On 3 October 2023 01:53:11 BST, Sean Christopherson <seanjc@...gle.com> wrote:
>I think there is still use for synchronizing with the host's view of time, e.g.
>to deal with lost time across host suspend+resume.
>
>So I don't think we can completely sever KVM's paravirt clocks from host time,
>at least not without harming use cases that rely on the host's view to keep
>accurate time. And honestly at that point, the right answer would be to stop
>advertising paravirt clocks entirely.
>
>But I do think we can address the issues that Dongli and David are obversing
>where guest time drifts even though the host kernel's base time hasn't changed.
>If I've pieced everything together correctly, the drift can be eliminated simply
>by using the paravirt clock algorithm when converting the delta from the raw TSC
>to nanoseconds.
>
>This is *very* lightly tested, as in it compiles and doesn't explode, but that's
>about all I've tested.
Hm, I don't think I like this.
You're making get_monotonic_raw() not *actually* return the monotonic_raw clock, but basically return the kvmclock instead? And why? So that when KVM attempts to synchronize the kvmclock to the monotonic_raw clock, it gets tricked into actually synchronizing the kvmclock to *itself*?
If you get this right, don't we have a fairly complex piece of code that has precisely *no* effect?
Can't we just *refrain* from synchronizing the kvmclock to *anything*, in the CONSTANT_TSC case? Why do we do that anyway?
(Suspend/resume, live update and live migration are different. In *those* cases we may need to preserve both the guest TSC and kvmclock based on either the host TSC or CLOCK_TAI. But that's different.)
Powered by blists - more mailing lists