[PATCH 0/2] Fix build on i386 due to the latest tsc changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux