From: Zachary Amsden Date: Sun, 19 Sep 2010 00:38:13 +0000 (-1000) Subject: KVM: x86: Make math work for other scales X-Git-Tag: v2.6.37-rc1~142^2~21 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f4e3f882731c65b5d64a2ff743fda96eaebb9ee;p=pandora-kernel.git KVM: x86: Make math work for other scales The math in kvm_get_time_scale relies on the fact that NSEC_PER_SEC < 2^32. To use the same function to compute arbitrary time scales, we must extend the first reduction step to shrink the base rate to a 32-bit value, and possibly reduce the scaled rate into a 32-bit as well. Note we must take care to avoid an arithmetic overflow when scaling up the tps32 value (this could not happen with the fixed scaled value of NSEC_PER_SEC, but can happen with scaled rates above 2^31. Signed-off-by: Zachary Amsden Signed-off-by: Marcelo Tosatti --- Reading git-diff-tree failed