From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Sean Christopherson <seanjc@google.com>
Subject: [GIT PULL] KVM: x86: Timekeeping fixes+cleanups for 7.4
Date: Thu, 15 Oct 2026 21:44:06 -0700 [thread overview]
Message-ID: <20261016044415.958618-2-seanjc@google.com> (raw)
In-Reply-To: <20261016044415.958618-1-seanjc@google.com>
Part 1 of 2 (or maybe 3) of David's war on kvmclock. Ugh, and when looking at
the shortlog, I realized I botched the author on these:
KVM: x86: Use kernel timekeeping snapshot for monotonic clock
KVM: x86: Use kernel timekeeping snapshot to get walltime+TSC
Holler if you would prefer a fixup to get the author right; these have been in
-next for over a month, so I opted to send them as-is instead of doing a super
last minute rewrite.
The following changes since commit d4b7fb647204f0c81dfeae2d1a708e4d858e0c94:
Merge branch 'kvm-xen-longmode' into HEAD (2026-09-04 17:35:03 +0200)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-clocks-7.4
for you to fetch changes up to d7841275e1fb4ad1e1877e56725ebda5b6e3143d:
KVM: x86: Use kernel timekeeping snapshot to get walltime+TSC (2026-09-11 11:46:19 -0700)
----------------------------------------------------------------
KVM x86 timekeeping fixes and cleanups for 7.4
Fix a variety of warts in KVM's handling of guest TSC, kvmclock, and
timekeeping in general, as a (big) first step towards addressing several
longstanding problems with the kvmclock implementation.
Most notably, fix a precision issue where get_kvmclock_ns() computed the
clock from the *host* TSC without applying guest TSC scaling, causing
systemic drift from the values the guest computes from its own TSC.
As a bonus cleanup, rip out the whole pvclock_gtod_data hack, which was
shadowing the kernel's timekeeping, and use ktime snapshots.
----------------------------------------------------------------
David Woodhouse (14):
KVM: x86: Improve accuracy of KVM clock when TSC scaling is in force
KVM: x86: Explicitly disable TSC scaling without CONSTANT_TSC
KVM: x86: Activate master clock immediately on vCPU creation
KVM: x86: Compute kvmclock base without pvclock_gtod_data
KVM: x86: Avoid NTP frequency skew for KVM clock on 32-bit host
KVM: x86: Wrap all of __get_kvmclock_master_clock() with CONFIG_X86_64=y
KVM: x86: Fall back to non-master-clock if clockread fails in get_kvmclock()
KVM: x86: Fix KVM clock precision in get_kvmclock() with TSC scaling
KVM: x86: Use get_kvmclock() in kvm_get_wall_clock_epoch()
KVM: x86: Fix compute_guest_tsc() to handle negative time deltas
KVM: x86: Upscale TSC to "now", not master clock when updating PV clocks
KVM: x86: Simplify and comment kvm_get_time_scale()
KVM: x86: Remove implicit rdtsc() from kvm_compute_l1_tsc_offset()
KVM: x86: Use kernel timekeeping snapshots for getting kvmclock time since boot
Sean Christopherson (7):
KVM: x86: Update "last guest TSC" snapshot prior to enabling IRQs/preemption
KVM: x86: Drop unnecessary CPU pinning when computing/getting kvmclock
KVM: x86: Move "no master clock" fallback from __get_kvmclock() to get_kvmclock()
KVM: x86: Disable preemption, not IRQs, when getting TSC+freq pair
KVM: x86: Make master clock logic in guest PV clock updates 64-bit only
KVM: x86: Use kernel timekeeping snapshot for monotonic clock
KVM: x86: Use kernel timekeeping snapshot to get walltime+TSC
arch/x86/include/asm/kvm_host.h | 6 +-
arch/x86/kvm/cpuid.c | 1 +
arch/x86/kvm/msrs.c | 3 +-
arch/x86/kvm/svm/svm.c | 3 +-
arch/x86/kvm/vmx/vmx.c | 10 +
arch/x86/kvm/x86.c | 480 ++++++++++++++++++----------------------
arch/x86/kvm/x86.h | 3 +-
7 files changed, 240 insertions(+), 266 deletions(-)
next prev parent reply other threads:[~2026-10-16 4:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 4:44 [GIT PULL] KVM: x86: Pull requests " Sean Christopherson
2026-10-16 4:44 ` Sean Christopherson [this message]
2026-10-16 4:44 ` [GIT PULL] KVM: guest_memfd and CoCo changes " Sean Christopherson
2026-10-16 4:44 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
2026-10-16 4:44 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
2026-10-16 4:44 ` [GIT PULL] KVM: selftests: Add PPC support Sean Christopherson
2026-10-16 4:44 ` [GIT PULL] KVM: Selftests changes for 7.4 Sean Christopherson
2026-10-16 4:44 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
2026-10-16 4:44 ` [GIT PULL] KVM: x86: VMX+TDX " Sean Christopherson
2026-10-16 9:11 ` [GIT PULL] KVM: x86: Pull requests " Paolo Bonzini
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=20261016044415.958618-2-seanjc@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/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
all inboxes | Powered by JetHome®