On Tue, 4 Jul 2006, Rich Kadel wrote:
> Robert,
>
> I believe I've witnessed a similar problem (driver crash loading my PVR-500
> (see email thread Re: [ivtv-devel] System hangs loading driver modules for
> PVR-500), but only with the PVR-500 and only on my Dell 2850 (specifics in
> the thread).  I had a partial fix inserting a sleep in a certain place, but
> it only worked 50% of the time.  About half the time it would still crash.
> It's possible your patch would work, but I no longer have access to the
> machine for testing.  I had to replace the PVR-500s with PVR-250s, and now
> it's stable.
>
> The problem is, inserting the sleep as you've suggested is just masking the
> real problem, and I don't think the IVTV developers (I am not one of them)
> are willing to throw sleeps at a problem without really knowing what it is
> doing and why.  I don't blame them.
>
> I'd like someone to confirm this solution, and when I get a chance and
> access to a similar system, I will test it myself.

Your situation sounds a little bit different. Without my ivtv patch I can
expect, 90% of the time, ivtv unreliability after the ivtv module is loaded
or outright hard locksup on load; with my ivtv patch in place it just works
100% the time.

My PVR is on a fairly vanilla hyperthreaded P4 Intel 875 based system with a
single PVR-350. I've been running the same system for years. I'm running
CentOS 4.3 with my own kernel patch set currently based on 2.6.17.3:
I've sent in several other patches to ivtv back when Chris was very active.
See here for my kernel patch set details:
http://webcon.ca/~rhardy/patches/linux/kernel/Patchset-2.6.17-rh3/index.txt

Recently i.e. for at least the last 4 kernel upgrades / ivtv driver
versions, without my ivtv patch the ivtv driver would fail to load causing a
hard lockup 100% of the time. The driver has never failed to load with the
patch in place.

My patch puts a short delay after succeeding to load a firmware file so that
a race with respect to loading multiple firmware in a very short period of
time can be avoided. In a perfect world it would be nice to fix that race,
but if that was simple to do I imagine other kernel developers would have
already done that instead of working around the problem.

There have been discussions on the kernel mailing list about similar issues
in other drivers. Ultimately the fix chosen there for the wireless ipwXXXX
drivers was a lot more work and I wasn't sure how to go about implementing
it for the ivtv driver.

I don't know where the race is and given other kernel drivers have been
forced to work around it, hoping to fix the race instead of avoiding it may
be impractical. Given the flakiness shown with sound issues below, I'm
attempted to suggest my PVR-350 card likes having a delay between firmware
loading too...

I've seen various other people on the lists with similar problems, but of
course I didn't find any good examples when I went looking for them just now...

I just tried applying a recent git semaphore to mutex conversion of
firmware_class.c to see if it would help i.e.:
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=cad1e55d4d19a49c2b82b74562a6e4e555b05f38

I then removed my patch from ivtv 0.7.0, reinstalled ivtv and rebooted into
the new kernel. It gets back into the failure mode of multiple ivtv
initialization failures before ivtv gets loaded properly. Immediately after
reboot the firmware fails to load but at least it doesn't crash the machine:

ivtv:  ==================== START INIT IVTV ====================
ivtv:  version 0.7.0 (tagged release) loading
ivtv:  Linux version: 2.6.17-rh3 SMP preempt mod_unload PENTIUM4 gcc-3.4
ivtv:  In case of problems please include the debug info between
ivtv:  the START INIT IVTV and END INIT IVTV lines, along with
ivtv:  any module options, when mailing the ivtv-users mailinglist.
ivtv0: Autodetected Hauppauge WinTV PVR-350 card (cx23415 based)
ACPI: PCI Interrupt 0000:03:05.0[A] -> GSI 21 (level, low) -> IRQ 209
tveeprom 1-0050: Hauppauge model 48132, rev J323, serial# 7012766
tveeprom 1-0050: tuner model is Philips FM1236 (idx 23, type 2)
tveeprom 1-0050: TV standards NTSC(M) (eeprom 0x08)
tveeprom 1-0050: audio processor is MSP4448 (idx 27)
tveeprom 1-0050: decoder processor is SAA7115 (idx 19)
tveeprom 1-0050: has radio, has IR remote
tuner 1-0061: chip found @ 0xc2 (ivtv i2c driver #0)
saa7115 1-0021: saa7115 found @ 0x42 (ivtv i2c driver #0)
saa7127 1-0044: saa7127 found @ 0x88 (ivtv i2c driver #0)
msp3400 1-0040: MSP4448G-A2 found @ 0x80 (ivtv i2c driver #0)
msp3400 1-0040: MSP4448G-A2 supports radio, mode is autodetect and
autoselect
ivtv0: loaded v4l-cx2341x-enc.fw firmware (262144 bytes)
ivtv0: unable to open firmware v4l-cx2341x-dec.fw
ivtv0: did you put the firmware in the hotplug firmware directory?
ivtv0 warning: failed loading decoder firmware
ivtv0 warning: Error loading firmware -1!
ivtv0: Error -1 initializing firmware.
ivtv0: Error -12 on initialization
ivtv: probe of 0000:03:05.0 failed with error -12
ivtv:  ====================  END INIT IVTV  ====================


Unloading and reloading the ivtv module seems to properly load the firmware
but I get no sound on TV playback in Mythtv:

Jul  5 13:07:13 vortex kernel: Linux video capture interface: v1.00
Jul  5 13:07:13 vortex kernel: ivtv:  ==================== START INIT IVTV 
====================
Jul  5 13:07:13 vortex kernel: ivtv:  version 0.7.0 (tagged release) loading
Jul  5 13:07:13 vortex kernel: ivtv:  Linux version: 2.6.17-rh3 SMP preempt 
mod_unload PENTIUM4 gcc-3.4
Jul  5 13:07:13 vortex kernel: ivtv:  In case of problems please include the 
debug info between
Jul  5 13:07:13 vortex kernel: ivtv:  the START INIT IVTV and END INIT IVTV 
lines, along with
Jul  5 13:07:13 vortex kernel: ivtv:  any module options, when mailing the 
ivtv-users mailinglist.
Jul  5 13:07:13 vortex kernel: ivtv0: Autodetected Hauppauge WinTV PVR-350 card 
(cx23415 based)
Jul  5 13:07:13 vortex kernel: ACPI: PCI Interrupt 0000:03:05.0[A] -> GSI 21 
(level, low) -> IRQ 209
Jul  5 13:07:13 vortex kernel: tuner 4-0061: chip found @ 0xc2 (ivtv i2c driver 
#0)
Jul  5 13:07:13 vortex kernel: saa7115 4-0021: saa7115 found @ 0x42 (ivtv i2c 
driver #0)
Jul  5 13:07:13 vortex kernel: saa7127 4-0044: saa7127 found @ 0x88 (ivtv i2c 
driver #0)
Jul  5 13:07:13 vortex kernel: msp3400 4-0040: MSP4448G-A2 found @ 0x80 (ivtv 
i2c driver #0)
Jul  5 13:07:13 vortex kernel: msp3400 4-0040: MSP4448G-A2 supports radio, mode 
is autodetect and autoselect
Jul  5 13:07:13 vortex kernel: tveeprom 4-0050: Hauppauge model 48132, rev 
J323, serial# 7012766
Jul  5 13:07:13 vortex kernel: tveeprom 4-0050: tuner model is Philips FM1236 
(idx 23, type 2)
Jul  5 13:07:13 vortex kernel: tveeprom 4-0050: TV standards NTSC(M) (eeprom 
0x08)
Jul  5 13:07:13 vortex kernel: tveeprom 4-0050: audio processor is MSP4448 (idx 
27)
Jul  5 13:07:13 vortex kernel: tveeprom 4-0050: decoder processor is SAA7115 
(idx 19)
Jul  5 13:07:13 vortex kernel: tveeprom 4-0050: has radio, has IR remote
Jul  5 13:07:14 vortex kernel: ivtv0: loaded v4l-cx2341x-enc.fw firmware 
(262144 bytes)
Jul  5 13:07:14 vortex kernel: ivtv0: loaded v4l-cx2341x-dec.fw firmware 
(262144 bytes)
Jul  5 13:07:14 vortex kernel: ivtv0: Encoder revision: 0x02050032
Jul  5 13:07:14 vortex kernel: ivtv0: Decoder revision: 0x02020023
Jul  5 13:07:14 vortex kernel: ivtv0: Allocate DMA encoder MPEG stream: 128 x 
32768 buffers (4096KB total)
Jul  5 13:07:14 vortex udevd-event[4814]: create_node: symlink(video0, 
/dev/video) failed: File exists
Jul  5 13:07:14 vortex kernel: ivtv0: Allocate DMA encoder YUV stream: 194 x 
10800 buffers (2048KB total)
Jul  5 13:07:14 vortex kernel: ivtv0: Allocate DMA encoder VBI stream: 120 x 
17472 buffers (2048KB total)
Jul  5 13:07:14 vortex kernel: ivtv0: Allocate DMA encoder PCM audio stream: 
455 x 4608 buffers (2048KB total)
Jul  5 13:07:14 vortex kernel: ivtv0: Create encoder radio stream
Jul  5 13:07:14 vortex kernel: ivtv0: Allocate DMA decoder MPEG stream: 16 x 
65536 buffers (1024KB total)
Jul  5 13:07:15 vortex kernel: ivtv0: Allocate DMA decoder VBI stream: 512 x 
2048 buffers (1024KB total)
Jul  5 13:07:15 vortex mythbackend: mythbackend shutdown succeeded
Jul  5 13:07:15 vortex kernel: ivtv0: Create decoder VOUT stream
Jul  5 13:07:15 vortex kernel: ivtv0: Allocate DMA decoder YUV stream: 24 x 
43200 buffers (1024KB total)
Jul  5 13:07:15 vortex kernel: ivtv0: loaded v4l-cx2341x-init.mpg firmware 
(155648 bytes)
Jul  5 13:07:15 vortex kernel: tuner 4-0061: type set to 2 (Philips NTSC 
(FI1236,FM1236 and compatibles))
Jul  5 13:07:15 vortex mythbackend: mythbackend startup succeeded
Jul  5 13:07:15 vortex kernel: ivtv0: Initialized Hauppauge WinTV PVR-350, card 
#0
Jul  5 13:07:15 vortex kernel: ivtv:  ====================  END INIT IVTV  
====================
Jul  5 13:10:41 vortex kernel: ivtv0 warning: 100 ms time out waiting for 
firmware
Jul  5 13:10:41 vortex kernel: ivtv0 warning: Failed api call 0x0000000e with 
result 0xfffffff0
Jul  5 13:10:41 vortex kernel: ivtv0 warning: stop_fw error 4. Code -16
Jul  5 13:10:42 vortex kernel: ACPI: PCI interrupt for device 0000:03:05.0 
disabled
Jul  5 13:10:42 vortex kernel: ivtv0: Removed Hauppauge WinTV PVR-350, card #0


On the 3rd unload/load of the ivtv module it actually initalizes well enough
to give livetv with sound in mythtv:

Jul  5 13:11:59 vortex kernel: Linux video capture interface: v1.00
Jul  5 13:11:59 vortex kernel: ivtv:  ==================== START INIT IVTV 
====================
Jul  5 13:11:59 vortex kernel: ivtv:  version 0.7.0 (tagged release) loading
Jul  5 13:11:59 vortex kernel: ivtv:  Linux version: 2.6.17-rh3 SMP preempt 
mod_unload PENTIUM4 gcc-3.4
Jul  5 13:11:59 vortex kernel: ivtv:  In case of problems please include the 
debug info between
Jul  5 13:11:59 vortex kernel: ivtv:  the START INIT IVTV and END INIT IVTV 
lines, along with
Jul  5 13:11:59 vortex kernel: ivtv:  any module options, when mailing the 
ivtv-users mailinglist.
Jul  5 13:11:59 vortex kernel: ivtv0: Autodetected Hauppauge WinTV PVR-350 card 
(cx23415 based)
Jul  5 13:11:59 vortex kernel: ACPI: PCI Interrupt 0000:03:05.0[A] -> GSI 21 
(level, low) -> IRQ 209
Jul  5 13:11:59 vortex kernel: tveeprom 4-0050: Hauppauge model 48132, rev 
J323, serial# 7012766
Jul  5 13:11:59 vortex kernel: tveeprom 4-0050: tuner model is Philips FM1236 
(idx 23, type 2)
Jul  5 13:11:59 vortex kernel: tveeprom 4-0050: TV standards NTSC(M) (eeprom 
0x08)
Jul  5 13:11:59 vortex kernel: tveeprom 4-0050: audio processor is MSP4448 (idx 
27)
Jul  5 13:11:59 vortex kernel: tveeprom 4-0050: decoder processor is SAA7115 
(idx 19)
Jul  5 13:11:59 vortex kernel: tveeprom 4-0050: has radio, has IR remote
Jul  5 13:11:59 vortex kernel: tuner 4-0061: chip found @ 0xc2 (ivtv i2c driver 
#0)
Jul  5 13:11:59 vortex kernel: saa7115 4-0021: saa7115 found @ 0x42 (ivtv i2c 
driver #0)
Jul  5 13:11:59 vortex kernel: saa7127 4-0044: saa7127 found @ 0x88 (ivtv i2c 
driver #0)
Jul  5 13:11:59 vortex kernel: msp3400 4-0040: MSP4448G-A2 found @ 0x80 (ivtv 
i2c driver #0)
Jul  5 13:11:59 vortex kernel: msp3400 4-0040: MSP4448G-A2 supports radio, mode 
is autodetect and autoselect
Jul  5 13:12:00 vortex kernel: ivtv0: loaded v4l-cx2341x-enc.fw firmware 
(262144 bytes)
Jul  5 13:12:00 vortex kernel: ivtv0: loaded v4l-cx2341x-dec.fw firmware 
(262144 bytes)
Jul  5 13:12:00 vortex kernel: ivtv0: Encoder revision: 0x02050032
Jul  5 13:12:00 vortex kernel: ivtv0: Decoder revision: 0x02020023
Jul  5 13:12:00 vortex udevd-event[6066]: create_node: symlink(video0, 
/dev/video) failed: File exists
Jul  5 13:12:00 vortex kernel: ivtv0: Allocate DMA encoder MPEG stream: 128 x 
32768 buffers (4096KB total)
Jul  5 13:12:00 vortex kernel: ivtv0: Allocate DMA encoder YUV stream: 194 x 
10800 buffers (2048KB total)
Jul  5 13:12:00 vortex kernel: ivtv0: Allocate DMA encoder VBI stream: 120 x 
17472 buffers (2048KB total)
Jul  5 13:12:00 vortex kernel: ivtv0: Allocate DMA encoder PCM audio stream: 
455 x 4608 buffers (2048KB total)
Jul  5 13:12:00 vortex kernel: ivtv0: Create encoder radio stream
Jul  5 13:12:00 vortex kernel: ivtv0: Allocate DMA decoder MPEG stream: 16 x 
65536 buffers (1024KB total)
Jul  5 13:12:00 vortex kernel: ivtv0: Allocate DMA decoder VBI stream: 512 x 
2048 buffers (1024KB total)
Jul  5 13:12:00 vortex kernel: ivtv0: Create decoder VOUT stream
Jul  5 13:12:00 vortex kernel: ivtv0: Allocate DMA decoder YUV stream: 24 x 
43200 buffers (1024KB total)
Jul  5 13:12:00 vortex kernel: firmware_loading_store: unexpected value (0)
Jul  5 13:12:00 vortex kernel: ivtv0: loaded v4l-cx2341x-init.mpg firmware 
(155648 bytes)
Jul  5 13:12:00 vortex kernel: tuner 4-0061: type set to 2 (Philips NTSC 
(FI1236,FM1236 and compatibles))
Jul  5 13:12:00 vortex kernel: ivtv0: Initialized Hauppauge WinTV PVR-350, card 
#0
Jul  5 13:12:00 vortex kernel: ivtv:  ====================  END INIT IVTV  
====================

So switching to using mutexes seems to avoid the hard lockups (or is just a
coincidence) but unreliability on module load still exists.

Applying my patch to 2.6.17-rh3 and rebooting, suddenly everything always
works properly right after reboot: No firmware load failures or missing
sound or need for a bunch of module reloads. YMMV obviously but I'd like to
here other people's input. The patch can be nabbed from here:
http://webcon.ca/~rhardy/patches/ivtv-0.6.0-delay_request_firmware.patch.bz2

Regards,
Rob

-- 
---------------------"Happiness is understanding."----------------------
Robert Hardy, B.Eng Computer Systems                  C.E.O. Webcon Inc.
rhardy <at> webcon <dot> ca    GPG Key available          (613) 276-7327

_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel

Reply via email to