Re: [PATCH] video4linux: Push down the BKL

From: Jonathan Corbet
Date: Tue May 27 2008 - 11:41:56 EST


On Tue, 27 May 2008 10:10:39 -0300
Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx> wrote:


> What if we create 3 functions:
>
> video_ioctl2_bkl()
> video_ioctl2_serialized()
> video_ioctl2_unlocked()
>
> The first patch will point .ioctl_unlock to video_ioctl2_bkl.
>
> A next step would be to move the drivers to use the serialized one.

So we're replacing the big kernel lock with the big v4l2 lock. That
might help the situation, but you'd need to be sure to serialize
against other calls (open(), for example) which are also currently done
under the BKL.

> IMO, we need to create a multi-thread stress userspace tool for
> checking the locks at the ioctls. There are a few testing utils at
> mercurial tree, under v4l2-apps/test. This can be a starting point
> for this tool. Also, Brandon improved one of those tools to work with
> multithread.

I don't think that stress tools are the way to eliminate the BKL.
You'll never find all the problems that way. There's really no way to
avoid the task of actually *looking* at each driver and ensuring that
it has its act together with regard to locking.

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/