Skip to contentSkip to conversation

bttv timeouts

DISCUSSION Ori Pessach 3 participants 5 messages Dec 4, 2008 – Mar 10, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello,

I'm trying to diagnose an issue I'm seeing pretty frequently on multiple systems when using a generic, Kodicom 8800 clone capture card (with 8 bt878 chips.) After running for a while, the logs starts showing:

bttv2: timeout: drop=0 irq=24104841/44746684, risc=3787b03c, bits: VSYNC HSYNC RISCI
bttv2: reset, reinitialize
bttv3: timeout: drop=0 irq=27822078/51658940, risc=3785903c, bits: VSYNC HSYNC RISCI
bttv3: reset, reinitialize

over and over again, and the capture code times out when waiting for a frame. No frames are captured after that point.

Unloading and reloading the bttv module fixes that for a while. This is happening with kernel build 2.6.18-53.el5 on a CentOS system. I've seen references to this behavior on the web, but no solution or even speculation as to what might be causing this. Has anyone seen this before? Any ideas what could be the cause of this, or how to fix it?

Thanks,

--Ori Pessach
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#1 lore raw

Hi,

Maybe this can help you. See here:
http://n2.nabble.com/Pre-crash-log-td1515298.html#a1621996

BR,
Alex

Signature · 7 lines
View this message in context: http://n2.nabble.com/bttv-timeouts-tp1614747p1621999.html
Sent from the video4linux-list mailing list archive at Nabble.com.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#2 lore raw

This seems to be a bug in the bttv-risc.c code, at least according to Vegard Nossum on the Kernel Dev list:

I found that if you set pixfmt from YVU420 to YUYV in capture.c :

Quoted 8 lines

V4L2_PIX_FMT_YUV420 seems to be the culprit!
YUYV is the stable rock solid setting
Right now I am talking to the linux-kernel list trying to track down the memory problem we are running into.

The bug that I am running into is on an intel quad core machine, 2x4 input chip bt878 based pci capture cards with /dev/video0-7

Quoted 7 lines

All you have to do is change "count" from 100 to something large like 10million or so and change:
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;

to:
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;

Here is the patch from Vegard, but it caused a select time out using capture.c.

Hi Brian,

Quoted 217 lines

Can you see if this patch helps your problem?

Vegard

From 84396b14b9059de4a697df4ea4e036a22513436e Mon Sep 17 00:00:00 2001
From: Vegard Nossum <[email protected]>
Date: Sat, 22 Nov 2008 12:12:11 +0100
Subject: [PATCH] bttv: don't compare list_head's .next with NULL

The list implementation doesn't store NULLs in .next/.prev, but uses poison values (for-sure invalid pointers). I assume that this code wanted to test whether an entry was the last in a list.

This function is only ever called for the video capture list, so we know which list to check (it could have been vcapture as well).

Patch is untested!

---
drivers/media/video/bt8xx/bttv-risc.c | 10 +++++-----

1 files changed, 5 insertions(+), 5 deletions(-)
drivers/media/video/bt8xx/bttv-risc.c +3 -3
index 5b1b8e4..7a54c99 100644
@@ -649,14 +649,14 @@ bttv_buffer_activate_video(struct bttv *btv,
      if (NULL != set->top  &&  NULL != set->bottom) {
              if (set->top == set->bottom) {
                      set->top->vb.state    = VIDEOBUF_ACTIVE;
-                       if (set->top->vb.queue.next)
+                       if (list_is_last(&set->top->vb.queue,
 &btv->capture))
                              list_del(&set->top->vb.queue);
              } else {
                      set->top->vb.state    = VIDEOBUF_ACTIVE;
                      set->bottom->vb.state = VIDEOBUF_ACTIVE;
-                       if (set->top->vb.queue.next)
+                       if (list_is_last(&set->top->vb.queue,
 &btv->capture))
                              list_del(&set->top->vb.queue);
-                       if (set->bottom->vb.queue.next)
+                       if (list_is_last(&set->bottom->vb.queue,
 &btv->capture))
                              list_del(&set->bottom->vb.queue);
              }
              bttv_apply_geo(btv, &set->top->geo, 1);
drivers/media/video/bt8xx/bttv-risc.c +2 -3
@@ -671,7 +671,7 @@ bttv_buffer_activate_video(struct bttv *btv,
                    ~0x0f, BT848_COLOR_CTL);
      } else if (NULL != set->top) {
              set->top->vb.state  = VIDEOBUF_ACTIVE;
-               if (set->top->vb.queue.next)
+               if (list_is_last(&set->top->vb.queue, &btv->capture))
                      list_del(&set->top->vb.queue);
              bttv_apply_geo(btv, &set->top->geo,1);
              bttv_apply_geo(btv, &set->top->geo,0);
@@ -682,7 +682,7 @@ bttv_buffer_activate_video(struct bttv *btv,
              btaor(set->top->btswap & 0x0f,   ~0x0f, BT848_COLOR_CTL);
      } else if (NULL != set->bottom) {
              set->bottom->vb.state = VIDEOBUF_ACTIVE;
-               if (set->bottom->vb.queue.next)
+               if (list_is_last(&set->bottom->vb.queue, &btv->capture))
                      list_del(&set->bottom->vb.queue);
              bttv_apply_geo(btv, &set->bottom->geo,1);
              bttv_apply_geo(btv, &set->bottom->geo,0);
--

1.5.6.5

Quoted 5 lines · Brian Phelps

This possible kernel bug (see bottom) is very reproducible when the pci bus gets loaded with traffic, specifically video data. It has been reproduced on 2 identical machines.

Please let me know if you need more information

Hi,

Can you reproduce this with CONFIG_DEBUG_SLAB=y?

Can you reproduce this with CONFIG_SLUB=y instead of SLAB? If not, could be a genuine bug in SLAB (but I doubt it). If yes, then SLUB debugging might help us more than SLAB debugging can.

It sounds likely that bttv driver is involved somehow -- it would fit with your description too. Maybe the fact that the same driver is serving many devices on the same IRQ? But I guess that shouldn't really be a problem.

It would also be interesting to see if you can find more different crashes in other places, like the corrupted page tables. Those are important clues. Like this:

Quoted 1 line
[ 2128.370257] PGD 10869067 PUD 23232323 BAD

That looks like a magic number of sorts. This was the only one I could find, however:

crypto/anubis.c: 0x83838383U, 0x1b1b1b1bU, 0x0e0e0e0eU, 0x23232323U,

But google has some more info. A google for "23232323 bug" turned up this thread:

http://lkml.org/lkml/2008/1/5/51

...which also involves bttv driver. I've added the Ccs of that discussion.

But it seems that it is not a regression at least. Did you try earlier kernels as well?

Vegard

--
"The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation."

      -- E. W. Dijkstra, EWD1036

and ....

Quoted 6 lines · Vegard Nossum
Quoted 2 lines
[  527.562373]  ffffffff8043b157 0000000000200200 ffffffffa02810d4

ffff88001e13c600

LIST_POISON2 on the stack:

include/linux/poison.h:#define LIST_POISON2 ((void *) 0x00200200)

So looking at bttv source code, I wonder what the codes like these are trying to do:

                      if (set->top->vb.queue.next)
                              list_del(&set->top->vb.queue);

Code is ancient, I'll ask Mauro.
- Hide quoted text -

Vegard

--
"The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation."

      -- E. W. Dijkstra, EWD1036
Quoted 7 lines · alexWe

Hi,

Maybe this can help you. See here:
http://n2.nabble.com/Pre-crash-log-td1515298.html#a1621996

Quoted 5 lines

BR,
Alex

--
View this message in context:

http://n2.nabble.com/bttv-timeouts-tp1614747p1621999.html

Quoted 5 lines

Sent from the video4linux-list mailing list archive at Nabble.com.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]

?subject=unsubscribe

Quoted 2 lines

https://www.redhat.com/mailman/listinfo/video4linux-list

Quoted 5 lines · Brian Phelps

This possible kernel bug (see bottom) is very reproducible when the pci bus gets loaded with traffic, specifically video data. It has been reproduced on 2 identical machines.

Please let me know if you need more information

Hi,

Can you reproduce this with CONFIG_DEBUG_SLAB=y?

Can you reproduce this with CONFIG_SLUB=y instead of SLAB? If not, could be a genuine bug in SLAB (but I doubt it). If yes, then SLUB debugging might help us more than SLAB debugging can.

It sounds likely that bttv driver is involved somehow -- it would fit with your description too. Maybe the fact that the same driver is serving many devices on the same IRQ? But I guess that shouldn't really be a problem.

It would also be interesting to see if you can find more different crashes in other places, like the corrupted page tables. Those are important clues. Like this:

Quoted 1 line
[ 2128.370257] PGD 10869067 PUD 23232323 BAD

That looks like a magic number of sorts. This was the only one I could find, however:

crypto/anubis.c: 0x83838383U, 0x1b1b1b1bU, 0x0e0e0e0eU, 0x23232323U,

But google has some more info. A google for "23232323 bug" turned up this thread:

http://lkml.org/lkml/2008/1/5/51

...which also involves bttv driver. I've added the Ccs of that discussion.

But it seems that it is not a regression at least. Did you try earlier kernels as well?

Quoted 8 lines

Vegard

--
"The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation."

      -- E. W. Dijkstra, EWD1036

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#3 lore raw
Quoted 5 lines · Brian Phelps

This seems to be a bug in the bttv-risc.c code, at least according to Vegard
Nossum on the Kernel Dev list:

Hi,

is there any progress?

Bye,
Alex

Signature · 7 lines
View this message in context: http://n2.nabble.com/bttv-timeouts-tp1614747p2454732.html
Sent from the video4linux-list mailing list archive at Nabble.com.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#4 lore raw
In reply to alexWe

Alex,

I was wondering why you think this is the same problem? I'm not saying it isn't, but it's not obvious to me.

Thanks,

--Ori Pessach

________________________________
From: alexWe <[email protected]>
To: [email protected]
Sent: Saturday, December 6, 2008 5:09:33 AM
Subject: Re: bttv timeouts

Hi,

Maybe this can help you. See here:
http://n2.nabble.com/Pre-crash-log-td1515298.html#a1621996

BR,
Alex

Signature · 11 lines
View this message in context: http://n2.nabble.com/bttv-timeouts-tp1614747p1621999.html
Sent from the video4linux-list mailing list archive at Nabble.com.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list