Re: [PATCH] Use 64bit timer values while calibrating BogoMips



On Wed, 31 Oct 2007 16:52:16 +0100
Andi Kleen <ak@xxxxxxx> wrote:


When calibrating BogoMips 32bit architectures using
read_current_timer will truncate the timer value to 32bit.
This is a problem on x86 when the TSC timer is already beyond
2^32-1 or wraps during the calibration. The current code
has no wrap handling.

This could potentially lead to wrong BogoMips, causing
incorrect delays e.g. in hardware drivers and then difficult
to track down bugs.

bogomips tends to not be used for that nowadays

Change read_current_timer() to always return a 64bit
value even on 32bit and do the computation in 64bit.

Only found by code inspection; i haven't seen a failure
in the wild.

avr32/sparc64 read_current_timer() updated, but I haven't
compiled/tested them.

one general comment, if you really want 64 bit... you're using
"unsigned long long" all over, just use u64 instead.


--
If you want to reach me at my work email, use arjan@xxxxxxxxxxxxxxx
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages