summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/parallel-perf.py
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw@amazon.co.uk>2026-08-26 14:32:42 -0700
committerSean Christopherson <seanjc@google.com>2026-09-11 11:45:41 -0700
commitd4f54ed48e0043371f8b81aac3450ea86ce30a3e (patch)
treeb0af63a4cdef832f557772f576f07fa06cddbaa8 /tools/perf/scripts/python/parallel-perf.py
parentba78382f34c10dcb04f352b959b16b469fba417a (diff)
KVM: x86: Improve accuracy of KVM clock when TSC scaling is in force
The kvm_guest_time_update() function scales the host TSC frequency to the guest's using kvm_scale_tsc() and the v->arch.l1_tsc_scaling_ratio scaling ratio previously calculated for that vCPU. Then calculates the scaling factors for the KVM clock itself based on that guest TSC frequency. However, it uses kHz as the unit when scaling, and then multiplies by 1000 only at the end. With a host TSC frequency of 3000MHz and a guest set to 2500MHz, the result of kvm_scale_tsc() will actually come out at 2,499,999kHz. So the KVM clock advertised to the guest is based on a frequency of 2,499,999,000 Hz. By using Hz as the unit from the beginning, the KVM clock would be based on a more accurate frequency of 2,499,999,999 Hz in this example. Use u64 for the hw_tsc_hz field since an unsigned int would overflow for TSC frequencies above 4GHz. Fixes: 78db6a503796 ("KVM: x86: rewrite handling of scaled TSC for kvmclock") Reviewed-by: Paul Durrant <paul@xen.org> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Tested-by: Dongli Zhang <dongli.zhang@oracle.com> Link: https://patch.msgid.link/20260826213303.914988-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts/python/parallel-perf.py')
0 files changed, 0 insertions, 0 deletions