Ralf Baechle wrote:
On Fri, Jan 08, 2010 at 02:47:36PM -0800, David Daney wrote:
With typical mult and shift values, the calculation for Octeon's
sched_clock overflows when using 64-bit arithmetic. Use 128-bit
calculations instead.
Applied though my first thought whenever I see extended precission math
is gross - maybe we're going to find a better solution. Hopefully!
Ralf
I did have some apprehension myself. However consider:
* For an 800MHz core clock, clocksource_set_clock() generates a shift
value of 31. This leads to overflow of 64-bit arithmetic approximately
every 8 seconds. This specific case could be reduced to a 2 bit shift,
resulting in time to overflow of more than 100 years. But one can
imagine clock rates that would require large shifts.
* We need to return a 64-bit clock value, this will overflow in about
500 years, Unless we are very careful with our arithmetic, we risk
overflow in unacceptable short time periods.
* This is octeon specific and the 128-bit operation is cheap. Probably
cheaper than accounting for overflows in 64-bit arithmetic.
David Daney