Re: x86 TSC time warp puzzle
From: Joe Korty
Date: Mon Apr 04 2005 - 08:59:27 EST
On Mon, Apr 04, 2005 at 09:59:22AM +0100, P@xxxxxxxxxxxxxx wrote:
> Jonathan Lundell wrote:
> >Well, not actually a time warp, though it feels like one.
> >
> >I'm doing some real-time bit-twiddling in a driver, using the TSC to
> >measure out delays on the order of hundreds of nanoseconds. Because I
> >want an upper limit on the delay, I disable interrupts around it.
> >
> >The logic is something like:
> >
> > local_irq_save
> > out(set a bit)
> > t0 = TSC
> > wait while (t = (TSC - t0)) < delay_time
> > out(clear the bit)
> > local_irq_restore
> >
> > From time to time, when I exit the delay, t is *much* bigger than
> >delay_time. If delay_time is, say, 300ns, t is usually no more than
> >325ns. But every so often, t can be 2000, or 10000, or even much higher.
> >
> >The value of t seems to depend on the CPU involved, The worst case is
> >with an Intel 915GV chipset, where t approaches 500 microseconds (!).
Add nmi_watchdog=0 to your boot command line.
-
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/