diff options
| author | David Woodhouse <dwmw@amazon.co.uk> | 2026-08-26 14:32:51 -0700 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-09-11 11:46:18 -0700 |
| commit | abdef42276d88417f6a0c1f9fae8190accc3bc38 (patch) | |
| tree | 6ffa1810014e924adb2d25d7db2c3bcbe50ce71b /tools/perf/scripts/python/stackcollapse.py | |
| parent | 25f75fb43fd53138c248869334fdff4555a7a1e4 (diff) | |
KVM: x86: Fix KVM clock precision in get_kvmclock() with TSC scaling
When in master clock mode, the KVM clock is defined in terms of the
guest TSC. But get_kvmclock() was computing it from the host TSC
without applying TSC scaling, leading to a systemic drift from the
values the guest computes from its own TSC.
Store the VM's TSC scaling ratio in kvm_arch and precompute the
guest-TSC-based mul/shift in pvclock_update_vm_gtod_copy(). Use these
in get_kvmclock() to scale the host TSC delta to guest TSC before
converting to nanoseconds.
This avoids "definition C" of the KVM clock described in commit
633d7652f80f ("KVM: x86/xen: Do not corrupt KVM clock in
kvm_xen_shared_info_init()").
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Link: https://patch.msgid.link/20260826213303.914988-12-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
