[linux-dvb] SAA7146 DMA buffer overflow

Johannes Stezenbach js at linuxtv.org
Tue Feb 21 14:19:24 CET 2006

On Mon, Feb 20, 2006, Ingo Schneider wrote:
> Quite a big mail, but maybe someone may give me some useful hints in 
> finding the real cause for my problem (besides the working work-around).
> >Processing is done from the irq handler (well, actually from
> >a tasklet triggered by irq). For a 30Mbit/s stream
> >this buffer holds ~50ms worth of TS packets which are then pushed
> >into a larger ringbuffer where it waits to be picked up by read()
> >from the demux/dvr device. If the DMA buffer overflows you have
> >an irq/tasklet latency problem.
> > 
> >
> If this is really a IRQ latency problem, how does it come the timer 
> interrupt
> keeps counting jiffies while the SAA7146 cannot get its interrupt handled ?

Are you sure the timer irq is serviced? IIRC the x86 timer irq
handler can detect lost irqs and correctly update jiffies later.

> Why does this happen in a reproducable way when using dump or sync ?

I'd say it points in the direction of the IDE driver.

> My cards are at interrupt 5 and 10 (both have same problem), where IRQ 
> 10 even has a higher priority than the IDE interrupt.

Irq sharing and priority shouldn't matter. The problem seems
to be that some code disables all irqs completely for too long.

> Using APIC doesn't work at all, even with big DMA buffer.
> Below I measured the time in jiffies vs. the real time (which was 
> measured by the amount of data filling the buffer ;-).
> As one sees, the latency for the IRQ is as high as 74 milliseconds, 
> which I think is a "week" for an AMD Athlon XP 1600+ ...
> And far beyond everything discussed for preemption and IRQ latencies.
> The delay between hardware interrupt and tasklet was always < 2ms.

Which matches my expectations. tasklets run on return from irq
(so they can be interrupted by other irqs). The only case where
this would cause problems is when there are too many irqs,
e.g. when you flood-ping your box via gigabit ethernet.
(Caution: I'm not too sure about this, you might want to
recheck to facts.)


More information about the linux-dvb mailing list