[linux-dvb] SAA7146 DMA buffer overflow

Ingo Schneider mail at ingo-schneider.de
Mon Feb 20 22:19:32 CET 2006


Hello again !

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 ?
Why does this happen in a reproducable way when using dump or sync ?
My cards are at interrupt 5 and 10 (both have same problem), where IRQ 
10 even has a higher priority than the IDE interrupt.
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.

So, if interrupts are not locked (timer interrupt is running),
and the SAA7146 keeps generating interrupt (why should it stop just 
because of system activity),
where does this problem come from ?
Is there a piece of code in the kernel which just blocks the interrupts 
5 and 10 (or anything but timer) ?
Can something steal interrupts even if /proc/interrupts shows the 
interrupt as unshared ?
Or am I getting something totally wrong here ?
Maybe the only way of really finding out is using the internal SAA7146 
event counter for the interrupts, and see if they get lost somewhere ...

Ciao,
Ingo Schneider.

73884 bytes now, time: 16, missed: 0
81216 bytes now, time: 17, missed: 0
81404 bytes now, time: 17, missed: 0
81404 bytes now, time: 18, missed: 0
83848 bytes now, time: 17, missed: 0
89488 bytes now, time: 19, missed: 0
92496 bytes now, time: 19, missed: 0
93060 bytes now, time: 20, missed: 0
95128 bytes now, time: 20, missed: 0
105092 bytes now, time: 22, missed: 0
105468 bytes now, time: 22, missed: 0
106784 bytes now, time: 22, missed: 0
107536 bytes now, time: 23, missed: 0
108664 bytes now, time: 22, missed: 0
109792 bytes now, time: 23, missed: 0
111108 bytes now, time: 23, missed: 0
114868 bytes now, time: 24, missed: 0
115808 bytes now, time: 24, missed: 0
117500 bytes now, time: 24, missed: 0
140812 bytes now, time: 30, missed: 0
143820 bytes now, time: 31, missed: 0
144196 bytes now, time: 30, missed: 0
146452 bytes now, time: 31, missed: 0
146828 bytes now, time: 31, missed: 0
154912 bytes now, time: 32, missed: 0
164876 bytes now, time: 34, missed: 0
171456 bytes now, time: 36, missed: 0
180856 bytes now, time: 38, missed: 0
181420 bytes now, time: 39, missed: 0
183300 bytes now, time: 38, missed: 0
192888 bytes now, time: 40, missed: 0
197588 bytes now, time: 42, missed: 0
197964 bytes now, time: 42, missed: 0
220900 bytes now, time: 46, missed: 0
223156 bytes now, time: 47, missed: 0
223720 bytes now, time: 48, missed: 0
229548 bytes now, time: 49, missed: 0
236692 bytes now, time: 50, missed: 0
251920 bytes now, time: 53, missed: 0
258876 bytes now, time: 54, missed: 0
273728 bytes now, time: 57, missed: 0
279180 bytes now, time: 59, missed: 0
282564 bytes now, time: 60, missed: 0
313208 bytes now, time: 66, missed: 0
354380 bytes now, time: 74, missed: 0

Btw: The "missed" is the interrupts delivered without the SAA7146 ISR 
being set correctly  (none, I just wanted to know ...).

My /proc/interrupts:
           CPU0      
  0:   69043004          XT-PIC  timer
  1:          8          XT-PIC  i8042
  2:          0          XT-PIC  cascade
  4:       6222          XT-PIC  serial
  5:    5065177          XT-PIC  saa7146 (1)
  7:    9032713          XT-PIC  parport0
  8:          4          XT-PIC  rtc
  9:          1          XT-PIC  acpi
 10:    5152056          XT-PIC  saa7146 (0)
 11:    3597113          XT-PIC  eth0
 12:        102          XT-PIC  i8042
 14:     271268          XT-PIC  ide0
 15:      67231          XT-PIC  ide1
NMI:          0
LOC:          0
ERR:          0
MIS:          0

lspci -vv
----------
0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo 
KT266/A/333]
        Subsystem: VIA Technologies, Inc.: Unknown device 0000
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort+ >SERR- <PERR-
        Latency: 0
        Region 0: Memory at e0000000 (32-bit, prefetchable) [size=4M]
        Capabilities: [a0] AGP version 2.0
                Status: RQ=32 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- 
HTrans- 64bit- FW- AGP3- Rate=x1,x2,x4
                Command: RQ=1 ArqSz=0 Cal=0 SBA- AGP- GART64- 64bit- FW- 
Rate=<none>
        Capabilities: [c0] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-

0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo 
KT266/A/333 AGP] (prog-if 00 [Normal decode])
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort+ >SERR- <PERR-
        Latency: 0
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        Memory behind bridge: dde00000-dfefffff
        Prefetchable memory behind bridge: cdc00000-ddcfffff
        BridgeCtl: Parity- SERR- NoISA+ VGA+ MAbort- >Reset- FastB2B-
        Capabilities: [80] Power Management version 2
                Flags: PMEClk- DSI- D1+ D2- AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-

0000:00:06.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)
        Subsystem: TERRATEC Electronic GmbH: Unknown device 1156
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B-
        Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort- >SERR- <PERR-
        Latency: 240 (3750ns min, 9500ns max)
        Interrupt: pin A routed to IRQ 10
        Region 0: Memory at dffffe00 (32-bit, non-prefetchable) [size=512]

0000:00:08.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)
        Subsystem: TERRATEC Electronic GmbH: Unknown device 1156
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B-
        Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort- >SERR- <PERR-
        Latency: 240 (3750ns min, 9500ns max)
        Interrupt: pin A routed to IRQ 5
        Region 0: Memory at dffffc00 (32-bit, non-prefetchable) [size=512]

0000:00:09.0 Ethernet controller: Realtek Semiconductor Co., Ltd. 
RTL-8139/8139C/8139C+ (rev 10)
        Subsystem: Realtek Semiconductor Co., Ltd. RT8139
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR+ FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort- >SERR- <PERR-
        Latency: 32 (8000ns min, 16000ns max)
        Interrupt: pin A routed to IRQ 11
        Region 0: I/O ports at ec00 [size=256]
        Region 1: Memory at dffffb00 (32-bit, non-prefetchable) [size=256]
        Capabilities: [50] Power Management version 2
                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA 
PME(D0-,D1+,D2+,D3hot+,D3cold+)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-

0000:00:11.0 ISA bridge: VIA Technologies, Inc. VT8233 PCI to ISA Bridge
        Subsystem: VIA Technologies, Inc.: Unknown device 0000
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping+ SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort- >SERR- <PERR-
        Latency: 0
        Capabilities: [c0] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-

0000:00:11.1 IDE interface: VIA Technologies, Inc. 
VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06) 
(prog-if 8a [Master SecP PriP])
        Subsystem: VIA Technologies, Inc. 
VT82C586/B/VT82C686/A/B/VT8233/A/C/VT8235 PIPC Bus Master IDE
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort- >SERR- <PERR-
        Latency: 32
        Region 4: I/O ports at fc00 [size=16]
        Capabilities: [c0] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-

0000:00:11.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 
1.1 Controller (rev 1b) (prog-if 00 [UHCI])
        Subsystem: VIA Technologies, Inc. (Wrong ID) USB Controller
        Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV+ VGASnoop- 
ParErr- Stepping- SERR+ FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort- >SERR- <PERR-
        Interrupt: pin D routed to IRQ 5
        Region 4: I/O ports at e000 [size=32]
        Capabilities: [80] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-

0000:00:11.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 
1.1 Controller (rev 1b) (prog-if 00 [UHCI])
        Subsystem: VIA Technologies, Inc. (Wrong ID) USB Controller
        Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV+ VGASnoop- 
ParErr- Stepping- SERR+ FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort- >SERR- <PERR-
        Interrupt: pin D routed to IRQ 5
        Region 4: I/O ports at e400 [size=32]
        Capabilities: [80] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-

0000:00:11.5 Multimedia audio controller: VIA Technologies, Inc. 
VT8233/A/8235/8237 AC97 Audio Controller (rev 10)
        Subsystem: Avance Logic Inc.: Unknown device 4710
        Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort- >SERR- <PERR-
        Interrupt: pin C routed to IRQ 6
        Region 0: I/O ports at e800 [size=256]
        Capabilities: [c0] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-

0000:01:00.0 VGA compatible controller: nVidia Corporation NV15DDR 
[GeForce2 Ti] (rev a4) (prog-if 00 [VGA])
        Subsystem: Micro-Star International Co., Ltd. Creative 3D 
Blaster Geforce2 Titanium
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- 
<TAbort- <MAbort- >SERR- <PERR-
        Latency: 32 (1250ns min, 250ns max)
        Interrupt: pin A routed to IRQ 11
        Region 0: Memory at de000000 (32-bit, non-prefetchable) [size=16M]
        Region 1: Memory at d0000000 (32-bit, prefetchable) [size=128M]
        Expansion ROM at dfef0000 [disabled] [size=64K]
        Capabilities: [60] Power Management version 1
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [44] AGP version 2.0
                Status: RQ=32 Iso- ArqSz=0 Cal=0 SBA- ITACoh- GART64- 
HTrans- 64bit- FW+ AGP3- Rate=x1,x2,x4
                Command: RQ=1 ArqSz=0 Cal=0 SBA- AGP- GART64- 64bit- FW- 
Rate=<none>





More information about the linux-dvb mailing list