[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <586c04a6672bf15d4bc82d64d96aed6417b6e874.camel@amazon.co.uk>
Date: Wed, 10 Apr 2024 10:08:29 +0000
From: "Allister, Jack" <jalliste@...zon.co.uk>
To: "dongli.zhang@...cle.com" <dongli.zhang@...cle.com>
CC: "dwmw2@...radead.org" <dwmw2@...radead.org>, "corbet@....net"
<corbet@....net>, "seanjc@...gle.com" <seanjc@...gle.com>, "bp@...en8.de"
<bp@...en8.de>, "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"x86@...nel.org" <x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Allister,
Jack" <jalliste@...zon.co.uk>, "linux-doc@...r.kernel.org"
<linux-doc@...r.kernel.org>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"paul@....org" <paul@....org>, "mingo@...hat.com" <mingo@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>, "pbonzini@...hat.com"
<pbonzini@...hat.com>
Subject: Re: [PATCH 1/2] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for KVM clock
drift fixup
> Would the above rely not only on TSC clocksource, but also
> ka->use_master_clock==true?
Yes this should only be in the case of master clock. Extra verification
to check this for both GET/SET should be present.
> What will happen if the vCPU=0 (e.g., BSP) thread is racing with here
> to update the vcpu->arch.hv_clock?
> In addition to live migration, can the user call this API any time
> during the VM is running (to fix the clock drift)? Therefore, any
> requirement to protect the update of kvmclock_offset from racing?
This should occur when none of the vCPUs are running, in the context of
a live-migration/update this would be after deserialization before the
resume. I may have been unintentionally misleading here describing some
of the problem space. There isn't a "drift" per say when a VM is
running and the PVTI stays constant. It's more the relationship between
the TSC & PV clock changes due to inaccuracy when KVM decides to
generate that information, e.g on a live-update/migration KVM will
perform the update. The KVM_REQ_MASTERCLOCK_UPDATE is just an example
as to how to simulate/trigger this.
I've posted a V2 which hopefully addresses some of above and makes it
clearer overall the aim behind the patches.
Powered by blists - more mailing lists