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