On 02/16/2012 03:48 PM, Avi Kivity wrote: > 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 > Actually it results in units of microseconds, while we want nanoseconds. So maybe the correct code is nsdiff = (nsdiff * 1000000) / vcpu->arch.virtual_tsc_khz; returning nanoseconds. I note that if the guest writes a large value into the tsc, this breaks. -- error compiling committee.c: too many arguments to function -- 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