From: David Woodhouse <dwmw2@infradead.org>
To: Dongli Zhang <dongli.zhang@oracle.com>,
kvm@vger.kernel.org, x86@kernel.org,
linux-kselftest@vger.kernel.org
Cc: seanjc@google.com, pbonzini@redhat.com, vkuznets@redhat.com,
tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, shuah@kernel.org,
peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, kprateek.nayak@amd.com, jgross@suse.com,
joe.jin@oracle.com, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH 3/5] KVM: x86: account KVM_SET_CLOCK downtime in steal time
Date: Tue, 12 May 2026 06:34:03 +0100 [thread overview]
Message-ID: <82bd3ade27e251ce6bebc03a2c8d12144523cd35.camel@infradead.org> (raw)
In-Reply-To: <87ac4d82-a121-4666-bfa1-8a279133c683@oracle.com>
[-- Attachment #1: Type: text/plain, Size: 1789 bytes --]
On Mon, 2026-05-11 at 14:46 -0700, Dongli Zhang wrote:
>
> Thank you very much!
>
> Based on my understanding, you have two main points:
>
> 1. KVM_CLOCK_REALTIME is not preferred for live migration or live update.
> Essentially, the only acceptable use of KVM_CLOCK_REALTIME is to adjust
> guest_TSC. After that, everything should rely on kvm-clock (especially after
> KVM_SET_CLOCK_GUEST).
>
> 2. Regardless of whether TAI or KVM_CLOCK_REALTIME is used to adjust guest_TSC,
> the calculation of the steal-time delta should always and exclusively be based
> on kvm-clock values before and after the adjustment.
>
> Would you mind confirming whether my understanding of your points is correct?
Yeah, I think so. Let me rephrase it as:
1. Any comparison with "real time" should be used *only* for migrating
the guest TSC to another physical host on live migration. And not on
live update (where the offset from the host TSC remains constant).
The time nerds will go on about UTC/TAI and leap seconds, but you
can mostly ignore them.
2. The KVM clock should be set in terms of the guest TSC, using the
KVM_[GS]ET_CLOCK_GUEST ioctl. (Guests without ->use_master_clock
will sadly have to use real time for restoring the KVM clock too.)
3. Absolutely everything else should be set in terms of the KVM clock
(nanoseconds) or guest TSC (cycles), never with any relation to
'real time'.
Take a look at the selftest I added for Xen steal time, prompted by
this. I posted it as [PATCH 33/30] and it's in my kvmclock5 branch,
collected with a couple of 32-bit build fixes I'll roll into the next
series along with any other review feedback.
https://git.infradead.org/?p=users/dwmw2/linux.git;a=shortlog;h=refs/heads/kvmclock5
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5069 bytes --]
next prev parent reply other threads:[~2026-05-12 5:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 0:30 [PATCH 0/5] Fix and enhance KVM steal accounting for both guest and host Dongli Zhang
2026-05-05 0:30 ` [PATCH 1/5] x86/kvm: Reset prev_steal_time and prev_steal_time_rq when enabling steal time Dongli Zhang
2026-05-05 0:30 ` [PATCH 2/5] KVM: x86: Reset vcpu->arch.st.last_steal " Dongli Zhang
2026-05-08 22:40 ` Sean Christopherson
2026-05-10 17:09 ` David Woodhouse
2026-05-10 18:40 ` David Woodhouse
2026-05-11 21:27 ` Dongli Zhang
2026-05-12 5:46 ` David Woodhouse
2026-05-11 21:26 ` Dongli Zhang
2026-05-05 0:30 ` [PATCH 3/5] KVM: x86: account KVM_SET_CLOCK downtime in " Dongli Zhang
2026-05-10 18:54 ` David Woodhouse
2026-05-10 19:11 ` H. Peter Anvin
2026-05-10 20:13 ` David Woodhouse
2026-05-11 21:46 ` Dongli Zhang
2026-05-12 5:34 ` David Woodhouse [this message]
2026-05-05 0:30 ` [PATCH 4/5] KVM: selftests: Test steal time when re-adding a vCPU on a new thread Dongli Zhang
2026-05-05 0:30 ` [PATCH 5/5] KVM: selftests: Test KVM_SET_CLOCK downtime in steal time 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=82bd3ade27e251ce6bebc03a2c8d12144523cd35.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=bp@alien8.de \
--cc=bsegall@google.com \
--cc=dave.hansen@linux.intel.com \
--cc=dietmar.eggemann@arm.com \
--cc=dongli.zhang@oracle.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=joe.jin@oracle.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vkuznets@redhat.com \
--cc=vschneid@redhat.com \
--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