Re: [PATCH] video4linux: Push down the BKL

From: Jonathan Corbet
Date: Fri May 23 2008 - 09:57:23 EST


> diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
> [...]
> - .ioctl = video_ioctl2,
> + .unlocked_ioctl = video_ioctl2,

Weird, that was always intended to be that way, I'm not sure what
happened. In any case, consider this part to be

Acked-by: Jonathan Corbet <corbet@xxxxxxx>

However, in this part:

> diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
> [...]

> + lock_kernel();
> err = __video_do_ioctl(inode, file, cmd, parg);
> + unlock_kernel();

This forces the BKL on all V4L2 drivers whether or not they need it.
Given that this code can, in fact, be a path where latency matters
(consider VIDIOC_DQBUF), I'm not sure that's the best way to do it.

On the other hand, the next level of BKL pushdown would be painful as
all hell, given the massive number of callbacks in the V4L2 API. So I'm
thinking it might be justified to create a video_ioctl2_locked() for
V4L2 drivers which are not yet known to be safe in the absence of the
BKL. The amount of extra code would be quite small, and it would let
safe drivers operate BKL-free.

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/