Skip to contentSkip to conversation

Oops when modprobing ivtv outside of dom0

DISCUSSION Keir Fraser 2 participants 4 messages Jul 5, 2005 – Jul 6, 2005 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 6 lines · Keir Fraser
Quoted 5 lines

That's weird. It's crashing somewhere in ivtv_probe(), yet one of the first things that function does is print a line of debug output. But that output hasn;t appeared in your trace. :-/

Quoted 8 lines
Quoted 3 lines

Maybe try adding an explicit printk at the start of ivtv_probe and see if that appears:
printk(KERN_ALERT "**********\n");

You mean the "Found card #" message? That did show up on the one that I modprobe'd with ivtv_debug=255.

Here's the dmesg output with the printk added, and with ivtv_debug=255:

Ah, I see the bug. It's in both 2.0 and 3.3 (the unstable version) so it's worth pointing out to the developers. The following code in ivtv_setup_pci() is broken:

        if (pci_bus != NULL && pci_bus->vendor == PCI_VENDOR_ID_VIA) {
                ....
        } else
                IVTV_KERN_INFO("XXX PCI device: 0x%04x vendor: 0x%04x\n",
                                pci_bus->device, pci_bus->vendor);

The else clause should be 'else if (pci_bus != NULL)'. Otherwise the debug IVTV_KERN_INFO line crashes trying to dereference a NULL pointer. :-)

Actually, I think maybe they could get rid of that entire block of code -- nothing seems to depend on via_fix, which is the variable that it sets up.

-- Keir

#2 lore raw
Quoted 3 lines · Keir Fraser

Ah, I see the bug. It's in both 2.0 and 3.3 (the unstable version) so it's worth pointing out to the developers. The following code in ivtv_setup_pci() is broken:

Thanks, that fixed the loading problem, it now detects all the cards properly. However, when I try to read some video from the card (you can just cat /dev/video0 > file.mpg) it crashes the entire domU:

neptune ~ # cat /dev/video0 > test.mpg

Oops: 0000 [#1]
Modules linked in: msp3400 saa7115 tuner tveeprom ivtv i2c_algo_bit
videodev ehci_hcd uhci_hcd usbcore
CPU:    0
EIP:    0061:[<b6f92126>]    Not tainted VLI
EFLAGS: 00010282   (2.6.11-xenU)

EIP is at 0xb6f92126
eax: d08cfbc0 ebx: 00001000 ecx: 0007dfc0 edx: cbbe3fac
esi: 00000000 edi: c0792c80 ebp: 0804d080 esp: cbbe3f74
ds: 007b es: 007b ss: 0069
Process cat (pid: 5522, threadinfo=cbbe3000 task=cdf7da00)

Stack: c015133e c0792c80 0804d080 00001000 cbbe3fac c0792c80 fffffff7 0804d080
       cbbe3000 c0151631 c0792c80 0804d080 00001000 cbbe3fac 0007dfc0 00000000
       00000000 00000003 fbffc000 c0109040 00000003 0804d080 00001000 00001000
Call Trace:
 [<c015133e>] vfs_read+0xae/0x130
 [<c0151631>] sys_read+0x51/0x80
 [<c0109040>] syscall_call+0x7/0xb
Code:  Bad EIP value.
 <1>Unable to handle kernel paging request at virtual address 761853ac
 printing eip:
761853ac
*pde = ma 00000000 pa 55555000
 [<c011a874>] put_files_struct+0x64/0xd0
 [<c011b46f>] do_exit+0xaf/0x2b0
 [<c0110069>] sys_ptrace+0x89/0x610
 [<c010999d>] die+0x16d/0x170
 [<c0109040>] syscall_call+0x7/0xb
 [<c0113138>] do_page_fault+0x318/0x693
 [<c0187994>] ext3_file_write+0x44/0xd0
 [<c0151477>] do_sync_write+0xb7/0xf0
 [<c01093ff>] page_fault+0x3b/0x40
 [<c015133e>] vfs_read+0xae/0x130
 [<c0151631>] sys_read+0x51/0x80
 [<c0109040>] syscall_call+0x7/0xb
Oops: 0000 [#2]
Modules linked in: msp3400 saa7115 tuner tveeprom ivtv i2c_algo_bit
videodev ehci_hcd uhci_hcd usbcore
CPU:    0
EIP:    0061:[<761853ac>]    Not tainted VLI
EFLAGS: 00010206   (2.6.11-xenU)

EIP is at 0x761853ac
eax: d08cfbc0 ebx: c0792c80 ecx: c08e3780 edx: 761853ac
esi: 00000000 edi: cfb8a680 ebp: 00000001 esp: cbbe3dd4
ds: 0069 es: 0069 ss: 0069
Process cat (pid: 5522, threadinfo=cbbe3000 task=cdf7da00)

Stack: c0150b26 c0792c80 cfb8a680 00000001 00000003 cfb8a680 c011a874 c0792c80
       cfb8a680 cbbe3000 cdf7da00 0000000b 00000001 c011b46f cdf7da00 00000069
       c0110069 00000012 cbbe3000 00000000 00000000 c078b22c c010999d 00000000
Call Trace:
 [<c0150b26>] filp_close+0x76/0x90
 [<c011a874>] put_files_struct+0x64/0xd0
 [<c011b46f>] do_exit+0xaf/0x2b0
 [<c0110069>] sys_ptrace+0x89/0x610
 [<c010999d>] die+0x16d/0x170
 [<c0109040>] syscall_call+0x7/0xb
 [<c0113138>] do_page_fault+0x318/0x693
 [<c0187994>] ext3_file_write+0x44/0xd0
 [<c0151477>] do_sync_write+0xb7/0xf0
 [<c01093ff>] page_fault+0x3b/0x40
 [<c015133e>] vfs_read+0xae/0x130
 [<c0151631>] sys_read+0x51/0x80
 [<c0109040>] syscall_call+0x7/0xb
Code:  Bad EIP value.
 Segmentation fault

neptune ~ #
************ REMOTE CONSOLE EXITED *****************

Any ideas on that one? :) If we're getting out of the realm of Xen and I should go ask the IVTV guys, please don't hesitate to say so.

I just tried a second time, and it took a few tries of capturing video to crash it. But even when it didn't crash, all I got was a zero byte file. I noticed the card was using interrupts (looking at /proc/interrupts), and things looked ok in dmesg, but no mpeg data. That time the domU didn't exit on it's own, but was pretty well hung up (non-responsive other than line feeds on the console). So I tried to xm destroy it, and that rebooted the entire box.

Thanks,
Dave

Signature · 2 lines
David Muench - [email protected]
Jabber ID: [email protected]
#3 lore raw
Quoted 7 lines · David Muench

I just tried a second time, and it took a few tries of capturing video to crash it. But even when it didn't crash, all I got was a zero byte file. I noticed the card was using interrupts (looking at /proc/interrupts), and things looked ok in dmesg, but no mpeg data. That time the domU didn't exit on it's own, but was pretty well hung up (non-responsive other than line feeds on the console). So I tried to xm destroy it, and that rebooted the entire box.

I think the ivtv driver is probably not calculating dma addresses in the way that xen requires. On native Linux, if you allocate a multi-page chunk of physical memory, you can pass the start address of that buffer to hardware and it can dma the entire buffer given just that address. In Xen, because we give guests 'pseudo-physical' memory, that physical buffer may not be really physically contiguous. So we need drivers to dma_alloc_coherent or pci_alloc_consistent the memory they will use for dma --- we modified those functions to ensure they return suitable contiguous physical memory.

Perhaps the developers may know where to look further.

-- Keir

#4 lore raw
Quoted 11 lines · Keir Fraser

I think the ivtv driver is probably not calculating dma addresses in the way that xen requires. On native Linux, if you allocate a multi-page chunk of physical memory, you can pass the start address of that buffer to hardware and it can dma the entire buffer given just that address. In Xen, because we give guests 'pseudo-physical' memory, that physical buffer may not be really physically contiguous. So we need drivers to dma_alloc_coherent or pci_alloc_consistent the memory they will use for dma --- we modified those functions to ensure they return suitable contiguous physical memory.

Perhaps the developers may know where to look further.

Thanks very much for all your help Keir, I've posted to the IVTV-Devel list and hopefully someone there can help me with the rest.

Dave

Signature · 2 lines
David Muench - [email protected]
Jabber ID: [email protected]