Fix build on i386 due to the latest tsc changes
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | KVM: Fix 64-bit division in kvm_set_tsc_khz()arch/ | +9 | 0 replies | |
| 2/2 | KVM: Fix 64-bit division in kvm_write_tsc()arch/ | +7 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] Fix build on i386 due to the latest tsc changes
The code fixed by the second patch looks suspect though:
nsdiff = data - kvm->arch.last_tsc_write; nsdiff = (nsdiff * 1000) / vcpu->arch.virtual_tsc_khz;
before the division, nsdiff is in tsc units. Dividing it by tsc_khz/1000 is equivalent to multiplying it by 1000000 and dividing it by tsc_hz, so the result is in units of mega-seconds. I expect we want
nsdiff /= (u64)tsc_khz * 1000;
(which is somewhat hard on i386)
Avi Kivity (2):
KVM: Fix 64-bit division in kvm_set_tsc_khz()
KVM: Fix 64-bit division in kvm_write_tsc()
arch/x86/kvm/x86.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9