Re: [PATCH v2 1/3] KVM: x86: implement KVM_{GET|SET}_TSC_STATE

From: Marcelo Tosatti
Date: Thu Dec 10 2020 - 11:42:26 EST


On Wed, Dec 09, 2020 at 09:58:23PM +0100, Thomas Gleixner wrote:
> Marcelo,
>
> On Wed, Dec 09 2020 at 13:34, Marcelo Tosatti wrote:
> > On Tue, Dec 08, 2020 at 10:33:15PM +0100, Thomas Gleixner wrote:
> >> On Tue, Dec 08 2020 at 15:11, Marcelo Tosatti wrote:
> >> > max_cycles overflow. Sent a message to Maxim describing it.
> >>
> >> Truly helpful. Why the hell did you not talk to me when you ran into
> >> that the first time?
> >
> > Because
> >
> > 1) Users wanted CLOCK_BOOTTIME to stop counting while the VM
> > is paused (so we wanted to stop guest clock when VM is paused anyway).
>
> How is that supposed to work w/o the guest kernels help if you have to
> keep clock realtime up to date?

Upon VM resume, we notify NTP daemon in the guest to sync realtime
clock.
>
> > 2) The solution to inject NMIs to the guest seemed overly
> > complicated.
>
> Why do you need NMIs?
>
> All you need is a way to communicate to the guest that it should prepare
> for clock madness to happen. Whether that's an IPI or a bit in a
> hyperpage which gets checked during the update of the guest timekeeping
> does not matter at all.
>
> But you certainly do not need an NMI because there is nothing useful you
> can do within an NMI.
>
> Thanks,
>
> tglx