[PATCH v2 3/4] Implement clockevents driver for powerpc

Gabriel Paubert paubert at iram.es
Fri Oct 19 19:22:05 EST 2007


On Fri, Oct 19, 2007 at 10:14:54AM +1000, Paul Mackerras wrote:
> Sergei Shtylyov writes:
> 
> > > What problem do you see arising from this?
> > 
> >     Timers firing too early.
> 
> Only if the minimum interrupt latency is less than 1 decrementer
> tick.  That seems pretty unlikely to me unless you have a very slow
> timebase frequency.
> 
> In fact what we should program the decrementer to is:
> 
> 	timeout - (is_booke? 0: 1) - min_interrupt_latency
> 
> I was assuming that min_interrupt_latency (measured in timebase ticks)
> would be at least 1, but apparently some systems can have a timebase
> frequency as low as 1kHz, so we'll have to have an ifdef or something.

If it is the case (the slowest I've seen was in the 8 MHz range), then
it is better not to subtract the one: think of what happens when you
have say, a 10kHz timebase/decrementer frequency and you want to
interrupt after 1 ms. You actually want to interrupt after 11
transitions of the decrementer, not 10 since the result could be
as low as 900us if you happen to read the timebase just before
a transition.

I'd really wish there were a guarantee of a minimum timebase 
frequency, for anything above ~10MHz, we are splitting hairs
about an off-by-one error that never accumulates, but if systems
with very low TB freq exist, you have to be very careful. In any case
timer interrupts should never came earlier than asked for.

	Gabriel



More information about the Linuxppc-dev mailing list