Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel warning __vb2_queue_cancel when streaming is stopped #12

Closed
k-a-z-u opened this issue Apr 6, 2015 · 2 comments
Closed

kernel warning __vb2_queue_cancel when streaming is stopped #12

k-a-z-u opened this issue Apr 6, 2015 · 2 comments

Comments

@k-a-z-u
Copy link
Contributor

k-a-z-u commented Apr 6, 2015

Every time I captured several images from the xtion and then closed the device, I got a kernel warning and stack-dump:

[...] WARNING: CPU: x PID: xxxxxx at drivers/media/v4l2-core/videobuf2-core.c:2135 __vb2_queue_cancel+0x117/0x180 [videobuf2_core]()

Following raspberrypi/linux#817 this warning happens from kernel 3.18 onwards (due to new sanity checks within v4l) when not returning all buffers to v4l using vb2_buffer_done().

Adding some debug-output to xtion_kill_urbs I noticed that only 7 of the 8 buffer (aquired by my application) were returned. I only have a very basic knowledge of kernel-modules so I looked into the code of some other webcam modules. Just guessing: The queue contains only the currently unused buffers for later use and we miss to return the currently active buffer? Thus I added the following line:

/* It's important to clear current buffer */
vb2_buffer_done(&endp->active_buffer->vb, VB2_BUF_STATE_ERROR); <<<<
endp->active_buffer = 0;

and the warning disappeared. Is this the correct fix for the issue?

@xqms
Copy link
Owner

xqms commented Apr 6, 2015

Yes, this looks like a valid fix. I'll check it on Wednesday as well. Thanks for reporting!

@k-a-z-u
Copy link
Contributor Author

k-a-z-u commented Apr 7, 2015

ah.. haven't done my homework properly... forgot to check for active_buffer == 0 and got a kernel panic when: disconnecting the xtion or killing the application currently using it ;)

/* It's important to clear current buffer */
if (endp->active_buffer != 0) {
    vb2_buffer_done(&endp->active_buffer->vb, VB2_BUF_STATE_ERROR);
    endp->active_buffer = 0;
}

@xqms xqms closed this as completed in 7326357 Apr 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants