[mythtv-users] Kernel Crash when starting up in au0828-video.c line 895
Larry Finger
Larry.Finger at lwfinger.net
Mon Apr 9 02:36:36 UTC 2012
On 04/08/2012 04:38 PM, jrh wrote:
As you have seen, someone did not like my patch. That frequently happens when
you try to touch a new area of the kernel. Thus, we need to find the real bug
before any patch is likely to be accepted.
To help debug the problem, I have prepared a new version of the patch. This one
will still remove the BUG_ON, but it will also dump the stack whenever the code
gets or frees AU0828_RESOURCE_VIDEO. I hope this shows where the imbalance occurs.
Larry
-------------- next part --------------
Index: linux-3.1.9-1.4/drivers/media/video/au0828/au0828-video.c
===================================================================
--- linux-3.1.9-1.4.orig/drivers/media/video/au0828/au0828-video.c
+++ linux-3.1.9-1.4/drivers/media/video/au0828/au0828-video.c
@@ -891,8 +891,13 @@ static int res_locked(struct au0828_dev
static void res_free(struct au0828_fh *fh, unsigned int bits)
{
struct au0828_dev *dev = fh->dev;
+ unsigned int bits2 = fh->resources & bits;
- BUG_ON((fh->resources & bits) != bits);
+ if (bits2 != bits) {
+ WARN_ONCE(true, "au0828: Trying to free resource 0x%x"
+ " without reserving it\n", bits);
+ return;
+ }
mutex_lock(&dev->lock);
fh->resources &= ~bits;
@@ -1050,6 +1055,8 @@ static int au0828_v4l2_close(struct file
videobuf_stop(&fh->vb_vidq);
res_free(fh, AU0828_RESOURCE_VIDEO);
+ pr_info("AU0828_RESOURCE_VIDEO freed\n");
+ dump_stack();
}
if (res_check(fh, AU0828_RESOURCE_VBI)) {
@@ -1138,8 +1145,13 @@ static unsigned int au0828_v4l2_poll(str
return rc;
if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
- if (!res_get(fh, AU0828_RESOURCE_VIDEO))
+ if (!res_get(fh, AU0828_RESOURCE_VIDEO)) {
+ pr_err("AU0828_RESOURCE_VIDEO was busy\n");
+ dump_stack();
return POLLERR;
+ }
+ pr_info("AU0828_RESOURCE_VIDEO acquired\n");
+ dump_stack();
return videobuf_poll_stream(filp, &fh->vb_vidq, wait);
} else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
if (!res_get(fh, AU0828_RESOURCE_VBI))
@@ -1694,6 +1706,8 @@ static int vidioc_streamoff(struct file
videobuf_streamoff(&fh->vb_vidq);
res_free(fh, AU0828_RESOURCE_VIDEO);
+ pr_info("AU0828_RESOURCE_VIDEO freed\n");
+ dump_stack();
} else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
dev->vbi_timeout_running = 0;
del_timer_sync(&dev->vbi_timeout);
More information about the mythtv-users
mailing list