<br><br><div class="gmail_quote">On Thu, Nov 20, 2008 at 9:34 PM, Andy Walls <span dir="ltr"><<a href="mailto:awalls@radix.net">awalls@radix.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Wed, 2008-11-19 at 21:04 -0500, Al McIntosh wrote:<br>
><br>
><br>
> On Wed, Nov 19, 2008 at 12:10 AM, Andy Walls <<a href="mailto:awalls@radix.net">awalls@radix.net</a>> wrote:<br>
> cx18 driver users:<br>
><br>
> I have implemented quite a few cx18 driver changes in my<br>
> current<br>
> experimental repo at<br>
><br>
> <a href="http://linuxtv.org/hg/%7Eawalls/cx18-bugfix" target="_blank">http://linuxtv.org/hg/~awalls/cx18-bugfix</a><br>
><br>
> The goal behind these changes is to fix problems with<br>
> simultaneous<br>
> analog and digital capture causing the driver to quit after a<br>
> while.<br>
> And to fix related problems with buffers getting lost and<br>
> falling out of<br>
> the driver<->firmware transfer rotation.<br>
<br>
</div><div class="Ih2E3d">> Please test the debug parameter with at least info and warn<br>
> set:<br>
><br>
> # modprobe cx18 debug=3<br>
><br>
><br>
> I am especially interested in<br>
><br>
><br>
> 1. How often you get messages like the following on your<br>
> system?<br>
><br>
> cx18-0 warning: Possibly falling behind: CPU self-ack'ed our<br>
> incoming CPU to EPU mailbox (sequence no. nnnn)<br>
><br>
> I need to get a feel for if I need to have the cx18 driver not<br>
> request a<br>
> shared IRQ line for most user applications.<br>
><br>
> On my system where irq balance/migration is turned off, and<br>
> the HVR-1600<br>
> shares an interrupt with the SATA controller, I get them quite<br>
> a bit<br>
> doing simultaneous analog and digital capture with MythTV<br>
> (I've<br>
> approximated a busy, single CPU machine with that setup).<br>
<br>
<br>
</div><div class="Ih2E3d">> For the following system:<br>
<br>
<br>
> $ cat /proc/cpuinfo<br>
> processor : 0<br>
> vendor_id : AuthenticAMD<br>
> cpu family : 15<br>
> model : 28<br>
> model name : AMD Sempron(tm) Processor 2800+<br>
> stepping : 0<br>
> cpu MHz : 1607.382<br>
> cache size : 256 KB<br>
</div>[snip]<br>
> bogomips : 3214.76<br>
<br>
OK. Single core.<br>
<div class="Ih2E3d"><br>
<br>
<br>
> $grep cx18 /proc/interrupts<br>
> 18: 72358 IO-APIC-fasteoi cx18-0, nvidia<br>
<br>
</div>Sharing an interrupt line with the video graphics hardware. Not ideal.<br>
The only thing that could as bad is sharing an interrupt with the disk<br>
controller (MythTV is constantly accessing disk when recording and<br>
stimulating disk interrupts, and I'll assume X11/nvidia has setup for<br>
regular video interrupts will rending the video in MythTV.)<br>
<br>
>From your output below, the last CX23418 to host interrupt sequence # is<br>
4684. For every buffer we get from the CX23418 we send one command back<br>
(approximately) and get an interrupt for those too. So the lasted<br>
missed cx18 driver mailbox log message let's us account for 9300, heck<br>
let's round up, 10,000 of those 72358 interrupts. I'd say the nvidia<br>
hardware is generating a lot of interrupts on that line too, and causing<br>
the cx18 driver to fall behind on servicing interrupts from the CX23418<br>
while the kernel and nvidia driver irq handling has the line disabled.<br>
<div class="Ih2E3d"><br>
<br>
<br>
> $ uname -a<br>
> Linux nelson 2.6.27-7-generic #1 SMP Fri Oct 24 06:42:44 UTC 2008 i686<br>
> GNU/Linux<br>
><br>
><br>
> I built and installed the following:<br>
><br>
> <a href="http://linuxtv.org/hg/%7Eawalls/cx18-bugfix/archive/891eedf234a5.tar.bz2" target="_blank">http://linuxtv.org/hg/~awalls/cx18-bugfix/archive/891eedf234a5.tar.bz2</a><br>
><br>
> Here is the debug output:<br>
<br>
</div>[snip]<br>
> [ 11.643132] cx18: Start initialization, version 1.0.2<br>
<div class="Ih2E3d">> [ 11.648808] cx18-0: Initializing card #0<br>
> [ 11.648815] cx18-0: Autodetected Hauppauge card<br>
> [ 11.648819] cx18-0 info: base addr: 0xf8000000<br>
> [ 11.648822] cx18-0 info: Enabling pci device<br>
> [ 11.649212] ACPI: PCI Interrupt Link [APC3] enabled at IRQ 18<br>
> [ 11.649223] cx18 0000:01:08.0: PCI INT A -> Link[APC3] -> GSI 18<br>
> (level, low) -> IRQ 18<br>
> [ 11.649233] cx18-0: Unreasonably low latency timer, setting to 64<br>
> (was 32)<br>
> [ 11.649239] cx18-0 info: cx23418 (rev 0) at 01:08.0, irq: 18,<br>
> latency: 64, memory: 0xf8000000<br>
</div>[snip - everything looks cool]<br>
> [ 13.673758] cx18-0: Initialized card #0: Hauppauge HVR-1600<br>
<div class="Ih2E3d">> [ 13.674278] cx18: End initialization<br>
> [ 13.984265] ACPI: PCI Interrupt Link [APC4] enabled at IRQ 19<br>
> [ 13.984278] EMU10K1_Audigy 0000:01:09.0: PCI INT A -> Link[APC4] -><br>
> GSI 19 (level, low) -> IRQ 19<br>
> [ 14.017458] Linux agpgart interface v0.103<br>
<br>
<br>
<br>
<br>
> [ 14.200463] nvidia: module license 'NVIDIA' taints kernel.<br>
> [ 14.795264] nvidia 0000:05:00.0: PCI INT A -> Link[APC3] -> GSI 18<br>
> (level, low) -> IRQ 18<br>
> [ 14.795274] nvidia 0000:05:00.0: setting latency timer to 64<br>
> [ 14.795670] NVRM: loading NVIDIA UNIX x86 Kernel Module 173.14.12<br>
> Thu Jul 17 18:11:36 PDT 2008<br>
<br>
</div>A binary module. We have no hope of improving the nvidia driver's irq<br>
handling top half. We have no way of easily knowing how efficient it is<br>
either. Note, it is using IRQ 18 as well as the CX23418.<br>
<br>
[snip]<br>
> [ 32.816051] firmware: requesting v4l-cx23418-apu.fw<br>
<div><div></div><div class="Wj3C7c">> [ 32.889470] cx18-0 info: load segment a00000-a07fff<br>
> [ 32.908330] cx18-0 info: load segment ae0000-ae00ff<br>
> [ 32.908482] cx18-0 info: load segment b00000-b1a65f<br>
> [ 32.970481] cx18-0: loaded v4l-cx23418-apu.fw firmware V00120000<br>
> (141200 bytes)<br>
> [ 33.472733] firmware: requesting v4l-cx23418-cpu.fw<br>
> [ 33.582593] cx18-0: loaded v4l-cx23418-cpu.fw firmware (158332<br>
> bytes)<br>
> [ 33.588746] cx18-0 info: 1 MiniMe Encoder Firmware <a href="http://0.0.74.0" target="_blank">0.0.74.0</a><br>
> (Release 2007/03/12)<br>
> [ 33.588755] cx18-0: FW version: <a href="http://0.0.74.0" target="_blank">0.0.74.0</a> (Release 2007/03/12)<br>
> [ 33.784035] firmware: requesting v4l-cx23418-apu.fw<br>
> [ 33.788935] cx18-0 info: load segment a00000-a07fff<br>
> [ 33.807756] cx18-0 info: load segment ae0000-ae00ff<br>
> [ 33.807908] cx18-0 info: load segment b00000-b1a65f<br>
> [ 34.368013] firmware: requesting v4l-cx23418-cpu.fw<br>
> [ 34.469963] cx18-0 info: 1 MiniMe Encoder Firmware <a href="http://0.0.74.0" target="_blank">0.0.74.0</a><br>
> (Release 2007/03/12)<br>
> [ 34.664016] cx18-0 info: Changing input from 1 to 0<br>
> [ 34.664021] cx18-0 info: Mute<br>
> [ 34.664025] cx18-0 info: cmd 4008646f triggered fw load<br>
> [ 34.664028] firmware: requesting v4l-cx23418-dig.fw<br>
> [ 34.849528] cx18-0: loaded v4l-cx23418-dig.fw firmware (16382<br>
> bytes)<br>
> [ 34.849570] cx18-0 info: decoder set video input 7, audio input 8<br>
> [ 34.852749] cx18-0 info: decoder set video input 7, audio input 8<br>
> [ 34.853726] cx18-0 info: Unmute<br>
> [ 34.853732] cx18-0 info: Switching standard to 1000.<br>
> [ 34.853736] cx18-0 info: changing video std to fmt 1<br>
> [ 34.853750] cx18-0 info: PLL regs = int: 15, frac: 2876158, post: 4<br>
> [ 34.853753] cx18-0 info: PLL = 108.000014 MHz<br>
> [ 34.853756] cx18-0 info: PLL/8 = 13.500001 MHz<br>
> [ 34.853759] cx18-0 info: ADC Sampling freq = 14.317384 MHz<br>
> [ 34.853762] cx18-0 info: Chroma sub-carrier freq = 3.579545 MHz<br>
> [ 34.853766] cx18-0 info: hblank 122, hactive 720, vblank 26 ,<br>
> vactive 487, vblank656 26, src_dec 543,burst 0x5b, luma_lpf 1, uv_lpf<br>
> 1, comb 0x66, sc 0x087c1f<br>
> [ 34.861431] cx18-0 info: Mute<br>
> [ 34.861436] cx18-0 info: v4l2 ioctl: set frequency 1076<br>
> [ 34.863303] cx18-0 info: Unmute<br>
> [ 35.009920] cx18-0 info: Changing input from 0 to 1<br>
> [ 35.009930] cx18-0 info: Mute<br>
> [ 35.009934] cx18-0 info: decoder set video input 1296, audio input<br>
> 8<br>
> [ 35.013455] cx18-0 info: decoder set video input 1296, audio input<br>
> 0<br>
> [ 35.014359] cx18-0 info: Unmute<br>
> [ 35.014806] cx18-0 info: Switching standard to b000.<br>
> [ 35.014812] cx18-0 info: changing video std to fmt 1<br>
> [ 35.014826] cx18-0 info: PLL regs = int: 15, frac: 2876158, post: 4<br>
> [ 35.014830] cx18-0 info: PLL = 108.000014 MHz<br>
> [ 35.014832] cx18-0 info: PLL/8 = 13.500001 MHz<br>
> [ 35.014835] cx18-0 info: ADC Sampling freq = 14.317384 MHz<br>
> [ 35.014838] cx18-0 info: Chroma sub-carrier freq = 3.579545 MHz<br>
> [ 35.014842] cx18-0 info: hblank 122, hactive 720, vblank 26 ,<br>
> vactive 487, vblank656 26, src_dec 543,burst 0x5b, luma_lpf 1, uv_lpf<br>
> 1, comb 0x66, sc 0x087c1f<br>
> [ 35.023866] cx18-0 info: Input unchanged<br>
> [ 35.024540] cx18-0 info: Mute<br>
> [ 35.024546] cx18-0 info: v4l2 ioctl: set frequency 980<br>
> [ 35.026401] cx18-0 info: Unmute<br>
> [ 35.095604] cx18-0 info: Mute<br>
> [ 35.095613] cx18-0 info: v4l2 ioctl: set frequency 980<br>
> [ 35.097794] cx18-0 info: Unmute<br>
</div></div>[snip]<br>
> [ 83.801929] cx18-0 info: Start encoder stream encoder MPEG<br>
<div class="Ih2E3d">> [ 88.328814] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 52) while<br>
> processing<br>
> [ 89.526914] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 67) while<br>
> processing<br>
> [ 112.046227] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 357) while<br>
> processing<br>
> [ 128.563274] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 576) while<br>
> processing<br>
> [ 144.781984] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 795) while<br>
> processing<br>
<br>
</div>These are all happening too close together. The cx18 irq handler is not<br>
being passed control in a timely fashion when the CX23418 signals an<br>
interrupt.<br>
<br>
<br>
> [ 155.334230] cx18-0 info: User stopped encoder MPEG<br>
<div><div></div><div class="Wj3C7c">> [ 155.335043] cx18-0 info: close stopping capture<br>
> [ 155.335051] cx18-0 info: Stop Capture<br>
> [ 422.270549] cx18-0 info: Input unchanged<br>
> [ 422.271205] cx18-0 info: Mute<br>
> [ 422.271211] cx18-0 info: v4l2 ioctl: set frequency 980<br>
> [ 422.273081] cx18-0 info: Unmute<br>
> [ 422.276845] cx18-0 info: Mute<br>
> [ 422.276853] cx18-0 info: v4l2 ioctl: set frequency 980<br>
> [ 422.278831] cx18-0 info: Unmute<br>
> [ 428.728899] cx18-0 info: Start encoder stream encoder MPEG<br>
> [ 434.640532] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 1320) while<br>
> processing<br>
> [ 435.033614] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 1340) while<br>
> processing<br>
> [ 438.009412] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 1488)<br>
> [ 440.165578] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 1594) while<br>
> processing<br>
> [ 450.877048] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 2138) while<br>
> processing<br>
> [ 462.228374] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 2722) while<br>
> processing<br>
> [ 469.673531] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 3104) while<br>
> processing<br>
> [ 469.866070] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 3114) while<br>
> processing<br>
> [ 472.342068] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 3237) while<br>
> processing<br>
<br>
</div></div>Same as above. Too frequent to be comfortable.<br>
<br>
> [ 499.116283] cx18-0 info: close stopping capture<br>
<div class="Ih2E3d">> [ 499.116292] cx18-0 info: Stop Capture<br>
> [ 724.246799] cx18-0 info: Start encoder stream encoder MPEG<br>
> [ 725.454632] cx18-0 warning: Possibly falling behind: CPU<br>
> self-ack'ed our incoming CPU to EPU mailbox (sequence no. 4684) while<br>
> processing<br>
> [ 757.880500] cx18-0 info: User stopped encoder MPEG<br>
> [ 757.881320] cx18-0 info: close stopping capture<br>
> [ 757.881328] cx18-0 info: Stop Capture<br>
><br>
><br>
> If you're interested in viewing the result email me and I will email<br>
> you a URL to dl an mpg.<br>
<br>
> I am tempted to put the card into another dual core system to see how<br>
> it performs.<br>
<br>
</div>/proc/cpuinfo and /proc/interrupts indicated the machine the card is in<br>
is a single core machine.<br>
<br>
The real problem is interrupt sharing with a busy device, and perhaps a<br>
suboptimal nvidia module irq handler on a single core machine<br>
contributes as well.<br>
<br>
<br>
I need to look at the implications of requesting an exclusive IRQ line<br>
for a device that supports shared IRQs. I think things will be OK. I<br>
just have to do tests.<br>
<br>
Ultimately I guess I'll change the driver to always request an exclusive<br>
IRQ line first, and then fall back to a shared line if it can't get an<br>
exclusive one.<br>
<br>
In the meantime, if you're feeling adventurous, you may wish to try<br>
removing "IRQF_SHARED |" from line 730 in cx18-driver.c:cx18_probe():<br>
<br>
<br>
/* Register IRQ */<br>
retval = request_irq(cx->dev->irq, cx18_irq_handler,<br>
IRQF_SHARED | IRQF_DISABLED, cx->name, (void *)cx);<br>
^^^^^^^^^^^^^<br>
Try removing this ---+<br>
<br>
recompile and reinstall the driver and see what happens. Hopefully the<br>
cx18 driver will then get it's own interrupt line and things will be<br>
better for you.<br>
</blockquote><div><br><br><br>I will definitely test this for you, likely won't be until next week, off to Montreal for the weekend. :) <br><br><br><br> </div></div><br>