From: "Allister, Jack" <jalliste@amazon.co.uk>
To: "dongli.zhang@oracle.com" <dongli.zhang@oracle.com>
Cc: "dwmw2@infradead.org" <dwmw2@infradead.org>,
"corbet@lwn.net" <corbet@lwn.net>,
"seanjc@google.com" <seanjc@google.com>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Allister, Jack" <jalliste@amazon.co.uk>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"paul@xen.org" <paul@xen.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"pbonzini@redhat.com" <pbonzini@redhat.com>
Subject: Re: [PATCH 1/2] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for KVM clock drift fixup
Date: Wed, 10 Apr 2024 10:08:29 +0000 [thread overview]
Message-ID: <586c04a6672bf15d4bc82d64d96aed6417b6e874.camel@amazon.co.uk> (raw)
In-Reply-To: <1195c194-a2cc-6793-009c-376f091be7f0@oracle.com>
> 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.
next prev parent reply other threads:[~2024-04-10 10:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 22:07 [PATCH 0/2] Add API to correct KVM/PV clock drift Jack Allister
2024-04-08 22:07 ` [PATCH 1/2] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for KVM clock drift fixup Jack Allister
2024-04-09 0:34 ` Dongli Zhang
2024-04-09 3:50 ` David Woodhouse
2024-04-10 10:08 ` Allister, Jack [this message]
2024-04-08 22:07 ` [PATCH 2/2] KVM: selftests: Add KVM/PV clock selftest to prove timer drift correction Jack Allister
2024-04-09 0:43 ` Dongli Zhang
2024-04-09 4:23 ` David Woodhouse
2024-04-10 10:15 ` Allister, Jack
2024-04-11 13:28 ` David Woodhouse
2024-04-19 17:13 ` Chen, Zide
[not found] ` <17F1A2E9-6BAD-40E7-ACDD-B110CFC124B3@infradead.org>
2024-04-19 18:43 ` David Woodhouse
2024-04-19 23:54 ` Chen, Zide
2024-04-20 10:32 ` David Woodhouse
2024-04-20 16:03 ` David Woodhouse
2024-04-22 22:02 ` Chen, Zide
2024-04-23 7:49 ` David Woodhouse
2024-04-23 17:59 ` Chen, Zide
2024-04-23 21:02 ` David Woodhouse
2024-04-24 12:58 ` David Woodhouse
2024-04-19 19:34 ` David Woodhouse
2024-04-19 23:53 ` Chen, Zide
2024-04-10 9:52 ` [PATCH v2 0/2] Add API for accurate KVM/PV clock migration Jack Allister
2024-04-10 9:52 ` [PATCH v2 1/2] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for accurate KVM " Jack Allister
2024-04-10 10:29 ` Paul Durrant
2024-04-10 12:09 ` David Woodhouse
2024-04-10 12:43 ` Paul Durrant
2024-04-17 19:50 ` David Woodhouse
2024-04-15 7:16 ` David Woodhouse
2024-04-10 9:52 ` [PATCH v2 2/2] KVM: selftests: Add KVM/PV clock selftest to prove timer correction Jack Allister
2024-04-10 10:36 ` Paul Durrant
2024-04-12 8:19 ` Dongli Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=586c04a6672bf15d4bc82d64d96aed6417b6e874.camel@amazon.co.uk \
--to=jalliste@amazon.co.uk \
--cc=1195c194-a2cc-6793-009c-376f091be7f0@oracle.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=dongli.zhang@oracle.com \
--cc=dwmw2@infradead.org \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).