Re: [PATCH 0/5] Pushdown bkl from v4l ioctls

From: Laurent Pinchart
Date: Fri Apr 30 2010 - 13:46:27 EST


Hi Hans,

On Thursday 29 April 2010 08:44:29 Hans Verkuil wrote:
> On Thursday 29 April 2010 05:42:39 Frederic Weisbecker wrote:
> > Hi,
> >
> > Linus suggested to rename struct v4l2_file_operations::ioctl
> > into bkl_ioctl to eventually get something greppable and make
> > its background explicit.
> >
> > While at it I thought it could be a good idea to just pushdown
> > the bkl to every v4l drivers that have an .ioctl, so that we
> > actually remove struct v4l2_file_operations::ioctl for good.
> >
> > It passed make allyesconfig on sparc.
> > Please tell me what you think.
>
> I much prefer to keep the bkl inside the v4l2 core. One reason is that I
> think that we can replace the bkl in the core with a mutex. Still not
> ideal of course, so the next step will be to implement proper locking in
> each driver. For this some additional v4l infrastructure work needs to be
> done. I couldn't proceed with that until the v4l events API patches went
> in, and that happened yesterday.
>
> So from my point of view the timeline is this:
>
> 1) I do the infrastructure work this weekend. This will make it much easier
> to convert drivers to do proper locking. And it will also simplify
> v4l2_priority handling, so I'm killing two birds with one stone :-)
>
> 2) Wait until Arnd's patch gets merged that pushes the bkl down to
> v4l2-dev.c
>
> 3) Investigate what needs to be done to replace the bkl with a v4l2-dev.c
> global mutex. Those drivers that call the bkl themselves should probably be
> converted to do proper locking, but there are only about 14 drivers that do
> this. The other 60 or so drivers should work fine if a v4l2-dev global lock
> is used. At this point the bkl is effectively removed from the v4l
> subsystem.
>
> 4) Work on the remaining 60 drivers to do proper locking and get rid of the
> v4l2-dev global lock. This is probably less work than it sounds.
>
> Since your patch moves everything down to the driver level it will actually
> make this work harder rather than easier. And it touches almost all drivers
> as well.

Every driver will need to be carefully checked to make sure the BKL can be
replaced by a v4l2-dev global mutex. Why would it be more difficult to do so
if the BKL is pushed down to the drivers ?

--
Regards,

Laurent Pinchart
--
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/