Re: One-shot high-resolution POSIX timer periodically late

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2007-01-24 at 10:41 +0100, John wrote:
> I'm using the POSIX timers API. My platform is x86 running Linux
> 2.6.18.6 patched with the high-resolution timer subsystem.
> 
> http://www.tglx.de/hrtimers.html
> 
> I've written a small "de-jittering engine" that receives packets in
> small bursts due to network jitter (typical average rate of 1000 packets
> per second), and re-sends them at a "smooth" rate.
> 
> Just before I re-send a packet, I arm a one-shot timer in order to
> receive a signal when it is time to send the next packet.
> 
> I've noticed a strange phenomenon that I cannot explain.
> 
> Sometimes (rarely) the one-shot timer will expire more than 50 µs later
> than expected. This would seem normal, except that it happens periodically.
> 
> For example, my app had been running normally for 2 minutes when it
> started printing diagnostics (see below).
> 
> The first T_NEXT_POP is the date the timer was supposed to expire,
> 
> NOW is the date the timer was handled after returning from sigwaitinfo
> (I am aware that blocking signals, and handling them at a specific point
> in the code will add some latency)
> 
> The second T_NEXT_POP is the date the next timer is supposed to expire.
> 
> DIFF is the difference between real and expected dates.
> 
> (All dates are CLOCK_MONOTONIC by the way.)
> 
> As you can see, the first diagnostic came at 472.410501014... Then
> another diagnostic almost exactly two seconds apart 9 times in a row!
> 
> My process is the only SCHED_FIFO process on the system. There are no
> user-space processes with a higher priority. AFAICT, only a kernel
> thread could keep the CPU away from my app.
> 
> Is there a periodic kernel thread that runs every 2 seconds, cannot be
> preempted, and runs for over 50 µs??

This sounds like a BIOS SMI issue. Can you reproduce this behavior on
different hardware? 

thanks
-john

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux