Re: Is the clockevent resolution fine-grained enough?

From: Marko Rauhamaa
Date: Fri Mar 02 2007 - 12:25:16 EST


Thomas Gleixner <tglx@xxxxxxxxxxxxx>:

> On Thu, 2007-03-01 at 18:34 -0800, Marko Rauhamaa wrote:
> > It would appear the new clockevent API has a one-nanosecond
> > resolution. It certainly looks sufficiently fine-grained, but I'm
> > afraid it's too coarse for some applications.
>
> That's an academic exercise, or are you talking about some real world
> hardware which runs Linux ?

Real hardware running linux.

> > In our application, we need periodic clock interrupts at about 100
> > kHz.
>
> With a stock kernel ?

Well, with a "clockevent" patch of our own. We'd like to use a stock
kernel, though.

> > If the (programmable) frequency must be rounded to the nearest
> > nanosecond, we have a cumulative error of
> >
> > 100,000 * 0.5 ns/s = 50 Âs/s
>
> clockevents is based on the monotonic system clock and depends on the
> accuracy of that and the device which deliveres the interrupts.
> [...]
> There is nothing to nugde. The clockevent subsystem operates on
> absolute time, so there is no cummulative error, except you setup your
> timers relative per event.

I'm afraid you didn't quite understand what I was getting at. Say the
user programs the frequency to be 109,000ÂHz. That means a nominal clock
interval of ~9174.3119Âns. Now the clockevent interface forces me to
round it down to 9174Âns. That means the clock interrupts fall behind
with respect to the other parts in the system that implement 109,000ÂHz
much more to the letter. The error grows by 34ÂÂs every second so that
after 8 hours, we are lagging by a whole second.


Marko

--
Marko Rauhamaa mailto:marko@xxxxxxxxxx http://pacujo.net/marko/
-
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/