]> git.baikalelectronics.ru Git - kernel.git/commit
parisc: fix "delay!" timer handling
authorGrant Grundler <grundler@parisc-linux.org>
Mon, 1 Jun 2009 00:20:23 +0000 (00:20 +0000)
committerKyle McMartin <kyle@mcmartin.ca>
Fri, 3 Jul 2009 03:34:09 +0000 (03:34 +0000)
commit1f5c23c8663479e7b0071dfc0921524c487c1176
tree34ba0390a709316a7f4f65f83e6f6ff09248a174
parent2848cab9300e0fcaebc5e80e055cc990e90ea326
parisc: fix "delay!" timer handling

Rewrote timer_interrupt() to properly handle the "delayed!" case.

If we used floating point math to compute the number of ticks that had
elapsed since the last timer interrupt, it could take up to 12K cycles
(emperical!) to handle the interrupt. Existing code assumed it would
never take more than 8k cycles. We end up programming Interval Timer
to a value less than "current" cycle counter.  Thus have to wait until
Interval Timer "wrapped" and would then get the "delayed!" printk that
I moved below.

Since we don't really know what the upper limit is, I prefer to read
CR16 again after we've programmed it to make sure we won't have to
wait for CR16 to wrap.

Further, the printk was between reading CR16 (cycle couner) and writing CR16
(the interval timer). This would cause us to continue to set the interval
timer to a value that was "behind" the cycle counter. Rinse and repeat.
So no printk's between reading CR16 and setting next interval timer.

Tested on A500 (550 Mhz PA8600).

Signed-off-by: Grant Grundler <grundler@parisc-linux.org>
Tested-by: Kyle McMartin <kyle@mcmartin.ca>
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
----
Kyle, Helge, and other parisc's,
Please test on 32-bit before committing.
I think I have it right but recognize I might not.

TODO: I wanted to use "do_div()" in order to get both remainder
and value back with one division op. That should help with the
latency alot but can be applied seperately from this patch.

thanks,
grant
arch/parisc/kernel/time.c