On Tue, 2009-04-28 at 15:34 +0200, maleadt wrote: > Hi, > > I'm using ivtv in combination with a Hauppauge PVR 150, but every boot > I experience a 4 second delay every loading the firmware. During that, > one core of my processor spikes to 100% usage. I'm running kernel > 2.6.28 (ubuntu jaunty), and have experienced this issue on another > computer too (running kernel 2.6.27, ubuntu intrepid). > > Is this normal behaviour? I'd think my processor (a Q9500) would have > enough computational power to load a 16kB firmware file in less then 4 > seconds.
Well, a busy CPU and a delay will be normal. I'd have to do some spreadsheet calculations to make an estimate to verify if 4 seconds was about right. Here the circumstances which may help you understand your observations: 1. The CX25842 on your PVR-150 card is loaded and controlled via an I2C (3 wire serial) bus to the CX23416 chip which acts as the I2C bus master on that PVR-150 card. 2. The CX23416 does not (AFAIK) have any intelligence to manipulate the I2C bus clock and data line automatically. There are a few registers with bits to set and clear to set the clock or data line to a high or low state. The CPU has control over this by PCI bus read and write accesses to the CX23416 registers for the I2C lines. Manipulating bits on a wire this way with the CPU is called "bit-banging". 3. Because of the nominal I2C clock rate of 100 kHz (IIRC) and that any given kernel can have a low timer tick rate (i.e. with HZ = 100 ticks/sec is 1000 times slower than 100 kHz) the CPU does busy waits during the high and low times of bits on the I2C bus while bit banging. It can't rely on sleeping and kernel timers to get the bit times right. 4. The CX25842 firmware is about 16 KBytes long. 5. Apparently there are some PVR board (and/or motherboard combinations) which will sometimes causes PCI bus reads or writes to fail. The ivtv driver works around this by having it's own i2c bit banging implmentation that does extra reads of the CX23416 registers on the PCI bus. (Hans can correct me on this if I'm too far off). These extra read result in some additional delays - like if the CPU or PCI-PCI bridge is forced to yield the PCI bus due to PCI latency timers and bus arbitration rules. In short the 100 % CPU usage is expected due to busy waits, and a noticable delay in loading the firmware doesn't surpirse me. Is there room for improvement? Assuming a 100 kHz I2C clock rate and neglecting *all* overhead bits (start,stop) and bytes (chip addresses) and turn-around delays and the fact that the PCI bus is shared: 16384 bytes * 8 bits/byte / 100000 bits/sec = 1.31072 seconds is an optimistic, unrealistic lower bound on the time to load the firmware. Maybe things can be improved to get closer to that lower bound than 4 seconds, but I suspect not much improvement can be had. Also the time investment on ensuring continued reliability of I2C bus transactions for all ivtv users may not make it worth the effort. The ivtv and cx25840 module should be deferring the cx2584x firmware load until the chip is actually needed. Then the actual loading is spun off to some transient kernel thread to get the job done in parallel with other processes. Regards, Andy > I've added some details at the end of my mail, thanks in advance for > any comment. > maleadt > > Hardware (lspci -v): > 05:06.0 Multimedia video controller: Internext Compression Inc iTVC16 > (CX23416) MPEG-2 Encoder (rev 01) > Subsystem: Hauppauge computer works Inc. Device 8003 > Flags: bus master, medium devsel, latency 64, IRQ 22 > Memory at f8000000 (32-bit, prefetchable) [size=64M] > Capabilities: [44] Power Management version 2 > Kernel driver in use: ivtv > Kernel modules: ivtv > > Kernel (relevant part of /var/log/messages): > [ 10.398809] ivtv: Start initialization, version 1.4.0 > [ 10.398854] ivtv0: Initializing card #0 > [ 10.398856] ivtv0: Autodetected Hauppauge card (cx23416 based) > [ 10.398939] ivtv 0000:05:06.0: PCI INT A -> GSI 22 (level, low) -> IRQ 22 > [ 10.452053] tveeprom 0-0050: The eeprom says no radio is present, > but the tuner type > [ 10.452055] tveeprom 0-0050: indicates otherwise. I will assume > that radio is present. > [ 10.452057] tveeprom 0-0050: Hauppauge model 26039, rev C1A5, serial# > 7930745 > [ 10.452058] tveeprom 0-0050: tuner model is TCL MPE05-2 (idx 105, type 38) > [ 10.452060] tveeprom 0-0050: TV standards PAL(B/G) PAL(I) > SECAM(L/L') PAL(D/D1/K) (eeprom 0x74) > [ 10.452061] tveeprom 0-0050: audio processor is CX25842 (idx 36) > [ 10.452063] tveeprom 0-0050: decoder processor is CX25842 (idx 29) > [ 10.452064] tveeprom 0-0050: has radio, has IR receiver, has IR transmitter > [ 10.452065] ivtv0: Autodetected Hauppauge WinTV PVR-150 > [ 10.452066] ivtv0: Reopen i2c bus for IR-blaster support > [ 10.494662] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 22 (level, > low) -> IRQ 22 > [ 10.494709] HDA Intel 0000:00:1b.0: setting latency timer to 64 > [ 10.513721] cx25840 0-0044: cx25842-23 found @ 0x88 (ivtv i2c driver #0) > [ 10.526432] hda_codec: Unknown model for ALC883, trying auto-probe > from BIOS... > [ 10.551060] tuner 0-0043: chip found @ 0x86 (ivtv i2c driver #0) > [ 10.555344] tda9887 0-0043: creating new instance > [ 10.555345] tda9887 0-0043: tda988[5/6/7] found > [ 10.556731] tuner 0-0061: chip found @ 0xc2 (ivtv i2c driver #0) > [ 10.556774] wm8775 0-001b: chip found @ 0x36 (ivtv i2c driver #0) > [ 10.563959] HDA Intel 0000:01:00.1: PCI INT B -> GSI 17 (level, > low) -> IRQ 17 > [ 10.564010] HDA Intel 0000:01:00.1: setting latency timer to 64 > [ 10.572902] tuner-simple 0-0061: creating new instance > [ 10.572904] tuner-simple 0-0061: type set to 38 (Philips PAL/SECAM > multi (FM1216ME MK3)) > [ 10.590693] cx25840 0-0044: firmware: requesting v4l-cx25840.fw > [ 14.290279] cx25840 0-0044: loaded v4l-cx25840.fw firmware (16382 bytes) > [ 14.367933] ivtv0: Registered device video0 for encoder MPG (4096 kB) > [ 14.367971] ivtv0: Registered device video32 for encoder YUV (2048 kB) > [ 14.368016] ivtv0: Registered device vbi0 for encoder VBI (1024 kB) > [ 14.368050] ivtv0: Registered device video24 for encoder PCM (320 kB) > [ 14.368079] ivtv0: Registered device radio0 for encoder radio > [ 14.368081] ivtv0: Initialized card #0: Hauppauge WinTV PVR-150 > [ 14.368122] ivtv: End initialization _______________________________________________ ivtv-users mailing list [email protected] http://ivtvdriver.org/mailman/listinfo/ivtv-users
